From da362325f2fe8d29fa62d98dc40c9dc717213d52 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Sun, 8 Dec 2024 06:50:08 +0700 Subject: [PATCH] Disable absolute mouse in Android app --- dist/better-xcloud.user.js | 10 ++++++++-- src/modules/patcher/patcher.ts | 13 ++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dist/better-xcloud.user.js b/dist/better-xcloud.user.js index 39bd16c..6a165ff 100755 --- a/dist/better-xcloud.user.js +++ b/dist/better-xcloud.user.js @@ -4545,6 +4545,11 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) { }, streamPageBeforeLoad(str) { return PatcherUtils.patchBeforePageLoad(str, "stream"); + }, + disableAbsoluteMouse(str) { + let text = "sendAbsoluteMouseCapableMessage(e){"; + if (!str.includes(text)) return !1; + return str = str.replace(text, text + "return;"), str; } }, PATCH_ORDERS = PatcherUtils.filterPatches([ ...getPref("nativeMkb.mode") === "on" ? [ @@ -4621,9 +4626,10 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) { "patchRemotePlayMkb", "remotePlayConnectMode" ] : [], - ...getPref("nativeMkb.mode") === "on" ? [ + ...AppInterface && getPref("nativeMkb.mode") === "on" ? [ "patchMouseAndKeyboardEnabled", - "disableNativeRequestPointerLock" + "disableNativeRequestPointerLock", + "disableAbsoluteMouse" ] : [] ]), PRODUCT_DETAIL_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([ AppInterface && "detectProductDetailPage" diff --git a/src/modules/patcher/patcher.ts b/src/modules/patcher/patcher.ts index 4f8d7a0..d7d4236 100755 --- a/src/modules/patcher/patcher.ts +++ b/src/modules/patcher/patcher.ts @@ -947,6 +947,16 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) { streamPageBeforeLoad(str: string) { return PatcherUtils.patchBeforePageLoad(str, 'stream'); }, + + disableAbsoluteMouse(str: string) { + let text = 'sendAbsoluteMouseCapableMessage(e){'; + if (!str.includes(text)) { + return false; + } + + str = str.replace(text, text + 'return;'); + return str; + } }; let PATCH_ORDERS = PatcherUtils.filterPatches([ @@ -1062,9 +1072,10 @@ let STREAM_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([ ] : []), // Native MKB - ...(getPref(PrefKey.NATIVE_MKB_MODE) === NativeMkbMode.ON ? [ + ...(AppInterface && getPref(PrefKey.NATIVE_MKB_MODE) === NativeMkbMode.ON ? [ 'patchMouseAndKeyboardEnabled', 'disableNativeRequestPointerLock', + 'disableAbsoluteMouse', ] : []), ]);