From 462d87707b0532882c63ef8589d49d772177d6a4 Mon Sep 17 00:00:00 2001 From: Northfear <11291116+Northfear@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:04:21 +0200 Subject: [PATCH] Fixed Vita text input --- src/character_editor.cc | 4 ---- src/input.cc | 13 +++++++++++-- src/loadsave.cc | 4 ---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/character_editor.cc b/src/character_editor.cc index fd5d02a5..ca6513b0 100644 --- a/src/character_editor.cc +++ b/src/character_editor.cc @@ -1939,10 +1939,6 @@ static int _get_input_str(int win, int cancelKeyCode, char* text, int maxLength, int rc = 1; -#ifdef __vita__ - vitaActivateIme(); -#endif - while (rc == 1) { sharedFpsLimiter.mark(); diff --git a/src/input.cc b/src/input.cc index cc74317f..79cefc4e 100644 --- a/src/input.cc +++ b/src/input.cc @@ -1294,12 +1294,21 @@ static void idleImpl() void beginTextInput() { +#ifdef __vita__ + vitaActivateIme(); +#else SDL_StartTextInput(); +#endif } void endTextInput() { +#ifdef __vita__ + sceImeClose(); + ime_active = 0; +#else SDL_StopTextInput(); +#endif } #ifdef __vita__ @@ -1554,9 +1563,9 @@ void vitaActivateIme() param.arg = NULL; param.work = libime_work; - int res = sceImeOpen(¶m); + int32_t res = sceImeOpen(¶m); if (res < 0) { - sceClibPrintf("Failed to init IME\n"); + sceClibPrintf("Failed to init IME: %ld\n", res); } ime_active = 1; } diff --git a/src/loadsave.cc b/src/loadsave.cc index 675dc5a9..1eb43987 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -2222,10 +2222,6 @@ static int _get_input_str2(int win, int doneKeyCode, int cancelKeyCode, char* de int rc = 1; -#ifdef __vita__ - vitaActivateIme(); -#endif - while (rc == 1) { sharedFpsLimiter.mark();