GRIM: Add support for blacklisting with patchr

This commit is contained in:
Andrea Corna 2012-03-03 12:23:45 +01:00
parent 32b513b659
commit b653a63d6f
3 changed files with 31 additions and 1 deletions

View File

@ -282,6 +282,25 @@ Common::Error GrimEngine::run() {
lua->registerOpcodes();
lua->registerLua();
lua->loadSystemScript();
if (!lua->supportedVersion()) {
const char *errorMessage;
if (g_grim->getGameType() == GType_GRIM)
errorMessage = "Unsupported version of Grim Fandango.\n"
"Please download the original patch from\n"
"http://www.residualvm.org/downloads/\n"
"and put it the game data files directory.";
else if (g_grim->getGameType() == GType_MONKEY4)
errorMessage = "Unsupported version of Escape from Monkey Island.\n"
"Please download the original patch from\n"
"http://www.residualvm.org/downloads/\n"
"and put it the game data files directory.\n"
"Pay attention to download the correct version according to the game's language.";
GUI::displayErrorDialog(errorMessage);
return Common::kNoError;
}
lua->boot();
_savegameLoadRequest = false;

View File

@ -245,9 +245,18 @@ void LuaBase::registerOpcodes() {
luaL_openlib(baseOpcodes, ARRAYSIZE(baseOpcodes));
}
void LuaBase::boot() {
void LuaBase::loadSystemScript() {
dofile("_system.lua");
}
bool LuaBase::supportedVersion() {
if (lua_isnil(lua_getglobal("game_needs_update")))
return true;
else
return false;
}
void LuaBase::boot() {
lua_pushnil(); // resumeSave
lua_pushnil(); // bootParam - not used in scripts
lua_call("BOOT");

View File

@ -120,6 +120,8 @@ public:
void setMovieTime(float movieTime);
virtual void registerLua();
virtual void registerOpcodes();
virtual void loadSystemScript();
virtual bool supportedVersion();
virtual void boot();
virtual void postRestoreHandle() { }