fix snes controller support

pull/685/head
Greenlamp 2024-05-12 13:54:49 +02:00
parent ba42f072e1
commit 3938975710
3 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@ import {Button} from "../enums/buttons";
*/
const pad_unlicensedSNES = {
padID: '081f-e401',
padType: 'xbox',
padType: 'snes',
gamepadMapping : {
RC_S: 2,
RC_E: 1,

View File

@ -501,7 +501,6 @@ export class InputsController {
return pad_dualshock;
}
return pad_unlicensedSNES;
return pad_generic;
}
@ -663,7 +662,8 @@ export class InputsController {
* @returns Array Tuple containing the pad type and the currently assigned icon for the button index.
*/
getPressedButtonLabel(button: Phaser.Input.Gamepad.Button): [string, string] {
return [this.configs[this.chosenGamepad].padType, getCurrenlyAssignedIconFromInputIndex(this.configs[this.chosenGamepad], button.index)];
const type = this.configs[this.chosenGamepad].padType;
return [type === 'snes' ? 'xbox' : type, getCurrenlyAssignedIconFromInputIndex(this.configs[this.chosenGamepad], button.index)];
}
/**

View File

@ -144,7 +144,7 @@ export default class SettingsGamepadUiHandler extends UiHandler {
}
// For null options, add an icon for the key.
const key = getKeyForSettingName(config as GamepadConfig, SettingGamepad[setting]);
const icon = this.scene.add.sprite(0, 0, config.padType);
const icon = this.scene.add.sprite(0, 0, config.padType === 'snes' ? 'xbox' : config.padType);
icon.setScale(0.1);
icon.setOrigin(0, -0.1);
inputsIcons[key] = icon;
@ -429,7 +429,7 @@ export default class SettingsGamepadUiHandler extends UiHandler {
const lastCursor = this.optionCursors[settingIndex];
// Check if the setting is not part of the bindings (i.e., it's a regular setting).
if (!this.bindingSettings.includes(setting)) {
if (!this.bindingSettings.includes(setting) && !setting.includes('BUTTON_')) {
// Get the label of the last selected option and revert its color to the default.
const lastValueLabel = this.optionValueLabels[settingIndex][lastCursor];
lastValueLabel.setColor(this.getTextColor(TextStyle.WINDOW));