diff options
author | Shauren <shauren.trinity@gmail.com> | 2016-04-03 10:21:30 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2016-04-03 10:21:30 +0200 |
commit | 77761e819506075b28c1b4eaf3fb295cc544c838 (patch) | |
tree | 694123b8a8bf2c70d94b09b44f1dcb576f0127e4 /dep/CascLib/src/CascRootFile_Ovr.cpp | |
parent | e320ce27c578b21b8611ecfb01084a205790e2e6 (diff) |
Dep/CascLib: Update to ladislav-zezula/CascLib@d477d30f7c2b3a306fd07c92929950639335fb3f
Diffstat (limited to 'dep/CascLib/src/CascRootFile_Ovr.cpp')
-rw-r--r-- | dep/CascLib/src/CascRootFile_Ovr.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/dep/CascLib/src/CascRootFile_Ovr.cpp b/dep/CascLib/src/CascRootFile_Ovr.cpp index 205353c0120..dbb7620b769 100644 --- a/dep/CascLib/src/CascRootFile_Ovr.cpp +++ b/dep/CascLib/src/CascRootFile_Ovr.cpp @@ -140,6 +140,7 @@ int RootHandler_CreateOverwatch(TCascStorage * hs, LPBYTE pbRootFile, DWORD cbRo char szOneLine[0x200]; char szFileName[MAX_PATH+1]; DWORD dwFileCountMax = hs->pEncodingMap->TableSize; + int nFileNameIndex; int nError = ERROR_SUCCESS; // Allocate the root handler object @@ -177,20 +178,26 @@ int RootHandler_CreateOverwatch(TCascStorage * hs, LPBYTE pbRootFile, DWORD cbRo pTextFile = ListFile_FromBuffer(pbRootFile, cbRootFile); if(pTextFile != NULL) { - // Skip the first line, containing "#MD5|CHUNK_ID|FILENAME|INSTALLPATH" - ListFile_GetNextLine(pTextFile, szOneLine, _maxchars(szOneLine)); - - // Parse the next lines - while((nLength = ListFile_GetNextLine(pTextFile, szOneLine, _maxchars(szOneLine))) > 0) + // Get the initial line, containing variable names + nLength = ListFile_GetNextLine(pTextFile, szOneLine, _maxchars(szOneLine)); + + // Determine the index of the "FILENAME" variable + nError = GetRootVariableIndex(szOneLine, szOneLine + nLength, "FILENAME", &nFileNameIndex); + if(nError == ERROR_SUCCESS) { - // Parse the line - nError = ParseRootFileLine(szOneLine, szOneLine + nLength, &EncodingKey, szFileName, _maxchars(szFileName)); - if(nError == ERROR_SUCCESS) + // Parse the next lines + while((nLength = ListFile_GetNextLine(pTextFile, szOneLine, _maxchars(szOneLine))) > 0) { - InsertFileEntry(pRootHandler, szFileName, KeyBuffer.Value); + // Parse the line + nError = ParseRootFileLine(szOneLine, szOneLine + nLength, nFileNameIndex, &EncodingKey, szFileName, _maxchars(szFileName)); + if(nError == ERROR_SUCCESS) + { + InsertFileEntry(pRootHandler, szFileName, KeyBuffer.Value); + } } } + // Free the listfile ListFile_Free(pTextFile); } |