From 10d0dedc0af684cb09c7751ab66b9e140b26a0cc Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Mon, 8 Jul 2024 17:17:28 +0700 Subject: [PATCH] Add "alwaysShowStreamHud" patch --- dist/better-xcloud.user.js | 9 +++++++++ src/modules/patcher.ts | 19 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/dist/better-xcloud.user.js b/dist/better-xcloud.user.js index d107a9c..45b11b2 100644 --- a/dist/better-xcloud.user.js +++ b/dist/better-xcloud.user.js @@ -5839,6 +5839,14 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) { } `; return str2 = str2.replace("}getSetting(e){", "}getSetting(e){" + newCode), str2; + }, + alwaysShowStreamHud(str2) { + let index = str2.indexOf(",{onShowStreamMenu:"); + if (index === -1) + return !1; + if (index = str2.indexOf("&&(0,", index - 100), index === -1) + return !1; + return str2 = str2.substring(0, index) + "|| true" + str2.substring(index), str2; } }, PATCH_ORDERS = [ ...getPref(PrefKey.NATIVE_MKB_ENABLED) === "on" ? [ @@ -5883,6 +5891,7 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) { "disableGamepadDisconnectedScreen", "patchStreamHud", "playVibration", + "alwaysShowStreamHud", getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && !getPref(PrefKey.STREAM_COMBINE_SOURCES) && "patchAudioMediaStream", getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && getPref(PrefKey.STREAM_COMBINE_SOURCES) && "patchCombinedAudioVideoMediaStream", getPref(PrefKey.STREAM_DISABLE_FEEDBACK_DIALOG) && "skipFeedbackDialog", diff --git a/src/modules/patcher.ts b/src/modules/patcher.ts index 9b7ca05..aeff808 100644 --- a/src/modules/patcher.ts +++ b/src/modules/patcher.ts @@ -757,7 +757,22 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) { `; str = str.replace(text, text + newCode); return str; - } + }, + + alwaysShowStreamHud(str: string) { + let index = str.indexOf(',{onShowStreamMenu:'); + if (index === -1) { + return false; + } + + index = str.indexOf('&&(0,', index - 100); + if (index === -1) { + return false; + } + + str = str.substring(0, index) + '|| true' + str.substring(index); + return str; + }, }; let PATCH_ORDERS: PatchArray = [ @@ -819,6 +834,8 @@ let PLAYING_PATCH_ORDERS: PatchArray = [ 'patchStreamHud', 'playVibration', + 'alwaysShowStreamHud', + // 'exposeEventTarget', // Patch volume control for normal stream