File 0006-update-stargus-launcher-to-work-with-extraction-supp.patch of Package stargus

From 9f2b958033f38f3e479b7a804c1866762d3cb6af Mon Sep 17 00:00:00 2001
From: Tim Felgentreff <timfelgentreff@gmail.com>
Date: Thu, 17 Nov 2016 13:27:59 +0100
Subject: [PATCH 06/26] update stargus launcher to work with extraction,
 support more cases for mpq filenames

---
 stargus.cpp  | 11 ++++++++++-
 startool.cpp | 21 ++++++++++++++++++---
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/stargus.cpp b/stargus.cpp
index f38fde3..58fdd6c 100644
--- a/stargus.cpp
+++ b/stargus.cpp
@@ -18,7 +18,16 @@
 */
 
 #define GAME_NAME "Stargus"
-#define GAME_CD "Starcraft CD"
+#define GAME_CD "Starcraft CD or installation stardat.mpq or starcraft.mpq file"
+#define GAME_CD_FILE_PATTERNS "stardat.mpq", "StarDat.mpq", "starcraft.mpq", "StarCraft.mpq"
 #define GAME "stargus"
+#define EXTRACTOR_TOOL "startool"
+#define EXTRACTOR_ARGS
+// contrib has fog.png
+#define CONTRIB_DIRECTORIES { "mpqlist.txt", "mpqlist.txt", \
+			      "contrib", "graphics/tilesets", \
+			      "scripts", "scripts", NULL }
+
+const char* SRC_PATH() { return __FILE__; }
 
 #include "stratagus-game-launcher.h"
diff --git a/startool.cpp b/startool.cpp
index 721dd1b..44d6689 100644
--- a/startool.cpp
+++ b/startool.cpp
@@ -234,7 +234,9 @@ enum _archive_type_ {
 
 Control CDTodo[] = {
 	{F,0,"","install.exe" __4},
+	{F,0,"","Install.exe" __4},
 	{F,0,"","starcraft.mpq" __4 },
+	{F,0,"","StarCraft.mpq" __4 },
 	// Fonts
 	{N,0,"font8","files\\font\\font8.fnt" __4},
 	{N,0,"font10","files\\font\\font10.fnt" __4},
@@ -884,6 +886,7 @@ Control CDTodo[] = {
 
 Control Todo[] = {
 	{F,0,"","stardat.mpq" __4},
+	{F,0,"","StarDat.mpq" __4},
 
 //	{G,0,"ui/blink","game\\blink.grp",0 __3},
 
@@ -4188,7 +4191,7 @@ int main(int argc, char **argv)
 	printf("Please be patient, the data may take a couple of minutes to extract...\n");
 	fflush(stdout);
 
-	for (i = 0; i < 3; ++i) {
+	for (i = 0; i <= 5; ++i) {
 		Control *c;
 		unsigned len;
 
@@ -4200,12 +4203,24 @@ int main(int argc, char **argv)
 			break;
 		case 1:
 			c = &(CDTodo[1]);
-			len = sizeof(CDTodo) / sizeof(*CDTodo) - 1; // CD install.exe renamed to starcraft.mpq
+			len = sizeof(CDTodo) / sizeof(*CDTodo) - 1; // CD Install.exe
 			break;
-		default:
+		case 2:
+			c = &(CDTodo[2]);
+			len = sizeof(CDTodo) / sizeof(*CDTodo) - 2; // CD install.exe renamed to starcraft.mpq
+			break;
+		case 3:
+			c = &(CDTodo[3]);
+			len = sizeof(CDTodo) / sizeof(*CDTodo) - 3; // CD install.exe renamed to StarCraft.mpq
+			break;
+		case 4:
 			// stardat.mpq from cd or hard drive
 			c = Todo;
 			len = sizeof(Todo) / sizeof(*Todo);
+		case 5:
+			// StarDat.mpq from cd or hard drive
+			c = &(Todo[1]);
+			len = sizeof(Todo) / sizeof(*Todo) - 1;
 		}
 
 		for (u = 0; u < len; ++u) {
-- 
2.16.4

openSUSE Build Service is sponsored by