diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/SFileListFile.cpp | 45 | ||||
-rw-r--r-- | src/StormLib.h | 1 |
2 files changed, 46 insertions, 0 deletions
diff --git a/src/SFileListFile.cpp b/src/SFileListFile.cpp index 2a3f02a..efad14e 100644 --- a/src/SFileListFile.cpp +++ b/src/SFileListFile.cpp @@ -558,6 +558,25 @@ static DWORD SFileAddArbitraryListFile( return (pCache != NULL) ? ERROR_SUCCESS : ERROR_FILE_CORRUPT;
}
+static int SFileAddArbitraryListFile(
+ TMPQArchive * ha,
+ const char ** listFileEntries,
+ DWORD dwEntryCount)
+{
+ if(listFileEntries != NULL && dwEntryCount > 0)
+ {
+ // Get the next line
+ for (DWORD dwListFileNum=0; dwListFileNum<dwEntryCount; dwListFileNum++)
+ {
+ const char* listFileEntry = listFileEntries[dwListFileNum];
+ if ( listFileEntry != NULL )
+ SListFileCreateNodeForAllLocales(ha, listFileEntry);
+ }
+ }
+
+ return (listFileEntries != NULL && dwEntryCount > 0) ? ERROR_SUCCESS : ERROR_INVALID_PARAMETER;
+}
+
static DWORD SFileAddInternalListFile(
TMPQArchive * ha,
HANDLE hMpq)
@@ -662,6 +681,32 @@ DWORD WINAPI SFileAddListFile(HANDLE hMpq, const TCHAR * szListFile) return dwErrCode;
}
+DWORD WINAPI SFileAddListFileEntries(HANDLE hMpq, const char ** listFileEntries, DWORD dwEntryCount)
+{
+ TMPQArchive * ha = (TMPQArchive *)hMpq;
+ DWORD dwErrCode = ERROR_SUCCESS;
+
+ // Add the listfile for each MPQ in the patch chain
+ while(ha != NULL)
+ {
+ if(listFileEntries != NULL && dwEntryCount > 0)
+ dwErrCode = SFileAddArbitraryListFile(ha, listFileEntries, dwEntryCount);
+ else
+ dwErrCode = SFileAddInternalListFile(ha, hMpq);
+
+ // Also, add three special files to the listfile:
+ // (listfile) itself, (attributes) and (signature)
+ SListFileCreateNodeForAllLocales(ha, LISTFILE_NAME);
+ SListFileCreateNodeForAllLocales(ha, SIGNATURE_NAME);
+ SListFileCreateNodeForAllLocales(ha, ATTRIBUTES_NAME);
+
+ // Move to the next archive in the chain
+ ha = ha->haPatch;
+ }
+
+ return dwErrCode;
+}
+
//-----------------------------------------------------------------------------
// Enumerating files in listfile
diff --git a/src/StormLib.h b/src/StormLib.h index e45f99d..07408b2 100644 --- a/src/StormLib.h +++ b/src/StormLib.h @@ -1025,6 +1025,7 @@ bool WINAPI SFileCloseArchive(HANDLE hMpq); // so you can use this API to combining more listfiles. // Note that this function is internally called by SFileFindFirstFile DWORD WINAPI SFileAddListFile(HANDLE hMpq, const TCHAR * szListFile); +DWORD WINAPI SFileAddListFileEntries(HANDLE hMpq, const char ** listFileEntries, DWORD dwEntryCount); // Archive compacting bool WINAPI SFileSetCompactCallback(HANDLE hMpq, SFILE_COMPACT_CALLBACK CompactCB, void * pvUserData); |