From fcdbf2b5c0867312a365194d0c03dded13b00ebd Mon Sep 17 00:00:00 2001 From: Greenlamp Date: Tue, 14 May 2024 19:41:11 +0200 Subject: [PATCH] fix stuck screen on unknwo button --- src/ui/settings/gamepad-binding-ui-handler.ts | 4 ++-- src/ui/settings/keyboard-binding-ui-handler.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/settings/gamepad-binding-ui-handler.ts b/src/ui/settings/gamepad-binding-ui-handler.ts index ca0b696dc..1ecd28fcd 100644 --- a/src/ui/settings/gamepad-binding-ui-handler.ts +++ b/src/ui/settings/gamepad-binding-ui-handler.ts @@ -18,12 +18,12 @@ export default class GamepadBindingUiHandler extends AbstractBindingUiHandler { const blacklist = [12, 13, 14, 15]; // d-pad buttons are blacklisted. // Check conditions before processing the button press. if (!this.listening || pad.id !== this.scene.inputController?.chosenGamepad || blacklist.includes(button.index) || this.buttonPressed !== null) return; - this.buttonPressed = button.index; const activeConfig = this.scene.inputController.getActiveConfig(); const type = activeConfig.padType - const key = getKeyFromMapping(activeConfig, this.buttonPressed); + const key = getKeyFromMapping(activeConfig, button.index); const buttonIcon = activeConfig.ogIcons[key]; if (!buttonIcon) return; + this.buttonPressed = button.index; const assignedButtonIcon = getKeyAndActionFromCurrentKeysWithSettingName(activeConfig, this.target)?.icon; this.onInputDown(buttonIcon, assignedButtonIcon, type); } diff --git a/src/ui/settings/keyboard-binding-ui-handler.ts b/src/ui/settings/keyboard-binding-ui-handler.ts index d2e0c792c..fd23fc5fe 100644 --- a/src/ui/settings/keyboard-binding-ui-handler.ts +++ b/src/ui/settings/keyboard-binding-ui-handler.ts @@ -18,11 +18,11 @@ export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler { const key = event.keyCode; // // Check conditions before processing the button press. if (!this.listening || this.buttonPressed !== null) return; - this.buttonPressed = key; const activeConfig = this.scene.inputController.getActiveKeyboardConfig(); const _key = getKeyFromMapping(activeConfig, key); const buttonIcon = activeConfig.ogIcons[_key]; if (!buttonIcon) return; + this.buttonPressed = key; const assignedButtonIcon = getKeyAndActionFromCurrentKeysWithSettingName(activeConfig, this.target)?.icon; this.onInputDown(buttonIcon, assignedButtonIcon, 'keyboard'); }