[Scummvm-cvs-logs] SF.net SVN: scummvm: [31695] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Apr 24 17:49:41 CEST 2008


Revision: 31695
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31695&view=rev
Author:   lordhoto
Date:     2008-04-24 08:49:41 -0700 (Thu, 24 Apr 2008)

Log Message:
-----------
Output error message when kyra.dat initialization fails because of old version or missing entries.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/resource.h
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/resource.h
===================================================================
--- scummvm/trunk/engines/kyra/resource.h	2008-04-24 15:04:12 UTC (rev 31694)
+++ scummvm/trunk/engines/kyra/resource.h	2008-04-24 15:49:41 UTC (rev 31695)
@@ -263,6 +263,8 @@
 	bool prefetchId(int id);
 	void unloadId(int id);
 private:
+	void outputError();
+
 	KyraEngine *_vm;
 
 	struct FilenameTable;

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-04-24 15:04:12 UTC (rev 31694)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-04-24 15:49:41 UTC (rev 31695)
@@ -37,6 +37,8 @@
 #include "kyra/resource.h"
 #include "kyra/gui_v1.h"
 
+#include "gui/message.h"
+
 namespace Kyra {
 
 #define RESFILE_VERSION 24
@@ -277,13 +279,15 @@
 	int tempSize = 0;
 	uint8 *temp = getFile("INDEX", tempSize);
 	if (!temp) {
-		warning("no matching INDEX file found ('%s')", getFilename("INDEX"));
+		warning("No matching INDEX file found ('%s')", getFilename("INDEX"));
+		outputError();
 		return false;
 	}
 
 	if (tempSize != 3*4) {
 		delete [] temp;
 		warning("'%s' has illegal filesize %d", getFilename("INDEX"), tempSize);
+		outputError();
 		return false;
 	}
 
@@ -294,18 +298,31 @@
 	delete [] temp;
 	temp = 0;
 
-	if (version != RESFILE_VERSION)
-		error("invalid KYRA.DAT file version (%u, required %d)", version, RESFILE_VERSION);
-	if (gameID != _vm->game())
-		error("invalid game id (%u)", gameID);
+	if (version != RESFILE_VERSION) {
+		warning("Invalid KYRA.DAT file version (%u, required %d)", version, RESFILE_VERSION);
+		outputError();
+		return false;
+	}
 
+	if (gameID != _vm->game()) {
+		warning("Invalid game id (%u)", gameID);
+		outputError();
+		return false;
+	}
+
 	uint32 gameFeatures = createFeatures(_vm->gameFlags());
-	if ((featuresValue & GAME_FLAGS) != gameFeatures)
-		error("your data file has a different game flags (0x%.08X has the data and your version has 0x%.08X)", (featuresValue & GAME_FLAGS), gameFeatures);
+	if ((featuresValue & GAME_FLAGS) != gameFeatures) {
+		warning("Your data file has a different game flags (0x%.08X has the data and your version has 0x%.08X)", (featuresValue & GAME_FLAGS), gameFeatures);
+		outputError();
+		return false;
+	}
 
 	// load all tables for now
-	if (!prefetchId(-1))
-		error("couldn't load all needed resources from 'KYRA.DAT'");
+	if (!prefetchId(-1)) {
+		warning("Couldn't load all needed resources from 'KYRA.DAT'");
+		outputError();
+		return false;
+	}
 	return true;
 }
 
@@ -313,6 +330,13 @@
 	unloadId(-1);
 }
 
+void StaticResource::outputError() {
+	Common::String errorMessage = "Your '" + StaticResource::staticDataFilename() + "' file is outdated, reget it from the ScummVM website";
+	::GUI::MessageDialog errorMsg(errorMessage);
+	errorMsg.runModal();
+	error(errorMessage.c_str());
+}
+
 const char * const*StaticResource::loadStrings(int id, int &strings) {
 	const char * const*temp = (const char* const*)getData(id, kStringList, strings);
 	if (temp)


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