mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-12 04:35:56 +00:00
- Restructured the code for better clarity.
- Added missing enums and structs. - Updated OrbisImeTextAreaProperty. - Fixed incorrect / incomplete OrbisImeEventParam. - Replaced OrbisImeDialogOption with OrbisImeOption. - Removed the incorrect OrbisImeDialogOption. - Fixed OrbisImeDialogParam. - Updated the sceImeOpen declaration to use extended parameters, but this is not yet implemented.
This commit is contained in:
parent
4f99f304e6
commit
2b60d9bb55
7 changed files with 221 additions and 49 deletions
|
@ -43,8 +43,8 @@ public:
|
||||||
openEvent.param.rect.x = m_param.ime.posx;
|
openEvent.param.rect.x = m_param.ime.posx;
|
||||||
openEvent.param.rect.y = m_param.ime.posy;
|
openEvent.param.rect.y = m_param.ime.posy;
|
||||||
} else {
|
} else {
|
||||||
openEvent.param.resource_id_array.userId = 1;
|
openEvent.param.resource_id_array.user_id = 1;
|
||||||
openEvent.param.resource_id_array.resourceId[0] = 1;
|
openEvent.param.resource_id_array.resource_id[0] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are we supposed to call the event handler on init with
|
// Are we supposed to call the event handler on init with
|
||||||
|
@ -304,7 +304,7 @@ int PS4_SYSV_ABI sceImeKeyboardUpdate() {
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceImeOpen(const OrbisImeParam* param, const void* extended) {
|
s32 PS4_SYSV_ABI sceImeOpen(const OrbisImeParam* param, const OrbisImeParamExtended* extended) {
|
||||||
LOG_INFO(Lib_Ime, "called");
|
LOG_INFO(Lib_Ime, "called");
|
||||||
|
|
||||||
if (!param) {
|
if (!param) {
|
||||||
|
|
|
@ -26,7 +26,8 @@ enum class OrbisImeKeyboardOption : u32 {
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeKeyboardOption)
|
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeKeyboardOption)
|
||||||
|
|
||||||
enum class OrbisImeOption : u32 {
|
/*Needed for both, Ime & ImeDialog, so, move to ime_common.h*/
|
||||||
|
/* enum class OrbisImeOption : u32 {
|
||||||
DEFAULT = 0,
|
DEFAULT = 0,
|
||||||
MULTILINE = 1,
|
MULTILINE = 1,
|
||||||
NO_AUTO_CAPITALIZATION = 2,
|
NO_AUTO_CAPITALIZATION = 2,
|
||||||
|
@ -35,6 +36,7 @@ enum class OrbisImeOption : u32 {
|
||||||
EXT_KEYBOARD = 16,
|
EXT_KEYBOARD = 16,
|
||||||
NO_LEARNING = 32,
|
NO_LEARNING = 32,
|
||||||
FIXED_POSITION = 64,
|
FIXED_POSITION = 64,
|
||||||
|
DISABLE_COPY_PASTE = 128, // Source: psOff
|
||||||
DISABLE_RESUME = 256,
|
DISABLE_RESUME = 256,
|
||||||
DISABLE_AUTO_SPACE = 512,
|
DISABLE_AUTO_SPACE = 512,
|
||||||
DISABLE_POSITION_ADJUSTMENT = 2048,
|
DISABLE_POSITION_ADJUSTMENT = 2048,
|
||||||
|
@ -42,7 +44,7 @@ enum class OrbisImeOption : u32 {
|
||||||
USE_JAPANESE_EISUU_KEY_AS_CAPSLOCK = 8192,
|
USE_JAPANESE_EISUU_KEY_AS_CAPSLOCK = 8192,
|
||||||
USE_2K_COORDINATES = 16384,
|
USE_2K_COORDINATES = 16384,
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeOption)
|
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeOption)*/
|
||||||
|
|
||||||
struct OrbisImeKeyboardParam {
|
struct OrbisImeKeyboardParam {
|
||||||
OrbisImeKeyboardOption option;
|
OrbisImeKeyboardOption option;
|
||||||
|
@ -53,17 +55,17 @@ struct OrbisImeKeyboardParam {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OrbisImeParam {
|
struct OrbisImeParam {
|
||||||
s32 user_id;
|
s32 user_id; // Todo: switch to OrbisUserServiceUserId
|
||||||
OrbisImeType type;
|
OrbisImeType type;
|
||||||
u64 supported_languages;
|
u64 supported_languages; // OrbisImeLanguage flags
|
||||||
OrbisImeEnterLabel enter_label;
|
OrbisImeEnterLabel enter_label;
|
||||||
OrbisImeInputMethod input_method;
|
OrbisImeInputMethod input_method;
|
||||||
OrbisImeTextFilter filter;
|
OrbisImeTextFilter filter;
|
||||||
OrbisImeOption option;
|
OrbisImeOption option;
|
||||||
u32 maxTextLength;
|
u32 maxTextLength;
|
||||||
char16_t* inputTextBuffer;
|
char16_t* inputTextBuffer;
|
||||||
float posx;
|
f32 posx;
|
||||||
float posy;
|
f32 posy;
|
||||||
OrbisImeHorizontalAlignment horizontal_alignment;
|
OrbisImeHorizontalAlignment horizontal_alignment;
|
||||||
OrbisImeVerticalAlignment vertical_alignment;
|
OrbisImeVerticalAlignment vertical_alignment;
|
||||||
void* work;
|
void* work;
|
||||||
|
@ -106,7 +108,7 @@ s32 PS4_SYSV_ABI sceImeKeyboardOpen(s32 userId, const OrbisImeKeyboardParam* par
|
||||||
int PS4_SYSV_ABI sceImeKeyboardOpenInternal();
|
int PS4_SYSV_ABI sceImeKeyboardOpenInternal();
|
||||||
int PS4_SYSV_ABI sceImeKeyboardSetMode();
|
int PS4_SYSV_ABI sceImeKeyboardSetMode();
|
||||||
int PS4_SYSV_ABI sceImeKeyboardUpdate();
|
int PS4_SYSV_ABI sceImeKeyboardUpdate();
|
||||||
s32 PS4_SYSV_ABI sceImeOpen(const OrbisImeParam* param, const void* extended);
|
s32 PS4_SYSV_ABI sceImeOpen(const OrbisImeParam* param, const OrbisImeParamExtended* extended);
|
||||||
int PS4_SYSV_ABI sceImeOpenInternal();
|
int PS4_SYSV_ABI sceImeOpenInternal();
|
||||||
void PS4_SYSV_ABI sceImeParamInit(OrbisImeParam* param);
|
void PS4_SYSV_ABI sceImeParamInit(OrbisImeParam* param);
|
||||||
int PS4_SYSV_ABI sceImeSetCandidateIndex();
|
int PS4_SYSV_ABI sceImeSetCandidateIndex();
|
||||||
|
|
|
@ -3,9 +3,108 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/enum.h"
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
#include "core/libraries/rtc/rtc.h"
|
#include "core/libraries/rtc/rtc.h"
|
||||||
|
|
||||||
|
/* Moved from ime_dialog.h */
|
||||||
|
enum class Error : u32 {
|
||||||
|
OK = 0x0,
|
||||||
|
BUSY = 0x80bc0001,
|
||||||
|
NOT_OPENED = 0x80bc0002,
|
||||||
|
NO_MEMORY = 0x80bc0003,
|
||||||
|
CONNECTION_FAILED = 0x80bc0004,
|
||||||
|
TOO_MANY_REQUESTS = 0x80bc0005,
|
||||||
|
INVALID_TEXT = 0x80bc0006,
|
||||||
|
EVENT_OVERFLOW = 0x80bc0007,
|
||||||
|
NOT_ACTIVE = 0x80bc0008,
|
||||||
|
IME_SUSPENDING = 0x80bc0009,
|
||||||
|
DEVICE_IN_USE = 0x80bc000a,
|
||||||
|
INVALID_USER_ID = 0x80bc0010,
|
||||||
|
INVALID_TYPE = 0x80bc0011,
|
||||||
|
INVALID_SUPPORTED_LANGUAGES = 0x80bc0012,
|
||||||
|
INVALID_ENTER_LABEL = 0x80bc0013,
|
||||||
|
INVALID_INPUT_METHOD = 0x80bc0014,
|
||||||
|
INVALID_OPTION = 0x80bc0015,
|
||||||
|
INVALID_MAX_TEXT_LENGTH = 0x80bc0016,
|
||||||
|
INVALID_INPUT_TEXT_BUFFER = 0x80bc0017,
|
||||||
|
INVALID_POSX = 0x80bc0018,
|
||||||
|
INVALID_POSY = 0x80bc0019,
|
||||||
|
INVALID_HORIZONTALIGNMENT = 0x80bc001a,
|
||||||
|
INVALID_VERTICALALIGNMENT = 0x80bc001b,
|
||||||
|
INVALID_EXTENDED = 0x80bc001c,
|
||||||
|
INVALID_KEYBOARD_TYPE = 0x80bc001d,
|
||||||
|
INVALID_WORK = 0x80bc0020,
|
||||||
|
INVALID_ARG = 0x80bc0021,
|
||||||
|
INVALID_HANDLER = 0x80bc0022,
|
||||||
|
NO_RESOURCE_ID = 0x80bc0023,
|
||||||
|
INVALID_MODE = 0x80bc0024,
|
||||||
|
INVALID_PARAM = 0x80bc0030,
|
||||||
|
INVALID_ADDRESS = 0x80bc0031,
|
||||||
|
INVALID_RESERVED = 0x80bc0032,
|
||||||
|
INVALID_TIMING = 0x80bc0033,
|
||||||
|
INTERNAL = 0x80bc00ff,
|
||||||
|
DIALOG_INVALID_TITLE = 0x80bc0101,
|
||||||
|
DIALOG_NOT_RUNNING = 0x80bc0105,
|
||||||
|
DIALOG_NOT_FINISHED = 0x80bc0106,
|
||||||
|
DIALOG_NOT_IN_USE = 0x80bc0107
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Moved from ime.h */
|
||||||
|
enum class OrbisImeOption : u32 {
|
||||||
|
DEFAULT = 0,
|
||||||
|
MULTILINE = 1,
|
||||||
|
NO_AUTO_CAPITALIZATION = 2,
|
||||||
|
PASSWORD = 4,
|
||||||
|
LANGUAGES_FORCED = 8,
|
||||||
|
EXT_KEYBOARD = 16,
|
||||||
|
NO_LEARNING = 32,
|
||||||
|
FIXED_POSITION = 64,
|
||||||
|
DISABLE_COPY_PASTE = 128, // Source: psOff
|
||||||
|
DISABLE_RESUME = 256,
|
||||||
|
DISABLE_AUTO_SPACE = 512,
|
||||||
|
DISABLE_POSITION_ADJUSTMENT = 2048,
|
||||||
|
EXPANDED_PREEDIT_BUFFER = 4096,
|
||||||
|
USE_JAPANESE_EISUU_KEY_AS_CAPSLOCK = 8192,
|
||||||
|
USE_2K_COORDINATES = 16384,
|
||||||
|
};
|
||||||
|
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeOption);
|
||||||
|
|
||||||
|
/* Source: psOff */
|
||||||
|
enum class OrbisImeLanguage : u64 {
|
||||||
|
DANISH = 0x0000000000000001,
|
||||||
|
GERMAN = 0x0000000000000002,
|
||||||
|
ENGLISH_US = 0x0000000000000004,
|
||||||
|
SPANISH = 0x0000000000000008,
|
||||||
|
FRENCH = 0x0000000000000010,
|
||||||
|
ITALIAN = 0x0000000000000020,
|
||||||
|
DUTCH = 0x0000000000000040ULL,
|
||||||
|
NORWEGIAN = 0x0000000000000080,
|
||||||
|
POLISH = 0x0000000000000100,
|
||||||
|
PORTUGUESE_PT = 0x0000000000000200,
|
||||||
|
RUSSIAN = 0x0000000000000400,
|
||||||
|
FINNISH = 0x0000000000000800,
|
||||||
|
SWEDISH = 0x0000000000001000,
|
||||||
|
JAPANESE = 0x0000000000002000,
|
||||||
|
KOREAN = 0x0000000000004000,
|
||||||
|
SIMPLIFIED_CHINESE = 0x0000000000008000,
|
||||||
|
TRADITIONAL_CHINESE = 0x0000000000010000,
|
||||||
|
PORTUGUESE_BR = 0x0000000000020000,
|
||||||
|
ENGLISH_GB = 0x0000000000040000,
|
||||||
|
TURKISH = 0x0000000000080000,
|
||||||
|
SPANISH_LA = 0x0000000000100000,
|
||||||
|
ARABIC = 0x0000000001000000ULL,
|
||||||
|
FRENCH_CA = 0x0000000002000000,
|
||||||
|
THAI = 0x0000000004000000,
|
||||||
|
CZECH = 0x0000000008000000,
|
||||||
|
GREEK = 0x0000000010000000,
|
||||||
|
INDONESIAN = 0x0000000020000000,
|
||||||
|
VIETNAMESE = 0x0000000040000000,
|
||||||
|
ROMANIAN = 0x0000000080000000,
|
||||||
|
HUNGARIAN = 0x0000000100000000,
|
||||||
|
};
|
||||||
|
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeLanguage);
|
||||||
|
|
||||||
enum class OrbisImeType : u32 {
|
enum class OrbisImeType : u32 {
|
||||||
Default = 0,
|
Default = 0,
|
||||||
BasicLatin = 1,
|
BasicLatin = 1,
|
||||||
|
@ -41,6 +140,7 @@ enum class OrbisImeEventId : u32 {
|
||||||
Open = 0,
|
Open = 0,
|
||||||
UpdateText = 1,
|
UpdateText = 1,
|
||||||
UpdateCaret = 2,
|
UpdateCaret = 2,
|
||||||
|
ChangeSize = 3, // Source: psOff
|
||||||
PressClose = 4,
|
PressClose = 4,
|
||||||
PressEnter = 5,
|
PressEnter = 5,
|
||||||
Abort = 6,
|
Abort = 6,
|
||||||
|
@ -51,6 +151,10 @@ enum class OrbisImeEventId : u32 {
|
||||||
CandidateDone = 11,
|
CandidateDone = 11,
|
||||||
CandidateCancel = 12,
|
CandidateCancel = 12,
|
||||||
ChangeDevice = 14,
|
ChangeDevice = 14,
|
||||||
|
JumpToNextObject = 15, // Source: psOff
|
||||||
|
JumpToBeforeObject = 16, // Source: psOff
|
||||||
|
ChangeWindowType = 17, // Source: psOff
|
||||||
|
|
||||||
ChangeInputMethodState = 18,
|
ChangeInputMethodState = 18,
|
||||||
|
|
||||||
KeyboardOpen = 256,
|
KeyboardOpen = 256,
|
||||||
|
@ -110,6 +214,14 @@ enum class OrbisImeDeviceType : u32 {
|
||||||
RemoteOsk = 3,
|
RemoteOsk = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Moved from ime_dialog.h */
|
||||||
|
enum class OrbisImePanelPriority : u32 {
|
||||||
|
Default = 0,
|
||||||
|
Alphabet = 1,
|
||||||
|
Symbol = 2,
|
||||||
|
Accent = 3,
|
||||||
|
};
|
||||||
|
|
||||||
struct OrbisImeRect {
|
struct OrbisImeRect {
|
||||||
f32 x;
|
f32 x;
|
||||||
f32 y;
|
f32 y;
|
||||||
|
@ -117,8 +229,24 @@ struct OrbisImeRect {
|
||||||
u32 height;
|
u32 height;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Moved from ime_dialog.h */
|
||||||
|
struct OrbisImeColor {
|
||||||
|
u8 r;
|
||||||
|
u8 g;
|
||||||
|
u8 b;
|
||||||
|
u8 a;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Source: psOff */
|
||||||
|
enum class OrbisImeTextAreaMode : u32 {
|
||||||
|
Disable = 0,
|
||||||
|
Edit = 1,
|
||||||
|
Preedit = 2,
|
||||||
|
Select = 3,
|
||||||
|
};
|
||||||
|
|
||||||
struct OrbisImeTextAreaProperty {
|
struct OrbisImeTextAreaProperty {
|
||||||
u32 mode; // OrbisImeTextAreaMode
|
OrbisImeTextAreaMode mode;
|
||||||
u32 index;
|
u32 index;
|
||||||
s32 length;
|
s32 length;
|
||||||
};
|
};
|
||||||
|
@ -135,14 +263,14 @@ struct OrbisImeKeycode {
|
||||||
char16_t character;
|
char16_t character;
|
||||||
u32 status;
|
u32 status;
|
||||||
OrbisImeKeyboardType type;
|
OrbisImeKeyboardType type;
|
||||||
s32 user_id;
|
s32 user_id; // Todo: switch to OrbisUserServiceUserId
|
||||||
u32 resource_id;
|
u32 resource_id;
|
||||||
Libraries::Rtc::OrbisRtcTick timestamp;
|
Libraries::Rtc::OrbisRtcTick timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OrbisImeKeyboardResourceIdArray {
|
struct OrbisImeKeyboardResourceIdArray {
|
||||||
s32 userId;
|
s32 user_id; // Todo: switch to OrbisUserServiceUserId
|
||||||
u32 resourceId[5];
|
u32 resource_id[5];
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class OrbisImeCaretMovementDirection : u32 {
|
enum class OrbisImeCaretMovementDirection : u32 {
|
||||||
|
@ -159,6 +287,42 @@ enum class OrbisImeCaretMovementDirection : u32 {
|
||||||
Bottom = 10,
|
Bottom = 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Source: psOff */
|
||||||
|
enum class OrbisImePanelType : u32 {
|
||||||
|
Hide = 0,
|
||||||
|
Osk = 1,
|
||||||
|
Dialog = 2,
|
||||||
|
Candidate = 3,
|
||||||
|
Edit = 4,
|
||||||
|
EditAndCandidate = 5,
|
||||||
|
Accessibility = 6,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Moved from ime_dialog.h */
|
||||||
|
using OrbisImeExtKeyboardFilter = PS4_SYSV_ABI int (*)(const OrbisImeKeycode* srcKeycode,
|
||||||
|
u16* outKeycode, u32* outStatus,
|
||||||
|
void* reserved);
|
||||||
|
|
||||||
|
/* Moved from ime_dialog.h */
|
||||||
|
struct OrbisImeParamExtended {
|
||||||
|
u32 option; // OrbisImeExtOption flags
|
||||||
|
OrbisImeColor color_base;
|
||||||
|
OrbisImeColor color_line;
|
||||||
|
OrbisImeColor color_text_field;
|
||||||
|
OrbisImeColor color_preedit;
|
||||||
|
OrbisImeColor color_button_default;
|
||||||
|
OrbisImeColor color_button_function;
|
||||||
|
OrbisImeColor color_button_symbol;
|
||||||
|
OrbisImeColor color_text;
|
||||||
|
OrbisImeColor color_special;
|
||||||
|
OrbisImePanelPriority priority;
|
||||||
|
char* additional_dictionary_path;
|
||||||
|
OrbisImeExtKeyboardFilter ext_keyboard_filter;
|
||||||
|
u32 disable_device;
|
||||||
|
u32 ext_keyboard_mode;
|
||||||
|
s8 reserved[60];
|
||||||
|
};
|
||||||
|
|
||||||
union OrbisImeEventParam {
|
union OrbisImeEventParam {
|
||||||
OrbisImeRect rect;
|
OrbisImeRect rect;
|
||||||
OrbisImeEditText text;
|
OrbisImeEditText text;
|
||||||
|
@ -168,6 +332,7 @@ union OrbisImeEventParam {
|
||||||
char16_t* candidate_word;
|
char16_t* candidate_word;
|
||||||
s32 candidate_index;
|
s32 candidate_index;
|
||||||
OrbisImeDeviceType device_type;
|
OrbisImeDeviceType device_type;
|
||||||
|
OrbisImePanelType panel_type; // Source: psOff
|
||||||
u32 input_method_state;
|
u32 input_method_state;
|
||||||
s8 reserved[64];
|
s8 reserved[64];
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,19 +20,19 @@ static OrbisImeDialogResult g_ime_dlg_result{};
|
||||||
static ImeDialogState g_ime_dlg_state{};
|
static ImeDialogState g_ime_dlg_state{};
|
||||||
static ImeDialogUi g_ime_dlg_ui;
|
static ImeDialogUi g_ime_dlg_ui;
|
||||||
|
|
||||||
static bool IsValidOption(OrbisImeDialogOption option, OrbisImeType type) {
|
static bool IsValidOption(OrbisImeOption option, OrbisImeType type) {
|
||||||
if (False(~option &
|
if (False(~option & (OrbisImeOption::MULTILINE |
|
||||||
(OrbisImeDialogOption::Multiline | OrbisImeDialogOption::NoAutoCompletion))) {
|
OrbisImeOption::NO_AUTO_CAPITALIZATION /* NoAutoCompletion */))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (True(option & OrbisImeDialogOption::Multiline) && type != OrbisImeType::Default &&
|
if (True(option & OrbisImeOption::MULTILINE) && type != OrbisImeType::Default &&
|
||||||
type != OrbisImeType::BasicLatin) {
|
type != OrbisImeType::BasicLatin) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (True(option & OrbisImeDialogOption::NoAutoCompletion) && type != OrbisImeType::Number &&
|
if (True(option & OrbisImeOption::NO_AUTO_CAPITALIZATION /* NoAutoCompletion */) &&
|
||||||
type != OrbisImeType::BasicLatin) {
|
type != OrbisImeType::Number && type != OrbisImeType::BasicLatin) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ Error PS4_SYSV_ABI sceImeDialogGetPanelSize(const OrbisImeDialogParam* param, u3
|
||||||
case OrbisImeType::Url:
|
case OrbisImeType::Url:
|
||||||
case OrbisImeType::Mail:
|
case OrbisImeType::Mail:
|
||||||
*width = 500; // original: 793
|
*width = 500; // original: 793
|
||||||
if (True(param->option & OrbisImeDialogOption::Multiline)) {
|
if (True(param->option & OrbisImeOption::MULTILINE)) {
|
||||||
*height = 300; // original: 576
|
*height = 300; // original: 576
|
||||||
} else {
|
} else {
|
||||||
*height = 150; // original: 476
|
*height = 150; // original: 476
|
||||||
|
@ -168,15 +168,13 @@ Error PS4_SYSV_ABI sceImeDialogInit(OrbisImeDialogParam* param, OrbisImeParamExt
|
||||||
// TODO: do correct param->supportedLanguages validation
|
// TODO: do correct param->supportedLanguages validation
|
||||||
|
|
||||||
if (param->posx < 0.0f ||
|
if (param->posx < 0.0f ||
|
||||||
param->posx >=
|
param->posx >= MAX_X_POSITIONS[False(param->option & OrbisImeOption::USE_2K_COORDINATES)]) {
|
||||||
MAX_X_POSITIONS[False(param->option & OrbisImeDialogOption::LargeResolution)]) {
|
|
||||||
LOG_INFO(Lib_ImeDialog, "Invalid param->posx");
|
LOG_INFO(Lib_ImeDialog, "Invalid param->posx");
|
||||||
return Error::INVALID_POSX;
|
return Error::INVALID_POSX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param->posy < 0.0f ||
|
if (param->posy < 0.0f ||
|
||||||
param->posy >=
|
param->posy >= MAX_Y_POSITIONS[False(param->option & OrbisImeOption::USE_2K_COORDINATES)]) {
|
||||||
MAX_Y_POSITIONS[False(param->option & OrbisImeDialogOption::LargeResolution)]) {
|
|
||||||
LOG_INFO(Lib_ImeDialog, "Invalid param->posy");
|
LOG_INFO(Lib_ImeDialog, "Invalid param->posy");
|
||||||
return Error::INVALID_POSY;
|
return Error::INVALID_POSY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ namespace Libraries::ImeDialog {
|
||||||
|
|
||||||
constexpr u32 ORBIS_IME_DIALOG_MAX_TEXT_LENGTH = 2048;
|
constexpr u32 ORBIS_IME_DIALOG_MAX_TEXT_LENGTH = 2048;
|
||||||
|
|
||||||
enum class Error : u32 {
|
/*Needed for both, Ime & ImeDialog, so, move to ime_common.h*/
|
||||||
|
/* enum class Error : u32 {
|
||||||
OK = 0x0,
|
OK = 0x0,
|
||||||
BUSY = 0x80bc0001,
|
BUSY = 0x80bc0001,
|
||||||
NOT_OPENED = 0x80bc0002,
|
NOT_OPENED = 0x80bc0002,
|
||||||
|
@ -55,7 +56,7 @@ enum class Error : u32 {
|
||||||
DIALOG_NOT_RUNNING = 0x80bc0105,
|
DIALOG_NOT_RUNNING = 0x80bc0105,
|
||||||
DIALOG_NOT_FINISHED = 0x80bc0106,
|
DIALOG_NOT_FINISHED = 0x80bc0106,
|
||||||
DIALOG_NOT_IN_USE = 0x80bc0107,
|
DIALOG_NOT_IN_USE = 0x80bc0107,
|
||||||
};
|
};*/
|
||||||
|
|
||||||
enum class OrbisImeDialogStatus : u32 {
|
enum class OrbisImeDialogStatus : u32 {
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@ -69,7 +70,8 @@ enum class OrbisImeDialogEndStatus : u32 {
|
||||||
Aborted = 2,
|
Aborted = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class OrbisImeDialogOption : u32 {
|
/*OrbisImeOption flags must be used instead, so just remove it*/
|
||||||
|
/* enum class OrbisImeDialogOption : u32 {
|
||||||
Default = 0,
|
Default = 0,
|
||||||
Multiline = 1,
|
Multiline = 1,
|
||||||
NoAutoCorrection = 2,
|
NoAutoCorrection = 2,
|
||||||
|
@ -77,28 +79,31 @@ enum class OrbisImeDialogOption : u32 {
|
||||||
// TODO: Document missing options
|
// TODO: Document missing options
|
||||||
LargeResolution = 1024,
|
LargeResolution = 1024,
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeDialogOption)
|
DECLARE_ENUM_FLAG_OPERATORS(OrbisImeDialogOption)*/
|
||||||
|
|
||||||
enum class OrbisImePanelPriority : u32 {
|
/*Needed for both, Ime & ImeDialog, so, move to ime_common.h*/
|
||||||
|
/* enum class OrbisImePanelPriority : u32 {
|
||||||
Default = 0,
|
Default = 0,
|
||||||
Alphabet = 1,
|
Alphabet = 1,
|
||||||
Symbol = 2,
|
Symbol = 2,
|
||||||
Accent = 3,
|
Accent = 3,
|
||||||
};
|
};*/
|
||||||
|
|
||||||
struct OrbisImeColor {
|
/*Needed for both, Ime & ImeDialog, so, move to ime_common.h*/
|
||||||
|
/* struct OrbisImeColor {
|
||||||
u8 r;
|
u8 r;
|
||||||
u8 g;
|
u8 g;
|
||||||
u8 b;
|
u8 b;
|
||||||
u8 a;
|
u8 a;
|
||||||
};
|
};*/
|
||||||
|
|
||||||
struct OrbisImeDialogResult {
|
struct OrbisImeDialogResult {
|
||||||
OrbisImeDialogEndStatus endstatus;
|
OrbisImeDialogEndStatus endstatus;
|
||||||
s32 reserved[12];
|
s32 reserved[12];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OrbisImeKeycode {
|
/*Already defined in ime_common.h, so remove from here*/
|
||||||
|
/* struct OrbisImeKeycode {
|
||||||
u16 keycode;
|
u16 keycode;
|
||||||
char16_t character;
|
char16_t character;
|
||||||
u32 status;
|
u32 status;
|
||||||
|
@ -106,24 +111,25 @@ struct OrbisImeKeycode {
|
||||||
s32 user_id;
|
s32 user_id;
|
||||||
u32 resource_id;
|
u32 resource_id;
|
||||||
u64 timestamp;
|
u64 timestamp;
|
||||||
};
|
};*/
|
||||||
|
|
||||||
using OrbisImeExtKeyboardFilter = PS4_SYSV_ABI int (*)(const OrbisImeKeycode* srcKeycode,
|
/*Needed for both, Ime & ImeDialog, so, move to ime_common.h*/
|
||||||
|
/*using OrbisImeExtKeyboardFilter = PS4_SYSV_ABI int (*)(const OrbisImeKeycode* srcKeycode,
|
||||||
u16* outKeycode, u32* outStatus,
|
u16* outKeycode, u32* outStatus,
|
||||||
void* reserved);
|
void* reserved);*/
|
||||||
|
|
||||||
struct OrbisImeDialogParam {
|
struct OrbisImeDialogParam {
|
||||||
s32 user_id;
|
s32 user_id;
|
||||||
OrbisImeType type;
|
OrbisImeType type;
|
||||||
u64 supported_languages;
|
u64 supported_languages; // OrbisImeLanguage flags
|
||||||
OrbisImeEnterLabel enter_label;
|
OrbisImeEnterLabel enter_label;
|
||||||
OrbisImeInputMethod input_method;
|
OrbisImeInputMethod input_method;
|
||||||
OrbisImeTextFilter filter;
|
OrbisImeTextFilter filter;
|
||||||
OrbisImeDialogOption option;
|
OrbisImeOption option; // it uses OrbisImeOption flags, so, OrbisImeDialogOption not exists
|
||||||
u32 max_text_length;
|
u32 max_text_length;
|
||||||
char16_t* input_text_buffer;
|
char16_t* input_text_buffer;
|
||||||
float posx;
|
f32 posx;
|
||||||
float posy;
|
f32 posy;
|
||||||
OrbisImeHorizontalAlignment horizontal_alignment;
|
OrbisImeHorizontalAlignment horizontal_alignment;
|
||||||
OrbisImeVerticalAlignment vertical_alignment;
|
OrbisImeVerticalAlignment vertical_alignment;
|
||||||
const char16_t* placeholder;
|
const char16_t* placeholder;
|
||||||
|
@ -131,8 +137,9 @@ struct OrbisImeDialogParam {
|
||||||
s8 reserved[16];
|
s8 reserved[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OrbisImeParamExtended {
|
/*Needed for both, Ime & ImeDialog, so, move to ime_common.h*/
|
||||||
u32 option; // OrbisImeDialogOptionExtended
|
/* struct OrbisImeParamExtended {
|
||||||
|
u32 option; // OrbisImeOptionExtended
|
||||||
OrbisImeColor color_base;
|
OrbisImeColor color_base;
|
||||||
OrbisImeColor color_line;
|
OrbisImeColor color_line;
|
||||||
OrbisImeColor color_text_field;
|
OrbisImeColor color_text_field;
|
||||||
|
@ -145,10 +152,10 @@ struct OrbisImeParamExtended {
|
||||||
OrbisImePanelPriority priority;
|
OrbisImePanelPriority priority;
|
||||||
char* additional_dictionary_path;
|
char* additional_dictionary_path;
|
||||||
OrbisImeExtKeyboardFilter ext_keyboard_filter;
|
OrbisImeExtKeyboardFilter ext_keyboard_filter;
|
||||||
uint32_t disable_device;
|
u32 disable_device;
|
||||||
uint32_t ext_keyboard_mode;
|
u32 ext_keyboard_mode;
|
||||||
int8_t reserved[60];
|
s8 reserved[60];
|
||||||
};
|
};*/
|
||||||
|
|
||||||
Error PS4_SYSV_ABI sceImeDialogAbort();
|
Error PS4_SYSV_ABI sceImeDialogAbort();
|
||||||
Error PS4_SYSV_ABI sceImeDialogForceClose();
|
Error PS4_SYSV_ABI sceImeDialogForceClose();
|
||||||
|
|
|
@ -26,7 +26,7 @@ ImeDialogState::ImeDialogState(const OrbisImeDialogParam* param,
|
||||||
}
|
}
|
||||||
|
|
||||||
user_id = param->user_id;
|
user_id = param->user_id;
|
||||||
is_multi_line = True(param->option & OrbisImeDialogOption::Multiline);
|
is_multi_line = True(param->option & OrbisImeOption::MULTILINE);
|
||||||
is_numeric = param->type == OrbisImeType::Number;
|
is_numeric = param->type == OrbisImeType::Number;
|
||||||
type = param->type;
|
type = param->type;
|
||||||
enter_label = param->enter_label;
|
enter_label = param->enter_label;
|
||||||
|
|
|
@ -199,7 +199,7 @@ int ImeUi::InputTextCallback(ImGuiInputTextCallbackData* data) {
|
||||||
eventParam.caret_index = data->CursorPos;
|
eventParam.caret_index = data->CursorPos;
|
||||||
eventParam.area_num = 1;
|
eventParam.area_num = 1;
|
||||||
|
|
||||||
eventParam.text_area[0].mode = 1; // Edit mode
|
eventParam.text_area[0].mode = OrbisImeTextAreaMode::Edit;
|
||||||
eventParam.text_area[0].index = data->CursorPos;
|
eventParam.text_area[0].index = data->CursorPos;
|
||||||
eventParam.text_area[0].length = data->BufTextLen;
|
eventParam.text_area[0].length = data->BufTextLen;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue