diff --git a/dist/better-xcloud.pretty.user.js b/dist/better-xcloud.pretty.user.js index 452ec16..87298bf 100644 --- a/dist/better-xcloud.pretty.user.js +++ b/dist/better-xcloud.pretty.user.js @@ -8245,6 +8245,11 @@ var BxExposed = { } catch (e) { BxLogger.error(LOG_TAG3, e); } + try { + state.uhf.headerMode = "Off", state.uhf.footerMode = "Off"; + } catch (e) { + BxLogger.error(LOG_TAG3, e); + } try { let xCloud = state.xcloud.authentication.authStatusByStrategy.XCloud; if (xCloud.type === 3 && xCloud.error.type === "UnsupportedMarketError") window.stop(), window.location.href = "https://www.xbox.com/en-US/play"; diff --git a/dist/better-xcloud.user.js b/dist/better-xcloud.user.js index ffb899a..cdab434 100755 --- a/dist/better-xcloud.user.js +++ b/dist/better-xcloud.user.js @@ -284,7 +284,7 @@ if (blockFeatures.includes("friends")) FeatureGates.EnableFriendsAndFollowers = if (blockFeatures.includes("byog")) FeatureGates.EnableBYOG = !1, FeatureGates.EnableBYOGPurchase = !1; if (BX_FLAGS.FeatureGates) FeatureGates = Object.assign(BX_FLAGS.FeatureGates, FeatureGates); class LocalCoOpManager {static instance;static getInstance = () => LocalCoOpManager.instance ?? (LocalCoOpManager.instance = new LocalCoOpManager);supportedIds;constructor() {BxEventBus.Script.once("list.localCoOp.updated", (e) => {this.supportedIds = e.ids;}), this.supportedIds = GhPagesUtils.getLocalCoOpList(), console.log("this.supportedIds", this.supportedIds);}isSupported(productId) {return this.supportedIds.has(productId);}} -var BxExposed = {getTitleInfo: () => STATES.currentStream.titleInfo,modifyPreloadedState: (state) => {let LOG_TAG3 = "PreloadState";try {state.appContext.requestInfo.userAgent = window.navigator.userAgent;} catch (e) {BxLogger.error(LOG_TAG3, e);}try {for (let exp in FeatureGates)state.experiments.overrideFeatureGates[exp.toLocaleLowerCase()] = FeatureGates[exp];} catch (e) {BxLogger.error(LOG_TAG3, e);}try {let sigls = state.xcloud.sigls;if (STATES.userAgent.capabilities.touch) {let customList = TouchController.getCustomList(), siglId = "ce573635-7c18-4d0c-9d68-90b932393470";if (siglId in sigls) {let allGames = sigls[siglId].data.products;customList = customList.filter((id) => allGames.includes(id)), sigls["9c86f07a-f3e8-45ad-82a0-a1f759597059"]?.data.products.push(...customList);} else BxLogger.warning(LOG_TAG3, "Sigl not found: " + siglId);}} catch (e) {BxLogger.error(LOG_TAG3, e);}try {let sigls = state.xcloud.sigls;if (BX_FLAGS.ForceNativeMkbTitles) sigls["8fa264dd-124f-4af3-97e8-596fcdf4b486"]?.data.products.push(...BX_FLAGS.ForceNativeMkbTitles);} catch (e) {BxLogger.error(LOG_TAG3, e);}try {let xCloud = state.xcloud.authentication.authStatusByStrategy.XCloud;if (xCloud.type === 3 && xCloud.error.type === "UnsupportedMarketError") window.stop(), window.location.href = "https://www.xbox.com/en-US/play";} catch (e) {BxLogger.error(LOG_TAG3, e);}return state;},modifyTitleInfo: function(titleInfo) {titleInfo = deepClone(titleInfo);let supportedInputTypes = titleInfo.details.supportedInputTypes;if (BX_FLAGS.ForceNativeMkbTitles?.includes(titleInfo.details.productId)) supportedInputTypes.push("MKB");if (getGlobalPref("nativeMkb.mode") === "off") supportedInputTypes = supportedInputTypes.filter((i) => i !== "MKB");if (titleInfo.details.hasMkbSupport = supportedInputTypes.includes("MKB"), STATES.userAgent.capabilities.touch) {let touchControllerAvailability = getGlobalPref("touchController.mode");if (touchControllerAvailability !== "off" && getGlobalPref("touchController.autoOff")) {let gamepads = window.navigator.getGamepads(), gamepadFound = !1;for (let gamepad of gamepads)if (gamepad && gamepad.connected) {gamepadFound = !0;break;}gamepadFound && (touchControllerAvailability = "off");}if (touchControllerAvailability === "off") supportedInputTypes = supportedInputTypes.filter((i) => i !== "CustomTouchOverlay" && i !== "GenericTouch"), titleInfo.details.supportedTabs = [];if (titleInfo.details.hasNativeTouchSupport = supportedInputTypes.includes("NativeTouch"), titleInfo.details.hasTouchSupport = titleInfo.details.hasNativeTouchSupport || supportedInputTypes.includes("CustomTouchOverlay") || supportedInputTypes.includes("GenericTouch"), !titleInfo.details.hasTouchSupport && touchControllerAvailability === "all") titleInfo.details.hasFakeTouchSupport = !0, supportedInputTypes.push("GenericTouch");}return titleInfo.details.supportedInputTypes = supportedInputTypes, STATES.currentStream.titleInfo = titleInfo, BxEventBus.Script.emit("titleInfo.ready", {}), titleInfo;},setupGainNode: ($media, audioStream) => {if ($media instanceof HTMLAudioElement) $media.muted = !0, $media.addEventListener("playing", (e) => {$media.muted = !0, $media.pause();});else $media.muted = !0, $media.addEventListener("playing", (e) => {$media.muted = !0;});try {let audioCtx = STATES.currentStream.audioContext, source = audioCtx.createMediaStreamSource(audioStream), gainNode = audioCtx.createGain();source.connect(gainNode).connect(audioCtx.destination);} catch (e) {BxLogger.error("setupGainNode", e), STATES.currentStream.audioGainNode = null;}},handleControllerShortcut: ControllerShortcut.handle,resetControllerShortcut: ControllerShortcut.reset,overrideSettings: {Tv_settings: {hasCompletedOnboarding: !0}},disableGamepadPolling: !1,backButtonPressed: () => {let navigationDialogManager = NavigationDialogManager.getInstance();if (navigationDialogManager.isShowing()) return navigationDialogManager.hide(), !0;let dict = {bubbles: !0,cancelable: !0,key: "XF86Back",code: "XF86Back",keyCode: 4,which: 4};return document.body.dispatchEvent(new KeyboardEvent("keydown", dict)), document.body.dispatchEvent(new KeyboardEvent("keyup", dict)), !1;},GameSlugRegexes: [/[;,/?:@&=+_`~$%#^*()!^™\xae\xa9]/g,/ {2,}/g,/ /g],toggleLocalCoOp(enable) {},beforePageLoad: (page) => {BxLogger.info("beforePageLoad", page), Patcher.patchPage(page);},localCoOpManager: LocalCoOpManager.getInstance(),reactCreateElement: function(...args) {},createReactLocalCoOpIcon: (attrs) => {let reactCE = window.BX_EXPOSED.reactCreateElement;return reactCE("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 32 32", "fill-rule": "evenodd", "stroke-linecap": "round", "stroke-linejoin": "round", ...attrs }, reactCE("g", null, reactCE("path", { d: "M24.272 11.165h-3.294l-3.14 3.564c-.391.391-.922.611-1.476.611a2.1 2.1 0 0 1-2.087-2.088 2.09 2.09 0 0 1 .031-.362l1.22-6.274a3.89 3.89 0 0 1 3.81-3.206h6.57c1.834 0 3.439 1.573 3.833 3.295l1.205 6.185a2.09 2.09 0 0 1 .031.362 2.1 2.1 0 0 1-2.087 2.088c-.554 0-1.085-.22-1.476-.611l-3.14-3.564", fill: "none", stroke: "#fff", "stroke-width": "2" }), reactCE("circle", { cx: "22.625", cy: "5.874", r: ".879" }), reactCE("path", { d: "M11.022 24.415H7.728l-3.14 3.564c-.391.391-.922.611-1.476.611a2.1 2.1 0 0 1-2.087-2.088 2.09 2.09 0 0 1 .031-.362l1.22-6.274a3.89 3.89 0 0 1 3.81-3.206h6.57c1.834 0 3.439 1.573 3.833 3.295l1.205 6.185a2.09 2.09 0 0 1 .031.362 2.1 2.1 0 0 1-2.087 2.088c-.554 0-1.085-.22-1.476-.611l-3.14-3.564", fill: "none", stroke: "#fff", "stroke-width": "2" }), reactCE("circle", { cx: "9.375", cy: "19.124", r: ".879" })));}}; +var BxExposed = {getTitleInfo: () => STATES.currentStream.titleInfo,modifyPreloadedState: (state) => {let LOG_TAG3 = "PreloadState";try {state.appContext.requestInfo.userAgent = window.navigator.userAgent;} catch (e) {BxLogger.error(LOG_TAG3, e);}try {for (let exp in FeatureGates)state.experiments.overrideFeatureGates[exp.toLocaleLowerCase()] = FeatureGates[exp];} catch (e) {BxLogger.error(LOG_TAG3, e);}try {let sigls = state.xcloud.sigls;if (STATES.userAgent.capabilities.touch) {let customList = TouchController.getCustomList(), siglId = "ce573635-7c18-4d0c-9d68-90b932393470";if (siglId in sigls) {let allGames = sigls[siglId].data.products;customList = customList.filter((id) => allGames.includes(id)), sigls["9c86f07a-f3e8-45ad-82a0-a1f759597059"]?.data.products.push(...customList);} else BxLogger.warning(LOG_TAG3, "Sigl not found: " + siglId);}} catch (e) {BxLogger.error(LOG_TAG3, e);}try {let sigls = state.xcloud.sigls;if (BX_FLAGS.ForceNativeMkbTitles) sigls["8fa264dd-124f-4af3-97e8-596fcdf4b486"]?.data.products.push(...BX_FLAGS.ForceNativeMkbTitles);} catch (e) {BxLogger.error(LOG_TAG3, e);}try {state.uhf.headerMode = "Off", state.uhf.footerMode = "Off";} catch (e) {BxLogger.error(LOG_TAG3, e);}try {let xCloud = state.xcloud.authentication.authStatusByStrategy.XCloud;if (xCloud.type === 3 && xCloud.error.type === "UnsupportedMarketError") window.stop(), window.location.href = "https://www.xbox.com/en-US/play";} catch (e) {BxLogger.error(LOG_TAG3, e);}return state;},modifyTitleInfo: function(titleInfo) {titleInfo = deepClone(titleInfo);let supportedInputTypes = titleInfo.details.supportedInputTypes;if (BX_FLAGS.ForceNativeMkbTitles?.includes(titleInfo.details.productId)) supportedInputTypes.push("MKB");if (getGlobalPref("nativeMkb.mode") === "off") supportedInputTypes = supportedInputTypes.filter((i) => i !== "MKB");if (titleInfo.details.hasMkbSupport = supportedInputTypes.includes("MKB"), STATES.userAgent.capabilities.touch) {let touchControllerAvailability = getGlobalPref("touchController.mode");if (touchControllerAvailability !== "off" && getGlobalPref("touchController.autoOff")) {let gamepads = window.navigator.getGamepads(), gamepadFound = !1;for (let gamepad of gamepads)if (gamepad && gamepad.connected) {gamepadFound = !0;break;}gamepadFound && (touchControllerAvailability = "off");}if (touchControllerAvailability === "off") supportedInputTypes = supportedInputTypes.filter((i) => i !== "CustomTouchOverlay" && i !== "GenericTouch"), titleInfo.details.supportedTabs = [];if (titleInfo.details.hasNativeTouchSupport = supportedInputTypes.includes("NativeTouch"), titleInfo.details.hasTouchSupport = titleInfo.details.hasNativeTouchSupport || supportedInputTypes.includes("CustomTouchOverlay") || supportedInputTypes.includes("GenericTouch"), !titleInfo.details.hasTouchSupport && touchControllerAvailability === "all") titleInfo.details.hasFakeTouchSupport = !0, supportedInputTypes.push("GenericTouch");}return titleInfo.details.supportedInputTypes = supportedInputTypes, STATES.currentStream.titleInfo = titleInfo, BxEventBus.Script.emit("titleInfo.ready", {}), titleInfo;},setupGainNode: ($media, audioStream) => {if ($media instanceof HTMLAudioElement) $media.muted = !0, $media.addEventListener("playing", (e) => {$media.muted = !0, $media.pause();});else $media.muted = !0, $media.addEventListener("playing", (e) => {$media.muted = !0;});try {let audioCtx = STATES.currentStream.audioContext, source = audioCtx.createMediaStreamSource(audioStream), gainNode = audioCtx.createGain();source.connect(gainNode).connect(audioCtx.destination);} catch (e) {BxLogger.error("setupGainNode", e), STATES.currentStream.audioGainNode = null;}},handleControllerShortcut: ControllerShortcut.handle,resetControllerShortcut: ControllerShortcut.reset,overrideSettings: {Tv_settings: {hasCompletedOnboarding: !0}},disableGamepadPolling: !1,backButtonPressed: () => {let navigationDialogManager = NavigationDialogManager.getInstance();if (navigationDialogManager.isShowing()) return navigationDialogManager.hide(), !0;let dict = {bubbles: !0,cancelable: !0,key: "XF86Back",code: "XF86Back",keyCode: 4,which: 4};return document.body.dispatchEvent(new KeyboardEvent("keydown", dict)), document.body.dispatchEvent(new KeyboardEvent("keyup", dict)), !1;},GameSlugRegexes: [/[;,/?:@&=+_`~$%#^*()!^™\xae\xa9]/g,/ {2,}/g,/ /g],toggleLocalCoOp(enable) {},beforePageLoad: (page) => {BxLogger.info("beforePageLoad", page), Patcher.patchPage(page);},localCoOpManager: LocalCoOpManager.getInstance(),reactCreateElement: function(...args) {},createReactLocalCoOpIcon: (attrs) => {let reactCE = window.BX_EXPOSED.reactCreateElement;return reactCE("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 32 32", "fill-rule": "evenodd", "stroke-linecap": "round", "stroke-linejoin": "round", ...attrs }, reactCE("g", null, reactCE("path", { d: "M24.272 11.165h-3.294l-3.14 3.564c-.391.391-.922.611-1.476.611a2.1 2.1 0 0 1-2.087-2.088 2.09 2.09 0 0 1 .031-.362l1.22-6.274a3.89 3.89 0 0 1 3.81-3.206h6.57c1.834 0 3.439 1.573 3.833 3.295l1.205 6.185a2.09 2.09 0 0 1 .031.362 2.1 2.1 0 0 1-2.087 2.088c-.554 0-1.085-.22-1.476-.611l-3.14-3.564", fill: "none", stroke: "#fff", "stroke-width": "2" }), reactCE("circle", { cx: "22.625", cy: "5.874", r: ".879" }), reactCE("path", { d: "M11.022 24.415H7.728l-3.14 3.564c-.391.391-.922.611-1.476.611a2.1 2.1 0 0 1-2.087-2.088 2.09 2.09 0 0 1 .031-.362l1.22-6.274a3.89 3.89 0 0 1 3.81-3.206h6.57c1.834 0 3.439 1.573 3.833 3.295l1.205 6.185a2.09 2.09 0 0 1 .031.362 2.1 2.1 0 0 1-2.087 2.088c-.554 0-1.085-.22-1.476-.611l-3.14-3.564", fill: "none", stroke: "#fff", "stroke-width": "2" }), reactCE("circle", { cx: "9.375", cy: "19.124", r: ".879" })));}}; function localRedirect(path) {let url = window.location.href.substring(0, 31) + path, $pageContent = document.getElementById("PageContent");if (!$pageContent) return;let $anchor = CE("a", {href: url,class: "bx-hidden bx-offscreen"}, "");$anchor.addEventListener("click", (e) => {window.setTimeout(() => {$pageContent.removeChild($anchor);}, 1000);}), $pageContent.appendChild($anchor), $anchor.click();} window.localRedirect = localRedirect; function getPreferredServerRegion(shortName = !1) {let preferredRegion = getGlobalPref("server.region"), serverRegions = STATES.serverRegions;if (preferredRegion in serverRegions) if (shortName && serverRegions[preferredRegion].shortName) return serverRegions[preferredRegion].shortName;else return preferredRegion;for (let regionName in serverRegions) {let region = serverRegions[regionName];if (!region.isDefault) continue;if (shortName && region.shortName) return region.shortName;else return regionName;}return null;} diff --git a/src/utils/bx-exposed.ts b/src/utils/bx-exposed.ts index d288174..87cc187 100755 --- a/src/utils/bx-exposed.ts +++ b/src/utils/bx-exposed.ts @@ -81,6 +81,14 @@ export const BxExposed = { BxLogger.error(LOG_TAG, e); } + // Disable header & footer + try { + state.uhf.headerMode = 'Off'; + state.uhf.footerMode = 'Off'; + } catch (e) { + BxLogger.error(LOG_TAG, e); + } + // Redirect to /en-US/play if visiting from an unsupported region try { const xCloud = state.xcloud.authentication.authStatusByStrategy.XCloud;