summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-04-06 12:34:58 +0200
committerGitHub <noreply@github.com>2021-04-06 12:34:58 +0200
commite89ae71cec6390e2cc420af2548caf33afe02280 (patch)
tree9827a25eafb4aee8a5090351f1383c7f2de8a375 /Source/Core/DiscIO
parenta1ee6ace71ed9c0250e19e8ff11177da350f6a7c (diff)
parent27ddf6382ba312dbed77cf31f5a4a2bf9a013c88 (diff)
Merge pull request #9388 from JosJuice/default-locale
Set console's default language/country/region based on computer settings
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/Enums.cpp16
-rw-r--r--Source/Core/DiscIO/Enums.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/Source/Core/DiscIO/Enums.cpp b/Source/Core/DiscIO/Enums.cpp
index c43132b7f2..7ee3ce78eb 100644
--- a/Source/Core/DiscIO/Enums.cpp
+++ b/Source/Core/DiscIO/Enums.cpp
@@ -126,6 +126,22 @@ bool IsNTSC(Region region)
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
Country TypicalCountryForRegion(Region region)
diff --git a/Source/Core/DiscIO/Enums.h b/Source/Core/DiscIO/Enums.h
index 14940d92a8..18a344b680 100644
--- a/Source/Core/DiscIO/Enums.h
+++ b/Source/Core/DiscIO/Enums.h
@@ -76,6 +76,9 @@ bool IsDisc(Platform volume_type);
bool IsWii(Platform volume_type);
bool IsNTSC(Region region);
+int ToGameCubeLanguage(Language language);
+Language FromGameCubeLanguage(int language);
+
Country TypicalCountryForRegion(Region region);
Region SysConfCountryToRegion(u8 country_code);
// Avoid using this function if you can. Country codes aren't always reliable region indicators.