diff options
author | Johannes Schickel | 2008-05-24 22:44:15 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-05-24 22:44:15 +0000 |
commit | 6866a4e133f2ae505bc142bc4b35e79d48f5191a (patch) | |
tree | 126d1f0f151d3d87d14d5165495dff04499d918c | |
parent | 68fd8b74b0a42279056a4143455bb8b40dc83ca9 (diff) | |
download | scummvm-rg350-6866a4e133f2ae505bc142bc4b35e79d48f5191a.tar.gz scummvm-rg350-6866a4e133f2ae505bc142bc4b35e79d48f5191a.tar.bz2 scummvm-rg350-6866a4e133f2ae505bc142bc4b35e79d48f5191a.zip |
- Cleanup
- Added support for showing kyra.dat error messages in a dialog
svn-id: r32259
-rw-r--r-- | engines/kyra/resource.cpp | 5 | ||||
-rw-r--r-- | engines/kyra/resource.h | 2 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 34 |
3 files changed, 17 insertions, 24 deletions
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 197f363b1e..6fa256ce40 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -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 @@ bool Resource::reset() { 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()); } diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index 43a41940a3..90405690a4 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -285,7 +285,7 @@ public: bool prefetchId(int id); void unloadId(int id); private: - void outputError(); + void outputError(const Common::String &error); KyraEngine_v1 *_vm; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index b28fa45262..302b92ab07 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -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 @@ bool StaticResource::init() { 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 @@ bool StaticResource::init() { 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 @@ void StaticResource::deinit() { 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) { |