mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-01 06:58:34 +00:00
WINTERMUTE: Add hack to allow language-selection in James Peris demo.
This commit is contained in:
parent
f691e005f8
commit
1396052dc9
@ -1276,11 +1276,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
|
||||
stack->correctParams(2);
|
||||
const char *key = stack->pop()->getString();
|
||||
const char *initVal = stack->pop()->getString();
|
||||
Common::String privKey = "wme_" + StringUtil::encodeSetting(key);
|
||||
Common::String result = initVal;
|
||||
if (ConfMan.hasKey(privKey)) {
|
||||
result = StringUtil::decodeSetting(ConfMan.get(key));
|
||||
}
|
||||
Common::String result = readRegistryString(key, initVal);
|
||||
stack->pushString(result.c_str());
|
||||
return STATUS_OK;
|
||||
}
|
||||
@ -3902,4 +3898,26 @@ char *BaseGame::getKeyFromStringTable(const char *str) const {
|
||||
return _settings->getKeyFromStringTable(str);
|
||||
}
|
||||
|
||||
Common::String BaseGame::readRegistryString(const Common::String &key, const Common::String &initValue) const {
|
||||
// Game specific hacks:
|
||||
Common::String result = initValue;
|
||||
// James Peris:
|
||||
if (BaseEngine::instance().getGameId() == "jamesperis" && key == "Language") {
|
||||
Common::Language language = BaseEngine::instance().getLanguage();
|
||||
if (language == Common::EN_ANY) {
|
||||
result = "english";
|
||||
} else if (language == Common::ES_ESP) {
|
||||
result = "spanish";
|
||||
} else {
|
||||
error("Invalid language set for James Peris");
|
||||
}
|
||||
} else { // Just fallback to using ConfMan for now
|
||||
Common::String privKey = "wme_" + StringUtil::encodeSetting(key);
|
||||
if (ConfMan.hasKey(privKey)) {
|
||||
result = StringUtil::decodeSetting(ConfMan.get(key));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // end of namespace Wintermute
|
||||
|
@ -343,6 +343,8 @@ private:
|
||||
bool isDoubleClick(int32 buttonIndex);
|
||||
uint32 _usedMem;
|
||||
|
||||
// TODO: This should be expanded into a proper class eventually:
|
||||
Common::String readRegistryString(const Common::String &key, const Common::String &initValue) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user