Skip to content
Permalink
Browse files

Replace "Override Language on NTSC Games" with "Allow Mismatched Regi…

…on Settings"

This new setting is like Override Language on NTSC Games, except
instead of only applying to the GameCube language setting,
it also applies to the Wii language setting.

Fixes https://bugs.dolphin-emu.org/issues/11299
  • Loading branch information...
JosJuice committed Jun 30, 2019
1 parent b88e561 commit 561a4cfcce363fae6cfbd958200a49d241fe0d26
@@ -218,6 +218,7 @@ private void addGeneralSettings(ArrayList<SettingsItem> sl)
Setting overclock = null;
Setting speedLimit = null;
Setting audioStretch = null;
Setting overrideRegionSettings = null;
Setting autoDiscChange = null;
Setting analytics = null;
Setting enableSaveState;
@@ -231,6 +232,7 @@ private void addGeneralSettings(ArrayList<SettingsItem> sl)
overclock = coreSection.getSetting(SettingsFile.KEY_OVERCLOCK_PERCENT);
speedLimit = coreSection.getSetting(SettingsFile.KEY_SPEED_LIMIT);
audioStretch = coreSection.getSetting(SettingsFile.KEY_AUDIO_STRETCH);
overrideRegionSettings = coreSection.getSetting(SettingsFile.KEY_OVERRIDE_REGION_SETTINGS);
autoDiscChange = coreSection.getSetting(SettingsFile.KEY_AUTO_DISC_CHANGE);
analytics = analyticsSection.getSetting(SettingsFile.KEY_ANALYTICS_ENABLED);
enableSaveState = coreSection.getSetting(SettingsFile.KEY_ENABLE_SAVE_STATES);
@@ -271,6 +273,9 @@ else if (defaultCpuCore == 4) // AArch64
R.string.speed_limit, 0, 200, "%", 100, speedLimit));
sl.add(new CheckBoxSetting(SettingsFile.KEY_AUDIO_STRETCH, Settings.SECTION_INI_CORE,
R.string.audio_stretch, R.string.audio_stretch_description, false, audioStretch));
sl.add(new CheckBoxSetting(SettingsFile.KEY_OVERRIDE_REGION_SETTINGS,
Settings.SECTION_INI_CORE, R.string.override_region_settings, 0, false,
overrideRegionSettings));
sl.add(new CheckBoxSetting(SettingsFile.KEY_AUTO_DISC_CHANGE, Settings.SECTION_INI_CORE,
R.string.auto_disc_change, 0, false, autoDiscChange));
sl.add(new CheckBoxSetting(SettingsFile.KEY_ENABLE_SAVE_STATES, Settings.SECTION_INI_CORE,
@@ -306,22 +311,17 @@ private void addInterfaceSettings(ArrayList<SettingsItem> sl)
private void addGameCubeSettings(ArrayList<SettingsItem> sl)
{
Setting systemLanguage = null;
Setting overrideGCLanguage = null;
Setting slotADevice = null;
Setting slotBDevice = null;

SettingSection coreSection = mSettings.getSection(Settings.SECTION_INI_CORE);
systemLanguage = coreSection.getSetting(SettingsFile.KEY_GAME_CUBE_LANGUAGE);
overrideGCLanguage = coreSection.getSetting(SettingsFile.KEY_OVERRIDE_GAME_CUBE_LANGUAGE);
slotADevice = coreSection.getSetting(SettingsFile.KEY_SLOT_A_DEVICE);
slotBDevice = coreSection.getSetting(SettingsFile.KEY_SLOT_B_DEVICE);

sl.add(new SingleChoiceSetting(SettingsFile.KEY_GAME_CUBE_LANGUAGE, Settings.SECTION_INI_CORE,
R.string.gamecube_system_language, 0, R.array.gameCubeSystemLanguageEntries,
R.array.gameCubeSystemLanguageValues, 0, systemLanguage));
sl.add(new CheckBoxSetting(SettingsFile.KEY_OVERRIDE_GAME_CUBE_LANGUAGE,
Settings.SECTION_INI_CORE, R.string.override_gamecube_language, 0, false,
overrideGCLanguage));
sl.add(new SingleChoiceSetting(SettingsFile.KEY_SLOT_A_DEVICE, Settings.SECTION_INI_CORE,
R.string.slot_a_device, 0, R.array.slotDeviceEntries, R.array.slotDeviceValues, 8,
slotADevice));
@@ -48,7 +48,7 @@
public static final String KEY_AUDIO_STRETCH = "AudioStretch";
public static final String KEY_AUTO_DISC_CHANGE = "AutoDiscChange";
public static final String KEY_GAME_CUBE_LANGUAGE = "SelectedLanguage";
public static final String KEY_OVERRIDE_GAME_CUBE_LANGUAGE = "OverrideGCLang";
public static final String KEY_OVERRIDE_REGION_SETTINGS = "OverrideRegionSettings";
public static final String KEY_SLOT_A_DEVICE = "SlotA";
public static final String KEY_SLOT_B_DEVICE = "SlotB";
public static final String KEY_ENABLE_SAVE_STATES = "EnableSaveStates";
@@ -126,7 +126,6 @@
<string name="overclock_warning">WARNING: Changing this from the default (100%) WILL break games and cause glitches. Please do not report bugs that occur with a non-default clock.</string>
<string name="gamecube_submenu">GameCube</string>
<string name="gamecube_system_language">System Language</string>
<string name="override_gamecube_language">Override Language on NTSC games</string>
<string name="slot_a_device">GameCube Slot A Device</string>
<string name="slot_b_device">GameCube Slot B Device</string>
<string name="wii_submenu">Wii</string>
@@ -136,6 +135,7 @@
<string name="wiimote_speaker_description">Enable sound output through the speaker on a real Wiimote (DolphinBar required).</string>
<string name="audio_stretch">Audio Stretching</string>
<string name="audio_stretch_description">Stretches audio to reduce stuttering. Increases latency.</string>
<string name="override_region_settings">Allow Mismatched Region Settings</string>
<string name="auto_disc_change">Change Discs Automatically</string>
<string name="enable_save_states">Enable Savestates</string>
<string name="enable_save_states_description">WARNING: Savestates may not be compatible with future versions of Dolphin and can make it impossible to create normal saves in some cases. Never use savestates as the only way of saving your progress.</string>
@@ -356,7 +356,7 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
StartUp.bCopyWiiSaveNetplay = netplay_settings.m_CopyWiiSave;
StartUp.cpu_core = netplay_settings.m_CPUcore;
StartUp.SelectedLanguage = netplay_settings.m_SelectedLanguage;
StartUp.bOverrideGCLanguage = netplay_settings.m_OverrideGCLanguage;
StartUp.bOverrideRegionSettings = netplay_settings.m_OverrideRegionSettings;
StartUp.m_DSPEnableJIT = netplay_settings.m_DSPEnableJIT;
StartUp.m_OCEnable = netplay_settings.m_OCEnable;
StartUp.m_OCFactor = netplay_settings.m_OCFactor;
@@ -387,19 +387,24 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
g_SRAM_netplay_initialized = false;
}

const bool ntsc = DiscIO::IsNTSC(StartUp.m_region);

// Apply overrides
// Some NTSC GameCube games such as Baten Kaitos react strangely to
// language settings that would be invalid on an NTSC system
if (!StartUp.bOverrideGCLanguage && ntsc)
// Override out-of-region languages to prevent games from crashing or behaving oddly
if (!StartUp.bOverrideRegionSettings)
{
StartUp.SelectedLanguage = 0;
const int gc_language =
static_cast<int>(StartUp.GetLanguageAdjustedForRegion(false, StartUp.m_region));
StartUp.SelectedLanguage = gc_language - (gc_language > 0);

if (StartUp.bWii)
{
const u32 wii_language =
static_cast<u32>(StartUp.GetLanguageAdjustedForRegion(true, StartUp.m_region));
Config::SetCurrent(Config::SYSCONF_LANGUAGE, wii_language);
}
}

// Some NTSC Wii games such as Doc Louis's Punch-Out!! and
// 1942 (Virtual Console) crash if the PAL60 option is enabled
if (StartUp.bWii && ntsc)
if (StartUp.bWii && DiscIO::IsNTSC(StartUp.m_region))
Config::SetCurrent(Config::SYSCONF_PAL60, false);

// Ensure any new settings are written to the SYSCONF
@@ -28,7 +28,8 @@ const ConfigInfo<bool> MAIN_SYNC_ON_SKIP_IDLE{{System::Main, "Core", "SyncOnSkip
const ConfigInfo<std::string> MAIN_DEFAULT_ISO{{System::Main, "Core", "DefaultISO"}, ""};
const ConfigInfo<bool> MAIN_ENABLE_CHEATS{{System::Main, "Core", "EnableCheats"}, false};
const ConfigInfo<int> MAIN_GC_LANGUAGE{{System::Main, "Core", "SelectedLanguage"}, 0};
const ConfigInfo<bool> MAIN_OVERRIDE_GC_LANGUAGE{{System::Main, "Core", "OverrideGCLang"}, false};
const ConfigInfo<bool> MAIN_OVERRIDE_REGION_SETTINGS{
{System::Main, "Core", "OverrideRegionSettings"}, false};
const ConfigInfo<bool> MAIN_DPL2_DECODER{{System::Main, "Core", "DPL2Decoder"}, false};
const ConfigInfo<int> MAIN_AUDIO_LATENCY{{System::Main, "Core", "AudioLatency"}, 20};
const ConfigInfo<bool> MAIN_AUDIO_STRETCH{{System::Main, "Core", "AudioStretch"}, false};
@@ -30,7 +30,7 @@ extern const ConfigInfo<bool> MAIN_SYNC_ON_SKIP_IDLE;
extern const ConfigInfo<std::string> MAIN_DEFAULT_ISO;
extern const ConfigInfo<bool> MAIN_ENABLE_CHEATS;
extern const ConfigInfo<int> MAIN_GC_LANGUAGE;
extern const ConfigInfo<bool> MAIN_OVERRIDE_GC_LANGUAGE;
extern const ConfigInfo<bool> MAIN_OVERRIDE_REGION_SETTINGS;
extern const ConfigInfo<bool> MAIN_DPL2_DECODER;
extern const ConfigInfo<int> MAIN_AUDIO_LATENCY;
extern const ConfigInfo<bool> MAIN_AUDIO_STRETCH;
@@ -29,7 +29,7 @@ class NetPlayConfigLayerLoader final : public Config::ConfigLayerLoader
layer->Set(Config::MAIN_CPU_THREAD, m_settings.m_CPUthread);
layer->Set(Config::MAIN_CPU_CORE, m_settings.m_CPUcore);
layer->Set(Config::MAIN_GC_LANGUAGE, m_settings.m_SelectedLanguage);
layer->Set(Config::MAIN_OVERRIDE_GC_LANGUAGE, m_settings.m_OverrideGCLanguage);
layer->Set(Config::MAIN_OVERRIDE_REGION_SETTINGS, m_settings.m_OverrideRegionSettings);
layer->Set(Config::MAIN_DSP_HLE, m_settings.m_DSPHLE);
layer->Set(Config::MAIN_OVERCLOCK_ENABLE, m_settings.m_OCEnable);
layer->Set(Config::MAIN_OVERCLOCK, m_settings.m_OCFactor);
@@ -211,7 +211,7 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("AccurateNaNs", bAccurateNaNs);
core->Set("EnableCheats", bEnableCheats);
core->Set("SelectedLanguage", SelectedLanguage);
core->Set("OverrideGCLang", bOverrideGCLanguage);
core->Set("OverrideRegionSettings", bOverrideRegionSettings);
core->Set("DPL2Decoder", bDPL2Decoder);
core->Set("AudioLatency", iLatency);
core->Set("AudioStretch", m_audio_stretch);
@@ -486,7 +486,7 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("SyncOnSkipIdle", &bSyncGPUOnSkipIdleHack, true);
core->Get("EnableCheats", &bEnableCheats, false);
core->Get("SelectedLanguage", &SelectedLanguage, 0);
core->Get("OverrideGCLang", &bOverrideGCLanguage, false);
core->Get("OverrideRegionSettings", &bOverrideRegionSettings, false);
core->Get("DPL2Decoder", &bDPL2Decoder, false);
core->Get("AudioLatency", &iLatency, 20);
core->Get("AudioStretch", &m_audio_stretch, false);
@@ -650,7 +650,7 @@ void SConfig::LoadJitDebugSettings(IniFile& ini)

void SConfig::ResetRunningGameMetadata()
{
SetRunningGameMetadata("00000000", "", 0, 0, DiscIO::Country::Unknown);
SetRunningGameMetadata("00000000", "", 0, 0, DiscIO::Region::Unknown);
}

void SConfig::SetRunningGameMetadata(const DiscIO::Volume& volume,
@@ -660,13 +660,13 @@ void SConfig::SetRunningGameMetadata(const DiscIO::Volume& volume,
{
SetRunningGameMetadata(volume.GetGameID(), volume.GetGameTDBID(),
volume.GetTitleID().value_or(0), volume.GetRevision().value_or(0),
volume.GetCountry());
volume.GetRegion());
}
else
{
SetRunningGameMetadata(volume.GetGameID(partition), volume.GetGameTDBID(),
volume.GetTitleID(partition).value_or(0),
volume.GetRevision(partition).value_or(0), volume.GetCountry());
volume.GetRevision(partition).value_or(0), volume.GetRegion());
}
}

@@ -682,15 +682,13 @@ void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd, DiscIO::Plat
!DVDInterface::UpdateRunningGameMetadata(tmd_title_id))
{
// If not launching a disc game, just read everything from the TMD.
const DiscIO::Country country = DiscIO::CountryCodeToCountry(
static_cast<u8>(tmd_title_id), platform, tmd.GetRegion(), tmd.GetTitleVersion());
SetRunningGameMetadata(tmd.GetGameID(), tmd.GetGameTDBID(), tmd_title_id, tmd.GetTitleVersion(),
country);
tmd.GetRegion());
}
}

