Skip to content

Commit

Permalink
SCI: Fix FM-Towns audio language selection
Browse files Browse the repository at this point in the history
This first of all combines both detection entries and makes it
possible so that the user can directly choose English or Japanese
without having to add the game twice.
But it also fixes the in-game option to switch between English
and Japanese. Prior to this commit it was only possible to for
example switch from Japanese to English once, but it was not
possible to switch back without quitting the game and starting it
again.
  • Loading branch information
Martin Kiewitz committed Feb 23, 2016
1 parent ec9d937 commit bc0b82a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
15 changes: 2 additions & 13 deletions engines/sci/detection_tables.h
Expand Up @@ -1531,13 +1531,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "71afd220d46bde1109c58e6acc0f3a01", 469094},
{"resource.001", 0, "72a569f46f1abf2d9d2b1526ad3799c3", 12808839},
AD_LISTEND},
Common::EN_ANY, Common::kPlatformFMTowns, 0, GUIO2(GUIO_NOASPECT, GUIO_MIDITOWNS) },
{"kq5", "", {
{"resource.map", 0, "20c7cd248ff1a349ed354568eebd972b", 12733},
{"resource.000", 0, "71afd220d46bde1109c58e6acc0f3a01", 469094},
{"resource.001", 0, "72a569f46f1abf2d9d2b1526ad3799c3", 12808839},
AD_LISTEND},
Common::JA_JPN, Common::kPlatformFMTowns, 0, GUIO2(GUIO_NOASPECT, GUIO_MIDITOWNS) },
Common::JA_JPN, Common::kPlatformFMTowns, ADGF_ADDENGLISH, GUIO3(GUIO_NOASPECT, GAMEOPTION_ORIGINAL_SAVELOAD, GUIO_MIDITOWNS) },

// King's Quest 5 - Japanese PC-98 Floppy 0.000.015 (supplied by omer_mor in bug report #3073583)
{"kq5", "", {
Expand Down Expand Up @@ -2601,12 +2595,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "b11e971ccd2040bebba59dfb409a08ef", 5772},
{"resource.001", 0, "d49625d9b8005ec01c852f8322a82867", 4330713},
AD_LISTEND},
Common::EN_ANY, Common::kPlatformFMTowns, 0, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
{"mothergoose256", "", {
{"resource.map", 0, "b11e971ccd2040bebba59dfb409a08ef", 5772},
{"resource.001", 0, "d49625d9b8005ec01c852f8322a82867", 4330713},
AD_LISTEND},
Common::JA_JPN, Common::kPlatformFMTowns, 0, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },
Common::JA_JPN, Common::kPlatformFMTowns, ADGF_ADDENGLISH, GUIO4(GUIO_NOASPECT, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_FB01_MIDI) },

#ifdef ENABLE_SCI32
// Mixed-Up Mother Goose Deluxe - English Windows/DOS CD (supplied by markcoolio in bug report #2723810)
Expand Down
11 changes: 9 additions & 2 deletions engines/sci/engine/ksound.cpp
Expand Up @@ -206,8 +206,15 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) {
// athrxx: It seems from disasm that the original KQ5 FM-Towns loads a default language (Japanese) audio map at the beginning
// right after loading the video and audio drivers. The -1 language argument in here simply means that the original will stick
// with Japanese. Instead of doing that we switch to the language selected in the launcher.
if (g_sci->getPlatform() == Common::kPlatformFMTowns && language == -1)
language = (g_sci->getLanguage() == Common::JA_JPN) ? K_LANG_JAPANESE : K_LANG_ENGLISH;
if (g_sci->getPlatform() == Common::kPlatformFMTowns && language == -1) {
// FM-Towns calls us to get the current language / also set the default language
// This doesn't just happen right at the start, but also when the user clicks on the Sierra logo in the game menu
// It uses the result of this call to either show "English Voices" or "Japanese Voices".

// Language should have been set by setLauncherLanguage() already (or could have been modified by the scripts).
// Get this language setting, so that the chosen language will get set for resource manager.
language = g_sci->getSciLanguage();
}

debugC(kDebugLevelSound, "kDoAudio: set language to %d", language);

Expand Down
28 changes: 23 additions & 5 deletions engines/sci/sci.cpp
Expand Up @@ -897,12 +897,30 @@ int SciEngine::inQfGImportRoom() const {
void SciEngine::setLauncherLanguage() {
if (_gameDescription->flags & ADGF_ADDENGLISH) {
// If game is multilingual
if (Common::parseLanguage(ConfMan.get("language")) == Common::EN_ANY) {
Common::Language chosenLanguage = Common::parseLanguage(ConfMan.get("language"));
uint16 languageToSet = 0;

switch (chosenLanguage) {
case 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);
languageToSet = K_LANG_ENGLISH;
break;
case Common::JA_JPN: {
// Set Japanese for FM-Towns games
// KQ5 on FM-Towns has no initial language set
if (g_sci->getPlatform() == Common::kPlatformFMTowns) {
languageToSet = K_LANG_JAPANESE;
}
}
default:
break;
}

if (languageToSet) {
if (SELECTOR(printLang) != -1) // set text language
writeSelectorValue(_gamestate->_segMan, _gameObjectAddress, SELECTOR(printLang), languageToSet);
if (SELECTOR(parseLang) != -1) // and set parser language as well
writeSelectorValue(_gamestate->_segMan, _gameObjectAddress, SELECTOR(parseLang), languageToSet);
}
}
}
Expand Down

0 comments on commit bc0b82a

Please sign in to comment.