mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Boot: Preserve CODE value in setting.txt if it already matches the region
This is a part of fixing https://bugs.dolphin-emu.org/issues/11930.
This commit is contained in:
parent
c86832849a
commit
36c92294df
@ -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 = {
|
||||
@ -267,11 +291,25 @@ bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type)
|
||||
{
|
||||
gen.SetBytes(std::move(data));
|
||||
serno = gen.GetValue("SERNO");
|
||||
|
||||
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")};
|
||||
}
|
||||
|
||||
gen.Reset();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user