[Scummvm-cvs-logs] SF.net SVN: scummvm:[44148] scummvm/trunk/tools/create_kyradat

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Sep 17 14:42:50 CEST 2009


Revision: 44148
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44148&view=rev
Author:   lordhoto
Date:     2009-09-17 12:42:50 +0000 (Thu, 17 Sep 2009)

Log Message:
-----------
- Got rid of special id "kAmigaVersion"
- Changed handling of platform settings via game platform settings and not via special id

Modified Paths:
--------------
    scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
    scummvm/trunk/tools/create_kyradat/create_kyradat.h
    scummvm/trunk/tools/create_kyradat/extract.cpp
    scummvm/trunk/tools/create_kyradat/games.cpp

Modified: scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2009-09-17 12:42:25 UTC (rev 44147)
+++ scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2009-09-17 12:42:50 UTC (rev 44148)
@@ -308,7 +308,7 @@
 		return false;
 
 	const ExtractType *type = findExtractType(i->type);
-	type->createFilename(dstFilename, g->game, g->lang, g->special, i->filename);
+	type->createFilename(dstFilename, g->game, g->lang, g->platform, g->special, i->filename);
 	return true;
 }
 
@@ -318,9 +318,6 @@
 	{ kTalkieVersion, "CD" },
 	{ kDemoVersion, "DEM" },
 	{ kDemoCDVersion, "CD.DEM" },
-	{ kFMTownsVersionE , "TNS" },
-	{ kFMTownsVersionJ, "TNS" },
-	{ kAmigaVersion, "AMG" },
 
 	{ k2CDFile1E, "CD" },
 	{ k2CDFile1F, "CD" },
@@ -333,10 +330,6 @@
 	{ k2CDDemoF, "CD" },
 	{ k2CDDemoG, "CD" },
 
-	{ k2TownsFile1E, "TNS" },
-	{ k2TownsFile1J, "TNS" },
-	{ k2TownsFile2E, "TNS" },
-	{ k2TownsFile2J, "TNS" },
 	{ k2DemoVersion, "DEM" },
 	{ k2DemoLol, "DEM" },
 
@@ -356,6 +349,13 @@
 	{ -1, 0 }
 };
 
