Pull language names from langregion.ini.

This commit is contained in:
The Dax 2013-09-25 17:17:17 -04:00
parent 546a506c62
commit a7a416fa88
2 changed files with 18 additions and 5 deletions

View file

@ -36,6 +36,10 @@
#include <math.h> #include <math.h>
#endif #endif
extern std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping();
static std::map<std::string, std::pair<std::string, int>> languageMapping;
const int numKeyCols[OSK_KEYBOARD_COUNT] = {12, 12, 13, 13, 12, 12, 12, 12, 12}; const int numKeyCols[OSK_KEYBOARD_COUNT] = {12, 12, 13, 13, 12, 12, 12, 12, 12};
const int numKeyRows[OSK_KEYBOARD_COUNT] = {4, 4, 5, 5, 5, 4, 4, 4, 4}; const int numKeyRows[OSK_KEYBOARD_COUNT] = {4, 4, 5, 5, 5, 4, 4, 4, 4};
@ -273,6 +277,8 @@ int PSPOskDialog::Init(u32 oskPtr)
inputChars += c; inputChars += c;
} }
languageMapping = GetLangValuesMapping();
// Eat any keys pressed before the dialog inited. // Eat any keys pressed before the dialog inited.
__CtrlReadLatch(); __CtrlReadLatch();
@ -886,7 +892,14 @@ int PSPOskDialog::Update()
PPGeDrawText(d->T("Shift"), 240, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(d->T("Shift"), 240, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(d->T("R"), 300, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF)); PPGeDrawText(d->T("R"), 300, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
PPGeDrawText(d->T(OskKeyboardNames[(currentKeyboardLanguage + 1) % OSK_LANGUAGE_COUNT].c_str()), 315, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
const char *countryCode = OskKeyboardNames[(currentKeyboardLanguage + 1) % OSK_LANGUAGE_COUNT].c_str();
const char *language = languageMapping[countryCode].first.c_str();
if (!strcmp(countryCode, "English Full-width"))
language = "English Full-width";
PPGeDrawText(language, 315, 247, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
if (IsButtonPressed(CTRL_UP)) if (IsButtonPressed(CTRL_UP))
{ {

View file

@ -193,10 +193,10 @@ const OskKeyboardDisplay OskKeyboardCases[OSK_LANGUAGE_COUNT][2] =
static const std::string OskKeyboardNames[] = static const std::string OskKeyboardNames[] =
{ {
"English", "en_US",
"Japanese", "ja_JP",
"Korean", "ko_KR",
"Russian", "ru_RU",
"English Full-width", "English Full-width",
}; };