From 9ad1e5d635e2fd4c2486d5f2bf1cb52d8e768558 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 23 Jun 2023 10:25:18 +0200 Subject: Dep/CascLib: Update to ladislav-zezula/CascLib@ebd79e8fd43279343c543a27fce620f6b1b53cb9 --- dep/CascLib/src/CascRootFile_WoW.cpp | 38 +++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'dep/CascLib/src/CascRootFile_WoW.cpp') diff --git a/dep/CascLib/src/CascRootFile_WoW.cpp b/dep/CascLib/src/CascRootFile_WoW.cpp index 5b5375bcc7b..85942c432ba 100644 --- a/dep/CascLib/src/CascRootFile_WoW.cpp +++ b/dep/CascLib/src/CascRootFile_WoW.cpp @@ -78,6 +78,31 @@ typedef struct _FILE_ROOT_GROUP } FILE_ROOT_GROUP, *PFILE_ROOT_GROUP; +//----------------------------------------------------------------------------- +// Debug local stuff + +#if defined(_MSC_VER) && defined(CASCLIB_DEBUG) +static FILE * fp = NULL; +static bool bLogEntries = true; + +static void LogEntry(DWORD FileDataId, PCONTENT_KEY pCKey) +{ + if(fp && bLogEntries) + { + char szCKey[MD5_STRING_SIZE + 1]; + + if(FileDataId == 1260179) + { + bLogEntries = false; + __debugbreak(); + } + + StringFromBinary(pCKey->Value, MD5_HASH_SIZE, szCKey); + fprintf(fp, "File Data ID: %u, CKey = %s\n", FileDataId, szCKey); + } +} +#endif + //----------------------------------------------------------------------------- // TRootHandler_WoW interface / implementation @@ -89,7 +114,7 @@ struct TRootHandler_WoW : public TFileTreeRoot TRootHandler_WoW(ROOT_FORMAT RFormat, DWORD HashlessFileCount) : TFileTreeRoot(FTREE_FLAGS_WOW) { - // Turn off the "we know file names" bit + // Turn off the "we know file names" bit FileCounterHashless = HashlessFileCount; FileCounter = 0; RootFormat = RFormat; @@ -155,7 +180,7 @@ struct TRootHandler_WoW : public TFileTreeRoot return pbRootPtr + (sizeof(FILE_ROOT_ENTRY) * RootGroup.Header.NumberOfFiles); case RootFormatWoW82: - + // Verify the position of array of CONTENT_KEY if((pbRootPtr + (sizeof(CONTENT_KEY) * RootGroup.Header.NumberOfFiles)) > pbRootEnd) return NULL; @@ -229,7 +254,6 @@ struct TRootHandler_WoW : public TFileTreeRoot { // Set the file data ID FileDataId = FileDataId + RootGroup.FileDataIds[i]; - //printf("File Data ID: %u\n", FileDataId); // Find the item in the central storage. Insert it to the tree if((pCKeyEntry = FindCKeyEntry_CKey(hs, pCKey->Value)) != NULL) @@ -357,7 +381,7 @@ struct TRootHandler_WoW : public TFileTreeRoot */ DWORD ParseWowRootFile_Level1( - TCascStorage * hs, + TCascStorage * hs, LPBYTE pbRootPtr, LPBYTE pbRootEnd, DWORD dwLocaleMask, @@ -389,7 +413,7 @@ struct TRootHandler_WoW : public TFileTreeRoot if(dwErrCode == ERROR_SUCCESS) dwErrCode = ParseWowRootFile_Level1(hs, pbRootPtr, pbRootEnd, dwLocaleMask, 1); -#ifdef _DEBUG +#ifdef CASCLIB_DEBUG // Dump the array of the file data IDs //FileTree.DumpFileDataIds("e:\\file-data-ids.bin"); #endif @@ -494,6 +518,8 @@ DWORD RootHandler_CreateWoW(TCascStorage * hs, CASC_BLOB & RootFile, DWORD dwLoc pRootHandler = new TRootHandler_WoW(RootFormat, FileCounterHashless); if(pRootHandler != NULL) { + //fp = fopen("E:\\file-data-ids2.txt", "wt"); + // Load the root directory. If load failed, we free the object dwErrCode = pRootHandler->Load(hs, pbRootFile, pbRootEnd, dwLocaleMask); if(dwErrCode != ERROR_SUCCESS) @@ -501,6 +527,8 @@ DWORD RootHandler_CreateWoW(TCascStorage * hs, CASC_BLOB & RootFile, DWORD dwLoc delete pRootHandler; pRootHandler = NULL; } + + //fclose(fp); } // Assign the root directory (or NULL) and return error -- cgit v1.2.3