void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::string& gametdb_id,
u64 title_id, u16 revision, DiscIO::Country country)
u64 title_id, u16 revision, DiscIO::Region region)
{
const bool was_changed = m_game_id != game_id || m_gametdb_id != gametdb_id ||
m_title_id != title_id || m_revision != revision;
@@ -723,9 +721,7 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
}

const Core::TitleDatabase title_database;
const DiscIO::Language language = !bWii && country == DiscIO::Country::Japan ?
DiscIO::Language::Japanese :
GetCurrentLanguage(bWii);
const DiscIO::Language language = GetLanguageAdjustedForRegion(bWii, region);
m_title_description = title_database.Describe(m_gametdb_id, language);
NOTICE_LOG(CORE, "Active title: %s", m_title_description.c_str());
Host_TitleChanged();
@@ -782,7 +778,7 @@ void SConfig::LoadDefaults()
bFastDiscSpeed = false;
bEnableMemcardSdWriting = true;
SelectedLanguage = 0;
bOverrideGCLanguage = false;
bOverrideRegionSettings = false;
bWii = false;
bDPL2Decoder = false;
iLatency = 20;
@@ -995,6 +991,40 @@ DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
return language;
}

DiscIO::Language SConfig::GetLanguageAdjustedForRegion(bool wii, DiscIO::Region region) const
{
const DiscIO::Language language = GetCurrentLanguage(wii);

if (!wii && region == DiscIO::Region::NTSC_K)
region = DiscIO::Region::NTSC_J; // NTSC-K only exists on Wii, so use a fallback

if (!wii && region == DiscIO::Region::NTSC_J && language == DiscIO::Language::English)
return DiscIO::Language::Japanese; // English and Japanese both use the value 0 in GC SRAM

if (!bOverrideRegionSettings)
{
if (region == DiscIO::Region::NTSC_J)
return DiscIO::Language::Japanese;

if (region == DiscIO::Region::NTSC_U && language != DiscIO::Language::English &&
(!wii || (language != DiscIO::Language::French && language != DiscIO::Language::Spanish)))
{
return DiscIO::Language::English;
}

if (region == DiscIO::Region::PAL &&
(language < DiscIO::Language::English || language > DiscIO::Language::Dutch))
{
return DiscIO::Language::English;
}

if (region == DiscIO::Region::NTSC_K)
return DiscIO::Language::Korean;
}

return language;
}

