Mercurial > might-and-magic-trilogy
comparison LOD.cpp @ 115:75faebd0a975
lod fix
author | Nomad |
---|---|
date | Wed, 07 Nov 2012 20:42:12 +0200 |
parents | 8feb2dfd2f89 |
children | a64b244da76c 7b4725cdb74e 8981a63bb559 |
comparison
equal
deleted
inserted
replaced
114:8e802a11b20d | 115:75faebd0a975 |
---|---|
1642 pFile = 0; | 1642 pFile = 0; |
1643 } | 1643 } |
1644 } | 1644 } |
1645 // 6A0CA8: using guessed type int 6A0CA8_lod_unused; | 1645 // 6A0CA8: using guessed type int 6A0CA8_lod_unused; |
1646 | 1646 |
1647 //----- (00461B48) -------------------------------------------------------- | 1647 |
1648 /*unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4) | 1648 unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4) |
1649 { | 1649 { |
1650 LODWriteableFile *v4; // ebx@1 | 1650 //LODWriteableFile *v4; // ebx@1 |
1651 int v5; // esi@1 | 1651 int v5; // esi@1 |
1652 unsigned __int8 v7; // zf@7 | 1652 //unsigned __int8 v7; // zf@7 |
1653 unsigned __int8 v8; // sf@7 | 1653 //unsigned __int8 v8; // sf@7 |
1654 const LOD::Directory *v9; // edi@9 | 1654 const LOD::Directory *v9; // edi@9 |
1655 int v10; // eax@9 | 1655 int v10; // eax@9 |
1656 unsigned __int8 v11; // of@15 | 1656 //unsigned __int8 v11; // of@15 |
1657 unsigned __int16 v12; // dx@17 | 1657 unsigned __int16 v12; // dx@17 |
1658 LOD::Directory *v13; // eax@17 | 1658 LOD::Directory *v13; // eax@17 |
1659 unsigned __int16 v14; // cx@17 | 1659 unsigned __int16 v14; // cx@17 |
1660 int v15; // edi@27 | 1660 int v15; // edi@27 |
1661 unsigned int v16; // eax@27 | 1661 unsigned int v16; // eax@27 |
1673 __int32 v28; // esi@46 | 1673 __int32 v28; // esi@46 |
1674 char pFilename[256]; // [sp+Ch] [bp-230h]@22 | 1674 char pFilename[256]; // [sp+Ch] [bp-230h]@22 |
1675 char NewFilename[256]; // [sp+10Ch] [bp-130h]@51 | 1675 char NewFilename[256]; // [sp+10Ch] [bp-130h]@51 |
1676 //LOD::Directory Str; // [sp+20Ch] [bp-30h]@27 | 1676 //LOD::Directory Str; // [sp+20Ch] [bp-30h]@27 |
1677 size_t v33; // [sp+22Ch] [bp-10h]@27 | 1677 size_t v33; // [sp+22Ch] [bp-10h]@27 |
1678 int v34; // [sp+230h] [bp-Ch]@7 | 1678 //int v34; // [sp+230h] [bp-Ch]@7 |
1679 __int32 v35; // [sp+234h] [bp-8h]@8 | 1679 __int32 v35; // [sp+234h] [bp-8h]@8 |
1680 int v36; // [sp+238h] [bp-4h]@7 | 1680 int v36; // [sp+238h] [bp-4h]@7 |
1681 size_t Count; // [sp+244h] [bp+8h]@40 | 1681 size_t Count; // [sp+244h] [bp+8h]@40 |
1682 __int32 Countc; // [sp+244h] [bp+8h]@46 | 1682 __int32 Countc; // [sp+244h] [bp+8h]@46 |
1683 size_t Countb; // [sp+244h] [bp+8h]@47 | 1683 size_t Countb; // [sp+244h] [bp+8h]@47 |
1684 FILE *pFile; // [sp+24Ch] [bp+10h]@22 | 1684 FILE *pFile; // [sp+24Ch] [bp+10h]@22 |
1685 | 1685 |
1686 v4 = this; | 1686 //v4 = this; |
1687 v5 = 0; | 1687 //v5 = 0; |
1688 if ( !this->isFileOpened ) | 1688 |
1689 if (!isFileOpened) | |
1689 return 1; | 1690 return 1; |
1690 if ( !this->pSubIndices ) | 1691 if (!pSubIndices) |
1691 return 2; | 1692 return 2; |
1692 if ( !this->pIOBuffer || !this->uIOBufferSize ) | 1693 if (!pIOBuffer || !uIOBufferSize) |
1693 return 3; | 1694 return 3; |
1694 v7 = this->uNumSubIndices == 0; | 1695 |
1695 v8 = (this->uNumSubIndices & 0x80000000u) != 0; | 1696 //v7 = this->uNumSubIndices == 0; |
1697 //v8 = (this->uNumSubIndices & 0x80000000u) != 0; | |
1698 v35 = 0; | |
1696 v36 = 0; | 1699 v36 = 0; |
1697 v34 = 0; | 1700 //v34 = 0; |
1698 if ( v8 | v7 ) | 1701 for (v5 = 0; v5 < uNumSubIndices; ++v5) |
1702 /*if ( v8 | v7 ) | |
1699 { | 1703 { |
1700 v9 = pDir; | 1704 v9 = pDir; |
1701 goto LABEL_22; | 1705 goto LABEL_22; |
1702 } | 1706 } |
1703 v35 = 0; | 1707 while ( 1 )*/ |
1704 while ( 1 ) | |
1705 { | 1708 { |
1706 v9 = pDir; | 1709 v9 = pDir; |
1707 v10 = _strcmpi((const char *)v4->pSubIndices + v35, (const char *)pDir); | 1710 v10 = _strcmpi(pSubIndices[v5].pFilename, pDir->pFilename); |
1708 if ( v10 ) | 1711 if (v10 > 0) |
1712 break; | |
1713 else if (v10 < 0) | |
1714 continue; | |
1715 /*if ( v10 ) | |
1709 { | 1716 { |
1710 if ( v10 > 0 ) | 1717 if ( v10 > 0 ) |
1711 goto LABEL_22; | 1718 goto LABEL_22; |
1712 goto LABEL_15; | 1719 goto LABEL_15; |
1713 } | 1720 }*/ |
1714 if ( !a4 ) | 1721 if ( !a4 ) |
1715 goto LABEL_20; | 1722 { |
1723 v36 = 1; | |
1724 break; | |
1725 } | |
1716 if ( a4 == 1 ) | 1726 if ( a4 == 1 ) |
1717 break; | 1727 { |
1728 v12 = pDir->uNumSubIndices; | |
1729 v13 = &pSubIndices[v5]; | |
1730 v14 = v13->uNumSubIndices; | |
1731 if ( v14 >= v12 && (v14 != v12 || (unsigned __int16)v13->word_00001E >= pDir->word_00001E) ) | |
1732 return 4; | |
1733 v36 = 1; | |
1734 break; | |
1735 } | |
1718 if ( a4 == 2 ) | 1736 if ( a4 == 2 ) |
1719 return 4; | 1737 return 4; |
1720 LABEL_15: | 1738 //LABEL_15: |
1721 v35 += 32; | 1739 //v35 += 32; |
1722 ++v5; | 1740 //++v5; |
1723 v11 = __OFSUB__(v5, v4->uNumSubIndices); | 1741 //v11 = __OFSUB__(v5, v4->uNumSubIndices); |
1724 v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0; | 1742 //v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0; |
1725 v34 = v5; | 1743 //v34 = v5; |
1726 if ( !(v8 ^ v11) ) | 1744 //if ( !(v8 ^ v11) ) |
1727 goto LABEL_22; | 1745 //goto LABEL_22; |
1728 } | 1746 } |
1729 v12 = pDir->uNumSubIndices; | 1747 /* v12 = pDir->uNumSubIndices; |
1730 v13 = &v4->pSubIndices[v5]; | 1748 v13 = &v4->pSubIndices[v5]; |
1731 v14 = v13->uNumSubIndices; | 1749 v14 = v13->uNumSubIndices; |
1732 if ( v14 >= v12 && (v14 != v12 || (unsigned __int16)v13->word_00001E >= pDir->word_00001E) ) | 1750 if ( v14 >= v12 && (v14 != v12 || (unsigned __int16)v13->word_00001E >= pDir->word_00001E) ) |
1733 return 4; | 1751 return 4; |
1734 LABEL_20: | 1752 LABEL_20: |
1735 v36 = 1; | 1753 v36 = 1; |
1736 LABEL_22: | 1754 LABEL_22:*/ |
1737 strcpy(pFilename, "lod.tmp"); | 1755 strcpy(pFilename, "lod.tmp"); |
1738 pFile = fopen(pFilename, "wb+"); | 1756 pFile = fopen(pFilename, "wb+"); |
1739 if ( !pFile ) | 1757 if ( !pFile ) |
1740 return 5; | 1758 return 5; |
1741 if ( v36 ) | 1759 if ( v36 ) |
1742 v35 = v4->pSubIndices[v5].uDataSize; | 1760 v35 = pSubIndices[v5].uDataSize; |
1743 else | 1761 else |
1744 v35 = 0; | 1762 v35 = 0; |
1745 v33 = v9->uDataSize; | 1763 v33 = v9->uDataSize; |
1746 v15 = v33 - v35; | 1764 v15 = v33 - v35; |
1747 | 1765 |
1748 LOD::Directory Str; // [sp+20Ch] [bp-30h]@27 | 1766 LOD::Directory Str; // [sp+20Ch] [bp-30h]@27 |
1749 //LOD::Directory::LOD::Directory(&Str); | 1767 //LOD::Directory::LOD::Directory(&Str); |
1750 | 1768 |
1751 strcpy((char *)&Str, "chapter"); | 1769 strcpy(Str.pFilename, "chapter"); |
1752 v16 = v4->uLODDataSize; | 1770 v16 = uLODDataSize; |
1753 Str.uNumSubIndices = LOWORD(v4->uNumSubIndices); | 1771 Str.uNumSubIndices = uNumSubIndices; |
1754 Str.dword_000018 = 0; | 1772 Str.dword_000018 = 0; |
1755 Str.word_00001E = 0; | 1773 Str.word_00001E = 0; |
1756 if ( !v36 ) | 1774 if ( !v36 ) |
1757 { | 1775 { |
1758 ++Str.uNumSubIndices; | 1776 ++Str.uNumSubIndices; |
1759 v15 += 32; | 1777 v15 += 32; |
1760 } | 1778 } |
1761 v7 = v36 == 0; | 1779 //v7 = v36 == 0; |
1762 Str.uDataSize = v15 + v16; | 1780 Str.uDataSize = v15 + v16; |
1763 Str.uOfsetFromSubindicesStart = 288; | 1781 Str.uOfsetFromSubindicesStart = 288; |
1764 v17 = (signed __int16)Str.uNumSubIndices; | 1782 v17 = (signed __int16)Str.uNumSubIndices; |
1765 v4->uNumSubIndices = (signed __int16)Str.uNumSubIndices; | 1783 uNumSubIndices = (signed __int16)Str.uNumSubIndices; |
1766 if ( v7 && v17 > v5 ) | 1784 if ( !v36 && v17 > v5 ) |
1767 { | 1785 { |
1768 v18 = v17; | 1786 v18 = v17; |
1769 v19 = v17 - v5; | 1787 v19 = v17 - v5; |
1770 do | 1788 do |
1771 { | 1789 { |
1772 v20 = &v4->pSubIndices[v18]; | 1790 v20 = &pSubIndices[v18]; |
1773 --v18; | 1791 --v18; |
1774 --v19; | 1792 --v19; |
1775 memcpy(v20, (char *)v20 - 32, 0x20u); | 1793 memcpy(v20, (char *)v20 - 32, 0x20u); |
1776 } | 1794 } |
1777 while ( v19 ); | 1795 while ( v19 ); |
1778 v5 = v34; | 1796 //v5 = v34; |
1779 } | 1797 } |
1780 v34 = 32 * v5; | 1798 //v34 = 32 * v5; |
1781 memcpy(&v4->pSubIndices[v5], pDir, sizeof(v4->pSubIndices[v5])); | 1799 memcpy(&pSubIndices[v5], pDir, sizeof(LOD::Directory)); |
1782 v23 = 32 * v4->uNumSubIndices; | 1800 v23 = 32 * uNumSubIndices; |
1783 if ( (signed int)v4->uNumSubIndices > 0 ) | 1801 if ( (signed int)uNumSubIndices > 0 ) |
1784 { | 1802 { |
1785 for (int i = 0; i < (signed int)v4->uNumSubIndices; ++i) | 1803 for (int i = 0; i < (signed int)uNumSubIndices; ++i) |
1786 { | 1804 { |
1787 v4->pSubIndices[i].uOfsetFromSubindicesStart = v23; | 1805 pSubIndices[i].uOfsetFromSubindicesStart = v23; |
1788 v23 += v4->pSubIndices[i].uDataSize; | 1806 v23 += pSubIndices[i].uDataSize; |
1789 } | 1807 } |
1790 } | 1808 } |
1791 fwrite(&v4->header, 0x100, 1, pFile); | 1809 fwrite(&header, 0x100, 1, pFile); |
1792 fwrite(&Str, 0x20, 1, pFile); | 1810 fwrite(&Str, 0x20, 1, pFile); |
1793 fseek(v4->pFile, Str.uOfsetFromSubindicesStart, 0); | 1811 fseek(pFile, Str.uOfsetFromSubindicesStart, 0); |
1794 fwrite(v4->pSubIndices, 0x20u, v4->uNumSubIndices, pFile); | 1812 fwrite(pSubIndices, 0x20u, uNumSubIndices, pFile); |
1795 v26 = 32 * v4->uNumSubIndices; | 1813 v26 = 32 * uNumSubIndices; |
1796 if ( !v36 ) | 1814 if ( !v36 ) |
1797 v26 -= 32; | 1815 v26 -= 32; |
1798 fseek(v4->pFile, v26, 1); | 1816 fseek(pFile, v26, 1); |
1799 for ( i = *(unsigned int *)((char *)&v4->pSubIndices->uOfsetFromSubindicesStart + v34) | 1817 for ( i = pSubIndices[v5].uOfsetFromSubindicesStart |
1800 - v4->pSubIndices->uOfsetFromSubindicesStart; i > 0; i -= Count ) | 1818 - pSubIndices->uOfsetFromSubindicesStart; i > 0; i -= Count ) |
1801 { | 1819 { |
1802 Count = v4->uIOBufferSize; | 1820 Count = uIOBufferSize; |
1803 if ( i <= (signed int)v4->uIOBufferSize ) | 1821 if ( i <= (signed int)uIOBufferSize ) |
1804 Count = i; | 1822 Count = i; |
1805 fread(v4->pIOBuffer, 1u, Count, v4->pFile); | 1823 fread(pIOBuffer, 1u, Count, pFile); |
1806 fwrite(v4->pIOBuffer, 1u, Count, pFile); | 1824 fwrite(pIOBuffer, 1u, Count, pFile); |
1807 } | 1825 } |
1808 fwrite(pDirData, 1u, v33, pFile); | 1826 fwrite(pDirData, 1u, v33, pFile); |
1809 if ( v36 ) | 1827 if ( v36 ) |
1810 fseek(v4->pFile, v35, 1); | 1828 fseek(pFile, v35, 1); |
1811 Countc = ftell(v4->pFile); | 1829 Countc = ftell(pFile); |
1812 fseek(v4->pFile, 0, 2); | 1830 fseek(pFile, 0, 2); |
1813 v28 = ftell(v4->pFile) - Countc; | 1831 v28 = ftell(pFile) - Countc; |
1814 fseek(v4->pFile, Countc, 0); | 1832 fseek(pFile, Countc, 0); |
1815 while ( v28 > 0 ) | 1833 while ( v28 > 0 ) |
1816 { | 1834 { |
1817 Countb = v4->uIOBufferSize; | 1835 Countb = uIOBufferSize; |
1818 if ( v28 <= (signed int)v4->uIOBufferSize ) | 1836 if ( v28 <= (signed int)uIOBufferSize ) |
1819 Countb = v28; | 1837 Countb = v28; |
1820 fread(v4->pIOBuffer, 1u, Countb, v4->pFile); | 1838 fread(pIOBuffer, 1u, Countb, pFile); |
1821 fwrite(v4->pIOBuffer, 1u, Countb, pFile); | 1839 fwrite(pIOBuffer, 1u, Countb, pFile); |
1822 v28 -= Countb; | 1840 v28 -= Countb; |
1823 } | 1841 } |
1824 strcpy(NewFilename, (const char *)v4->pLODName); | 1842 strcpy(NewFilename, (const char *)pLODName); |
1825 fclose(pFile); | 1843 fclose(pFile); |
1826 v4->CloseWriteFile(); | 1844 CloseWriteFile(); |
1827 remove(NewFilename); | 1845 remove(NewFilename); |
1828 rename(pFilename, NewFilename); | 1846 rename(pFilename, NewFilename); |
1829 v4->CloseWriteFile(); | 1847 CloseWriteFile(); |
1830 v4->LoadFile(v4->pLODName, 0); | 1848 LoadFile(pLODName, 0); |
1831 return 0; | |
1832 } | |
1833 */ | |
1834 | |
1835 unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4) | |
1836 { | |
1837 LODWriteableFile *v4; // ebx@1 | |
1838 int v5; // esi@1 | |
1839 unsigned __int8 v7; // zf@7 | |
1840 unsigned __int8 v8; // sf@7 | |
1841 const LOD::Directory *v9; // edi@9 | |
1842 int v10; // eax@9 | |
1843 unsigned __int8 v11; // of@15 | |
1844 unsigned __int16 v12; // dx@17 | |
1845 LOD::Directory *v13; // eax@17 | |
1846 unsigned __int16 v14; // cx@17 | |
1847 int v15; // edi@27 | |
1848 unsigned int v16; // eax@27 | |
1849 int v17; // eax@29 | |
1850 int v18; // edx@31 | |
1851 int v19; // eax@31 | |
1852 void *v20; // edi@32 | |
1853 LOD::Directory *v21; // edi@34 | |
1854 signed int v22; // esi@34 | |
1855 int v23; // eax@34 | |
1856 LOD::Directory *v24; // ecx@35 | |
1857 int v25; // edx@35 | |
1858 __int32 v26; // eax@37 | |
1859 int i; // esi@39 | |
1860 __int32 v28; // esi@46 | |
1861 char pFilename[256]; // [sp+Ch] [bp-230h]@22 | |
1862 char NewFilename[256]; // [sp+10Ch] [bp-130h]@51 | |
1863 //LOD::Directory Str; // [sp+20Ch] [bp-30h]@27 | |
1864 size_t v33; // [sp+22Ch] [bp-10h]@27 | |
1865 int v34; // [sp+230h] [bp-Ch]@7 | |
1866 __int32 v35; // [sp+234h] [bp-8h]@8 | |
1867 int v36; // [sp+238h] [bp-4h]@7 | |
1868 size_t Count; // [sp+244h] [bp+8h]@40 | |
1869 __int32 Countc; // [sp+244h] [bp+8h]@46 | |
1870 size_t Countb; // [sp+244h] [bp+8h]@47 | |
1871 FILE *pFile; // [sp+24Ch] [bp+10h]@22 | |
1872 | |
1873 v4 = this; | |
1874 v5 = 0; | |
1875 if ( !this->isFileOpened ) | |
1876 return 1; | |
1877 if ( !this->pSubIndices ) | |
1878 return 2; | |
1879 if ( !this->pIOBuffer || !this->uIOBufferSize ) | |
1880 return 3; | |
1881 v7 = this->uNumSubIndices == 0; | |
1882 v8 = (this->uNumSubIndices & 0x80000000u) != 0; | |
1883 v36 = 0; | |
1884 v34 = 0; | |
1885 if ( v8 | v7 ) | |
1886 { | |
1887 v9 = pDir; | |
1888 goto LABEL_22; | |
1889 } | |
1890 v35 = 0; | |
1891 while ( 1 ) | |
1892 { | |
1893 v9 = pDir; | |
1894 v10 = _strcmpi((const char *)v4->pSubIndices + v35, (const char *)pDir); | |
1895 if ( v10 ) | |
1896 { | |
1897 if ( v10 > 0 ) | |
1898 goto LABEL_22; | |
1899 goto LABEL_15; | |
1900 } | |
1901 if ( !a4 ) | |
1902 goto LABEL_20; | |
1903 if ( a4 == 1 ) | |
1904 break; | |
1905 if ( a4 == 2 ) | |
1906 return 4; | |
1907 LABEL_15: | |
1908 v35 += 32; | |
1909 ++v5; | |
1910 v11 = __OFSUB__(v5, v4->uNumSubIndices); | |
1911 v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0; | |
1912 v34 = v5; | |
1913 if ( !(v8 ^ v11) ) | |
1914 goto LABEL_22; | |
1915 } | |
1916 v12 = pDir->uNumSubIndices; | |
1917 v13 = &v4->pSubIndices[v5]; | |
1918 v14 = v13->uNumSubIndices; | |
1919 if ( v14 >= v12 && (v14 != v12 || (unsigned __int16)v13->word_00001E >= pDir->word_00001E) ) | |
1920 return 4; | |
1921 LABEL_20: | |
1922 v36 = 1; | |
1923 LABEL_22: | |
1924 strcpy(pFilename, "lod.tmp"); | |
1925 pFile = fopen(pFilename, "wb+"); | |
1926 if ( !pFile ) | |
1927 return 5; | |
1928 if ( v36 ) | |
1929 v35 = v4->pSubIndices[v5].uDataSize; | |
1930 else | |
1931 v35 = 0; | |
1932 v33 = v9->uDataSize; | |
1933 v15 = v33 - v35; | |
1934 | |
1935 LOD::Directory Str; // [sp+20Ch] [bp-30h]@27 | |
1936 //LOD::Directory::LOD::Directory(&Str); | |
1937 | |
1938 strcpy((char *)&Str, "chapter"); | |
1939 v16 = v4->uLODDataSize; | |
1940 Str.uNumSubIndices = LOWORD(v4->uNumSubIndices); | |
1941 Str.dword_000018 = 0; | |
1942 Str.word_00001E = 0; | |
1943 if ( !v36 ) | |
1944 { | |
1945 ++Str.uNumSubIndices; | |
1946 v15 += 32; | |
1947 } | |
1948 v7 = v36 == 0; | |
1949 Str.uDataSize = v15 + v16; | |
1950 Str.uOfsetFromSubindicesStart = 288; | |
1951 v17 = (signed __int16)Str.uNumSubIndices; | |
1952 v4->uNumSubIndices = (signed __int16)Str.uNumSubIndices; | |
1953 if ( v7 && v17 > v5 ) | |
1954 { | |
1955 v18 = v17; | |
1956 v19 = v17 - v5; | |
1957 do | |
1958 { | |
1959 v20 = &v4->pSubIndices[v18]; | |
1960 --v18; | |
1961 --v19; | |
1962 memcpy(v20, (char *)v20 - 32, 0x20u); | |
1963 } | |
1964 while ( v19 ); | |
1965 v5 = v34; | |
1966 } | |
1967 v34 = 32 * v5; | |
1968 memcpy(&v4->pSubIndices[v5], pDir, sizeof(v4->pSubIndices[v5])); | |
1969 v23 = 32 * v4->uNumSubIndices; | |
1970 if ( (signed int)v4->uNumSubIndices > 0 ) | |
1971 { | |
1972 for (int i = 0; i < (signed int)v4->uNumSubIndices; ++i) | |
1973 { | |
1974 v4->pSubIndices[i].uOfsetFromSubindicesStart = v23; | |
1975 v23 += v4->pSubIndices[i].uDataSize; | |
1976 } | |
1977 } | |
1978 fwrite(&v4->header, 0x100, 1, pFile); | |
1979 fwrite(&Str, 0x20, 1, pFile); | |
1980 fseek(v4->pFile, Str.uOfsetFromSubindicesStart, 0); | |
1981 fwrite(v4->pSubIndices, 0x20u, v4->uNumSubIndices, pFile); | |
1982 v26 = 32 * v4->uNumSubIndices; | |
1983 if ( !v36 ) | |
1984 v26 -= 32; | |
1985 fseek(v4->pFile, v26, 1); | |
1986 for ( i = *(unsigned int *)((char *)&v4->pSubIndices->uOfsetFromSubindicesStart + v34) | |
1987 - v4->pSubIndices->uOfsetFromSubindicesStart; i > 0; i -= Count ) | |
1988 { | |
1989 Count = v4->uIOBufferSize; | |
1990 if ( i <= (signed int)v4->uIOBufferSize ) | |
1991 Count = i; | |
1992 fread(v4->pIOBuffer, 1u, Count, v4->pFile); | |
1993 fwrite(v4->pIOBuffer, 1u, Count, pFile); | |
1994 } | |
1995 fwrite(pDirData, 1u, v33, pFile); | |
1996 if ( v36 ) | |
1997 fseek(v4->pFile, v35, 1); | |
1998 Countc = ftell(v4->pFile); | |
1999 fseek(v4->pFile, 0, 2); | |
2000 v28 = ftell(v4->pFile) - Countc; | |
2001 fseek(v4->pFile, Countc, 0); | |
2002 while ( v28 > 0 ) | |
2003 { | |
2004 Countb = v4->uIOBufferSize; | |
2005 if ( v28 <= (signed int)v4->uIOBufferSize ) | |
2006 Countb = v28; | |
2007 fread(v4->pIOBuffer, 1u, Countb, v4->pFile); | |
2008 fwrite(v4->pIOBuffer, 1u, Countb, pFile); | |
2009 v28 -= Countb; | |
2010 } | |
2011 strcpy(NewFilename, (const char *)v4->pLODName); | |
2012 fclose(pFile); | |
2013 v4->CloseWriteFile(); | |
2014 remove(NewFilename); | |
2015 rename(pFilename, NewFilename); | |
2016 v4->CloseWriteFile(); | |
2017 v4->LoadFile(v4->pLODName, 0); | |
2018 return 0; | 1849 return 0; |
2019 } | 1850 } |
2020 | 1851 |
2021 | 1852 |
2022 //----- (00461A43) -------------------------------------------------------- | 1853 //----- (00461A43) -------------------------------------------------------- |