Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boot: Do a better job of preserving certain parts of settings.txt #8673

Merged
merged 2 commits into from
Mar 24, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Boot: Preserve CODE value in setting.txt if it already matches the re…
…gion

This is a part of fixing https://bugs.dolphin-emu.org/issues/11930.
  • Loading branch information
JosJuice committed Mar 16, 2020
commit 36c92294dfcb2605b29bcc12e69526e904887818
38 changes: 38 additions & 0 deletions Source/Core/Core/Boot/Boot_BS2Emu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
leoetlino marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -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();
}
}
Expand Down