IniFile SConfig::LoadDefaultGameIni() const
{
return LoadDefaultGameIni(GetGameID(), m_revision);
@@ -18,7 +18,6 @@ class IniFile;

namespace DiscIO
{
enum class Country;
enum class Language;
enum class Platform;
enum class Region;
@@ -141,7 +140,7 @@ struct SConfig
float fSyncGpuOverclock;

int SelectedLanguage = 0;
bool bOverrideGCLanguage = false;
bool bOverrideRegionSettings = false;

bool bWii = false;
bool m_is_mios = false;
@@ -212,6 +211,7 @@ struct SConfig
bool SetPathsAndGameMetadata(const BootParameters& boot);
static DiscIO::Region GetFallbackRegion();
DiscIO::Language GetCurrentLanguage(bool wii) const;
DiscIO::Language GetLanguageAdjustedForRegion(bool wii, DiscIO::Region region) const;

IniFile LoadDefaultGameIni() const;
IniFile LoadLocalGameIni() const;
@@ -365,7 +365,7 @@ struct SConfig
void LoadJitDebugSettings(IniFile& ini);

void SetRunningGameMetadata(const std::string& game_id, const std::string& gametdb_id,
u64 title_id, u16 revision, DiscIO::Country country);
u64 title_id, u16 revision, DiscIO::Region region);

static SConfig* m_Instance;

@@ -624,7 +624,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)

