mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 23:57:19 +02:00
Fix Remote Play stopped working
This commit is contained in:
parent
75d7443e0f
commit
3483672554
24
dist/better-xcloud.pretty.user.js
vendored
24
dist/better-xcloud.pretty.user.js
vendored
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 6.4.3
|
// @version 6.4.4-beta
|
||||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||||
// @author redphx
|
// @author redphx
|
||||||
// @license MIT
|
// @license MIT
|
||||||
@ -192,7 +192,7 @@ class UserAgent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var SCRIPT_VERSION = "6.4.3", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
var SCRIPT_VERSION = "6.4.4-beta", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
||||||
UserAgent.init();
|
UserAgent.init();
|
||||||
var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, STATES = {
|
var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, STATES = {
|
||||||
supportedRegion: !0,
|
supportedRegion: !0,
|
||||||
@ -5073,7 +5073,7 @@ var poll_gamepad_default = "var self=this;if(window.BX_EXPOSED.disableGamepadPol
|
|||||||
var expose_stream_session_default = 'var self=this;window.BX_EXPOSED.streamSession=self;var orgSetMicrophoneState=self.setMicrophoneState.bind(self);self.setMicrophoneState=(state)=>{orgSetMicrophoneState(state),window.BxEventBus.Stream.emit("microphone.state.changed",{state})};window.dispatchEvent(new Event(BxEvent.STREAM_SESSION_READY));var updateDimensionsStr=self.updateDimensions.toString();if(updateDimensionsStr.startsWith("function "))updateDimensionsStr=updateDimensionsStr.substring(9);var renderTargetVar=updateDimensionsStr.match(/if\\((\\w+)\\){/)[1];updateDimensionsStr=updateDimensionsStr.replaceAll(renderTargetVar+".scroll","scroll");updateDimensionsStr=updateDimensionsStr.replace(`if(${renderTargetVar}){`,`\nif (${renderTargetVar}) {\nconst scrollWidth = ${renderTargetVar}.dataset.width ? parseInt(${renderTargetVar}.dataset.width) : ${renderTargetVar}.scrollWidth;\nconst scrollHeight = ${renderTargetVar}.dataset.height ? parseInt(${renderTargetVar}.dataset.height) : ${renderTargetVar}.scrollHeight;\n`);eval(`this.updateDimensions = function ${updateDimensionsStr}`);\n';
|
var expose_stream_session_default = 'var self=this;window.BX_EXPOSED.streamSession=self;var orgSetMicrophoneState=self.setMicrophoneState.bind(self);self.setMicrophoneState=(state)=>{orgSetMicrophoneState(state),window.BxEventBus.Stream.emit("microphone.state.changed",{state})};window.dispatchEvent(new Event(BxEvent.STREAM_SESSION_READY));var updateDimensionsStr=self.updateDimensions.toString();if(updateDimensionsStr.startsWith("function "))updateDimensionsStr=updateDimensionsStr.substring(9);var renderTargetVar=updateDimensionsStr.match(/if\\((\\w+)\\){/)[1];updateDimensionsStr=updateDimensionsStr.replaceAll(renderTargetVar+".scroll","scroll");updateDimensionsStr=updateDimensionsStr.replace(`if(${renderTargetVar}){`,`\nif (${renderTargetVar}) {\nconst scrollWidth = ${renderTargetVar}.dataset.width ? parseInt(${renderTargetVar}.dataset.width) : ${renderTargetVar}.scrollWidth;\nconst scrollHeight = ${renderTargetVar}.dataset.height ? parseInt(${renderTargetVar}.dataset.height) : ${renderTargetVar}.scrollHeight;\n`);eval(`this.updateDimensions = function ${updateDimensionsStr}`);\n';
|
||||||
var game_card_icons_default = `var supportedInputIcons=$supportedInputIcons$,{productId}=$param$;supportedInputIcons.shift();if(window.BX_EXPOSED.localCoOpManager.isSupported(productId))supportedInputIcons.push(window.BX_EXPOSED.createReactLocalCoOpIcon);`;
|
var game_card_icons_default = `var supportedInputIcons=$supportedInputIcons$,{productId}=$param$;supportedInputIcons.shift();if(window.BX_EXPOSED.localCoOpManager.isSupported(productId))supportedInputIcons.push(window.BX_EXPOSED.createReactLocalCoOpIcon);`;
|
||||||
var local_co_op_enable_default = 'this.orgOnGamepadChanged=this.onGamepadChanged;this.orgOnGamepadInput=this.onGamepadInput;var match,onGamepadChangedStr=this.onGamepadChanged.toString();if(onGamepadChangedStr.startsWith("function "))onGamepadChangedStr=onGamepadChangedStr.substring(9);onGamepadChangedStr=onGamepadChangedStr.replaceAll("0","arguments[1]");eval(`this.patchedOnGamepadChanged = function ${onGamepadChangedStr}`);var onGamepadInputStr=this.onGamepadInput.toString();if(onGamepadInputStr.startsWith("function "))onGamepadInputStr=onGamepadInputStr.substring(9);match=onGamepadInputStr.match(/(\\w+\\.GamepadIndex)/);if(match){let gamepadIndexVar=match[0];onGamepadInputStr=onGamepadInputStr.replace("this.gamepadStates.get(",`this.gamepadStates.get(${gamepadIndexVar},`),eval(`this.patchedOnGamepadInput = function ${onGamepadInputStr}`),BxLogger.info("supportLocalCoOp","✅ Successfully patched local co-op support")}else BxLogger.error("supportLocalCoOp","❌ Unable to patch local co-op support");this.toggleLocalCoOp=(enable)=>{BxLogger.info("toggleLocalCoOp",enable?"Enabled":"Disabled"),this.onGamepadChanged=enable?this.patchedOnGamepadChanged:this.orgOnGamepadChanged,this.onGamepadInput=enable?this.patchedOnGamepadInput:this.orgOnGamepadInput;let gamepads=window.navigator.getGamepads();for(let gamepad of gamepads){if(!gamepad?.connected)continue;if(gamepad.id.includes("Better xCloud"))continue;gamepad._noToast=!0,window.dispatchEvent(new GamepadEvent("gamepaddisconnected",{gamepad})),window.dispatchEvent(new GamepadEvent("gamepadconnected",{gamepad}))}};window.BX_EXPOSED.toggleLocalCoOp=this.toggleLocalCoOp.bind(null);\n';
|
var local_co_op_enable_default = 'this.orgOnGamepadChanged=this.onGamepadChanged;this.orgOnGamepadInput=this.onGamepadInput;var match,onGamepadChangedStr=this.onGamepadChanged.toString();if(onGamepadChangedStr.startsWith("function "))onGamepadChangedStr=onGamepadChangedStr.substring(9);onGamepadChangedStr=onGamepadChangedStr.replaceAll("0","arguments[1]");eval(`this.patchedOnGamepadChanged = function ${onGamepadChangedStr}`);var onGamepadInputStr=this.onGamepadInput.toString();if(onGamepadInputStr.startsWith("function "))onGamepadInputStr=onGamepadInputStr.substring(9);match=onGamepadInputStr.match(/(\\w+\\.GamepadIndex)/);if(match){let gamepadIndexVar=match[0];onGamepadInputStr=onGamepadInputStr.replace("this.gamepadStates.get(",`this.gamepadStates.get(${gamepadIndexVar},`),eval(`this.patchedOnGamepadInput = function ${onGamepadInputStr}`),BxLogger.info("supportLocalCoOp","✅ Successfully patched local co-op support")}else BxLogger.error("supportLocalCoOp","❌ Unable to patch local co-op support");this.toggleLocalCoOp=(enable)=>{BxLogger.info("toggleLocalCoOp",enable?"Enabled":"Disabled"),this.onGamepadChanged=enable?this.patchedOnGamepadChanged:this.orgOnGamepadChanged,this.onGamepadInput=enable?this.patchedOnGamepadInput:this.orgOnGamepadInput;let gamepads=window.navigator.getGamepads();for(let gamepad of gamepads){if(!gamepad?.connected)continue;if(gamepad.id.includes("Better xCloud"))continue;gamepad._noToast=!0,window.dispatchEvent(new GamepadEvent("gamepaddisconnected",{gamepad})),window.dispatchEvent(new GamepadEvent("gamepadconnected",{gamepad}))}};window.BX_EXPOSED.toggleLocalCoOp=this.toggleLocalCoOp.bind(null);\n';
|
||||||
var remote_play_keep_alive_default = `try{if(JSON.parse(e).reason==="WarningForBeingIdle"&&!window.location.pathname.includes("/launch/")){this.sendKeepAlive();return}}catch(ex){console.log(ex)}`;
|
var remote_play_keep_alive_default = `try{if(JSON.parse(e).reason==="WarningForBeingIdle"&&window.location.pathname.includes("/consoles/launch/")){this.sendKeepAlive();return}}catch(ex){console.log(ex)}`;
|
||||||
var vibration_adjust_default = `if(e?.gamepad?.connected){let gamepadSettings=window.BX_STREAM_SETTINGS.controllers[e.gamepad.id];if(gamepadSettings?.customization){let intensity=gamepadSettings.customization.vibrationIntensity;if(intensity<=0){e.repeat=0;return}else if(intensity<1)e.leftMotorPercent*=intensity,e.rightMotorPercent*=intensity,e.leftTriggerMotorPercent*=intensity,e.rightTriggerMotorPercent*=intensity}}`;
|
var vibration_adjust_default = `if(e?.gamepad?.connected){let gamepadSettings=window.BX_STREAM_SETTINGS.controllers[e.gamepad.id];if(gamepadSettings?.customization){let intensity=gamepadSettings.customization.vibrationIntensity;if(intensity<=0){e.repeat=0;return}else if(intensity<1)e.leftMotorPercent*=intensity,e.rightMotorPercent*=intensity,e.leftTriggerMotorPercent*=intensity,e.rightTriggerMotorPercent*=intensity}}`;
|
||||||
var stream_hud_default = `var options=arguments[0];window.BX_EXPOSED.showStreamMenu=options.onShowStreamMenu;options.guideUI=null;window.BX_EXPOSED.reactUseEffect(()=>{window.BxEventBus.Stream.emit("ui.streamHud.rendered",{expanded:options.offset.x===0})});`;
|
var stream_hud_default = `var options=arguments[0];window.BX_EXPOSED.showStreamMenu=options.onShowStreamMenu;options.guideUI=null;window.BX_EXPOSED.reactUseEffect(()=>{window.BxEventBus.Stream.emit("ui.streamHud.rendered",{expanded:options.offset.x===0})});`;
|
||||||
var create_portal_default = `var $dom=arguments[1];if($dom&&$dom instanceof HTMLElement&&$dom.id==="gamepass-dialog-root"){let showing=!1,$dialog=$dom.firstElementChild?.firstElementChild;if($dialog)showing=!$dialog.className.includes("pageChangeExit");window.BxEventBus.Script.emit(showing?"dialog.shown":"dialog.dismissed",{})}`;
|
var create_portal_default = `var $dom=arguments[1];if($dom&&$dom instanceof HTMLElement&&$dom.id==="gamepass-dialog-root"){let showing=!1,$dialog=$dom.firstElementChild?.firstElementChild;if($dialog)showing=!$dialog.className.includes("pageChangeExit");window.BxEventBus.Script.emit(showing?"dialog.shown":"dialog.dismissed",{})}`;
|
||||||
@ -5188,17 +5188,6 @@ remotePlayServerId: (window.BX_REMOTE_PLAY_CONFIG && window.BX_REMOTE_PLAY_CONFI
|
|||||||
let newCode = "if (!!window.BX_REMOTE_PLAY_CONFIG) return;";
|
let newCode = "if (!!window.BX_REMOTE_PLAY_CONFIG) return;";
|
||||||
return str.replace(text, text + newCode);
|
return str.replace(text, text + newCode);
|
||||||
},
|
},
|
||||||
remotePlayRecentlyUsedTitleIds(str) {
|
|
||||||
let text = "(e.data.recentlyUsedTitleIds)){";
|
|
||||||
if (!str.includes(text)) return !1;
|
|
||||||
let newCode = "if (window.BX_REMOTE_PLAY_CONFIG) return;";
|
|
||||||
return str.replace(text, text + newCode);
|
|
||||||
},
|
|
||||||
remotePlayWebTitle(str) {
|
|
||||||
let text = "titleTemplate:void 0,title:", index = str.indexOf(text);
|
|
||||||
if (index < 0) return !1;
|
|
||||||
return str = PatcherUtils.insertAt(str, index + text.length, `!!window.BX_REMOTE_PLAY_CONFIG ? "${t("remote-play")} - Better xCloud" :`), str;
|
|
||||||
},
|
|
||||||
blockWebRtcStatsCollector(str) {
|
blockWebRtcStatsCollector(str) {
|
||||||
let text = "this.shouldCollectStats=!0";
|
let text = "this.shouldCollectStats=!0";
|
||||||
if (!str.includes(text)) return !1;
|
if (!str.includes(text)) return !1;
|
||||||
@ -5718,9 +5707,7 @@ ${subsVar} = subs;
|
|||||||
...getGlobalPref("xhome.enabled") ? [
|
...getGlobalPref("xhome.enabled") ? [
|
||||||
"remotePlayDirectConnectUrl",
|
"remotePlayDirectConnectUrl",
|
||||||
"remotePlayKeepAlive",
|
"remotePlayKeepAlive",
|
||||||
"remotePlayWebTitle",
|
|
||||||
"remotePlayDisableAchievementToast",
|
"remotePlayDisableAchievementToast",
|
||||||
"remotePlayRecentlyUsedTitleIds",
|
|
||||||
STATES.userAgent.capabilities.touch && "patchUpdateInputConfigurationAsync"
|
STATES.userAgent.capabilities.touch && "patchUpdateInputConfigurationAsync"
|
||||||
] : [],
|
] : [],
|
||||||
...BX_FLAGS.EnableXcloudLogging ? [
|
...BX_FLAGS.EnableXcloudLogging ? [
|
||||||
@ -8161,7 +8148,8 @@ var FeatureGates = {
|
|||||||
EnableUpdateRequiredPage: !1,
|
EnableUpdateRequiredPage: !1,
|
||||||
ShowForcedUpdateScreen: !1,
|
ShowForcedUpdateScreen: !1,
|
||||||
EnableTakControlResizing: !0,
|
EnableTakControlResizing: !0,
|
||||||
EnableLazyLoadedHome: !1
|
EnableLazyLoadedHome: !1,
|
||||||
|
EnableRemotePlay: getGlobalPref("xhome.enabled")
|
||||||
}, nativeMkbMode = getGlobalPref("nativeMkb.mode");
|
}, nativeMkbMode = getGlobalPref("nativeMkb.mode");
|
||||||
if (nativeMkbMode !== "default") FeatureGates.EnableMouseAndKeyboard = nativeMkbMode === "on";
|
if (nativeMkbMode !== "default") FeatureGates.EnableMouseAndKeyboard = nativeMkbMode === "on";
|
||||||
var blockFeatures = getGlobalPref("block.features");
|
var blockFeatures = getGlobalPref("block.features");
|
||||||
@ -8528,7 +8516,7 @@ class RemotePlayManager {
|
|||||||
if (resolution) setGlobalPref("xhome.video.resolution", resolution, "ui");
|
if (resolution) setGlobalPref("xhome.video.resolution", resolution, "ui");
|
||||||
STATES.remotePlay.config = {
|
STATES.remotePlay.config = {
|
||||||
serverId
|
serverId
|
||||||
}, window.BX_REMOTE_PLAY_CONFIG = STATES.remotePlay.config, localRedirect("/launch/fortnite/BT5P2X999VH2#remote-play");
|
}, window.BX_REMOTE_PLAY_CONFIG = STATES.remotePlay.config, localRedirect("/launch/fortnite/BT5P2X999VH2#remote-play"), setTimeout(() => localRedirect("/consoles/launch/" + serverId), 100);
|
||||||
}
|
}
|
||||||
togglePopup(force = null) {
|
togglePopup(force = null) {
|
||||||
if (!this.isReady()) {
|
if (!this.isReady()) {
|
||||||
|
14
dist/better-xcloud.user.js
vendored
14
dist/better-xcloud.user.js
vendored
File diff suppressed because one or more lines are too long
@ -16,7 +16,6 @@ import codeCreatePortal from "./patches/create-portal.js" with { type: "text" };
|
|||||||
import { GlobalPref, StorageKey } from "@/enums/pref-keys.js";
|
import { GlobalPref, StorageKey } from "@/enums/pref-keys.js";
|
||||||
import { getGlobalPref } from "@/utils/pref-utils.js";
|
import { getGlobalPref } from "@/utils/pref-utils.js";
|
||||||
import { GamePassCloudGallery } from "@/enums/game-pass-gallery";
|
import { GamePassCloudGallery } from "@/enums/game-pass-gallery";
|
||||||
import { t } from "@/utils/translation";
|
|
||||||
import { BlockFeature, NativeMkbMode, TouchControllerMode, UiLayout, UiSection } from "@/enums/pref-values";
|
import { BlockFeature, NativeMkbMode, TouchControllerMode, UiLayout, UiSection } from "@/enums/pref-values";
|
||||||
import { PatcherUtils } from "./patcher-utils.js";
|
import { PatcherUtils } from "./patcher-utils.js";
|
||||||
|
|
||||||
@ -136,29 +135,6 @@ remotePlayServerId: (window.BX_REMOTE_PLAY_CONFIG && window.BX_REMOTE_PLAY_CONFI
|
|||||||
return str.replace(text, text + newCode);
|
return str.replace(text, text + newCode);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Remote Play: Prevent adding "Fortnite" to the "Jump back in" list
|
|
||||||
remotePlayRecentlyUsedTitleIds(str: string) {
|
|
||||||
let text = '(e.data.recentlyUsedTitleIds)){';
|
|
||||||
if (!str.includes(text)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const newCode = `if (window.BX_REMOTE_PLAY_CONFIG) return;`;
|
|
||||||
return str.replace(text, text + newCode);
|
|
||||||
},
|
|
||||||
|
|
||||||
// Remote Play: change web page's title
|
|
||||||
remotePlayWebTitle(str: string) {
|
|
||||||
let text = 'titleTemplate:void 0,title:';
|
|
||||||
const index = str.indexOf(text);
|
|
||||||
if (index < 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
str = PatcherUtils.insertAt(str, index + text.length, `!!window.BX_REMOTE_PLAY_CONFIG ? "${t('remote-play')} - Better xCloud" :`);
|
|
||||||
return str;
|
|
||||||
},
|
|
||||||
|
|
||||||
// Block WebRTC stats collector
|
// Block WebRTC stats collector
|
||||||
blockWebRtcStatsCollector(str: string) {
|
blockWebRtcStatsCollector(str: string) {
|
||||||
let text = 'this.shouldCollectStats=!0';
|
let text = 'this.shouldCollectStats=!0';
|
||||||
@ -1304,9 +1280,7 @@ let PATCH_ORDERS = PatcherUtils.filterPatches([
|
|||||||
...(getGlobalPref(GlobalPref.REMOTE_PLAY_ENABLED) ? [
|
...(getGlobalPref(GlobalPref.REMOTE_PLAY_ENABLED) ? [
|
||||||
'remotePlayDirectConnectUrl',
|
'remotePlayDirectConnectUrl',
|
||||||
'remotePlayKeepAlive',
|
'remotePlayKeepAlive',
|
||||||
'remotePlayWebTitle',
|
|
||||||
'remotePlayDisableAchievementToast',
|
'remotePlayDisableAchievementToast',
|
||||||
'remotePlayRecentlyUsedTitleIds',
|
|
||||||
STATES.userAgent.capabilities.touch && 'patchUpdateInputConfigurationAsync',
|
STATES.userAgent.capabilities.touch && 'patchUpdateInputConfigurationAsync',
|
||||||
] : []) as PatchArray,
|
] : []) as PatchArray,
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ declare const e: string;
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const msg = JSON.parse(e);
|
const msg = JSON.parse(e);
|
||||||
if (msg.reason === 'WarningForBeingIdle' && !window.location.pathname.includes('/launch/')) {
|
if (msg.reason === 'WarningForBeingIdle' && window.location.pathname.includes('/consoles/launch/')) {
|
||||||
$this$.sendKeepAlive();
|
$this$.sendKeepAlive();
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return;
|
return;
|
||||||
|
@ -195,6 +195,7 @@ export class RemotePlayManager {
|
|||||||
window.BX_REMOTE_PLAY_CONFIG = STATES.remotePlay.config;
|
window.BX_REMOTE_PLAY_CONFIG = STATES.remotePlay.config;
|
||||||
|
|
||||||
localRedirect('/launch/fortnite/BT5P2X999VH2#remote-play');
|
localRedirect('/launch/fortnite/BT5P2X999VH2#remote-play');
|
||||||
|
setTimeout(() => localRedirect('/consoles/launch/' + serverId), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
togglePopup(force = null) {
|
togglePopup(force = null) {
|
||||||
|
@ -10,6 +10,7 @@ export let FeatureGates: { [key: string]: boolean } = {
|
|||||||
ShowForcedUpdateScreen: false,
|
ShowForcedUpdateScreen: false,
|
||||||
EnableTakControlResizing: true, // Experimenting
|
EnableTakControlResizing: true, // Experimenting
|
||||||
EnableLazyLoadedHome: false,
|
EnableLazyLoadedHome: false,
|
||||||
|
EnableRemotePlay: getGlobalPref(GlobalPref.REMOTE_PLAY_ENABLED),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Enable Native Mouse & Keyboard
|
// Enable Native Mouse & Keyboard
|
||||||
|
Loading…
x
Reference in New Issue
Block a user