mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-15 16:59:18 +01:00
Add utility functions for GameCube language codes
This commit is contained in:
parent
8d2b0fff8a
commit
a1000afacc
@ -393,9 +393,8 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
|||||||
// Override out-of-region languages/countries to prevent games from crashing or behaving oddly
|
// Override out-of-region languages/countries to prevent games from crashing or behaving oddly
|
||||||
if (!StartUp.bOverrideRegionSettings)
|
if (!StartUp.bOverrideRegionSettings)
|
||||||
{
|
{
|
||||||
const int gc_language =
|
StartUp.SelectedLanguage =
|
||||||
static_cast<int>(StartUp.GetLanguageAdjustedForRegion(false, StartUp.m_region));
|
DiscIO::ToGameCubeLanguage(StartUp.GetLanguageAdjustedForRegion(false, StartUp.m_region));
|
||||||
StartUp.SelectedLanguage = gc_language - (gc_language > 0);
|
|
||||||
|
|
||||||
if (StartUp.bWii)
|
if (StartUp.bWii)
|
||||||
{
|
{
|
||||||
|
@ -963,12 +963,11 @@ DiscIO::Region SConfig::GetFallbackRegion()
|
|||||||
|
|
||||||
DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
|
DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
|
||||||
{
|
{
|
||||||
int language_value;
|
DiscIO::Language language;
|
||||||
if (wii)
|
if (wii)
|
||||||
language_value = Config::Get(Config::SYSCONF_LANGUAGE);
|
language = static_cast<DiscIO::Language>(Config::Get(Config::SYSCONF_LANGUAGE));
|
||||||
else
|
else
|
||||||
language_value = SConfig::GetInstance().SelectedLanguage + 1;
|
language = DiscIO::FromGameCubeLanguage(SConfig::GetInstance().SelectedLanguage);
|
||||||
DiscIO::Language language = static_cast<DiscIO::Language>(language_value);
|
|
||||||
|
|
||||||
// Get rid of invalid values (probably doesn't matter, but might as well do it)
|
// Get rid of invalid values (probably doesn't matter, but might as well do it)
|
||||||
if (language > DiscIO::Language::Unknown || language < DiscIO::Language::Japanese)
|
if (language > DiscIO::Language::Unknown || language < DiscIO::Language::Japanese)
|
||||||
|
@ -126,6 +126,22 @@ bool IsNTSC(Region region)
|
|||||||
return region == Region::NTSC_J || region == Region::NTSC_U || region == Region::NTSC_K;
|
return region == Region::NTSC_J || region == Region::NTSC_U || region == Region::NTSC_K;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ToGameCubeLanguage(Language language)
|
||||||
|
{
|
||||||
|
if (language < Language::English || language > Language::Dutch)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return static_cast<int>(language) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Language FromGameCubeLanguage(int language)
|
||||||
|
{
|
||||||
|
if (language < 0 || language > 5)
|
||||||
|
return Language::Unknown;
|
||||||
|
else
|
||||||
|
return static_cast<Language>(language + 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Increment CACHE_REVISION (GameFileCache.cpp) if the code below is modified
|
// Increment CACHE_REVISION (GameFileCache.cpp) if the code below is modified
|
||||||
|
|
||||||
Country TypicalCountryForRegion(Region region)
|
Country TypicalCountryForRegion(Region region)
|
||||||
|
@ -76,6 +76,9 @@ bool IsDisc(Platform volume_type);
|
|||||||
bool IsWii(Platform volume_type);
|
bool IsWii(Platform volume_type);
|
||||||
bool IsNTSC(Region region);
|
bool IsNTSC(Region region);
|
||||||
|
|
||||||
|
int ToGameCubeLanguage(Language language);
|
||||||
|
Language FromGameCubeLanguage(int language);
|
||||||
|
|
||||||
Country TypicalCountryForRegion(Region region);
|
Country TypicalCountryForRegion(Region region);
|
||||||
Region SysConfCountryToRegion(u8 country_code);
|
Region SysConfCountryToRegion(u8 country_code);
|
||||||
// Avoid using this function if you can. Country codes aren't always reliable region indicators.
|
// Avoid using this function if you can. Country codes aren't always reliable region indicators.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user