packet >> m_net_settings.m_EnableCheats;
packet >> m_net_settings.m_SelectedLanguage;
packet >> m_net_settings.m_OverrideGCLanguage;
packet >> m_net_settings.m_OverrideRegionSettings;
packet >> m_net_settings.m_ProgressiveScan;
packet >> m_net_settings.m_PAL60;
packet >> m_net_settings.m_DSPEnableJIT;
@@ -26,7 +26,7 @@ struct NetSettings
PowerPC::CPUCore m_CPUcore;
bool m_EnableCheats;
int m_SelectedLanguage;
bool m_OverrideGCLanguage;
bool m_OverrideRegionSettings;
bool m_ProgressiveScan;
bool m_PAL60;
bool m_DSPHLE;
@@ -1279,7 +1279,7 @@ bool NetPlayServer::StartGame()
spac << static_cast<std::underlying_type_t<PowerPC::CPUCore>>(m_settings.m_CPUcore);
spac << m_settings.m_EnableCheats;
spac << m_settings.m_SelectedLanguage;
spac << m_settings.m_OverrideGCLanguage;
spac << m_settings.m_OverrideRegionSettings;
spac << m_settings.m_ProgressiveScan;
spac << m_settings.m_PAL60;
spac << m_settings.m_DSPEnableJIT;
@@ -443,7 +443,7 @@ void NetPlayDialog::OnStart()
settings.m_CPUcore = Config::Get(Config::MAIN_CPU_CORE);
settings.m_EnableCheats = Config::Get(Config::MAIN_ENABLE_CHEATS);
settings.m_SelectedLanguage = Config::Get(Config::MAIN_GC_LANGUAGE);
settings.m_OverrideGCLanguage = Config::Get(Config::MAIN_OVERRIDE_GC_LANGUAGE);
settings.m_OverrideRegionSettings = Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS);
settings.m_ProgressiveScan = Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN);
settings.m_PAL60 = Config::Get(Config::SYSCONF_PAL60);
settings.m_DSPHLE = Config::Get(Config::MAIN_DSP_HLE);
@@ -55,7 +55,6 @@ void GameCubePane::CreateWidgets()
ipl_box->setLayout(ipl_layout);

