summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-03-24 10:16:17 +0100
committerGitHub <noreply@github.com>2020-03-24 10:16:17 +0100
commit5b10f4b71ee83e9bf64107960489cb6afdaafaa9 (patch)
treefa6353e4b174aa2fa9ad0b6cf34210d6775f0ddc /Source/Core
parent584eee818cf3eaa20d7cfecc03dd9fab881f59c8 (diff)
parent3614e9fcc292e8a6860549233c74c5fbd0fdf9de (diff)
Merge pull request #8673 from JosJuice/preserve-setting-txt
Boot: Do a better job of preserving certain parts of settings.txt
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Boot/Boot_BS2Emu.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/Source/Core/Core/Boot/Boot_BS2Emu.cpp b/Source/Core/Core/Boot/Boot_BS2Emu.cpp
index 98f3bca149..7ef205225d 100644
--- a/Source/Core/Core/Boot/Boot_BS2Emu.cpp
+++ b/Source/Core/Core/Boot/Boot_BS2Emu.cpp
@@ -242,6 +242,30 @@ bool CBoot::EmulatedBS2_GC(const DiscIO::VolumeDisc& volume)
return RunApploader(/*is_wii*/ false, volume);
}
+static DiscIO::Region CodeRegion(char c)
+{
+ switch (c)
+ {
+ case 'J': // Japan
+ case 'T': // Taiwan
+ return DiscIO::Region::NTSC_J;
+ case 'B': // Brazil
+ case 'M': // Middle East
+ case 'R': // Argentina
+ case 'S': // ???
+ case 'U': // USA
+ case 'W': // ???
+ return DiscIO::Region::NTSC_U;
+ case 'A': // Australia
+ case 'E': // Europe
+ return DiscIO::Region::PAL;
+ case 'K': // Korea
+ return DiscIO::Region::NTSC_K;
+ default:
+ return DiscIO::Region::Unknown;
+ }
+}
+
bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type)
{
static const std::map<DiscIO::Region, const RegionSetting> region_settings = {
@@ -254,6 +278,7 @@ bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type)
Common::SettingsHandler gen;
std::string serno;
+ std::string model = "RVL-001(" + region_setting.area + ")";
CreateSystemMenuTitleDirs();
const std::string settings_file_path(Common::GetTitleDataPath(Titles::SYSTEM_MENU) +
"/" WII_SETTING);
@@ -267,11 +292,32 @@ bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type)
{
gen.SetBytes(std::move(data));
serno = gen.GetValue("SERNO");
+ model = gen.GetValue("MODEL");
+
+ bool region_matches = false;
if (SConfig::GetInstance().bOverrideRegionSettings)
{
+ region_matches = true;
+ }
+ else
+ {
+ const std::string code = gen.GetValue("CODE");
+ if (code.size() >= 2 && CodeRegion(code[1]) == SConfig::GetInstance().m_region)
+ region_matches = true;
+ }
+
+ if (region_matches)
+ {
region_setting = RegionSetting{gen.GetValue("AREA"), gen.GetValue("VIDEO"),
gen.GetValue("GAME"), gen.GetValue("CODE")};
}
+ else
+ {
+ const size_t parenthesis_pos = model.find('(');
+ if (parenthesis_pos != std::string::npos)
+ model = model.substr(0, parenthesis_pos) + '(' + region_setting.area + ')';
+ }
+
gen.Reset();
}
}
@@ -290,7 +336,6 @@ bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type)
INFO_LOG(BOOT, "Using serial number: %s", serno.c_str());
}
- std::string model = "RVL-001(" + region_setting.area + ")";
gen.AddSetting("AREA", region_setting.area);
gen.AddSetting("MODEL", model);
gen.AddSetting("DVD", "0");