From a7d90852dd02efcceb539968667201dbc9799cb0 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 18 Jul 2026 18:21:25 +0200 Subject: [PATCH] pad settings: Fix for clearing bindings Fix accidentally clearing a binding during remap if the same button is assigned to rightclick in the pad navigation. Only allow clearing a binding on release if the same button was also pressed while no remapping occured. --- rpcs3/Emu/Cell/PPUThread.cpp | 1 - rpcs3/rpcs3qt/pad_settings_dialog.cpp | 16 +++++++++++++--- rpcs3/rpcs3qt/pad_settings_dialog.h | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index c5ec1e929d..a6703ae345 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -5486,7 +5486,6 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_s { usz index = umax; - #ifdef __APPLE__ named_thread sym_worker("PPU Symbol Resolver", [&]() { diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index 3cc15b7528..45409d03f4 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -1173,13 +1173,19 @@ bool pad_settings_dialog::eventFilter(QObject* object, QEvent* event) { switch (event->type()) { + case QEvent::MouseButtonPress: + { + // Save object on rightclick if we are not remapping a button in order to allow clearing a binding + m_clear_binding_object = (m_button_id == button_ids::id_pad_begin && static_cast(event)->button() == Qt::RightButton) ? object : nullptr; + break; + } case QEvent::MouseButtonRelease: { // On right click clear binding if we are not remapping pad button - if (m_button_id == button_ids::id_pad_begin) + // Only allow clearing a binding if the same object was also pressed while we were not remapping + if (m_button_id == button_ids::id_pad_begin && static_cast(event)->button() == Qt::RightButton && m_clear_binding_object == object) { - QMouseEvent* mouse_event = static_cast(event); - if (const auto button = qobject_cast(object); button && button->isEnabled() && mouse_event->button() == Qt::RightButton) + if (const auto button = qobject_cast(object); button && button->isEnabled()) { if (const int button_id = m_pad_buttons->id(button); m_cfg_entries.contains(button_id)) { @@ -1482,6 +1488,10 @@ void pad_settings_dialog::OnPadButtonClicked(int id) m_last_pos = QCursor::pos(); m_button_id = id; + + // Disable clearing of a binding while we are remapping a button + m_clear_binding_object = nullptr; + if (auto button = m_pad_buttons->button(m_button_id)) { button->setText(tr("[ Waiting %1 ]").arg(MAX_SECONDS)); diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.h b/rpcs3/rpcs3qt/pad_settings_dialog.h index c917f82ffa..936ee7663e 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.h +++ b/rpcs3/rpcs3qt/pad_settings_dialog.h @@ -132,6 +132,8 @@ private: std::string m_title_id; std::shared_ptr m_gui_settings; + QObject* m_clear_binding_object = nullptr; + // Tooltips QString m_description; QHash m_descriptions;