Fix warning message when loading german discs
Added COUNTRY_GERMANY as EUR_DIR so it will not show the warning message that the GCM/ISO is invalid. Also refactors the code to remove duplicate code.
This commit is contained in:
parent
537b9e507b
commit
a1f8c232b2
|
@ -108,9 +108,39 @@ void SCoreStartupParameter::LoadDefaults()
|
||||||
m_strUniqueID = "00000000";
|
m_strUniqueID = "00000000";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* GetRegionOfCountry(DiscIO::IVolume::ECountry country)
|
||||||
|
{
|
||||||
|
switch (country)
|
||||||
|
{
|
||||||
|
case DiscIO::IVolume::COUNTRY_USA:
|
||||||
|
return USA_DIR;
|
||||||
|
|
||||||
|
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||||
|
case DiscIO::IVolume::COUNTRY_KOREA:
|
||||||
|
// TODO: Should these have their own Region Dir?
|
||||||
|
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||||
|
return JAP_DIR;
|
||||||
|
|
||||||
|
case DiscIO::IVolume::COUNTRY_AUSTRALIA:
|
||||||
|
case DiscIO::IVolume::COUNTRY_EUROPE:
|
||||||
|
case DiscIO::IVolume::COUNTRY_FRANCE:
|
||||||
|
case DiscIO::IVolume::COUNTRY_GERMANY:
|
||||||
|
case DiscIO::IVolume::COUNTRY_INTERNATIONAL:
|
||||||
|
case DiscIO::IVolume::COUNTRY_ITALY:
|
||||||
|
case DiscIO::IVolume::COUNTRY_NETHERLANDS:
|
||||||
|
case DiscIO::IVolume::COUNTRY_RUSSIA:
|
||||||
|
case DiscIO::IVolume::COUNTRY_SPAIN:
|
||||||
|
return EUR_DIR;
|
||||||
|
|
||||||
|
case DiscIO::IVolume::COUNTRY_UNKNOWN:
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
|
bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
|
||||||
{
|
{
|
||||||
std::string Region(EUR_DIR);
|
std::string set_region_dir(EUR_DIR);
|
||||||
|
|
||||||
switch (_BootBS2)
|
switch (_BootBS2)
|
||||||
{
|
{
|
||||||
|
@ -154,52 +184,23 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
|
||||||
|
|
||||||
// Check if we have a Wii disc
|
// Check if we have a Wii disc
|
||||||
bWii = pVolume.get()->IsWiiDisc();
|
bWii = pVolume.get()->IsWiiDisc();
|
||||||
switch (pVolume->GetCountry())
|
|
||||||
|
const char* retrieved_region_dir = GetRegionOfCountry(pVolume->GetCountry());
|
||||||
|
if (!retrieved_region_dir)
|
||||||
{
|
{
|
||||||
case DiscIO::IVolume::COUNTRY_USA:
|
if (!PanicYesNoT("Your GCM/ISO file seems to be invalid (invalid country)."
|
||||||
bNTSC = true;
|
"\nContinue with PAL region?"))
|
||||||
Region = USA_DIR;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
|
||||||
case DiscIO::IVolume::COUNTRY_KOREA:
|
|
||||||
// TODO: Should these have their own Region Dir?
|
|
||||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
|
||||||
bNTSC = true;
|
|
||||||
Region = JAP_DIR;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DiscIO::IVolume::COUNTRY_AUSTRALIA:
|
|
||||||
case DiscIO::IVolume::COUNTRY_EUROPE:
|
|
||||||
case DiscIO::IVolume::COUNTRY_FRANCE:
|
|
||||||
case DiscIO::IVolume::COUNTRY_INTERNATIONAL:
|
|
||||||
case DiscIO::IVolume::COUNTRY_ITALY:
|
|
||||||
case DiscIO::IVolume::COUNTRY_NETHERLANDS:
|
|
||||||
case DiscIO::IVolume::COUNTRY_RUSSIA:
|
|
||||||
case DiscIO::IVolume::COUNTRY_SPAIN:
|
|
||||||
bNTSC = false;
|
|
||||||
Region = EUR_DIR;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DiscIO::IVolume::COUNTRY_UNKNOWN:
|
|
||||||
default:
|
|
||||||
if (PanicYesNoT("Your GCM/ISO file seems to be invalid (invalid country)."
|
|
||||||
"\nContinue with PAL region?"))
|
|
||||||
{
|
|
||||||
bNTSC = false;
|
|
||||||
Region = EUR_DIR;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
retrieved_region_dir = EUR_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_region_dir = retrieved_region_dir;
|
||||||
|
bNTSC = set_region_dir == USA_DIR || set_region_dir == JAP_DIR;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(Extension.c_str(), ".elf"))
|
else if (!strcasecmp(Extension.c_str(), ".elf"))
|
||||||
{
|
{
|
||||||
bWii = CBoot::IsElfWii(m_strFilename);
|
bWii = CBoot::IsElfWii(m_strFilename);
|
||||||
Region = USA_DIR;
|
set_region_dir = USA_DIR;
|
||||||
m_BootType = BOOT_ELF;
|
m_BootType = BOOT_ELF;
|
||||||
bNTSC = true;
|
bNTSC = true;
|
||||||
}
|
}
|
||||||
|
@ -207,14 +208,14 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
|
||||||
{
|
{
|
||||||
CDolLoader dolfile(m_strFilename);
|
CDolLoader dolfile(m_strFilename);
|
||||||
bWii = dolfile.IsWii();
|
bWii = dolfile.IsWii();
|
||||||
Region = USA_DIR;
|
set_region_dir = USA_DIR;
|
||||||
m_BootType = BOOT_DOL;
|
m_BootType = BOOT_DOL;
|
||||||
bNTSC = true;
|
bNTSC = true;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(Extension.c_str(), ".dff"))
|
else if (!strcasecmp(Extension.c_str(), ".dff"))
|
||||||
{
|
{
|
||||||
bWii = true;
|
bWii = true;
|
||||||
Region = USA_DIR;
|
set_region_dir = USA_DIR;
|
||||||
bNTSC = true;
|
bNTSC = true;
|
||||||
m_BootType = BOOT_DFF;
|
m_BootType = BOOT_DFF;
|
||||||
|
|
||||||
|
@ -239,37 +240,9 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
|
||||||
return false; //do not boot
|
return false; //do not boot
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ContentLoader.GetCountry())
|
const char* retrieved_region_dir = GetRegionOfCountry(ContentLoader.GetCountry());
|
||||||
{
|
set_region_dir = retrieved_region_dir ? retrieved_region_dir : EUR_DIR;
|
||||||
case DiscIO::IVolume::COUNTRY_USA:
|
bNTSC = set_region_dir == USA_DIR || set_region_dir == JAP_DIR;
|
||||||
bNTSC = true;
|
|
||||||
Region = USA_DIR;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
|
||||||
case DiscIO::IVolume::COUNTRY_KOREA:
|
|
||||||
// TODO: Should these have their own Region Dir?
|
|
||||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
|
||||||
bNTSC = true;
|
|
||||||
Region = JAP_DIR;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DiscIO::IVolume::COUNTRY_AUSTRALIA:
|
|
||||||
case DiscIO::IVolume::COUNTRY_EUROPE:
|
|
||||||
case DiscIO::IVolume::COUNTRY_FRANCE:
|
|
||||||
case DiscIO::IVolume::COUNTRY_INTERNATIONAL:
|
|
||||||
case DiscIO::IVolume::COUNTRY_ITALY:
|
|
||||||
case DiscIO::IVolume::COUNTRY_RUSSIA:
|
|
||||||
bNTSC = false;
|
|
||||||
Region = EUR_DIR;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DiscIO::IVolume::COUNTRY_UNKNOWN:
|
|
||||||
default:
|
|
||||||
bNTSC = false;
|
|
||||||
Region = EUR_DIR;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bWii = true;
|
bWii = true;
|
||||||
m_BootType = BOOT_WII_NAND;
|
m_BootType = BOOT_WII_NAND;
|
||||||
|
@ -309,35 +282,35 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BOOT_BS2_USA:
|
case BOOT_BS2_USA:
|
||||||
Region = USA_DIR;
|
set_region_dir = USA_DIR;
|
||||||
m_strFilename.clear();
|
m_strFilename.clear();
|
||||||
bNTSC = true;
|
bNTSC = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BOOT_BS2_JAP:
|
case BOOT_BS2_JAP:
|
||||||
Region = JAP_DIR;
|
set_region_dir = JAP_DIR;
|
||||||
m_strFilename.clear();
|
m_strFilename.clear();
|
||||||
bNTSC = true;
|
bNTSC = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BOOT_BS2_EUR:
|
case BOOT_BS2_EUR:
|
||||||
Region = EUR_DIR;
|
set_region_dir = EUR_DIR;
|
||||||
m_strFilename.clear();
|
m_strFilename.clear();
|
||||||
bNTSC = false;
|
bNTSC = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup paths
|
// Setup paths
|
||||||
CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardA, Region, true);
|
CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardA, set_region_dir, true);
|
||||||
CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardB, Region, false);
|
CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardB, set_region_dir, false);
|
||||||
m_strSRAM = File::GetUserPath(F_GCSRAM_IDX);
|
m_strSRAM = File::GetUserPath(F_GCSRAM_IDX);
|
||||||
if (!bWii)
|
if (!bWii)
|
||||||
{
|
{
|
||||||
if (!bHLE_BS2)
|
if (!bHLE_BS2)
|
||||||
{
|
{
|
||||||
m_strBootROM = File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + Region + DIR_SEP GC_IPL;
|
m_strBootROM = File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + set_region_dir + DIR_SEP GC_IPL;
|
||||||
if (!File::Exists(m_strBootROM))
|
if (!File::Exists(m_strBootROM))
|
||||||
m_strBootROM = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + Region + DIR_SEP GC_IPL;
|
m_strBootROM = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + set_region_dir + DIR_SEP GC_IPL;
|
||||||
|
|
||||||
if (!File::Exists(m_strBootROM))
|
if (!File::Exists(m_strBootROM))
|
||||||
{
|
{
|
||||||
|
|
|
@ -261,7 +261,7 @@ struct SCoreStartupParameter
|
||||||
void LoadDefaults();
|
void LoadDefaults();
|
||||||
bool AutoSetup(EBootBS2 _BootBS2);
|
bool AutoSetup(EBootBS2 _BootBS2);
|
||||||
const std::string &GetUniqueID() const { return m_strUniqueID; }
|
const std::string &GetUniqueID() const { return m_strUniqueID; }
|
||||||
void CheckMemcardPath(std::string& memcardPath, std::string Region, bool isSlotA);
|
void CheckMemcardPath(std::string& memcardPath, std::string gameRegion, bool isSlotA);
|
||||||
IniFile LoadDefaultGameIni() const;
|
IniFile LoadDefaultGameIni() const;
|
||||||
IniFile LoadLocalGameIni() const;
|
IniFile LoadLocalGameIni() const;
|
||||||
IniFile LoadGameIni() const;
|
IniFile LoadGameIni() const;
|
||||||
|
|
Loading…
Reference in New Issue