diff options
author | Johannes Schickel | 2008-04-24 15:49:41 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-04-24 15:49:41 +0000 |
commit | 103e944fa4c6191f6cce8a9c498f3af7d2a7e139 (patch) | |
tree | e16826c7f305086eeede6fd0fa904c78b3fa6b06 /engines/kyra | |
parent | b50948b60cf4bd38f3b27a8ec483b4089e9f08c4 (diff) | |
download | scummvm-rg350-103e944fa4c6191f6cce8a9c498f3af7d2a7e139.tar.gz scummvm-rg350-103e944fa4c6191f6cce8a9c498f3af7d2a7e139.tar.bz2 scummvm-rg350-103e944fa4c6191f6cce8a9c498f3af7d2a7e139.zip |
Output error message when kyra.dat initialization fails because of old version or missing entries.
svn-id: r31695
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/resource.h | 2 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 42 |
2 files changed, 35 insertions, 9 deletions
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index b60e39a017..7a6bdbd73e 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -263,6 +263,8 @@ public: bool prefetchId(int id); void unloadId(int id); private: + void outputError(); + KyraEngine *_vm; struct FilenameTable; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 7b66253317..abafeceeb4 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -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 @@ bool StaticResource::init() { 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 @@ bool StaticResource::init() { 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 @@ 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()); +} + const char * const*StaticResource::loadStrings(int id, int &strings) { const char * const*temp = (const char* const*)getData(id, kStringList, strings); if (temp) |