mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-03 06:07:19 +02:00
Fix patches
This commit is contained in:
parent
a3130101f4
commit
43a66db697
32
dist/better-xcloud.pretty.user.js
vendored
32
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.4
|
// @version 6.4.5-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.4", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
var SCRIPT_VERSION = "6.4.5-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,
|
||||||
@ -5133,11 +5133,6 @@ var LOG_TAG2 = "Patcher", PATCHES = {
|
|||||||
if (index < 0 || PatcherUtils.indexOf(str, '"AppInsightsCore', index, 200) < 0) return !1;
|
if (index < 0 || PatcherUtils.indexOf(str, '"AppInsightsCore', index, 200) < 0) return !1;
|
||||||
return PatcherUtils.replaceWith(str, index, text, ".track=function(e){},!!function(");
|
return PatcherUtils.replaceWith(str, index, text, ".track=function(e){},!!function(");
|
||||||
},
|
},
|
||||||
disableTelemetry(str) {
|
|
||||||
let text = ".disableTelemetry=function(){return!1}";
|
|
||||||
if (!str.includes(text)) return !1;
|
|
||||||
return str.replace(text, ".disableTelemetry=function(){return!0}");
|
|
||||||
},
|
|
||||||
disableTelemetryProvider(str) {
|
disableTelemetryProvider(str) {
|
||||||
let text = "this.enableLightweightTelemetry=!";
|
let text = "this.enableLightweightTelemetry=!";
|
||||||
if (!str.includes(text)) return !1;
|
if (!str.includes(text)) return !1;
|
||||||
@ -5165,10 +5160,10 @@ var LOG_TAG2 = "Patcher", PATCHES = {
|
|||||||
let layout = getGlobalPref("ui.layout") === "tv" ? "tv" : "default";
|
let layout = getGlobalPref("ui.layout") === "tv" ? "tv" : "default";
|
||||||
return str.replace(text, `?"${layout}":"${layout}"`);
|
return str.replace(text, `?"${layout}":"${layout}"`);
|
||||||
},
|
},
|
||||||
remotePlayDirectConnectUrl(str) {
|
remotePlayPostStreamRedirectUrl(str) {
|
||||||
let index = str.indexOf("/direct-connect");
|
let text = ".RemotePlayRoot.getLink()):";
|
||||||
if (index < 0) return !1;
|
if (!str.includes(text)) return !1;
|
||||||
return str.replace(str.substring(index - 9, index + 15), "https://www.xbox.com/play");
|
return str = str.replace(text, ".Home.getLink()):"), str;
|
||||||
},
|
},
|
||||||
remotePlayKeepAlive(str) {
|
remotePlayKeepAlive(str) {
|
||||||
let text = "onServerDisconnectMessage(e){";
|
let text = "onServerDisconnectMessage(e){";
|
||||||
@ -5212,14 +5207,14 @@ remotePlayServerId: (window.BX_REMOTE_PLAY_CONFIG && window.BX_REMOTE_PLAY_CONFI
|
|||||||
return customizationCode += renderString(controller_customization_default, { xCloudGamepadVar }), codeBlock = PatcherUtils.insertAt(codeBlock, backetIndex, customizationCode), str = str.substring(0, index) + codeBlock + str.substring(setTimeoutIndex), str;
|
return customizationCode += renderString(controller_customization_default, { xCloudGamepadVar }), codeBlock = PatcherUtils.insertAt(codeBlock, backetIndex, customizationCode), str = str.substring(0, index) + codeBlock + str.substring(setTimeoutIndex), str;
|
||||||
},
|
},
|
||||||
enableXcloudLogger(str) {
|
enableXcloudLogger(str) {
|
||||||
let text = "this.telemetryProvider=e}log(e,t,r){";
|
let index = str.indexOf("this.telemetryProvider.trackErrorLike");
|
||||||
if (!str.includes(text)) return !1;
|
if (index > -1 && (index = PatcherUtils.lastIndexOf(str, "}log(", index, 1500)), index > -1 && (index = PatcherUtils.indexOf(str, "{", index, 30, !0)), index < 0) return !1;
|
||||||
let newCode = `
|
let newCode = `
|
||||||
const [logTag, logLevel, logMessage] = Array.from(arguments);
|
const [logTag, logLevel, logMessage] = Array.from(arguments);
|
||||||
const logFunc = [console.debug, console.log, console.warn, console.error][logLevel];
|
const logFunc = [console.debug, console.log, console.warn, console.error][logLevel];
|
||||||
logFunc(logTag, '//', logMessage);
|
logFunc(logTag, '//', logMessage);
|
||||||
`;
|
`;
|
||||||
return str = str.replaceAll(text, text + newCode), str;
|
return str = PatcherUtils.insertAt(str, index, newCode), str;
|
||||||
},
|
},
|
||||||
enableConsoleLogging(str) {
|
enableConsoleLogging(str) {
|
||||||
let text = "static isConsoleLoggingAllowed(){";
|
let text = "static isConsoleLoggingAllowed(){";
|
||||||
@ -5548,11 +5543,6 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
|
|||||||
if (index >= 0 && (index = str.indexOf('addEventListener("touchstart"', index)), index >= 0 && (index = PatcherUtils.lastIndexOf(str, "return ", index, 50)), index < 0) return !1;
|
if (index >= 0 && (index = str.indexOf('addEventListener("touchstart"', index)), index >= 0 && (index = PatcherUtils.lastIndexOf(str, "return ", index, 50)), index < 0) return !1;
|
||||||
return str = PatcherUtils.replaceWith(str, index, "return", "return () => {};"), str;
|
return str = PatcherUtils.replaceWith(str, index, "return", "return () => {};"), str;
|
||||||
},
|
},
|
||||||
optimizeGameSlugGenerator(str) {
|
|
||||||
let text = "/[;,/?:@&=+_`~$%#^*()!^\\u2122\\xae\\xa9]/g";
|
|
||||||
if (!str.includes(text)) return !1;
|
|
||||||
return str = str.replace(text, "window.BX_EXPOSED.GameSlugRegexes[0]"), str = str.replace("/ {2,}/g", "window.BX_EXPOSED.GameSlugRegexes[1]"), str = str.replace("/ /g", "window.BX_EXPOSED.GameSlugRegexes[2]"), str;
|
|
||||||
},
|
|
||||||
modifyPreloadedState(str) {
|
modifyPreloadedState(str) {
|
||||||
let text = "=window.__PRELOADED_STATE__;";
|
let text = "=window.__PRELOADED_STATE__;";
|
||||||
if (!str.includes(text)) return !1;
|
if (!str.includes(text)) return !1;
|
||||||
@ -5669,7 +5659,6 @@ ${subsVar} = subs;
|
|||||||
"broadcastPollingMode",
|
"broadcastPollingMode",
|
||||||
getGlobalPref("ui.gameCard.waitTime.show") && "patchSetCurrentFocus",
|
getGlobalPref("ui.gameCard.waitTime.show") && "patchSetCurrentFocus",
|
||||||
"patchGamepadPolling",
|
"patchGamepadPolling",
|
||||||
"optimizeGameSlugGenerator",
|
|
||||||
"modifyPreloadedState",
|
"modifyPreloadedState",
|
||||||
"detectBrowserRouterReady",
|
"detectBrowserRouterReady",
|
||||||
"exposeStreamSession",
|
"exposeStreamSession",
|
||||||
@ -5699,13 +5688,11 @@ ${subsVar} = subs;
|
|||||||
] : [],
|
] : [],
|
||||||
...getGlobalPref("block.tracking") ? [
|
...getGlobalPref("block.tracking") ? [
|
||||||
"disableAiTrack",
|
"disableAiTrack",
|
||||||
"disableTelemetry",
|
|
||||||
"blockWebRtcStatsCollector",
|
"blockWebRtcStatsCollector",
|
||||||
"disableIndexDbLogging",
|
"disableIndexDbLogging",
|
||||||
"disableTelemetryProvider"
|
"disableTelemetryProvider"
|
||||||
] : [],
|
] : [],
|
||||||
...getGlobalPref("xhome.enabled") ? [
|
...getGlobalPref("xhome.enabled") ? [
|
||||||
"remotePlayDirectConnectUrl",
|
|
||||||
"remotePlayKeepAlive",
|
"remotePlayKeepAlive",
|
||||||
"remotePlayDisableAchievementToast",
|
"remotePlayDisableAchievementToast",
|
||||||
STATES.userAgent.capabilities.touch && "patchUpdateInputConfigurationAsync"
|
STATES.userAgent.capabilities.touch && "patchUpdateInputConfigurationAsync"
|
||||||
@ -5748,6 +5735,7 @@ ${subsVar} = subs;
|
|||||||
"patchPollGamepads",
|
"patchPollGamepads",
|
||||||
getGlobalPref("stream.video.combineAudio") && "streamCombineSources",
|
getGlobalPref("stream.video.combineAudio") && "streamCombineSources",
|
||||||
...getGlobalPref("xhome.enabled") ? [
|
...getGlobalPref("xhome.enabled") ? [
|
||||||
|
"remotePlayPostStreamRedirectUrl",
|
||||||
"patchRemotePlayMkb",
|
"patchRemotePlayMkb",
|
||||||
"remotePlayConnectMode"
|
"remotePlayConnectMode"
|
||||||
] : [],
|
] : [],
|
||||||
|
16
dist/better-xcloud.user.js
vendored
16
dist/better-xcloud.user.js
vendored
File diff suppressed because one or more lines are too long
@ -39,6 +39,7 @@ const PATCHES = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Set disableTelemetry() to true
|
// Set disableTelemetry() to true
|
||||||
|
/*
|
||||||
disableTelemetry(str: string) {
|
disableTelemetry(str: string) {
|
||||||
let text = '.disableTelemetry=function(){return!1}';
|
let text = '.disableTelemetry=function(){return!1}';
|
||||||
if (!str.includes(text)) {
|
if (!str.includes(text)) {
|
||||||
@ -47,6 +48,7 @@ const PATCHES = {
|
|||||||
|
|
||||||
return str.replace(text, '.disableTelemetry=function(){return!0}');
|
return str.replace(text, '.disableTelemetry=function(){return!0}');
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
|
|
||||||
disableTelemetryProvider(str: string) {
|
disableTelemetryProvider(str: string) {
|
||||||
let text = 'this.enableLightweightTelemetry=!';
|
let text = 'this.enableLightweightTelemetry=!';
|
||||||
@ -91,14 +93,14 @@ const PATCHES = {
|
|||||||
return str.replace(text, `?"${layout}":"${layout}"`);
|
return str.replace(text, `?"${layout}":"${layout}"`);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Replace "/direct-connect" with "/play"
|
remotePlayPostStreamRedirectUrl(str: string) {
|
||||||
remotePlayDirectConnectUrl(str: string) {
|
let text = '.RemotePlayRoot.getLink()):';
|
||||||
const index = str.indexOf('/direct-connect');
|
if (!str.includes(text)) {
|
||||||
if (index < 0) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str.replace(str.substring(index - 9, index + 15), 'https://www.xbox.com/play');
|
str = str.replace(text, '.Home.getLink()):');
|
||||||
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
remotePlayKeepAlive(str: string) {
|
remotePlayKeepAlive(str: string) {
|
||||||
@ -202,8 +204,11 @@ remotePlayServerId: (window.BX_REMOTE_PLAY_CONFIG && window.BX_REMOTE_PLAY_CONFI
|
|||||||
},
|
},
|
||||||
|
|
||||||
enableXcloudLogger(str: string) {
|
enableXcloudLogger(str: string) {
|
||||||
let text = 'this.telemetryProvider=e}log(e,t,r){';
|
let index = str.indexOf('this.telemetryProvider.trackErrorLike');
|
||||||
if (!str.includes(text)) {
|
index > -1 && (index = PatcherUtils.lastIndexOf(str, '}log(', index, 1500));
|
||||||
|
index > -1 && (index = PatcherUtils.indexOf(str, '{', index, 30, true));
|
||||||
|
|
||||||
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +218,7 @@ const logFunc = [console.debug, console.log, console.warn, console.error][logLev
|
|||||||
logFunc(logTag, '//', logMessage);
|
logFunc(logTag, '//', logMessage);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
str = str.replaceAll(text, text + newCode);
|
str = PatcherUtils.insertAt(str, index, newCode);
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -909,20 +914,6 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
|
|||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Optimize Game slug generator by using cached RegEx
|
|
||||||
optimizeGameSlugGenerator(str: string) {
|
|
||||||
let text = '/[;,/?:@&=+_`~$%#^*()!^\\u2122\\xae\\xa9]/g';
|
|
||||||
if (!str.includes(text)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
str = str.replace(text, 'window.BX_EXPOSED.GameSlugRegexes[0]');
|
|
||||||
str = str.replace('/ {2,}/g', 'window.BX_EXPOSED.GameSlugRegexes[1]');
|
|
||||||
str = str.replace('/ /g', 'window.BX_EXPOSED.GameSlugRegexes[2]');
|
|
||||||
|
|
||||||
return str;
|
|
||||||
},
|
|
||||||
|
|
||||||
modifyPreloadedState(str: string) {
|
modifyPreloadedState(str: string) {
|
||||||
let text = '=window.__PRELOADED_STATE__;';
|
let text = '=window.__PRELOADED_STATE__;';
|
||||||
if (!str.includes(text)) {
|
if (!str.includes(text)) {
|
||||||
@ -1219,8 +1210,6 @@ let PATCH_ORDERS = PatcherUtils.filterPatches([
|
|||||||
|
|
||||||
'patchGamepadPolling',
|
'patchGamepadPolling',
|
||||||
|
|
||||||
'optimizeGameSlugGenerator',
|
|
||||||
|
|
||||||
'modifyPreloadedState',
|
'modifyPreloadedState',
|
||||||
|
|
||||||
'detectBrowserRouterReady',
|
'detectBrowserRouterReady',
|
||||||
@ -1269,7 +1258,7 @@ let PATCH_ORDERS = PatcherUtils.filterPatches([
|
|||||||
|
|
||||||
...(getGlobalPref(GlobalPref.BLOCK_TRACKING) ? [
|
...(getGlobalPref(GlobalPref.BLOCK_TRACKING) ? [
|
||||||
'disableAiTrack',
|
'disableAiTrack',
|
||||||
'disableTelemetry',
|
// 'disableTelemetry',
|
||||||
|
|
||||||
'blockWebRtcStatsCollector',
|
'blockWebRtcStatsCollector',
|
||||||
'disableIndexDbLogging',
|
'disableIndexDbLogging',
|
||||||
@ -1278,7 +1267,6 @@ let PATCH_ORDERS = PatcherUtils.filterPatches([
|
|||||||
] : []) as PatchArray,
|
] : []) as PatchArray,
|
||||||
|
|
||||||
...(getGlobalPref(GlobalPref.REMOTE_PLAY_ENABLED) ? [
|
...(getGlobalPref(GlobalPref.REMOTE_PLAY_ENABLED) ? [
|
||||||
'remotePlayDirectConnectUrl',
|
|
||||||
'remotePlayKeepAlive',
|
'remotePlayKeepAlive',
|
||||||
'remotePlayDisableAchievementToast',
|
'remotePlayDisableAchievementToast',
|
||||||
STATES.userAgent.capabilities.touch && 'patchUpdateInputConfigurationAsync',
|
STATES.userAgent.capabilities.touch && 'patchUpdateInputConfigurationAsync',
|
||||||
@ -1348,6 +1336,7 @@ let STREAM_PAGE_PATCH_ORDERS = PatcherUtils.filterPatches([
|
|||||||
getGlobalPref(GlobalPref.STREAM_COMBINE_SOURCES) && 'streamCombineSources',
|
getGlobalPref(GlobalPref.STREAM_COMBINE_SOURCES) && 'streamCombineSources',
|
||||||
|
|
||||||
...(getGlobalPref(GlobalPref.REMOTE_PLAY_ENABLED) ? [
|
...(getGlobalPref(GlobalPref.REMOTE_PLAY_ENABLED) ? [
|
||||||
|
'remotePlayPostStreamRedirectUrl',
|
||||||
'patchRemotePlayMkb',
|
'patchRemotePlayMkb',
|
||||||
'remotePlayConnectMode',
|
'remotePlayConnectMode',
|
||||||
] : []) as PatchArray,
|
] : []) as PatchArray,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user