SCI: Set the printLang and parseLang selectors again when restarting, if necessary.
This sets the language again correctly to the language selected in the launcher when restarting multilingual games. svn-id: r55561
This commit is contained in:
parent
73a440cfe2
commit
a6e9fe69c3
2 changed files with 23 additions and 17 deletions
|
@ -262,19 +262,8 @@ Common::Error SciEngine::run() {
|
||||||
debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()));
|
debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()));
|
||||||
|
|
||||||
// Patch in our save/restore code, so that dialogs are replaced
|
// Patch in our save/restore code, so that dialogs are replaced
|
||||||
patchGameSaveRestore(segMan);
|
patchGameSaveRestore();
|
||||||
|
setLauncherLanguage();
|
||||||
if (_gameDescription->flags & ADGF_ADDENGLISH) {
|
|
||||||
// if game is multilingual
|
|
||||||
Common::Language selectedLanguage = Common::parseLanguage(ConfMan.get("language"));
|
|
||||||
if (selectedLanguage == Common::EN_ANY) {
|
|
||||||
// and english was selected as language
|
|
||||||
if (SELECTOR(printLang) != -1) // set text language to english
|
|
||||||
writeSelectorValue(segMan, _gameObjectAddress, SELECTOR(printLang), 1);
|
|
||||||
if (SELECTOR(parseLang) != -1) // and set parser language to english as well
|
|
||||||
writeSelectorValue(segMan, _gameObjectAddress, SELECTOR(parseLang), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check whether loading a savestate was requested
|
// Check whether loading a savestate was requested
|
||||||
int directSaveSlotLoading = ConfMan.getInt("save_slot");
|
int directSaveSlotLoading = ConfMan.getInt("save_slot");
|
||||||
|
@ -434,7 +423,8 @@ static byte patchGameRestoreSave[] = {
|
||||||
0x48, // ret
|
0x48, // ret
|
||||||
};
|
};
|
||||||
|
|
||||||
void SciEngine::patchGameSaveRestore(SegManager *segMan) {
|
void SciEngine::patchGameSaveRestore() {
|
||||||
|
SegManager *segMan = _gamestate->_segMan;
|
||||||
const Object *gameObject = segMan->getObject(_gameObjectAddress);
|
const Object *gameObject = segMan->getObject(_gameObjectAddress);
|
||||||
const uint16 gameMethodCount = gameObject->getMethodCount();
|
const uint16 gameMethodCount = gameObject->getMethodCount();
|
||||||
const Object *gameSuperObject = segMan->getObject(_gameSuperClassAddress);
|
const Object *gameSuperObject = segMan->getObject(_gameSuperClassAddress);
|
||||||
|
@ -680,7 +670,8 @@ void SciEngine::runGame() {
|
||||||
_gamestate->_segMan->resetSegMan();
|
_gamestate->_segMan->resetSegMan();
|
||||||
initGame();
|
initGame();
|
||||||
initStackBaseWithSelector(SELECTOR(play));
|
initStackBaseWithSelector(SELECTOR(play));
|
||||||
patchGameSaveRestore(_gamestate->_segMan);
|
patchGameSaveRestore();
|
||||||
|
setLauncherLanguage();
|
||||||
_gamestate->gameIsRestarting = GAMEISRESTARTING_RESTART;
|
_gamestate->gameIsRestarting = GAMEISRESTARTING_RESTART;
|
||||||
if (_gfxMenu)
|
if (_gfxMenu)
|
||||||
_gfxMenu->reset();
|
_gfxMenu->reset();
|
||||||
|
@ -689,7 +680,8 @@ void SciEngine::runGame() {
|
||||||
_gamestate->abortScriptProcessing = kAbortNone;
|
_gamestate->abortScriptProcessing = kAbortNone;
|
||||||
_gamestate->_executionStack.clear();
|
_gamestate->_executionStack.clear();
|
||||||
initStackBaseWithSelector(SELECTOR(replay));
|
initStackBaseWithSelector(SELECTOR(replay));
|
||||||
patchGameSaveRestore(_gamestate->_segMan);
|
patchGameSaveRestore();
|
||||||
|
setLauncherLanguage();
|
||||||
_gamestate->shrinkStackToBase();
|
_gamestate->shrinkStackToBase();
|
||||||
_gamestate->abortScriptProcessing = kAbortNone;
|
_gamestate->abortScriptProcessing = kAbortNone;
|
||||||
|
|
||||||
|
@ -798,6 +790,19 @@ int SciEngine::inQfGImportRoom() const {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SciEngine::setLauncherLanguage() {
|
||||||
|
if (_gameDescription->flags & ADGF_ADDENGLISH) {
|
||||||
|
// If game is multilingual
|
||||||
|
if (Common::parseLanguage(ConfMan.get("language")) == Common::EN_ANY) {
|
||||||
|
// and English was selected as language
|
||||||
|
if (SELECTOR(printLang) != -1) // set text language to English
|
||||||
|
writeSelectorValue(_gamestate->_segMan, _gameObjectAddress, SELECTOR(printLang), K_LANG_ENGLISH);
|
||||||
|
if (SELECTOR(parseLang) != -1) // and set parser language to English as well
|
||||||
|
writeSelectorValue(_gamestate->_segMan, _gameObjectAddress, SELECTOR(parseLang), K_LANG_ENGLISH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SciEngine::pauseEngineIntern(bool pause) {
|
void SciEngine::pauseEngineIntern(bool pause) {
|
||||||
_mixer->pauseAll(pause);
|
_mixer->pauseAll(pause);
|
||||||
if (_soundCmd)
|
if (_soundCmd)
|
||||||
|
|
|
@ -268,7 +268,7 @@ public:
|
||||||
bool checkExportBreakpoint(uint16 script, uint16 pubfunct);
|
bool checkExportBreakpoint(uint16 script, uint16 pubfunct);
|
||||||
bool checkSelectorBreakpoint(BreakpointType breakpointType, reg_t send_obj, int selector);
|
bool checkSelectorBreakpoint(BreakpointType breakpointType, reg_t send_obj, int selector);
|
||||||
|
|
||||||
void patchGameSaveRestore(SegManager *segMan);
|
void patchGameSaveRestore();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -352,6 +352,7 @@ private:
|
||||||
void initStackBaseWithSelector(Selector selector);
|
void initStackBaseWithSelector(Selector selector);
|
||||||
|
|
||||||
bool gameHasFanMadePatch();
|
bool gameHasFanMadePatch();
|
||||||
|
void setLauncherLanguage();
|
||||||
|
|
||||||
const ADGameDescription *_gameDescription;
|
const ADGameDescription *_gameDescription;
|
||||||
const SciGameId _gameId;
|
const SciGameId _gameId;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue