mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-10 07:07:46 +02:00
Move BLANK_PRESET_DATA to Table class
This commit is contained in:
@@ -6,6 +6,7 @@ export abstract class BasePresetsTable<T extends PresetRecord> extends BaseLocal
|
||||
protected abstract TABLE_PRESETS: string;
|
||||
protected abstract DEFAULT_PRESETS: PresetRecords<T>;
|
||||
protected abstract readonly DEFAULT_PRESET_ID: number;
|
||||
abstract readonly BLANK_PRESET_DATA: T['data'];
|
||||
|
||||
async newPreset(name: string, data: T['data']) {
|
||||
const newRecord = { name, data } as T;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import type { ControllerCustomizationPresetRecord, PresetRecords } from "@/types/presets";
|
||||
import type { ControllerCustomizationPresetData, ControllerCustomizationPresetRecord, PresetRecords } from "@/types/presets";
|
||||
import { LocalDb } from "./local-db";
|
||||
import { BasePresetsTable } from "./base-presets-table";
|
||||
import { GamepadKey } from "@/enums/gamepad";
|
||||
@@ -40,6 +40,17 @@ export class ControllerCustomizationsTable extends BasePresetsTable<ControllerCu
|
||||
},
|
||||
};
|
||||
|
||||
protected DEFAULT_PRESET_ID = ControllerCustomizationDefaultPresetId.DEFAULT;
|
||||
readonly BLANK_PRESET_DATA = {
|
||||
mapping: {},
|
||||
settings: {
|
||||
leftTriggerRange: [0, 100],
|
||||
rightTriggerRange: [0, 100],
|
||||
leftStickDeadzone: [0, 100],
|
||||
rightStickDeadzone: [0, 100],
|
||||
|
||||
vibrationIntensity: 100,
|
||||
},
|
||||
} satisfies ControllerCustomizationPresetData;
|
||||
|
||||
protected DEFAULT_PRESET_ID = ControllerCustomizationDefaultPresetId.DEFAULT;
|
||||
}
|
||||
|
@@ -52,6 +52,10 @@ export class ControllerShortcutsTable extends BasePresetsTable<ControllerShortcu
|
||||
},
|
||||
};
|
||||
|
||||
readonly BLANK_PRESET_DATA = {
|
||||
mapping: {},
|
||||
};
|
||||
|
||||
protected readonly DEFAULT_PRESET_ID = ControllerShortcutDefaultId.DEFAULT;
|
||||
|
||||
private constructor() {
|
||||
|
@@ -36,6 +36,10 @@ export class KeyboardShortcutsTable extends BasePresetsTable<KeyboardShortcutPre
|
||||
},
|
||||
};
|
||||
|
||||
readonly BLANK_PRESET_DATA = {
|
||||
mapping: {},
|
||||
};
|
||||
|
||||
protected readonly DEFAULT_PRESET_ID = KeyboardShortcutDefaultId.DEFAULT;
|
||||
|
||||
private constructor() {
|
||||
|
@@ -117,6 +117,17 @@ export class MkbMappingPresetsTable extends BasePresetsTable<MkbPresetRecord> {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
readonly BLANK_PRESET_DATA = {
|
||||
mapping: {},
|
||||
mouse: {
|
||||
[MkbPresetKey.MOUSE_MAP_TO]: MouseMapTo.RS,
|
||||
[MkbPresetKey.MOUSE_SENSITIVITY_X]: 100,
|
||||
[MkbPresetKey.MOUSE_SENSITIVITY_Y]: 100,
|
||||
[MkbPresetKey.MOUSE_DEADZONE_COUNTERWEIGHT]: 20,
|
||||
},
|
||||
};
|
||||
|
||||
protected readonly DEFAULT_PRESET_ID = MkbMappingDefaultPresetId.DEFAULT;
|
||||
|
||||
private constructor() {
|
||||
|
Reference in New Issue
Block a user