diff --git a/src/inputs-controller.ts b/src/inputs-controller.ts index 889f5bf8b..30072dc00 100644 --- a/src/inputs-controller.ts +++ b/src/inputs-controller.ts @@ -338,6 +338,7 @@ export class InputsController { const gamepadID = gamepad.toLowerCase(); const config = deepCopy(this.getConfig(gamepadID)); config.custom = this.configs[gamepad]?.custom || {...config.default}; + config.ogIcons = {...config.icons}; config.currentKeys = this.configs[gamepad]?.currentKeys; if (!this.configs[gamepad]?.currentKeys) reloadCurrentKeys(config); @@ -354,6 +355,7 @@ export class InputsController { const config = deepCopy(this.getConfigKeyboard(layout)); config.custom = this.keyboardConfigs[layout]?.custom || {...config.default}; config.currentKeys = this.keyboardConfigs[layout]?.currentKeys; + config.ogIcons = {...config.icons}; if (!this.keyboardConfigs[layout]?.currentKeys) reloadCurrentKeys(config); else diff --git a/src/ui/settings/gamepad-binding-ui-handler.ts b/src/ui/settings/gamepad-binding-ui-handler.ts index 3bece0542..e9345e825 100644 --- a/src/ui/settings/gamepad-binding-ui-handler.ts +++ b/src/ui/settings/gamepad-binding-ui-handler.ts @@ -3,7 +3,7 @@ import AbstractBindingUiHandler from "../settings/abrast-binding-ui-handler"; import {Mode} from "../ui"; import { getKeyAndActionFromCurrentKeysWithPressedButton, - getKeyAndActionFromCurrentKeysWithSettingName, + getKeyAndActionFromCurrentKeysWithSettingName, getKeyFromMapping, } from "#app/configs/gamepad-utils"; @@ -22,7 +22,8 @@ export default class GamepadBindingUiHandler extends AbstractBindingUiHandler { this.buttonPressed = button.index; const activeConfig = this.scene.inputController.getActiveConfig(); const type = activeConfig.padType - const buttonIcon = getKeyAndActionFromCurrentKeysWithPressedButton(activeConfig, this.buttonPressed)?.icon + const key = getKeyFromMapping(activeConfig, this.buttonPressed); + const buttonIcon = activeConfig.ogIcons[key]; if (!buttonIcon) return; 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 f1057bb92..242d0dfef 100644 --- a/src/ui/settings/keyboard-binding-ui-handler.ts +++ b/src/ui/settings/keyboard-binding-ui-handler.ts @@ -3,7 +3,7 @@ import AbstractBindingUiHandler from "../settings/abrast-binding-ui-handler"; import {Mode} from "../ui"; import { getKeyAndActionFromCurrentKeysWithPressedButton, - getKeyAndActionFromCurrentKeysWithSettingName, + getKeyAndActionFromCurrentKeysWithSettingName, getKeyFromMapping, } from "#app/configs/gamepad-utils"; @@ -21,7 +21,8 @@ export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler { if (!this.listening || this.buttonPressed !== null) return; this.buttonPressed = key; const activeConfig = this.scene.inputController.getActiveKeyboardConfig(); - const buttonIcon = getKeyAndActionFromCurrentKeysWithPressedButton(activeConfig, key)?.icon + const _key = getKeyFromMapping(activeConfig, key); + const buttonIcon = activeConfig.ogIcons[_key]; if (!buttonIcon) return; const assignedButtonIcon = getKeyAndActionFromCurrentKeysWithSettingName(activeConfig, this.target)?.icon; this.onInputDown(buttonIcon, assignedButtonIcon, 'keyboard');