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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun May 25 00:44:16 CEST 2008


Revision: 32259
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32259&view=rev
Author:   lordhoto
Date:     2008-05-24 15:44:15 -0700 (Sat, 24 May 2008)

Log Message:
-----------
- Cleanup
- Added support for showing kyra.dat error messages in a dialog

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

Modified: scummvm/trunk/engines/kyra/resource.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource.cpp	2008-05-24 22:41:15 UTC (rev 32258)
+++ scummvm/trunk/engines/kyra/resource.cpp	2008-05-24 22:44:15 UTC (rev 32259)
@@ -30,8 +30,6 @@
 #include "common/fs.h"
 #include "common/func.h"
 
-#include "gui/message.h"
-
 #include "kyra/resource.h"
 
 #define INS_CACHE_THRESHOLD		300000	// all files with file size greater than this will be cached
@@ -57,8 +55,7 @@
 
 	if (!loadPakFile(StaticResource::staticDataFilename()) || !StaticResource::checkKyraDat()) {
 		Common::String errorMessage = "You're missing the '" + StaticResource::staticDataFilename() + "' file or it got corrupted, (re)get it from the ScummVM website";
-		::GUI::MessageDialog errorMsg(errorMessage);
-		errorMsg.runModal();
+		_vm->GUIErrorMessage(errorMessage);
 		error(errorMessage.c_str());
 	}
 

Modified: scummvm/trunk/engines/kyra/resource.h
===================================================================
--- scummvm/trunk/engines/kyra/resource.h	2008-05-24 22:41:15 UTC (rev 32258)
+++ scummvm/trunk/engines/kyra/resource.h	2008-05-24 22:44:15 UTC (rev 32259)
@@ -285,7 +285,7 @@
 	bool prefetchId(int id);
 	void unloadId(int id);
 private:
-	void outputError();
+	void outputError(const Common::String &error);
 
 	KyraEngine_v1 *_vm;
 

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-05-24 22:41:15 UTC (rev 32258)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-05-24 22:44:15 UTC (rev 32259)
@@ -40,8 +40,6 @@
 #include "kyra/gui_hof.h"
 #include "kyra/gui_mr.h"
 
-#include "gui/message.h"
-
 namespace Kyra {
 
 #define RESFILE_VERSION 28
@@ -293,18 +291,20 @@
 		error("unknown game ID");
 	}
 
+	char errorBuffer[100];
 	int tempSize = 0;
 	uint8 *temp = getFile("INDEX", tempSize);
 	if (!temp) {
-		warning("No matching INDEX file found ('%s')", getFilename("INDEX"));
-		outputError();
+		snprintf(errorBuffer, sizeof(errorBuffer), "is missing an '%s' entry", getFilename("INDEX"));
+		outputError(errorBuffer);
 		return false;
 	}
 
 	if (tempSize != 3*4) {
 		delete[] temp;
-		warning("'%s' has illegal filesize %d", getFilename("INDEX"), tempSize);
-		outputError();
+
+		snprintf(errorBuffer, sizeof(errorBuffer), "has incorrect header size for entry '%s'", getFilename("INDEX"));
+		outputError(errorBuffer);
 		return false;
 	}
 
@@ -316,28 +316,25 @@
 	temp = 0;
 
 	if (version != RESFILE_VERSION) {
-		warning("Invalid KYRA.DAT file version (%u, required %d)", version, RESFILE_VERSION);
-		outputError();
+		snprintf(errorBuffer, sizeof(errorBuffer), "has invalid version %d required, you got %d", RESFILE_VERSION, version);
+		outputError(errorBuffer);
 		return false;
 	}
 
 	if (gameID != _vm->game()) {
-		warning("Invalid game id (%u)", gameID);
-		outputError();
+		outputError("does not include support for your game");
 		return false;
 	}
 
 	uint32 gameFeatures = createFeatures(_vm->gameFlags());
 	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();
+		outputError("does not include support for your game version");
 		return false;
 	}
 
 	// load all tables for now
 	if (!prefetchId(-1)) {
-		warning("Couldn't load all needed resources from 'KYRA.DAT'");
-		outputError();
+		outputError("is lacking entries for your game version");
 		return false;
 	}
 	return true;
@@ -347,11 +344,10 @@
 	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());
+void StaticResource::outputError(const Common::String &error) {
+	Common::String errorMessage = "Your '" + StaticResource::staticDataFilename() + "' file " + error + ", reget a correct version from the ScummVM website";
+	_vm->GUIErrorMessage(errorMessage);
+	::error(errorMessage.c_str());
 }
 
 const char * const*StaticResource::loadStrings(int id, int &strings) {


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