From 3d78c7f43a696a36c807810318f26e90b74fcaa6 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 18 Jan 2023 20:27:44 +0100 Subject: [PATCH] cellOskDialog: fix error check and improve initialKeyLayout logic --- rpcs3/Emu/Cell/Modules/cellOskDialog.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp index 2ccc04512d..1e8a32b3cf 100644 --- a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp @@ -65,10 +65,10 @@ struct osk_info atomic_t use_separate_windows = false; atomic_t lock_ext_input = false; - atomic_t device_mask = 0; // 0 means all devices can influence the OSK - atomic_t key_layout = CELL_OSKDIALOG_10KEY_PANEL; - atomic_t initial_key_layout = CELL_OSKDIALOG_INITIAL_PANEL_LAYOUT_SYSTEM; - atomic_t initial_input_device = CELL_OSKDIALOG_INPUT_DEVICE_PAD; + atomic_t device_mask = 0; // OSK ignores input from the specified devices. 0 means all devices can influence the OSK + atomic_t key_layout_options = CELL_OSKDIALOG_10KEY_PANEL; + atomic_t initial_key_layout = CELL_OSKDIALOG_INITIAL_PANEL_LAYOUT_SYSTEM; // TODO: use + atomic_t initial_input_device = CELL_OSKDIALOG_INPUT_DEVICE_PAD; // OSK at first only receives input from the initial device atomic_t clipboard_enabled = false; // For copy and paste atomic_t half_byte_kana_enabled = false; @@ -102,7 +102,7 @@ struct osk_info use_separate_windows = false; lock_ext_input = false; device_mask = 0; - key_layout = CELL_OSKDIALOG_10KEY_PANEL; + key_layout_options = CELL_OSKDIALOG_10KEY_PANEL; initial_key_layout = CELL_OSKDIALOG_INITIAL_PANEL_LAYOUT_SYSTEM; initial_input_device = CELL_OSKDIALOG_INPUT_DEVICE_PAD; clipboard_enabled = false; @@ -797,14 +797,17 @@ error_code cellOskDialogSetInitialKeyLayout(u32 initialKeyLayout) { cellOskDialog.todo("cellOskDialogSetInitialKeyLayout(initialKeyLayout=%d)", initialKeyLayout); - if (initialKeyLayout > (CELL_OSKDIALOG_INITIAL_PANEL_LAYOUT_10KEY | CELL_OSKDIALOG_INITIAL_PANEL_LAYOUT_FULLKEY)) + if (initialKeyLayout > CELL_OSKDIALOG_INITIAL_PANEL_LAYOUT_FULLKEY) { return CELL_OSKDIALOG_ERROR_PARAM; } - g_fxo->get().initial_key_layout = static_cast(initialKeyLayout); + auto& osk = g_fxo->get(); - // TODO: use initial_key_layout + if (osk.key_layout_options & initialKeyLayout) + { + osk.initial_key_layout = static_cast(initialKeyLayout); + } return CELL_OK; } @@ -827,9 +830,7 @@ error_code cellOskDialogSetKeyLayoutOption(u32 option) return CELL_OSKDIALOG_ERROR_PARAM; } - g_fxo->get().key_layout = option; - - // TODO: use key_layout + g_fxo->get().key_layout_options = option; return CELL_OK; }