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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Nov 19 18:43:15 CET 2009


Revision: 45988
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45988&view=rev
Author:   lordhoto
Date:     2009-11-19 17:43:15 +0000 (Thu, 19 Nov 2009)

Log Message:
-----------
More cleanup.

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

Modified: scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2009-11-19 17:42:51 UTC (rev 45987)
+++ scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2009-11-19 17:43:15 UTC (rev 45988)
@@ -309,14 +309,14 @@
 
 // filename processing
 
-bool getFilename(char *dstFilename, const Game *g, const int id) {
+bool getFilename(char *dstFilename, const ExtractInformation *info, const int id) {
 	const ExtractFilename *i = getFilenameDesc(id);
 
 	if (!i)
 		return false;
 
 	const ExtractType *type = findExtractType(i->type);
-	type->createFilename(dstFilename, g->game, g->lang, g->platform, g->special, i->filename);
+	type->createFilename(dstFilename, info, i->filename);
 	return true;
 }
 
@@ -428,8 +428,14 @@
 
 bool updateIndex(PAKFile &out, const Game *g) {
 	char filename[32];
-	createFilename(filename, g->game, -1, g->platform, g->special, "INDEX");
+	ExtractInformation extractInfo;
+	extractInfo.game = g->game;
+	extractInfo.lang = -1;
+	extractInfo.platform = g->platform;
+	extractInfo.special = g->special;
 
+	createFilename(filename, &extractInfo, "INDEX");
+
 	byte *index = new byte[kIndexSize];
 	assert(index);
 	memset(index, 0, kIndexSize);
@@ -456,8 +462,14 @@
 
 bool checkIndex(PAKFile &out, const Game *g) {
 	char filename[32];
-	createFilename(filename, g->game, -1, g->platform, g->special, "INDEX");
+	ExtractInformation extractInfo;
+	extractInfo.game = g->game;
+	extractInfo.lang = -1;
+	extractInfo.platform = g->platform;
+	extractInfo.special = g->special;
 
+	createFilename(filename, &extractInfo, "INDEX");
+
 	uint32 size = 0;
 	const uint8 *data = out.getFileData(filename, &size);
 	if (!data)
@@ -1027,6 +1039,12 @@
 bool process(PAKFile &out, const Game *g, const byte *data, const uint32 size) {
 	char filename[128];
 
+	ExtractInformation extractInfo;
+	extractInfo.game = g->game;
+	extractInfo.lang = g->lang;
+	extractInfo.platform = g->platform;
+	extractInfo.special = g->special;
+
 	if (!checkIndex(out, g)) {
 		fprintf(stderr, "ERROR: corrupted INDEX file\n");
 		return false;
@@ -1053,7 +1071,7 @@
 
 		// Try whether the data is present in the kyra.dat file already
 		filename[0] = 0;
-		if (!getFilename(filename, g, *entry))
+		if (!getFilename(filename, &extractInfo, *entry))
 			error("couldn't find filename for id %d", *entry);
 
 		PAKFile::cFileList *list = out.getFileList();
@@ -1069,17 +1087,11 @@
 	if (breakProcess)
 		return false;
 
-	ExtractInformation extractInfo;
-	extractInfo.game = g->game;
-	extractInfo.lang = g->lang;
-	extractInfo.platform = g->platform;
-	extractInfo.special = g->special;
-
 	for (IdMap::const_iterator i = ids.begin(); i != ids.end(); ++i) {
 		const int id = i->first;
 	
 		filename[0] = 0;
-		if (!getFilename(filename, g, id)) {
+		if (!getFilename(filename, &extractInfo, id)) {
 			fprintf(stderr, "ERROR: couldn't get filename for id %d\n", id);
 			return false;
 		}

Modified: scummvm/trunk/tools/create_kyradat/extract.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/extract.cpp	2009-11-19 17:42:51 UTC (rev 45987)
+++ scummvm/trunk/tools/create_kyradat/extract.cpp	2009-11-19 17:43:15 UTC (rev 45988)
@@ -87,7 +87,7 @@
 	strcpy(dstFilename, filename);
 
 	static const char *gidExtensions[] = { "", ".K2", ".K3", 0, ".LOL" };
-	strcat(dstFilename, gidExtensions[info->gid]);
+	strcat(dstFilename, gidExtensions[info->game]);
 
 	for (const SpecialExtension *specialE = specialTable; specialE->special != -1; ++specialE) {
 		if (specialE->special == info->special) {
@@ -119,7 +119,7 @@
 	}
 
 	static const char *gidExtensions[] = { "", ".K2", ".K3", 0, ".LOL" };
-	strcat(dstFilename, gidExtensions[gid]);
+	strcat(dstFilename, gidExtensions[info->game]);
 
 	for (const SpecialExtension *specialE = specialTable; specialE->special != -1; ++specialE) {
 		if (specialE->special == info->special) {

Modified: scummvm/trunk/tools/create_kyradat/extract.h
===================================================================
--- scummvm/trunk/tools/create_kyradat/extract.h	2009-11-19 17:42:51 UTC (rev 45987)
+++ scummvm/trunk/tools/create_kyradat/extract.h	2009-11-19 17:43:15 UTC (rev 45988)
@@ -68,7 +68,7 @@
 const ExtractType *findExtractType(const int type);
 
 // TODO: Do not export this in the future
-void createFilename(char *dstFilename, const int gid, const int lang, const int platform, const int special, const char *filename);
+void createFilename(char *dstFilename, const ExtractInformation *info, const char *filename);
 
 #endif
 


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