From b91a58feab46ec3245f0857ae89782c799a5097d Mon Sep 17 00:00:00 2001 From: Olivia!! Date: Sun, 17 May 2026 15:45:08 +0200 Subject: [PATCH] Adds option to unbind using controller only (#1212) * Adds option to unbind using controller only * Adds a new cheat to let you transform from the start of the game, without Midna or the Shadow Crystal * Revert "Adds a new cheat to let you transform from the start of the game, without Midna or the Shadow Crystal" This reverts commit 51ed7367295a1cfc60be0adf2d16dcb84f2c0821. * Do not allow unbinding the A or B buttons to prevent softlocks when no other input sources are available (e.g. playing on a TV) * change 'and' to '&&' in accordance with code standards --- src/dusk/ui/controller_config.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/dusk/ui/controller_config.cpp b/src/dusk/ui/controller_config.cpp index 43b913b6a7..a0b2b6baa9 100644 --- a/src/dusk/ui/controller_config.cpp +++ b/src/dusk/ui/controller_config.cpp @@ -1033,6 +1033,12 @@ void ControllerConfigWindow::poll_pending_binding() { const s32 nativeButton = PADGetNativeButtonPressed(mPendingPort); if (nativeButton != -1) { const int completedPort = mPendingPort; + if (mPendingButtonMapping->nativeButton == static_cast(nativeButton) && + (mPendingButtonMapping->padButton != PAD_BUTTON_A && + mPendingButtonMapping->padButton != PAD_BUTTON_B)) { + unmap_pending_binding(); + return; + } mPendingButtonMapping->nativeButton = static_cast(nativeButton); finish_pending_binding(completedPort); } @@ -1043,6 +1049,10 @@ void ControllerConfigWindow::poll_pending_binding() { const PADSignedNativeAxis nativeAxis = PADGetNativeAxisPulled(mPendingPort); if (nativeAxis.nativeAxis != -1) { const int completedPort = mPendingPort; + if (mPendingAxisMapping->nativeAxis.nativeAxis == nativeAxis.nativeAxis) { + unmap_pending_binding(); + return; + } mPendingAxisMapping->nativeAxis = nativeAxis; mPendingAxisMapping->nativeButton = -1; finish_pending_binding(completedPort); @@ -1069,6 +1079,10 @@ void ControllerConfigWindow::poll_pending_binding() { if (button != -1) { const int completedPort = mPendingPort; + if (mPendingActionBinding->getValue() == button) { + unmap_pending_binding(); + return; + } mPendingActionBinding->setValue(button); config::Save(); finish_pending_binding(completedPort);