From 3864457a0701d6e8a5010c04b1b8e6f630deb911 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Sun, 8 Dec 2024 07:08:15 +0700 Subject: [PATCH] Fix applying "disableAbsoluteMouse" patch in the wrong place --- dist/better-xcloud.lite.user.js | 2 +- dist/better-xcloud.user.js | 10 +++++----- src/modules/mkb/native-mkb-handler.ts | 3 +++ src/modules/patcher/patcher.ts | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dist/better-xcloud.lite.user.js b/dist/better-xcloud.lite.user.js index b6d5474..2a5f01a 100755 --- a/dist/better-xcloud.lite.user.js +++ b/dist/better-xcloud.lite.user.js @@ -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({ diff --git a/dist/better-xcloud.user.js b/dist/better-xcloud.user.js index 6a165ff..e4ea3c7 100755 --- a/dist/better-xcloud.user.js +++ b/dist/better-xcloud.user.js @@ -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({ @@ -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", @@ -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" diff --git a/src/modules/mkb/native-mkb-handler.ts b/src/modules/mkb/native-mkb-handler.ts index 84051ee..3523280 100755 --- a/src/modules/mkb/native-mkb-handler.ts +++ b/src/modules/mkb/native-mkb-handler.ts @@ -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); @@ -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 { diff --git a/src/modules/patcher/patcher.ts b/src/modules/patcher/patcher.ts index d7d4236..75ed7cb 100755 --- a/src/modules/patcher/patcher.ts +++ b/src/modules/patcher/patcher.ts @@ -960,9 +960,10 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) { }; let PATCH_ORDERS = PatcherUtils.filterPatches([ - ...(getPref(PrefKey.NATIVE_MKB_MODE) === NativeMkbMode.ON ? [ + ...(AppInterface && getPref(PrefKey.NATIVE_MKB_MODE) === NativeMkbMode.ON ? [ 'enableNativeMkb', 'exposeInputSink', + 'disableAbsoluteMouse', ] : []), 'modifyPreloadedState', @@ -1075,7 +1076,6 @@ let STREAM_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([ ...(AppInterface && getPref(PrefKey.NATIVE_MKB_MODE) === NativeMkbMode.ON ? [ 'patchMouseAndKeyboardEnabled', 'disableNativeRequestPointerLock', - 'disableAbsoluteMouse', ] : []), ]);