mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-07-02 04:11:44 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
619d70d3cb | |||
fb123e00d7 | |||
39f7ee6ddb | |||
5db35cdcc9 | |||
8c7e4650d4 | |||
a77460e242 | |||
d2839b2b7c | |||
8aa5177e10 | |||
ff490be713 | |||
eb340e7f2a |
33
.github/ISSUE_TEMPLATE/02-feature-request.yml
vendored
33
.github/ISSUE_TEMPLATE/02-feature-request.yml
vendored
@ -14,41 +14,12 @@ body:
|
|||||||
id: device_type
|
id: device_type
|
||||||
attributes:
|
attributes:
|
||||||
label: Device
|
label: Device
|
||||||
description: "Which device are you using?"
|
description: "Which device type is this feature for?"
|
||||||
options:
|
options:
|
||||||
|
- All devices
|
||||||
- Phone/Tablet
|
- Phone/Tablet
|
||||||
- Laptop
|
|
||||||
- Desktop
|
- Desktop
|
||||||
- TV
|
- TV
|
||||||
- Other
|
|
||||||
multiple: false
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: os
|
|
||||||
attributes:
|
|
||||||
label: "Operating System"
|
|
||||||
description: "Which operating system is it running?"
|
|
||||||
options:
|
|
||||||
- Windows
|
|
||||||
- macOS
|
|
||||||
- Linux
|
|
||||||
- Android
|
|
||||||
- iOS/iPadOS
|
|
||||||
- Other
|
|
||||||
multiple: false
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: browser
|
|
||||||
attributes:
|
|
||||||
label: "Browser"
|
|
||||||
description: "Which browser are you using?"
|
|
||||||
options:
|
|
||||||
- Chrome/Edge/Chromium
|
|
||||||
- Kiwi Browser
|
|
||||||
- Safari
|
|
||||||
- Other
|
|
||||||
multiple: false
|
multiple: false
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
2
dist/better-xcloud.meta.js
vendored
2
dist/better-xcloud.meta.js
vendored
@ -1,5 +1,5 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 5.5.1
|
// @version 5.5.2
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
79
dist/better-xcloud.user.js
vendored
79
dist/better-xcloud.user.js
vendored
File diff suppressed because one or more lines are too long
@ -211,3 +211,17 @@ div[class*=SupportedInputsBadge] {
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Device Code page */
|
||||||
|
#root {
|
||||||
|
section[class*=DeviceCodePage-module__page] {
|
||||||
|
margin-left: 20px !important;
|
||||||
|
margin-right: 20px !important;
|
||||||
|
margin-top: 20px !important;
|
||||||
|
max-width: 800px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
div[class*=DeviceCodePage-module__back] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -112,7 +112,7 @@ document.addEventListener('readystatechange', e => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATES.isSignedIn = (window as any).xbcUser?.isSignedIn;
|
STATES.isSignedIn = !!((window as any).xbcUser?.isSignedIn);
|
||||||
|
|
||||||
if (STATES.isSignedIn) {
|
if (STATES.isSignedIn) {
|
||||||
// Preload Remote Play
|
// Preload Remote Play
|
||||||
@ -152,6 +152,7 @@ window.addEventListener(BxEvent.XCLOUD_SERVERS_UNAVAILABLE, e => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener(BxEvent.XCLOUD_SERVERS_READY, e => {
|
window.addEventListener(BxEvent.XCLOUD_SERVERS_READY, e => {
|
||||||
|
STATES.isSignedIn = true;
|
||||||
HeaderSection.watchHeader();
|
HeaderSection.watchHeader();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,8 +20,35 @@ import { GamePassCloudGallery } from "@/enums/game-pass-gallery.js";
|
|||||||
|
|
||||||
type PatchArray = (keyof typeof PATCHES)[];
|
type PatchArray = (keyof typeof PATCHES)[];
|
||||||
|
|
||||||
const ENDING_CHUNKS_PATCH_NAME = 'loadingEndingChunks';
|
class PatcherUtils {
|
||||||
|
static indexOf(txt: string, searchString: string, startIndex: number, maxRange: number): number {
|
||||||
|
const index = txt.indexOf(searchString, startIndex);
|
||||||
|
if (index < 0 || (maxRange && index - startIndex > maxRange)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
static lastIndexOf(txt: string, searchString: string, startIndex: number, maxRange: number): number {
|
||||||
|
const index = txt.lastIndexOf(searchString, startIndex);
|
||||||
|
if (index < 0 || (maxRange && startIndex - index > maxRange)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
static insertAt(txt: string, index: number, insertString: string): string {
|
||||||
|
return txt.substring(0, index) + insertString + txt.substring(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
static replaceWith(txt: string, index: number, fromString: string, toString: string): string {
|
||||||
|
return txt.substring(0, index) + toString + txt.substring(index + fromString.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ENDING_CHUNKS_PATCH_NAME = 'loadingEndingChunks';
|
||||||
const LOG_TAG = 'Patcher';
|
const LOG_TAG = 'Patcher';
|
||||||
|
|
||||||
const PATCHES = {
|
const PATCHES = {
|
||||||
@ -33,11 +60,11 @@ const PATCHES = {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str.substring(0, index + 200).includes('"AppInsightsCore')) {
|
if (PatcherUtils.indexOf(str, '"AppInsightsCore', index, 200) < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str.substring(0, index) + '.track=function(e){},!!function(' + str.substring(index + text.length);
|
return PatcherUtils.replaceWith(str, index, text, '.track=function(e){},!!function(');
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set disableTelemetry() to true
|
// Set disableTelemetry() to true
|
||||||
@ -716,12 +743,12 @@ true` + text;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = str.indexOf('return', index - 50);
|
index = PatcherUtils.lastIndexOf(str, 'return', index, 50);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str.substring(0, index) + 'return null;' + str.substring(index + 6);
|
str = PatcherUtils.replaceWith(str, index, 'return', 'return null;');
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -732,14 +759,17 @@ true` + text;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = str.indexOf('grid:!0,', index);
|
index = PatcherUtils.indexOf(str, 'grid:!0,', index, 1500);
|
||||||
index > -1 && (index = str.indexOf('(0,', index - 70));
|
|
||||||
|
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str.substring(0, index) + 'true ? null :' + str.substring(index);
|
index = PatcherUtils.lastIndexOf(str, '(0,', index, 70);
|
||||||
|
if (index < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = PatcherUtils.insertAt(str, index, 'true ? null :');
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -750,12 +780,12 @@ true` + text;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = str.indexOf('const ', index - 100);
|
index = PatcherUtils.lastIndexOf(str, 'const ', index, 30);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str.substring(0, index) + 'return null;' + str.substring(index);
|
str = PatcherUtils.insertAt(str, index, 'return null;');
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -766,7 +796,7 @@ true` + text;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = str.indexOf('const[', index - 300);
|
index = PatcherUtils.lastIndexOf(str, 'const[', index, 300);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -794,7 +824,7 @@ if (e && e.id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
str = str.substring(0, index) + newCode + str.substring(index);
|
str = PatcherUtils.insertAt(str, index, newCode);
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -862,6 +892,26 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
|
|||||||
str = str.substring(0, index) + 'BxEvent.dispatch(window, BxEvent.XCLOUD_RENDERING_COMPONENT, {component: "product-details"});' + str.substring(index);
|
str = str.substring(0, index) + 'BxEvent.dispatch(window, BxEvent.XCLOUD_RENDERING_COMPONENT, {component: "product-details"});' + str.substring(index);
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
detectBrowserRouterReady(str: string) {
|
||||||
|
const text = 'BrowserRouter:()=>';
|
||||||
|
if (!str.includes(text)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let index = str.indexOf('{history:this.history,');
|
||||||
|
if (index < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
index = PatcherUtils.lastIndexOf(str, 'return', index, 100);
|
||||||
|
if (index < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = PatcherUtils.insertAt(str, index, 'window.BxEvent.dispatch(window, window.BxEvent.XCLOUD_ROUTER_HISTORY_READY, {history: this.history});');
|
||||||
|
return str;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let PATCH_ORDERS: PatchArray = [
|
let PATCH_ORDERS: PatchArray = [
|
||||||
@ -872,6 +922,7 @@ let PATCH_ORDERS: PatchArray = [
|
|||||||
'exposeInputSink',
|
'exposeInputSink',
|
||||||
] : []),
|
] : []),
|
||||||
|
|
||||||
|
'detectBrowserRouterReady',
|
||||||
'patchRequestInfoCrash',
|
'patchRequestInfoCrash',
|
||||||
|
|
||||||
'disableStreamGate',
|
'disableStreamGate',
|
||||||
@ -1067,7 +1118,7 @@ export class Patcher {
|
|||||||
item[1][id] = eval(patchedFuncStr);
|
item[1][id] = eval(patchedFuncStr);
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
if (e instanceof Error) {
|
if (e instanceof Error) {
|
||||||
BxLogger.error(LOG_TAG, 'Error', appliedPatches, e.message);
|
BxLogger.error(LOG_TAG, 'Error', appliedPatches, e.message, patchedFuncStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,13 +57,12 @@ export class HeaderSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static checkHeader() {
|
static checkHeader() {
|
||||||
if (!HeaderSection.#$buttonsWrapper.isConnected) {
|
let $target = document.querySelector('#PageContent div[class*=EdgewaterHeader-module__rightSectionSpacing]');
|
||||||
let $target = document.querySelector('#PageContent div[class*=EdgewaterHeader-module__rightSectionSpacing]');
|
if (!$target) {
|
||||||
if (!$target) {
|
$target = document.querySelector("div[class^=UnsupportedMarketPage-module__buttons]");
|
||||||
$target = document.querySelector("div[class^=UnsupportedMarketPage-module__buttons]");
|
|
||||||
}
|
|
||||||
$target && HeaderSection.#injectSettingsButton($target as HTMLElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$target && HeaderSection.#injectSettingsButton($target as HTMLElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
static showRemotePlayButton() {
|
static showRemotePlayButton() {
|
||||||
@ -71,7 +70,7 @@ export class HeaderSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static watchHeader() {
|
static watchHeader() {
|
||||||
let $root = document.querySelector('#PageContent header') || document.querySelector('#root');
|
const $root = document.querySelector('#PageContent header') || document.querySelector('#root');
|
||||||
if (!$root) {
|
if (!$root) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,8 @@ export namespace BxEvent {
|
|||||||
|
|
||||||
export const XCLOUD_RENDERING_COMPONENT = 'bx-xcloud-rendering-page';
|
export const XCLOUD_RENDERING_COMPONENT = 'bx-xcloud-rendering-page';
|
||||||
|
|
||||||
|
export const XCLOUD_ROUTER_HISTORY_READY = 'bx-xcloud-router-history-ready';
|
||||||
|
|
||||||
export function dispatch(target: Element | Window | null, eventName: string, data?: any) {
|
export function dispatch(target: Element | Window | null, eventName: string, data?: any) {
|
||||||
if (!target) {
|
if (!target) {
|
||||||
return;
|
return;
|
||||||
|
@ -6,7 +6,7 @@ import { getPref } from "./settings-storages/global-settings-storage";
|
|||||||
|
|
||||||
|
|
||||||
export function addCss() {
|
export function addCss() {
|
||||||
const STYLUS_CSS = renderStylus();
|
const STYLUS_CSS = renderStylus() as unknown as string;
|
||||||
let css = STYLUS_CSS;
|
let css = STYLUS_CSS;
|
||||||
|
|
||||||
const PREF_HIDE_SECTIONS = getPref(PrefKey.UI_HIDE_SECTIONS);
|
const PREF_HIDE_SECTIONS = getPref(PrefKey.UI_HIDE_SECTIONS);
|
||||||
|
Reference in New Issue
Block a user