mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 17:23:40 +01:00
Overhaul the OSK. Select now acts as a shift button(swaps between upper/lower case; in the case of Korean, it does nothing. In the case of Japanese, it swaps Katakana/Hiragana). R Trigger now acts as a language selector, cycling through the 5 keyboard languages(English, English full-width, Japanese, Korean, Russian).
This commit is contained in:
1 parent
14aa0c6ffa
commit
7b6414e78d
2 files changed
+73
-10
No files matched your search
@@ -256,6 +256,7 @@ int PSPOskDialog::Init(u32 oskPtr)
|
||||
status = SCE_UTILITY_STATUS_INITIALIZE;
|
||||
selectedChar = 0;
|
||||
currentKeyboard = OSK_KEYBOARD_LATIN_LOWERCASE;
|
||||
currentKeyboardLanguage = OSK_LANGUAGE_ENGLISH;
|
||||
|
||||
ConvertUCS2ToUTF8(oskDesc, oskParams->fields[0].desc);
|
||||
ConvertUCS2ToUTF8(oskIntext, oskParams->fields[0].intext);
|
||||
@@ -866,22 +867,27 @@ int PSPOskDialog::Update()
|
||||
if (g_Config.iButtonPreference != PSP_SYSTEMPARAM_BUTTON_CIRCLE)
|
||||
{
|
||||
PPGeDrawImage(I_CROSS, 30, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawImage(I_CIRCLE, 150, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawImage(I_CIRCLE, 30, 245, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
|
||||
}
|
||||
else
|
||||
{
|
||||
PPGeDrawImage(I_CIRCLE, 30, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawImage(I_CROSS, 150, 220, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawImage(I_CROSS, 30, 245, 20, 20, 0, CalcFadedColor(0xFFFFFFFF));
|
||||
}
|
||||
|
||||
I18NCategory *d = GetI18NCategory("Dialog");
|
||||
PPGeDrawText(d->T("Select"), 60, 220, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawText(d->T("Delete"), 180, 220, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawText("Start", 245, 220, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawText(d->T("Finish"), 290, 222, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawText("Select", 365, 220, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFFFFFFF));
|
||||
// TODO: Show title of next keyboard?
|
||||
PPGeDrawText(d->T("Shift"), 415, 222, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawText(d->T("Delete"), 60, 245, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
|
||||
|
||||
PPGeDrawText("Start", 195, 220, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawText(d->T("Finish"), 235, 222, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
|
||||
|
||||
PPGeDrawText("Select", 195, 245, PPGE_ALIGN_LEFT, 0.6f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawText(d->T("Shift"), 240, 250, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
|
||||
|
||||
PPGeDrawText(d->T("R"), 300, 245, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawText(d->T(OskKeyboardNames[(currentKeyboardLanguage + 1) % OSK_LANGUAGE_COUNT].c_str()), 325, 245, PPGE_ALIGN_LEFT, 0.5f, CalcFadedColor(0xFFFFFFFF));
|
||||
|
||||
|
||||
if (IsButtonPressed(CTRL_UP))
|
||||
{
|
||||
@@ -912,8 +918,12 @@ int PSPOskDialog::Update()
|
||||
}
|
||||
else if (IsButtonPressed(CTRL_SELECT))
|
||||
{
|
||||
// TODO: Limit by allowed keyboards...
|
||||
currentKeyboard = (OskKeyboardDisplay)((currentKeyboard + 1) % OSK_KEYBOARD_COUNT);
|
||||
// Select now swaps case.
|
||||
|
||||
if (currentKeyboard == OskKeyboardCases[currentKeyboardLanguage][UPPERCASE])
|
||||
currentKeyboard = OskKeyboardCases[currentKeyboardLanguage][LOWERCASE];
|
||||
else
|
||||
currentKeyboard = OskKeyboardCases[currentKeyboardLanguage][UPPERCASE];
|
||||
|
||||
if(selectedRow >= numKeyRows[currentKeyboard])
|
||||
{
|
||||
@@ -927,6 +937,24 @@ int PSPOskDialog::Update()
|
||||
|
||||
selectedChar = selectedRow * numKeyCols[currentKeyboard] + selectedExtra;
|
||||
}
|
||||
else if (IsButtonPressed(CTRL_RTRIGGER))
|
||||
{
|
||||
// RTRIGGER now swaps languages.
|
||||
currentKeyboardLanguage = (OskKeyboardLanguage)((currentKeyboardLanguage + 1) % OSK_LANGUAGE_COUNT);
|
||||
currentKeyboard = OskKeyboardCases[currentKeyboardLanguage][LOWERCASE];
|
||||
|
||||
if (selectedRow >= numKeyRows[currentKeyboard])
|
||||
{
|
||||
selectedRow = numKeyRows[currentKeyboard] - 1;
|
||||
}
|
||||
|
||||
if (selectedExtra >= numKeyCols[currentKeyboard])
|
||||
{
|
||||
selectedExtra = numKeyCols[currentKeyboard] - 1;
|
||||
}
|
||||
|
||||
selectedChar = selectedRow * numKeyCols[currentKeyboard] + selectedExtra;
|
||||
}
|
||||
else if (IsButtonPressed(g_Config.iButtonPreference != PSP_SYSTEMPARAM_BUTTON_CIRCLE ? CTRL_CIRCLE : CTRL_CROSS))
|
||||
{
|
||||
if (inputChars.size() > 0)
|
||||
|
||||
@@ -164,6 +164,40 @@ enum OskKeyboardDisplay
|
||||
OSK_KEYBOARD_COUNT
|
||||
};
|
||||
|
||||
// Internal enum, not from PSP.
|
||||
enum OskKeyboardLanguage
|
||||
{
|
||||
OSK_LANGUAGE_ENGLISH, //English half-width
|
||||
OSK_LANGUAGE_JAPANESE,
|
||||
OSK_LANGUAGE_KOREAN,
|
||||
OSK_LANGUAGE_RUSSIAN,
|
||||
OSK_LANGUAGE_ENGLISH_FW, //English full-width(mostly used in Japanese games)
|
||||
OSK_LANGUAGE_COUNT
|
||||
};
|
||||
|
||||
// Internal enum, not from PSP.
|
||||
enum {
|
||||
LOWERCASE,
|
||||
UPPERCASE
|
||||
};
|
||||
|
||||
const OskKeyboardDisplay OskKeyboardCases[OSK_LANGUAGE_COUNT][2] =
|
||||
{
|
||||
{ OSK_KEYBOARD_LATIN_LOWERCASE, OSK_KEYBOARD_LATIN_UPPERCASE },
|
||||
{ OSK_KEYBOARD_HIRAGANA, OSK_KEYBOARD_KATAKANA },
|
||||
{ OSK_KEYBOARD_KOREAN, OSK_KEYBOARD_KOREAN }, // Korean only has one case, so just repeat it.
|
||||
{ OSK_KEYBOARD_RUSSIAN_LOWERCASE, OSK_KEYBOARD_RUSSIAN_UPPERCASE },
|
||||
{ OSK_KEYBOARD_LATIN_FW_LOWERCASE, OSK_KEYBOARD_LATIN_FW_UPPERCASE }
|
||||
};
|
||||
|
||||
static const std::string OskKeyboardNames[] = {
|
||||
"English",
|
||||
"Japanese",
|
||||
"Korean",
|
||||
"Russian",
|
||||
"English Full-width",
|
||||
};
|
||||
|
||||
|
||||
class PSPOskDialog: public PSPDialog {
|
||||
public:
|
||||
@@ -199,6 +233,7 @@ private:
|
||||
int selectedChar;
|
||||
std::wstring inputChars;
|
||||
OskKeyboardDisplay currentKeyboard;
|
||||
OskKeyboardLanguage currentKeyboardLanguage;
|
||||
bool isCombinated;
|
||||
|
||||
int i_level; // for Korean Keyboard support
|
||||
|
||||
Reference in new issue
Block a user