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 <noreply@anthropic.com>
This commit is contained in:
Chad
2026-10-05 20:14:09 -05:00
parent 9cafa33f94
commit a74f282359
2 changed files with 21 additions and 8 deletions
+4 -8
View File
@@ -31,8 +31,7 @@ std::set<int32_t> 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) {
+17
View File
@@ -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<int>(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();
}