Current News
Archived News
Search News
Discussion Forum


Old Forum
Install Programs More Downloads...
Troubleshooting
Source Code
Format Specs.
Misc. Information
Non-SF Stuff
Links




index a5b264f..86631f4 100644 (file)
@@ -106,8 +106,8 @@ MPQFILE * FirstLastFile[2] = {0,0};
 
 char StormBasePath[MAX_PATH+1];
 
-#define UNSUPPORTED_COMPRESSION   (0xFF ^ (0x40 | 0x80 | 0x01 | 0x02 | 0x08))
-#define UNSUPPORTED_DECOMPRESSION (0xFF ^ (0x40 | 0x80 | 0x01 | 0x02 | 0x08))
+#define UNSUPPORTED_COMPRESSION   (0xFF ^ (0x40 | 0x80 | 0x01 | 0x02 | 0x08 | 0x10))
+#define UNSUPPORTED_DECOMPRESSION (0xFF ^ (0x40 | 0x80 | 0x01 | 0x02 | 0x08 | 0x10))
 
 typedef BOOL (WINAPI* funcSCompCompress)(LPVOID lpvDestinationMem, LPDWORD lpdwCompressedSize, LPVOID lpvSourceMem, DWORD dwDecompressedSize, DWORD dwCompressionType, DWORD dwCompressionSubType, DWORD dwWAVQuality);
 typedef BOOL (WINAPI* funcSCompDecompress)(LPVOID lpvDestinationMem, LPDWORD lpdwDecompressedSize, LPVOID lpvSourceMem, DWORD dwCompressedSize);
@@ -1526,7 +1526,10 @@ BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELIST
                                lpListBuffer[i].dwCompressedSize = mpqOpenArc->lpBlockTable[dwBlockIndex].dwCompressedSize;
                                lpListBuffer[i].dwFullSize = mpqOpenArc->lpBlockTable[dwBlockIndex].dwFullSize;
                                lpListBuffer[i].dwFlags = mpqOpenArc->lpBlockTable[dwBlockIndex].dwFlags;
-                               lpListBuffer[i].dwFileExists=0xFFFFFFFF;
+                               if (dwFlags & SFILE_LIST_FLAG_UNKNOWN)
+                                       lpListBuffer[i].dwFileExists = 1;
+                               else
+                                       lpListBuffer[i].dwFileExists=0xFFFFFFFF;
                                SetFilePointer(mpqOpenArc->hFile,mpqOpenArc->dwMPQStart+mpqOpenArc->lpBlockTable[dwBlockIndex].dwFileOffset+0x40,0,FILE_BEGIN);
                                ReadFile(mpqOpenArc->hFile,lpListBuffer[i].szFileName,260,&tsz,0);
 
@@ -1537,6 +1540,10 @@ BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELIST
                                }
                                else {
                                        sprintf(lpListBuffer[i].szFileName,UNKNOWN_OUT,i);
+                                       if (dwFlags & SFILE_LIST_FLAG_UNKNOWN) {
+                                               lpListBuffer[i].dwFileExists |= 2;
+                                       }
+
                                        if (dwFlags&SFILE_LIST_ONLY_KNOWN) {
                                                lpListBuffer[i].dwFileExists = 0;
                                        }
@@ -1690,7 +1697,10 @@ BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELIST
                        lpListBuffer[i].dwCompressedSize = mpqOpenArc->lpBlockTable[dwBlockIndex].dwCompressedSize;
                        lpListBuffer[i].dwFullSize = mpqOpenArc->lpBlockTable[dwBlockIndex].dwFullSize;
                        lpListBuffer[i].dwFlags = mpqOpenArc->lpBlockTable[dwBlockIndex].dwFlags;
-                       lpListBuffer[i].dwFileExists=0xFFFFFFFF;
+                       if (dwFlags & SFILE_LIST_FLAG_UNKNOWN)
+                               lpListBuffer[i].dwFileExists = 1;
+                       else
+                               lpListBuffer[i].dwFileExists=0xFFFFFFFF;
                        for (j=0;j<dwTotalLines;j++) {
                                if (mpqOpenArc->lpHashTable[i].dwNameHashA==lpdwNameHashA[j] && mpqOpenArc->lpHashTable[i].dwNameHashB==lpdwNameHashB[j]) {
                                        strncpy(lpListBuffer[i].szFileName,lpNames[j],260);
@@ -1701,6 +1711,10 @@ BOOL SFMPQAPI WINAPI SFileListFiles(MPQHANDLE hMPQ, LPCSTR lpFileLists, FILELIST
                                }
                                if (j+1==dwTotalLines) {
                                        sprintf(lpListBuffer[i].szFileName,UNKNOWN_OUT,i);
+                                       if (dwFlags & SFILE_LIST_FLAG_UNKNOWN) {
+                                               lpListBuffer[i].dwFileExists |= 2;
+                                       }
+
                                        if (dwFlags&SFILE_LIST_ONLY_KNOWN) {
                                                lpListBuffer[i].dwFileExists = 0;
                                        }
@@ -3230,7 +3244,7 @@ MPQHANDLE GetFreeHashTableEntry(MPQHANDLE hMPQ, LPCSTR lpFileName, LCID FileLoca
        DWORD i=dwTablePos, nFirstFree = 0xFFFFFFFF;
        do
        {
-               if ((mpqOpenArc->lpHashTable[i].dwBlockTableIndex&0xFFFFFFFE)==0xFFFFFFFE && nFirstFree == 0xFFFFFFFF)
+               if ((mpqOpenArc->lpHashTable[i].dwBlockTableIndex&0xFFFFFFFE)==0xFFFFFFFE && (nFirstFree == 0xFFFFFFFF || mpqOpenArc->lpHashTable[i].dwBlockTableIndex == 0xFFFFFFFF))
                {
                        if (mpqOpenArc->lpHashTable[i].dwBlockTableIndex == 0xFFFFFFFF)
                        {