diff options
author | unknown <C:\Ladik\Mail> | 2015-08-03 17:41:31 +0200 |
---|---|---|
committer | unknown <C:\Ladik\Mail> | 2015-08-03 17:41:31 +0200 |
commit | 922d3a82b897f3cbe45b45d4e072361c681a8959 (patch) | |
tree | 196d2fc5034c68bbd8d4d5b660b40a127dc6ef25 /test/StormTest.cpp | |
parent | 607e4458e775e17de450f550e7d412ef41013138 (diff) |
+ Fixed patch archives
+ Empty MPQs are no longer marked as malformed
Diffstat (limited to 'test/StormTest.cpp')
-rw-r--r-- | test/StormTest.cpp | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/test/StormTest.cpp b/test/StormTest.cpp index b67e851..685e7de 100644 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -203,7 +203,7 @@ static const char * PatchList_SC2_34644_Maps[] = static const char * PatchList_SC2_32283_enGB[] =
{
- "MPQ_2013_v4_enGB.SC2Data",
+ "MPQ_2013_v4_Mods#Core.SC2Mod#enGB.SC2Assets",
"s2-update-enGB-23258.MPQ",
"s2-update-enGB-24540.MPQ",
"s2-update-enGB-26147.MPQ",
@@ -213,6 +213,18 @@ static const char * PatchList_SC2_32283_enGB[] = NULL
};
+static const char * PatchList_SC2_36281_enGB[] =
+{
+ "MPQ_2013_v4_Mods#Liberty.SC2Mod#enGB.SC2Data",
+ "s2-update-enGB-23258.MPQ",
+ "s2-update-enGB-24540.MPQ",
+ "s2-update-enGB-26147.MPQ",
+ "s2-update-enGB-28522.MPQ",
+ "s2-update-enGB-30384.MPQ",
+ "s2-update-enGB-32281.MPQ",
+ NULL
+};
+
static const char * PatchList_HS_6898_enGB[] =
{
"MPQ_2014_v4_base-Win.MPQ",
@@ -1924,10 +1936,15 @@ static int OpenPatchedArchive(TLogHelper * pLogger, HANDLE * phMpq, const char * }
}
- // Store the archive handle or close the archive
- if(phMpq == NULL)
+ // If anything failed, close the MPQ handle
+ if(nError != ERROR_SUCCESS)
+ {
SFileCloseArchive(hMpq);
- else
+ hMpq = NULL;
+ }
+
+ // Give the archive handle to the caller
+ if(phMpq != NULL)
*phMpq = hMpq;
return nError;
}
@@ -2494,7 +2511,7 @@ static int TestOpenArchive_Corrupt(const char * szPlainName) // Opens a patched MPQ archive
-static int TestOpenArchive_Patched(const char * PatchList[], const char * szPatchedFile, int nExpectedPatchCount)
+static int TestOpenArchive_Patched(const char * PatchList[], const char * szPatchedFile, int nExpectedPatchCount, bool bExpectedToFail = false)
{
TLogHelper Logger("OpenPatchedMpqTest", PatchList[0]);
HANDLE hMpq;
@@ -2530,6 +2547,9 @@ static int TestOpenArchive_Patched(const char * PatchList[], const char * szPatc SFileCloseArchive(hMpq);
}
+ // Clear the error if patch prefix was not found
+ if(nError == ERROR_CANT_FIND_PATCH_PREFIX && bExpectedToFail)
+ nError = ERROR_SUCCESS;
return nError;
}
@@ -4283,10 +4303,14 @@ int main(int argc, char * argv[]) // Open a patched archive with new format of BSDIFF patch
if(nError == ERROR_SUCCESS)
nError = TestOpenArchive_Patched(PatchList_SC2_34644_Maps, "Maps\\Campaign\\THorner03.SC2Map\\BankList.xml", 3);
-
+*/
// Open a patched archive
if(nError == ERROR_SUCCESS)
- nError = TestOpenArchive_Patched(PatchList_SC2_32283_enGB, "LocalizedData\\GameHotkeys.txt", 6);
+ nError = TestOpenArchive_Patched(PatchList_SC2_32283_enGB, "LocalizedData\\GameHotkeys.txt", 0, true);
+/*
+ // Open a patched archive where the "StreamingBuckets.txt" is not a patch file
+ if(nError == ERROR_SUCCESS)
+ nError = TestOpenArchive_Patched(PatchList_SC2_36281_enGB, "LocalizedData\\GameHotkeys.txt", 6);
// Open a patched archive
if(nError == ERROR_SUCCESS)
|