From a74f28235962ed77ad5da4152c8bc85bfb7c5f87 Mon Sep 17 00:00:00 2001 From: Chad Date: Mon, 5 Oct 2026 20:14:09 -0500 Subject: [PATCH] feat(libSceIme): report the closed IME panel sceImeOpen is not implemented, so the IME panel is never open. sceImeClose, sceImeSetCaret, sceImeSetText and sceImeSetTextGeometry return SCE_IME_ERROR_NOT_OPENED, checking the panel before their arguments, as sceImeKeyboardGetInfo does for the keyboard. Co-Authored-By: Claude Opus 5.5 --- core/libs/prx/libSceIme/Export.cpp | 12 ++++-------- core/libs/tests/GuestImeParameters.cpp | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/core/libs/prx/libSceIme/Export.cpp b/core/libs/prx/libSceIme/Export.cpp index db1dd7a85..480dbbd24 100644 --- a/core/libs/prx/libSceIme/Export.cpp +++ b/core/libs/prx/libSceIme/Export.cpp @@ -31,8 +31,7 @@ std::set g_openKeyboards; extern "C" { int APS5_VABI sceImeClose_nid_postfix(void) { - NotImplemented_nid_no_patch(__func__); - return 0; + return ErrorNotOpened; } int APS5_VABI sceImeGetPanelSize(const Param* param, uint32_t* width, uint32_t* height) { @@ -94,22 +93,19 @@ void APS5_VABI sceImeParamInit(Param* param) { int APS5_VABI sceImeSetCaret(const Caret* caret) { (void)caret; - NotImplemented_nid_no_patch(__func__); - return 0; + return ErrorNotOpened; } int APS5_VABI sceImeSetText(const char16_t* text, uint32_t length) { (void)text; (void)length; - NotImplemented_nid_no_patch(__func__); - return 0; + return ErrorNotOpened; } int APS5_VABI sceImeSetTextGeometry(TextAreaMode mode, const TextGeometry* geometry) { (void)mode; (void)geometry; - NotImplemented_nid_no_patch(__func__); - return 0; + return ErrorNotOpened; } int APS5_VABI sceImeUpdate(EventHandler handler) { diff --git a/core/libs/tests/GuestImeParameters.cpp b/core/libs/tests/GuestImeParameters.cpp index 880ebb9e0..3612fb077 100644 --- a/core/libs/tests/GuestImeParameters.cpp +++ b/core/libs/tests/GuestImeParameters.cpp @@ -7,6 +7,10 @@ extern "C" { void APS5_VABI sceImeParamInit(Param* param); int APS5_VABI sceImeGetPanelSize(const Param* param, uint32_t* width, uint32_t* height); +int APS5_VABI sceImeClose_nid_postfix(void); +int APS5_VABI sceImeSetCaret(const Caret* caret); +int APS5_VABI sceImeSetText(const char16_t* text, uint32_t length); +int APS5_VABI sceImeSetTextGeometry(TextAreaMode mode, const TextGeometry* geometry); } static_assert(sizeof(Param) == 96); @@ -102,8 +106,21 @@ static void CheckErrors() { Require(width == 0x12345678 && height == 0x87654321, "outputs changed on error"); } +static void CheckClosedPanel() { + constexpr int notOpened = static_cast(0x80bc0002u); + Caret caret{}; + TextGeometry geometry{}; + const char16_t text[] = u"text"; + Require(sceImeSetCaret(&caret) == notOpened, "caret needs an open panel"); + Require(sceImeSetCaret(nullptr) == notOpened, "caret checks the panel first"); + Require(sceImeSetText(text, 4) == notOpened, "text needs an open panel"); + Require(sceImeSetTextGeometry(TextAreaMode::Edit, &geometry) == notOpened, "geometry needs an open panel"); + Require(sceImeClose_nid_postfix() == notOpened, "closing needs an open panel"); +} + int main() { CheckInitialization(); CheckPanelSizes(); CheckErrors(); + CheckClosedPanel(); }