From 6a107601c628ec15b5d7947d6f51d00d709b0e7a Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Sat, 12 Feb 2022 21:14:55 +0100 Subject: Fixed regression tests --- src/SBaseFileTable.cpp | 33 +++++---------------------------- test/StormTest.cpp | 2 +- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/SBaseFileTable.cpp b/src/SBaseFileTable.cpp index bcbc5e1..1b79243 100644 --- a/src/SBaseFileTable.cpp +++ b/src/SBaseFileTable.cpp @@ -885,28 +885,6 @@ static TMPQHash * DefragmentHashTable( } */ -static void DeleteInvalidHashTableEntries(TMPQArchive * ha, TMPQHash * pHashTable, TMPQBlock * pBlockTable) -{ - TMPQHeader * pHeader = ha->pHeader; - TMPQHash * pHashTableEnd = pHashTable + pHeader->dwHashTableSize; - TMPQHash * pHash = pHashTable; - - // Sanity checks - assert(pHeader->wFormatVersion == MPQ_FORMAT_VERSION_1); - assert(pHeader->HiBlockTablePos64 == 0); - - // Parse the hash table and move the entries to the begin of it - for(pHash = pHashTable; pHash < pHashTableEnd; pHash++) - { - // Check whether this is a valid hash table entry - if(!IsValidHashEntry1(ha, pHash, pBlockTable)) - { - memset(pHash, 0xFF, sizeof(TMPQHash)); - pHash->dwBlockIndex = HASH_ENTRY_DELETED; - } - } -} - static DWORD BuildFileTableFromBlockTable( TMPQArchive * ha, TMPQBlock * pBlockTable) @@ -936,12 +914,11 @@ static DWORD BuildFileTableFromBlockTable( // Example MPQ: MPQ_2022_v1_Sniper.scx // - if(ha->dwFlags & MPQ_FLAG_HASH_TABLE_CUT) - { - //ha->pHashTable = DefragmentHashTable(ha, ha->pHashTable, pBlockTable); - //ha->dwMaxFileCount = pHeader->dwHashTableSize; - DeleteInvalidHashTableEntries(ha, ha->pHashTable, pBlockTable); - } + //if(ha->dwFlags & MPQ_FLAG_HASH_TABLE_CUT) + //{ + // ha->pHashTable = DefragmentHashTable(ha, ha->pHashTable, pBlockTable); + // ha->dwMaxFileCount = pHeader->dwHashTableSize; + //} // If the hash table or block table is cut, // we will defragment the block table diff --git a/test/StormTest.cpp b/test/StormTest.cpp index 3a6e573..a2db1a6 100644 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -4290,7 +4290,7 @@ static const TEST_INFO Test_Mpqs[] = {_T("MPQ_2015_v1_flem1.w3x"), NULL, TEST_DATA("1c4c13e627658c473e84d94371e31f37", 20)}, {_T("MPQ_2002_v1_ProtectedMap_HashTable_FakeValid.w3x"), NULL, TEST_DATA("5250975ed917375fc6540d7be436d4de", 114)}, {_T("MPQ_2021_v1_CantExtractCHK.scx"), NULL, TEST_DATA("055fd548a789c910d9dd37472ecc1e66", 28)}, - {_T("MPQ_2022_v1_Sniper.scx"), NULL, TEST_DATA("2e955271b70b79344ad85b698f6ce9d8", 63)}, // Multiple items in hash table for staredit\scenario.chk (locale=0, platform=0) + {_T("MPQ_2022_v1_Sniper.scx"), NULL, TEST_DATA("2e955271b70b79344ad85b698f6ce9d8", 64)}, // Multiple items in hash table for staredit\scenario.chk (locale=0, platform=0) {_T("MPQ_2022_v1_OcOc_Bound_2.scx"), NULL, TEST_DATA("25cad16a2fb4e883767a1f512fc1dce7", 16)}, }; -- cgit v1.2.3