From c3e4b6da464e787276854ab79c19ceb1c0c5108b Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 10 Feb 2023 03:35:47 +0100 Subject: [PATCH] cellPad: allow opening the home menu with ldd pads Speculative --- rpcs3/Emu/Io/pad_types.h | 5 +++++ rpcs3/Input/pad_thread.cpp | 18 +++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/Io/pad_types.h b/rpcs3/Emu/Io/pad_types.h index 0292476d37..d77df63f33 100644 --- a/rpcs3/Emu/Io/pad_types.h +++ b/rpcs3/Emu/Io/pad_types.h @@ -52,6 +52,11 @@ enum Digital2Flags : u32 CELL_PAD_CTRL_PS = 0x00000100, // Speculative }; +enum +{ + CELL_PAD_CTRL_LDD_PS = 0x00000001 +}; + enum DeviceCapability { CELL_PAD_CAPABILITY_PS3_CONFORMITY = 0x00000001, // PS3 Conformity Controller diff --git a/rpcs3/Input/pad_thread.cpp b/rpcs3/Input/pad_thread.cpp index 26e1fae37e..7c82c49897 100644 --- a/rpcs3/Input/pad_thread.cpp +++ b/rpcs3/Input/pad_thread.cpp @@ -422,21 +422,29 @@ void pad_thread::operator()() if (!(pad->m_port_status & CELL_PAD_STATUS_CONNECTED)) continue; + // Check if an LDD pad pressed the PS button (bit 0 of the first button) + if (pad->ldd && !!(static_cast>(pad->ldd_data[sizeof(be_t)]) & CELL_PAD_CTRL_LDD_PS)) + { + ps_button_pressed = true; + break; + } + for (const auto& button : pad->m_buttons) { if (button.m_offset == CELL_PAD_BTN_OFFSET_DIGITAL2 && button.m_outKeyCode == CELL_PAD_CTRL_PS && button.m_pressed) { - // Make sure we call this function only once per button press - if (!m_ps_button_pressed) - { - open_home_menu(); - } ps_button_pressed = true; break; } } } + // Make sure we call this function only once per button press + if (ps_button_pressed && !m_ps_button_pressed) + { + open_home_menu(); + } + m_ps_button_pressed = ps_button_pressed; }