fix snes controller support
parent
ba42f072e1
commit
3938975710
|
@ -6,7 +6,7 @@ import {Button} from "../enums/buttons";
|
||||||
*/
|
*/
|
||||||
const pad_unlicensedSNES = {
|
const pad_unlicensedSNES = {
|
||||||
padID: '081f-e401',
|
padID: '081f-e401',
|
||||||
padType: 'xbox',
|
padType: 'snes',
|
||||||
gamepadMapping : {
|
gamepadMapping : {
|
||||||
RC_S: 2,
|
RC_S: 2,
|
||||||
RC_E: 1,
|
RC_E: 1,
|
||||||
|
|
|
@ -501,7 +501,6 @@ export class InputsController {
|
||||||
return pad_dualshock;
|
return pad_dualshock;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pad_unlicensedSNES;
|
|
||||||
return pad_generic;
|
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.
|
* @returns Array Tuple containing the pad type and the currently assigned icon for the button index.
|
||||||
*/
|
*/
|
||||||
getPressedButtonLabel(button: Phaser.Input.Gamepad.Button): [string, string] {
|
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)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -144,7 +144,7 @@ export default class SettingsGamepadUiHandler extends UiHandler {
|
||||||
}
|
}
|
||||||
// For null options, add an icon for the key.
|
// For null options, add an icon for the key.
|
||||||
const key = getKeyForSettingName(config as GamepadConfig, SettingGamepad[setting]);
|
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.setScale(0.1);
|
||||||
icon.setOrigin(0, -0.1);
|
icon.setOrigin(0, -0.1);
|
||||||
inputsIcons[key] = icon;
|
inputsIcons[key] = icon;
|
||||||
|
@ -429,7 +429,7 @@ export default class SettingsGamepadUiHandler extends UiHandler {
|
||||||
const lastCursor = this.optionCursors[settingIndex];
|
const lastCursor = this.optionCursors[settingIndex];
|
||||||
|
|
||||||
// Check if the setting is not part of the bindings (i.e., it's a regular setting).
|
// 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.
|
// Get the label of the last selected option and revert its color to the default.
|
||||||
const lastValueLabel = this.optionValueLabels[settingIndex][lastCursor];
|
const lastValueLabel = this.optionValueLabels[settingIndex][lastCursor];
|
||||||
lastValueLabel.setColor(this.getTextColor(TextStyle.WINDOW));
|
lastValueLabel.setColor(this.getTextColor(TextStyle.WINDOW));
|
||||||
|
|
Loading…
Reference in New Issue