From 27ea4285ef30495eb574baeb3bb38296bd2d1a4a Mon Sep 17 00:00:00 2001 From: ikki84 Date: Fri, 7 Apr 2017 09:30:07 -0300 Subject: [PATCH] Imejp: cellImeJpEnterChar (#2600) --- .../Modules/{cellImejp.cpp => cellImeJp.cpp} | 66 +++++++++++-------- rpcs3/Emu/Cell/Modules/cellImeJp.h | 27 ++++++++ rpcs3/emucore.vcxproj | 5 +- rpcs3/emucore.vcxproj.filters | 7 +- 4 files changed, 75 insertions(+), 30 deletions(-) rename rpcs3/Emu/Cell/Modules/{cellImejp.cpp => cellImeJp.cpp} (70%) create mode 100644 rpcs3/Emu/Cell/Modules/cellImeJp.h diff --git a/rpcs3/Emu/Cell/Modules/cellImejp.cpp b/rpcs3/Emu/Cell/Modules/cellImeJp.cpp similarity index 70% rename from rpcs3/Emu/Cell/Modules/cellImejp.cpp rename to rpcs3/Emu/Cell/Modules/cellImeJp.cpp index 4a56d547de..e0d129c001 100644 --- a/rpcs3/Emu/Cell/Modules/cellImejp.cpp +++ b/rpcs3/Emu/Cell/Modules/cellImeJp.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Emu/Cell/PPUModule.h" +#include "cellImeJp.h" logs::channel cellImeJp("cellImeJp", logs::level::notice); @@ -15,21 +16,26 @@ enum CELL_IMEJP_ERROR_OTHER = 0x8002bfff, }; +static uint16_t s_ime_string[256]; + s32 cellImeJpOpen() { - UNIMPLEMENTED_FUNC(cellImeJp); + std::memset(s_ime_string, 0, sizeof(s_ime_string)); + cellImeJp.error("cellImeJpOpen()"); return CELL_OK; } s32 cellImeJpOpen2() { - UNIMPLEMENTED_FUNC(cellImeJp); + std::memset(s_ime_string, 0, sizeof(s_ime_string)); + cellImeJp.error("cellImeJpOpen2()"); return CELL_OK; } s32 cellImeJpOpen3() { - UNIMPLEMENTED_FUNC(cellImeJp); + std::memset(s_ime_string, 0, sizeof(s_ime_string)); + cellImeJp.error("cellImeJpOpen3()"); return CELL_OK; } @@ -69,34 +75,37 @@ s32 cellImeJpReset() return CELL_OK; } -s32 cellImeJpGetStatus() +s32 cellImeJpGetStatus(CellImeJpHandle hImeJpHandle, vm::ptr pInputStatus) { - UNIMPLEMENTED_FUNC(cellImeJp); + cellImeJp.error("cellImeJpGetStatus()"); + *pInputStatus = CELL_IMEJP_CANDIDATE_EMPTY; return CELL_OK; } -s32 cellImeJpEnterChar() +s32 cellImeJpEnterChar(CellImeJpHandle hImeJpHandle, u16 inputChar, vm::ptr pOutputStatus) { - UNIMPLEMENTED_FUNC(cellImeJp); + LOG_TODO(HLE, "cellImeJpEnterChar hImeJpHandle / inputChar / pOutputStatus (%d / 0x%x / %d)" HERE, hImeJpHandle, inputChar, pOutputStatus); + *s_ime_string = inputChar; + *pOutputStatus = CELL_IMEJP_RET_CONFIRMED; return CELL_OK; } -s32 cellImeJpEnterCharExt() +s32 cellImeJpEnterCharExt(CellImeJpHandle hImeJpHandle, u16 inputChar, vm::ptr pOutputStatus) { - UNIMPLEMENTED_FUNC(cellImeJp); - return CELL_OK; + cellImeJp.todo("cellImeJpEnterCharExt()"); + return cellImeJpEnterChar(hImeJpHandle, inputChar, pOutputStatus); } -s32 cellImeJpEnterString() +s32 cellImeJpEnterString(CellImeJpHandle hImeJpHandle, u16 inputChar, vm::ptr pOutputStatus) { - UNIMPLEMENTED_FUNC(cellImeJp); - return CELL_OK; + cellImeJp.todo("cellImeJpEnterString()"); + return cellImeJpEnterChar(hImeJpHandle, inputChar, pOutputStatus); } -s32 cellImeJpEnterStringExt() +s32 cellImeJpEnterStringExt(CellImeJpHandle hImeJpHandle, u16 inputChar, vm::ptr pOutputStatus) { - UNIMPLEMENTED_FUNC(cellImeJp); - return CELL_OK; + cellImeJp.todo("cellImeJpEnterStringExt()"); + return cellImeJpEnterChar(hImeJpHandle, inputChar, pOutputStatus); } s32 cellImeJpModeCaretRight() @@ -201,33 +210,38 @@ s32 cellImeJpGetFocusTop() return CELL_OK; } -s32 cellImeJpGetFocusLength() +s32 cellImeJpGetFocusLength(CellImeJpHandle hImeJpHandle, vm::ptr pFocusLength) { - UNIMPLEMENTED_FUNC(cellImeJp); + cellImeJp.error("cellImeJpGetFocusLength()"); + *pFocusLength = 1; return CELL_OK; } -s32 cellImeJpGetConfirmYomiString() +s32 cellImeJpGetConfirmYomiString(CellImeJpHandle hImeJpHandle, vm::ptr pYomiString) { - UNIMPLEMENTED_FUNC(cellImeJp); + cellImeJp.error("cellImeJpGetConfirmYomiString()"); + *pYomiString = *s_ime_string; return CELL_OK; } -s32 cellImeJpGetConfirmString() +s32 cellImeJpGetConfirmString(CellImeJpHandle hImeJpHandle, vm::ptr pConfirmString) { - UNIMPLEMENTED_FUNC(cellImeJp); + cellImeJp.error("cellImeJpGetConfirmString()"); + *pConfirmString = *s_ime_string; return CELL_OK; } -s32 cellImeJpGetConvertYomiString() +s32 cellImeJpGetConvertYomiString(CellImeJpHandle hImeJpHandle, vm::ptr pYomiString) { - UNIMPLEMENTED_FUNC(cellImeJp); + cellImeJp.error("cellImeJpGetConvertYomiString()"); + *pYomiString = *s_ime_string; return CELL_OK; } -s32 cellImeJpGetConvertString() +s32 cellImeJpGetConvertString(CellImeJpHandle hImeJpHandle, vm::ptr pConvertString) { - UNIMPLEMENTED_FUNC(cellImeJp); + cellImeJp.error("cellImeJpGetConvertString()"); + *pConvertString = *s_ime_string; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellImeJp.h b/rpcs3/Emu/Cell/Modules/cellImeJp.h new file mode 100644 index 0000000000..cfed9b257f --- /dev/null +++ b/rpcs3/Emu/Cell/Modules/cellImeJp.h @@ -0,0 +1,27 @@ +#pragma once + +namespace vm { using namespace ps3; } + +typedef vm::ptr CellImeJpHandle; + +//Input state of the ImeJp +enum { + CELL_IMEJP_BEFORE_INPUT = 0, + CELL_IMEJP_BEFORE_CONVERT = 1, + CELL_IMEJP_CONVERTING = 2, + CELL_IMEJP_CANDIDATE_EMPTY = 3, + CELL_IMEJP_POSTCONVERT_KANA = 4, + CELL_IMEJP_POSTCONVERT_HALF = 5, + CELL_IMEJP_POSTCONVERT_RAW = 6, + CELL_IMEJP_CANDIDATES = 7, + CELL_IMEJP_MOVE_CLAUSE_GAP = 8, +}; + +//cellImeJpEnterChar, returning values pointed in pOutputStatus. +enum { + CELL_IMEJP_RET_NONE = 0, + CELL_IMEJP_RET_THROUGH = 1, + CELL_IMEJP_RET_CONFIRMED = 2, +}; + + diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index fde5629563..5254e92a14 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -164,7 +164,7 @@ - + @@ -557,6 +557,7 @@ + @@ -705,4 +706,4 @@ - \ No newline at end of file + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 10cda3e8d2..8bde17b861 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -371,7 +371,7 @@ Emu\Cell\Modules - + Emu\Cell\Modules @@ -1282,6 +1282,9 @@ Emu\Cell\Modules + + Emu\Cell\Modules + Emu\Cell\Modules @@ -1751,4 +1754,4 @@ Utilities - \ No newline at end of file +