mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-10 15:17:45 +02:00
Controller customization feature
This commit is contained in:
45
src/utils/local-db/controller-customizations-table.ts
Normal file
45
src/utils/local-db/controller-customizations-table.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import type { ControllerCustomizationPresetRecord, PresetRecords } from "@/types/presets";
|
||||
import { LocalDb } from "./local-db";
|
||||
import { BasePresetsTable } from "./base-presets-table";
|
||||
import { GamepadKey } from "@/enums/gamepad";
|
||||
|
||||
export const enum ControllerCustomizationDefaultPresetId {
|
||||
OFF = 0,
|
||||
BAYX = -1,
|
||||
|
||||
DEFAULT = OFF,
|
||||
};
|
||||
|
||||
export class ControllerCustomizationsTable extends BasePresetsTable<ControllerCustomizationPresetRecord> {
|
||||
private static instance: ControllerCustomizationsTable;
|
||||
public static getInstance = () => ControllerCustomizationsTable.instance ?? (ControllerCustomizationsTable.instance = new ControllerCustomizationsTable(LocalDb.TABLE_CONTROLLER_CUSTOMIZATIONS));
|
||||
|
||||
protected readonly TABLE_PRESETS = LocalDb.TABLE_CONTROLLER_CUSTOMIZATIONS;
|
||||
protected DEFAULT_PRESETS: PresetRecords<ControllerCustomizationPresetRecord> = {
|
||||
[ControllerCustomizationDefaultPresetId.BAYX]: {
|
||||
id: ControllerCustomizationDefaultPresetId.BAYX,
|
||||
name: 'ABXY ⇄ BAYX',
|
||||
data: {
|
||||
mapping: {
|
||||
[GamepadKey.A]: GamepadKey.B,
|
||||
[GamepadKey.B]: GamepadKey.A,
|
||||
[GamepadKey.X]: GamepadKey.Y,
|
||||
[GamepadKey.Y]: GamepadKey.X,
|
||||
},
|
||||
|
||||
settings: {
|
||||
leftStickDeadzone: [0, 100],
|
||||
rightStickDeadzone: [0, 100],
|
||||
|
||||
leftTriggerRange: [0, 100],
|
||||
rightTriggerRange: [0, 100],
|
||||
|
||||
vibrationIntensity: 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
protected DEFAULT_PRESET_ID = ControllerCustomizationDefaultPresetId.DEFAULT;
|
||||
|
||||
}
|
Reference in New Issue
Block a user