From 208c6a3011d4680140364b120a04d6e862b2a226 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 14 Dec 2019 19:03:20 +0100 Subject: [PATCH] Boot: Optionally allow preserving region settings in setting.txt See the discussion in https://bugs.dolphin-emu.org/issues/11930. (This probably doesn't really fix that issue, but it's something I thought would make sense anyway.) --- Source/Core/Core/Boot/Boot.h | 8 ++++---- Source/Core/Core/Boot/Boot_BS2Emu.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Boot/Boot.h b/Source/Core/Core/Boot/Boot.h index 2118993ca0..c34e1738fe 100644 --- a/Source/Core/Core/Boot/Boot.h +++ b/Source/Core/Core/Boot/Boot.h @@ -26,10 +26,10 @@ class IOFile; struct RegionSetting { - const std::string area; - const std::string video; - const std::string game; - const std::string code; + std::string area; + std::string video; + std::string game; + std::string code; }; class BootExecutableReader; diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp index 208c02e13a..d73884df51 100644 --- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp +++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp @@ -233,7 +233,7 @@ bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type) {DiscIO::Region::PAL, {"EUR", "PAL", "EU", "LE"}}, {DiscIO::Region::NTSC_K, {"KOR", "NTSC", "KR", "LKH"}}}; auto entryPos = region_settings.find(SConfig::GetInstance().m_region); - const RegionSetting& region_setting = entryPos->second; + RegionSetting region_setting = entryPos->second; Common::SettingsHandler gen; std::string serno; @@ -250,6 +250,11 @@ bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type) { gen.SetBytes(std::move(data)); serno = gen.GetValue("SERNO"); + if (SConfig::GetInstance().bOverrideRegionSettings) + { + region_setting = RegionSetting{gen.GetValue("AREA"), gen.GetValue("VIDEO"), + gen.GetValue("GAME"), gen.GetValue("CODE")}; + } gen.Reset(); } }