+const PlatformExtension platformTable[] = {
+	{ kPlatformAmiga, "AMG" },
+	{ kPlatformFMTowns, "TNS" },
+
+	{ -1, 0 }
+};
+
 // index generation
 
 enum {
@@ -388,11 +388,9 @@
 		features |= GF_DEMO;
 	else if (g->special == kDemoCDVersion)
 		features |= (GF_DEMO | GF_TALKIE);
-	else if (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ ||
-		g->special == k2TownsFile1E || g->special == k2TownsFile1J ||
-		g->special == k2TownsFile2E || g->special == k2TownsFile2J)
+	else if (g->platform == kPlatformFMTowns)
 		features |= GF_FMTOWNS;
-	else if (g->special == kAmigaVersion)
+	else if (g->platform == kPlatformAmiga)
 		features |= GF_AMIGA;
 	else
 		features |= GF_FLOPPY;
@@ -435,7 +433,7 @@
 
 bool updateIndex(PAKFile &out, const Game *g) {
 	char filename[32];
-	createFilename(filename, g->game, -1, g->special, "INDEX");
+	createFilename(filename, g->game, -1, g->platform, g->special, "INDEX");
 
 	byte *index = new byte[kIndexSize];
 	assert(index);
@@ -463,7 +461,7 @@
 
 bool checkIndex(PAKFile &out, const Game *g) {
 	char filename[32];
-	createFilename(filename, g->game, -1, g->special, "INDEX");
+	createFilename(filename, g->game, -1, g->platform, g->special, "INDEX");
 
 	uint32 size = 0;
 	const uint8 *data = out.getFileData(filename, &size);

Modified: scummvm/trunk/tools/create_kyradat/create_kyradat.h
===================================================================
--- scummvm/trunk/tools/create_kyradat/create_kyradat.h	2009-09-17 12:42:25 UTC (rev 44147)
+++ scummvm/trunk/tools/create_kyradat/create_kyradat.h	2009-09-17 12:42:50 UTC (rev 44148)
@@ -32,6 +32,13 @@
 
 extern const Language languageTable[];
 
+struct PlatformExtension {
+	int platform;
+	const char *ext;
+};
+
+extern const PlatformExtension platformTable[];
+
 enum kExtractID {
 	kForestSeq = 1,
 	kKallakWritingSeq,
@@ -279,7 +286,6 @@
 	kDemoVersion,
 	kFMTownsVersionE,
 	kFMTownsVersionJ,
-	kAmigaVersion,
 
 	k2CDFile1E,
 	k2CDFile1F,

Modified: scummvm/trunk/tools/create_kyradat/extract.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/extract.cpp	2009-09-17 12:42:25 UTC (rev 44147)
+++ scummvm/trunk/tools/create_kyradat/extract.cpp	2009-09-17 12:42:50 UTC (rev 44148)
@@ -25,11 +25,11 @@
 
 // Filename creation
 
-void createFilename(char *dstFilename, const int gid, const int lang, const int special, const char *filename);
+void createFilename(char *dstFilename, const int gid, const int lang, const int platform, const int special, const char *filename);
 
 namespace {
 
-void createLangFilename(char *dstFilename, const int gid, const int lang, const int special, const char *filename);
+void createLangFilename(char *dstFilename, const int gid, const int lang, const int platform, const int special, const char *filename);
 
 // Extraction function prototypes 
 
@@ -83,7 +83,7 @@
 
 } // end of anonymous namespace
 
-void createFilename(char *dstFilename, const int gid, const int lang, const int special, const char *filename) {
+void createFilename(char *dstFilename, const int gid, const int lang, const int platform, const int special, const char *filename) {
 	strcpy(dstFilename, filename);
 
 	static const char *gidExtensions[] = { "", ".K2", ".K3", 0, ".LOL" };
@@ -96,11 +96,18 @@
 			break;
 		}
 	}
+
+	for (const PlatformExtension *platformE = platformTable; platformE->platform != -1; ++platformE) {
+		if (platformE->platform == platform) {
+			strcat(dstFilename, ".");
+			strcat(dstFilename, platformE->ext);
+		}
+	}
 }
 
 namespace {
 
-void createLangFilename(char *dstFilename, const int gid, const int lang, const int special, const char *filename) {
+void createLangFilename(char *dstFilename, const int gid, const int lang, const int platform, const int special, const char *filename) {
 	strcpy(dstFilename, filename);
 
 	for (const Language *langE = languageTable; langE->lang != -1; ++langE) {
@@ -121,6 +128,13 @@
 			break;
 		}
 	}
+
+	for (const PlatformExtension *platformE = platformTable; platformE->platform != -1; ++platformE) {
+		if (platformE->platform == platform) {
+			strcat(dstFilename, ".");
+			strcat(dstFilename, platformE->ext);
+		}
+	}
 }
 
 } // end of anonymous namespace
@@ -172,7 +186,7 @@
 	uint32 targetsize = size + 4;
 	for (uint32 i = 0; i < size; ++i) {
 		if (!data[i]) {
-			if (g->special == kAmigaVersion) {
+			if (g->platform == kPlatformAmiga) {
 				if (i + 1 >= size)
 					++entries;
 				else if (!data[i+1] && !(i & 1))
@@ -289,7 +303,7 @@
 			}
 
 		} while (input < c);
-	} else if (g->special == kAmigaVersion) {
+	} else if (g->platform == kPlatformAmiga) {
 		// we need to strip some aligment zeros out here
 		int dstPos = 0;
 		for (uint32 i = 0; i < size; ++i) {
@@ -345,7 +359,7 @@
 
 bool extractRooms(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int id, int lang) {
 	// different entry size for the FM-TOWNS version
-	const int roomEntrySize = (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ) ? (0x69) : ((g->special == kAmigaVersion) ? 0x52 : 0x51);
+	const int roomEntrySize = (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ) ? (0x69) : ((g->platform == kPlatformAmiga) ? 0x52 : 0x51);
 	const int countRooms = size / roomEntrySize;
 
 	uint8 *buffer = new uint8[countRooms * 9 + 4];
@@ -355,7 +369,7 @@
 	WRITE_BE_UINT32(output, countRooms); output += 4;
 
 	const byte *src = data;
-	if (g->special == kAmigaVersion) {
+	if (g->platform == kPlatformAmiga) {
 		for (int i = 0; i < countRooms; ++i) {
 			*output++ = *src++; assert(*src == 0); ++src;
 			memcpy(output, src, 8); output += 0x8;

Modified: scummvm/trunk/tools/create_kyradat/games.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/games.cpp	2009-09-17 12:42:25 UTC (rev 44147)
+++ scummvm/trunk/tools/create_kyradat/games.cpp	2009-09-17 12:42:50 UTC (rev 44148)
@@ -32,7 +32,7 @@
 	{ kKyra1, EN_ANY, kPlatformPC, kDemoCDVersion, "226fdba99cb11ef1047131d9a50e6292" },
 
 	// Amiga
-	{ kKyra1, EN_ANY, kPlatformAmiga, kAmigaVersion, "b620564b6b7e0787b053ca9e35bd9f52" },
+	{ kKyra1, EN_ANY, kPlatformAmiga, -1, "b620564b6b7e0787b053ca9e35bd9f52" },
 
 	// Floppy
 	{ kKyra1, EN_ANY, kPlatformPC, -1, "76a4fc84e173cadb6369785787e1546e" },
@@ -760,7 +760,7 @@
 
 const GameNeed gameNeedTable[] = {
 	{ kKyra1, kPlatformPC, -1, kyra1FloppyNeed },
-	{ kKyra1, kPlatformAmiga, kAmigaVersion, kyra1AmigaNeed },
+	{ kKyra1, kPlatformAmiga, -1, kyra1AmigaNeed },
 
 	{ kKyra1, kPlatformPC, kTalkieVersion, kyra1CDNeed },
 
@@ -817,7 +817,7 @@
 
 const int *getNeedList(const Game *g) {
 	for (const GameNeed *need = gameNeedTable; need->game != -1; ++need) {
-		if (need->game == g->game && need->special == g->special)
+		if (need->game == g->game && g->platform == need->platform && need->special == g->special)
 			return need->entries;
 	}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list