diff --git a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp index e8168bc6e3..05a6a0d4a1 100644 --- a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp @@ -57,7 +57,7 @@ void osk_info::reset() dlg.reset(); valid_text = {}; use_separate_windows = false; - lock_ext_input = false; + lock_ext_input_device = false; device_mask = 0; input_field_window_width = 0; input_field_background_transparency = 1.0f; @@ -578,7 +578,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr dia }; // Set device mask and event lock - osk->ignore_input_events = info.lock_ext_input.load(); + osk->ignore_device_events = info.lock_ext_input_device.load(); osk->input_device = info.initial_input_device.load(); osk->continuous_mode = info.osk_continuous_mode.load(); @@ -882,7 +882,7 @@ error_code cellOskDialogSetSeparateWindowOption(vm::ptrget().lock_ext_input = true; + g_fxo->get().lock_ext_input_device = true; if (const auto osk = _get_osk_dialog(false)) { - osk->ignore_input_events = true; + osk->ignore_device_events = true; } return CELL_OK; @@ -1132,11 +1132,11 @@ error_code cellOskDialogExtInputDeviceUnlock() { cellOskDialog.warning("cellOskDialogExtInputDeviceUnlock()"); - g_fxo->get().lock_ext_input = false; + g_fxo->get().lock_ext_input_device = false; if (const auto osk = _get_osk_dialog(false)) { - osk->ignore_input_events = false; + osk->ignore_device_events = false; } return CELL_OK; diff --git a/rpcs3/Emu/Cell/Modules/cellOskDialog.h b/rpcs3/Emu/Cell/Modules/cellOskDialog.h index 628bf6f7d4..682b195589 100644 --- a/rpcs3/Emu/Cell/Modules/cellOskDialog.h +++ b/rpcs3/Emu/Cell/Modules/cellOskDialog.h @@ -315,10 +315,10 @@ public: atomic_t state{ OskDialogState::Unloaded }; atomic_t continuous_mode{ CELL_OSKDIALOG_CONTINUOUS_MODE_NONE }; atomic_t input_device{ CELL_OSKDIALOG_INPUT_DEVICE_PAD }; // The current input device. - atomic_t pad_input_enabled{ true }; // Determines if the OSK consumes the device's events. - atomic_t mouse_input_enabled{ true }; // Determines if the OSK consumes the device's events. - atomic_t keyboard_input_enabled{ true }; // Determines if the OSK consumes the device's events. - atomic_t ignore_input_events{ false }; // Determines if the OSK ignores all consumed events. + atomic_t pad_input_enabled{ true }; // Determines if the OSK consumes the device's input. + atomic_t mouse_input_enabled{ true }; // Determines if the OSK consumes the device's input. + atomic_t keyboard_input_enabled{ true }; // Determines if the OSK consumes the device's input. + atomic_t ignore_device_events{ false }; // Determines if the OSK ignores device events. atomic_t osk_input_result{ CellOskDialogInputFieldResult::CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK }; char16_t osk_text[CELL_OSKDIALOG_STRING_SIZE]{}; @@ -333,7 +333,7 @@ struct osk_info atomic_t use_separate_windows = false; - atomic_t lock_ext_input = false; + atomic_t lock_ext_input_device = false; atomic_t device_mask = 0; // OSK ignores input from the specified devices. 0 means all devices can influence the OSK atomic_t input_field_window_width = 0; atomic_t input_field_background_transparency = 1.0f; diff --git a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp index d3156f859d..3f744aa123 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp @@ -555,15 +555,20 @@ namespace rsx void osk_dialog::on_button_pressed(pad_button button_press) { - if (!pad_input_enabled || ignore_input_events) + if (!pad_input_enabled) return; - if (input_device.exchange(CELL_OSKDIALOG_INPUT_DEVICE_PAD) != CELL_OSKDIALOG_INPUT_DEVICE_PAD) + if (!ignore_device_events && input_device.exchange(CELL_OSKDIALOG_INPUT_DEVICE_PAD) != CELL_OSKDIALOG_INPUT_DEVICE_PAD) { osk.notice("on_button_pressed: sending CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED with CELL_OSKDIALOG_INPUT_DEVICE_PAD"); sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED, CELL_OSKDIALOG_INPUT_DEVICE_PAD); } + if (input_device != CELL_OSKDIALOG_INPUT_DEVICE_PAD) + { + return; + } + // Always show the pad input panel if the pad is enabled and in use. if (!m_show_panel) { @@ -800,15 +805,20 @@ namespace rsx void osk_dialog::on_key_pressed(u32 led, u32 mkey, u32 key_code, u32 out_key_code, bool pressed, std::u32string key) { - if (!pressed || !keyboard_input_enabled || ignore_input_events) + if (!pressed || !keyboard_input_enabled) return; - if (input_device.exchange(CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD) != CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD) + if (!ignore_device_events && input_device.exchange(CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD) != CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD) { osk.notice("on_key_pressed: sending CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED with CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD"); sysutil_send_system_cmd(CELL_SYSUTIL_OSKDIALOG_INPUT_DEVICE_CHANGED, CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD); } + if (input_device != CELL_OSKDIALOG_INPUT_DEVICE_KEYBOARD) + { + return; + } + if (m_use_separate_windows && m_show_panel) { // Hide the pad input panel if the keyboard is in use during separate windows. diff --git a/rpcs3/Emu/RSX/Overlays/overlays.h b/rpcs3/Emu/RSX/Overlays/overlays.h index a78f14f1b4..d8aad90f5d 100644 --- a/rpcs3/Emu/RSX/Overlays/overlays.h +++ b/rpcs3/Emu/RSX/Overlays/overlays.h @@ -113,7 +113,7 @@ namespace rsx bool m_start_pad_interception = true; atomic_t m_stop_pad_interception = false; atomic_t thread_bits = 0; - bool m_keyboard_input_enabled = false; // Allow keyboard events + bool m_keyboard_input_enabled = false; // Allow keyboard input bool m_keyboard_pad_handler_active = true; // Initialized as true to prevent keyboard input until proven otherwise. bool m_allow_input_on_pause = false;