Skip to content

Commit

Permalink
Fix applying "disableAbsoluteMouse" patch in the wrong place
Browse files Browse the repository at this point in the history
  • Loading branch information
redphx committed Dec 8, 2024
1 parent da36232 commit 3864457
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/better-xcloud.lite.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2771,7 +2771,7 @@ class NativeMkbHandler extends MkbHandler {
this.resetMouseInput(), this.enabled = !1, this.updateInputConfigurationAsync(!1), this.waitForMouseData(!0);
}
destroy() {
this.pointerClient?.stop(), window.removeEventListener("keyup", this), window.removeEventListener(BxEvent.XCLOUD_DIALOG_SHOWN, this), window.removeEventListener(BxEvent.POINTER_LOCK_REQUESTED, this), window.removeEventListener(BxEvent.POINTER_LOCK_EXITED, this), window.removeEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this), this.waitForMouseData(!1);
this.pointerClient?.stop(), this.stop(), window.removeEventListener("keyup", this), window.removeEventListener(BxEvent.XCLOUD_DIALOG_SHOWN, this), window.removeEventListener(BxEvent.POINTER_LOCK_REQUESTED, this), window.removeEventListener(BxEvent.POINTER_LOCK_EXITED, this), window.removeEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this), this.waitForMouseData(!1), document.pointerLockElement && document.exitPointerLock();
}
handleMouseMove(data) {
this.sendMouseInput({
Expand Down
10 changes: 5 additions & 5 deletions dist/better-xcloud.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2886,7 +2886,7 @@ class NativeMkbHandler extends MkbHandler {
this.resetMouseInput(), this.enabled = !1, this.updateInputConfigurationAsync(!1), this.waitForMouseData(!0);
}
destroy() {
this.pointerClient?.stop(), window.removeEventListener("keyup", this), window.removeEventListener(BxEvent.XCLOUD_DIALOG_SHOWN, this), window.removeEventListener(BxEvent.POINTER_LOCK_REQUESTED, this), window.removeEventListener(BxEvent.POINTER_LOCK_EXITED, this), window.removeEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this), this.waitForMouseData(!1);
this.pointerClient?.stop(), this.stop(), window.removeEventListener("keyup", this), window.removeEventListener(BxEvent.XCLOUD_DIALOG_SHOWN, this), window.removeEventListener(BxEvent.POINTER_LOCK_REQUESTED, this), window.removeEventListener(BxEvent.POINTER_LOCK_EXITED, this), window.removeEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this), this.waitForMouseData(!1), document.pointerLockElement && document.exitPointerLock();
}
handleMouseMove(data) {
this.sendMouseInput({
Expand Down Expand Up @@ -4552,9 +4552,10 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
return str = str.replace(text, text + "return;"), str;
}
}, PATCH_ORDERS = PatcherUtils.filterPatches([
...getPref("nativeMkb.mode") === "on" ? [
...AppInterface && getPref("nativeMkb.mode") === "on" ? [
"enableNativeMkb",
"exposeInputSink"
"exposeInputSink",
"disableAbsoluteMouse"
] : [],
"modifyPreloadedState",
"optimizeGameSlugGenerator",
Expand Down Expand Up @@ -4628,8 +4629,7 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
] : [],
...AppInterface && getPref("nativeMkb.mode") === "on" ? [
"patchMouseAndKeyboardEnabled",
"disableNativeRequestPointerLock",
"disableAbsoluteMouse"
"disableNativeRequestPointerLock"
] : []
]), PRODUCT_DETAIL_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([
AppInterface && "detectProductDetailPage"
Expand Down
3 changes: 3 additions & 0 deletions src/modules/mkb/native-mkb-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ export class NativeMkbHandler extends MkbHandler {

destroy(): void {
this.pointerClient?.stop();
this.stop();

window.removeEventListener('keyup', this);

window.removeEventListener(BxEvent.XCLOUD_DIALOG_SHOWN, this);
Expand All @@ -203,6 +205,7 @@ export class NativeMkbHandler extends MkbHandler {
window.removeEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, this);

this.waitForMouseData(false);
document.pointerLockElement && document.exitPointerLock();
}

handleMouseMove(data: MkbMouseMove): void {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/patcher/patcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -960,9 +960,10 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
};

let PATCH_ORDERS = PatcherUtils.filterPatches([
...(getPref<NativeMkbMode>(PrefKey.NATIVE_MKB_MODE) === NativeMkbMode.ON ? [
...(AppInterface && getPref<NativeMkbMode>(PrefKey.NATIVE_MKB_MODE) === NativeMkbMode.ON ? [
'enableNativeMkb',
'exposeInputSink',
'disableAbsoluteMouse',
] : []),

'modifyPreloadedState',
Expand Down Expand Up @@ -1075,7 +1076,6 @@ let STREAM_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([
...(AppInterface && getPref<NativeMkbMode>(PrefKey.NATIVE_MKB_MODE) === NativeMkbMode.ON ? [
'patchMouseAndKeyboardEnabled',
'disableNativeRequestPointerLock',
'disableAbsoluteMouse',
] : []),
]);

Expand Down

0 comments on commit 3864457

Please sign in to comment.