mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Fix unable to reset Virtual controller's preset & Keyboard shortcuts' preset
This commit is contained in:
parent
0ef8fe18ac
commit
277a830d99
10
dist/better-xcloud.pretty.user.js
vendored
10
dist/better-xcloud.pretty.user.js
vendored
@ -3691,7 +3691,7 @@ class StreamSettings {
|
||||
StreamSettings.settings.deviceVibrationIntensity = intensity, BxEventBus.Stream.emit("deviceVibration.updated", {});
|
||||
}
|
||||
static async refreshMkbSettings() {
|
||||
let settings = StreamSettings.settings, presetId = getStreamPref("mkb.p1.preset.mappingId"), orgPreset = await MkbMappingPresetsTable.getInstance().getPreset(presetId), orgPresetData = orgPreset.data, converted = {
|
||||
let settings = StreamSettings.settings, presetId = getStreamPref("mkb.p1.preset.mappingId"), orgPresetData = (await MkbMappingPresetsTable.getInstance().getPreset(presetId)).data, converted = {
|
||||
mapping: {},
|
||||
mouse: Object.assign({}, orgPresetData.mouse)
|
||||
}, key;
|
||||
@ -3702,20 +3702,20 @@ class StreamSettings {
|
||||
if (typeof keyName === "string") converted.mapping[keyName] = buttonIndex;
|
||||
}
|
||||
let mouse = converted.mouse;
|
||||
mouse["sensitivityX"] *= 0.001, mouse["sensitivityY"] *= 0.001, mouse["deadzoneCounterweight"] *= 0.01, settings.mkbPreset = converted, setStreamPref("mkb.p1.preset.mappingId", orgPreset.id, "direct"), BxEventBus.Stream.emit("mkb.setting.updated", {});
|
||||
mouse["sensitivityX"] *= 0.001, mouse["sensitivityY"] *= 0.001, mouse["deadzoneCounterweight"] *= 0.01, settings.mkbPreset = converted, BxEventBus.Stream.emit("mkb.setting.updated", {});
|
||||
}
|
||||
static async refreshKeyboardShortcuts() {
|
||||
let settings = StreamSettings.settings, presetId = getStreamPref("keyboardShortcuts.preset.inGameId");
|
||||
if (presetId === 0) {
|
||||
settings.keyboardShortcuts = null, setStreamPref("keyboardShortcuts.preset.inGameId", presetId, "direct"), BxEventBus.Stream.emit("keyboardShortcuts.updated", {});
|
||||
settings.keyboardShortcuts = null, BxEventBus.Stream.emit("keyboardShortcuts.updated", {});
|
||||
return;
|
||||
}
|
||||
let orgPreset = await KeyboardShortcutsTable.getInstance().getPreset(presetId), orgPresetData = orgPreset.data.mapping, converted = {}, action;
|
||||
let orgPresetData = (await KeyboardShortcutsTable.getInstance().getPreset(presetId)).data.mapping, converted = {}, action;
|
||||
for (action in orgPresetData) {
|
||||
let info = orgPresetData[action], key = `${info.code}:${info.modifiers || 0}`;
|
||||
converted[key] = action;
|
||||
}
|
||||
settings.keyboardShortcuts = converted, setStreamPref("keyboardShortcuts.preset.inGameId", orgPreset.id, "direct"), BxEventBus.Stream.emit("keyboardShortcuts.updated", {});
|
||||
settings.keyboardShortcuts = converted, BxEventBus.Stream.emit("keyboardShortcuts.updated", {});
|
||||
}
|
||||
static async refreshAllSettings() {
|
||||
window.BX_STREAM_SETTINGS = StreamSettings.settings, await StreamSettings.refreshControllerSettings(), await StreamSettings.refreshMkbSettings(), await StreamSettings.refreshKeyboardShortcuts();
|
||||
|
2
dist/better-xcloud.user.js
vendored
2
dist/better-xcloud.user.js
vendored
File diff suppressed because one or more lines are too long
@ -13,7 +13,7 @@ import { ShortcutAction } from "@/enums/shortcut-actions";
|
||||
import { KeyHelper } from "@/modules/mkb/key-helper";
|
||||
import { BxEventBus } from "./bx-event-bus";
|
||||
import { ControllerCustomizationsTable } from "./local-db/controller-customizations-table";
|
||||
import { getStreamPref, setStreamPref, STORAGE } from "@/utils/pref-utils";
|
||||
import { getStreamPref, STORAGE } from "@/utils/pref-utils";
|
||||
|
||||
|
||||
export type StreamSettingsData = {
|
||||
@ -191,7 +191,6 @@ export class StreamSettings {
|
||||
|
||||
settings.mkbPreset = converted;
|
||||
|
||||
setStreamPref(StreamPref.MKB_P1_MAPPING_PRESET_ID, orgPreset.id, 'direct');
|
||||
BxEventBus.Stream.emit('mkb.setting.updated', {});
|
||||
}
|
||||
|
||||
@ -202,7 +201,6 @@ export class StreamSettings {
|
||||
if (presetId === KeyboardShortcutDefaultId.OFF) {
|
||||
settings.keyboardShortcuts = null;
|
||||
|
||||
setStreamPref(StreamPref.KEYBOARD_SHORTCUTS_IN_GAME_PRESET_ID, presetId, 'direct');
|
||||
BxEventBus.Stream.emit('keyboardShortcuts.updated', {});
|
||||
return;
|
||||
}
|
||||
@ -222,7 +220,6 @@ export class StreamSettings {
|
||||
|
||||
settings.keyboardShortcuts = converted;
|
||||
|
||||
setStreamPref(StreamPref.KEYBOARD_SHORTCUTS_IN_GAME_PRESET_ID, orgPreset.id, 'direct');
|
||||
BxEventBus.Stream.emit('keyboardShortcuts.updated', {});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user