m_skip_main_menu = new QCheckBox(tr("Skip Main Menu"), ipl_box);
m_override_language_ntsc = new QCheckBox(tr("Override Language on NTSC Games"), ipl_box);
m_language_combo = new QComboBox(ipl_box);
m_language_combo->setCurrentIndex(-1);

@@ -70,7 +69,6 @@ void GameCubePane::CreateWidgets()
ipl_layout->addWidget(m_skip_main_menu, 0, 0);
ipl_layout->addWidget(new QLabel(tr("System Language:")), 1, 0);
ipl_layout->addWidget(m_language_combo, 1, 1);
ipl_layout->addWidget(m_override_language_ntsc, 2, 0);

// Device Settings
QGroupBox* device_box = new QGroupBox(tr("Device Settings"), this);
@@ -133,7 +131,6 @@ void GameCubePane::ConnectWidgets()
connect(m_skip_main_menu, &QCheckBox::stateChanged, this, &GameCubePane::SaveSettings);
connect(m_language_combo, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&GameCubePane::SaveSettings);
connect(m_override_language_ntsc, &QCheckBox::stateChanged, this, &GameCubePane::SaveSettings);

// Device Settings
for (int i = 0; i < SLOT_COUNT; i++)
@@ -301,7 +298,6 @@ void GameCubePane::LoadSettings()
// IPL Settings
m_skip_main_menu->setChecked(params.bHLE_BS2);
m_language_combo->setCurrentIndex(m_language_combo->findData(params.SelectedLanguage));
m_override_language_ntsc->setChecked(params.bOverrideGCLanguage);

bool have_menu = false;

@@ -342,9 +338,6 @@ void GameCubePane::SaveSettings()
Config::SetBaseOrCurrent(Config::MAIN_SKIP_IPL, m_skip_main_menu->isChecked());
params.SelectedLanguage = m_language_combo->currentData().toInt();
Config::SetBaseOrCurrent(Config::MAIN_GC_LANGUAGE, m_language_combo->currentData().toInt());
params.bOverrideGCLanguage = m_override_language_ntsc->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_OVERRIDE_GC_LANGUAGE,
m_override_language_ntsc->isChecked());

for (int i = 0; i < SLOT_COUNT; i++)
{
@@ -27,7 +27,6 @@ class GameCubePane : public QWidget
void OnConfigPressed(int slot);

QCheckBox* m_skip_main_menu;
QCheckBox* m_override_language_ntsc;
QComboBox* m_language_combo;

QPushButton* m_slot_buttons[3];

0 comments on commit 561a4cf

Please sign in to comment.
You can’t perform that action at this time.