Skip to content

Commit

Permalink
Improve StormLib loading times (#64)
Browse files Browse the repository at this point in the history
This reverts parts of 503ab19d3d4253fb013752572c19c314d19de792 which massively impacted loading times.
  • Loading branch information
GaryOderNichts committed Dec 14, 2022
1 parent e1fa7a2 commit df3a6dd
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions extern/StormLib/src/SFileListFile.cpp
Expand Up @@ -409,6 +409,7 @@ static LPBYTE CreateListFile(TMPQArchive * ha, DWORD * pcbListFile)
static DWORD SListFileCreateNodeForAllLocales(TMPQArchive * ha, const char * szFileName)
{
TFileEntry * pFileEntry;
TMPQHash * pFirstHash;
TMPQHash * pHashEnd;
TMPQHash * pHash;
DWORD dwName1;
Expand Down Expand Up @@ -443,25 +444,25 @@ static DWORD SListFileCreateNodeForAllLocales(TMPQArchive * ha, const char * szF
pHashEnd = ha->pHashTable + (ha->dwRealHashTableSize / sizeof(TMPQHash));

// Go through the hash table and put the name in each item that has the same name pair
for(pHash = ha->pHashTable; pHash < pHashEnd; pHash++)
{
if(pHash->dwName1 == dwName1 && pHash->dwName2 == dwName2 && MPQ_BLOCK_INDEX(pHash) < ha->dwFileTableSize)
{
// Allocate file name for the file entry
AllocateFileName(ha, ha->pFileTable + MPQ_BLOCK_INDEX(pHash), szFileName);
}
}
//for(pHash = ha->pHashTable; pHash < pHashEnd; pHash++)
//{
// if(pHash->dwName1 == dwName1 && pHash->dwName2 == dwName2 && MPQ_BLOCK_INDEX(pHash) < ha->dwFileTableSize)
// {
// // Allocate file name for the file entry
// AllocateFileName(ha, ha->pFileTable + MPQ_BLOCK_INDEX(pHash), szFileName);
// }
//}

// Go while we found something
//pFirstHash = pHash = GetFirstHashEntry(ha, szFileName);
//while(pHash != NULL)
//{
// // Allocate file name for the file entry
// AllocateFileName(ha, ha->pFileTable + MPQ_BLOCK_INDEX(pHash), szFileName);
pFirstHash = pHash = GetFirstHashEntry(ha, szFileName);
while(pHash != NULL)
{
// Allocate file name for the file entry
AllocateFileName(ha, ha->pFileTable + MPQ_BLOCK_INDEX(pHash), szFileName);

// // Now find the next language version of the file
// pHash = GetNextHashEntry(ha, pFirstHash, pHash);
//}
// Now find the next language version of the file
pHash = GetNextHashEntry(ha, pFirstHash, pHash);
}

return ERROR_SUCCESS;
}
Expand Down

0 comments on commit df3a6dd

Please sign in to comment.