aboutsummaryrefslogtreecommitdiff
path: root/dep/CascLib/src/CascRootFile_WoW.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-06-23 10:25:18 +0200
committerShauren <shauren.trinity@gmail.com>2023-06-23 10:25:18 +0200
commit9ad1e5d635e2fd4c2486d5f2bf1cb52d8e768558 (patch)
tree00b379e3f84ff5b428f0fafd5bdeac0489ede0c4 /dep/CascLib/src/CascRootFile_WoW.cpp
parent54596eb8ce5d7933164073eb3768f52124ba4262 (diff)
Dep/CascLib: Update to ladislav-zezula/CascLib@ebd79e8fd43279343c543a27fce620f6b1b53cb9
Diffstat (limited to 'dep/CascLib/src/CascRootFile_WoW.cpp')
-rw-r--r--dep/CascLib/src/CascRootFile_WoW.cpp38
1 files changed, 33 insertions, 5 deletions
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
@@ -79,6 +79,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
#define FTREE_FLAGS_WOW (FTREE_FLAG_USE_DATA_ID | FTREE_FLAG_USE_LOCALE_FLAGS | FTREE_FLAG_USE_CONTENT_FLAGS)
@@ -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