mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
DiscIO: Add GetRegion function and Region enum
Instead of needing different switch cases for converting countries to regions in multiple places, we now only need a single country-to-region switch case (in DiscIO/Enums.cpp), and we get a nice Region type.
This commit is contained in:
@ -61,13 +61,20 @@ std::string CVolumeGC::GetGameID() const
|
||||
return DecodeString(ID);
|
||||
}
|
||||
|
||||
Region CVolumeGC::GetRegion() const
|
||||
{
|
||||
u8 country_code;
|
||||
if (!m_pReader->Read(3, 1, &country_code))
|
||||
return Region::UNKNOWN_REGION;
|
||||
|
||||
return RegionSwitchGC(country_code);
|
||||
}
|
||||
|
||||
Country CVolumeGC::GetCountry() const
|
||||
{
|
||||
if (!m_pReader)
|
||||
return Country::COUNTRY_UNKNOWN;
|
||||
|
||||
u8 country_code;
|
||||
m_pReader->Read(3, 1, &country_code);
|
||||
if (!m_pReader->Read(3, 1, &country_code))
|
||||
return Country::COUNTRY_UNKNOWN;
|
||||
|
||||
return CountrySwitch(country_code);
|
||||
}
|
||||
@ -247,7 +254,7 @@ void CVolumeGC::ExtractBannerInformation(const GCBanner& banner_file, bool is_bn
|
||||
|
||||
if (is_bnr1) // NTSC
|
||||
{
|
||||
bool is_japanese = GetCountry() == Country::COUNTRY_JAPAN;
|
||||
bool is_japanese = GetRegion() == Region::NTSC_J;
|
||||
number_of_languages = 1;
|
||||
start_language = is_japanese ? Language::LANGUAGE_JAPANESE : Language::LANGUAGE_ENGLISH;
|
||||
}
|
||||
|
Reference in New Issue
Block a user