mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-29 02:41:44 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
20caac4821 | |||
dac9823d5b | |||
bcdabbf1b9 | |||
11f3513b0c | |||
9786c7c8ee | |||
e48b277535 | |||
e2dbf873a6 | |||
6510eac0c3 | |||
3dd83ace6c | |||
45d8aed841 |
@ -1,5 +1,5 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 3.1.6
|
// @version 3.1.9
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 3.1.6
|
// @version 3.1.9
|
||||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||||
// @author redphx
|
// @author redphx
|
||||||
// @license MIT
|
// @license MIT
|
||||||
@ -14,7 +14,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const SCRIPT_VERSION = '3.1.6';
|
const SCRIPT_VERSION = '3.1.9';
|
||||||
const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
|
const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
|
||||||
|
|
||||||
const ENABLE_XCLOUD_LOGGER = false;
|
const ENABLE_XCLOUD_LOGGER = false;
|
||||||
@ -1062,10 +1062,10 @@ const Translations = {
|
|||||||
"zh-CN": "快速",
|
"zh-CN": "快速",
|
||||||
},
|
},
|
||||||
"fortnite-allow-stw-mode": {
|
"fortnite-allow-stw-mode": {
|
||||||
"de-DE": "Spielen im \"STW\"-Modus auf Mobilgeräten erlauben",
|
"de-DE": "Erlaubt das Spielen im \"STW\"-Modus auf Mobilgeräten",
|
||||||
"en-US": "Allow playing STW mode on mobile",
|
"en-US": "Allows playing STW mode on mobile",
|
||||||
"es-ES": "Permitir jugar al modo STW en el móvil",
|
"es-ES": "Permitir jugar al modo STW en el móvil",
|
||||||
"ja-JP": "モバイル版での「世界を救え」を許可する",
|
"ja-JP": "モバイル版で「世界を救え」をプレイできるようになります",
|
||||||
"pl-PL": "Zezwól na granie w tryb STW na urządzeniu mobilnym",
|
"pl-PL": "Zezwól na granie w tryb STW na urządzeniu mobilnym",
|
||||||
"pt-BR": "Permitir a reprodução do modo STW no celular",
|
"pt-BR": "Permitir a reprodução do modo STW no celular",
|
||||||
"tr-TR": "Mobil cihazda Fortnite: Dünyayı Kurtar modunu etkinleştir",
|
"tr-TR": "Mobil cihazda Fortnite: Dünyayı Kurtar modunu etkinleştir",
|
||||||
@ -1076,7 +1076,7 @@ const Translations = {
|
|||||||
"de-DE": "Fortnite: Erzwinge Konsolenversion",
|
"de-DE": "Fortnite: Erzwinge Konsolenversion",
|
||||||
"en-US": "Fortnite: force console version",
|
"en-US": "Fortnite: force console version",
|
||||||
"es-ES": "Fortnite: forzar versión de consola",
|
"es-ES": "Fortnite: forzar versión de consola",
|
||||||
"ja-JP": "Fortnite: 強制コンソールバージョン",
|
"ja-JP": "Fortnite: 強制的にコンソール版を起動する",
|
||||||
"pl-PL": "Fortnite: wymuś wersję konsolową",
|
"pl-PL": "Fortnite: wymuś wersję konsolową",
|
||||||
"pt-BR": "Fortnite: forçar versão para console",
|
"pt-BR": "Fortnite: forçar versão para console",
|
||||||
"tr-TR": "Fortnite'ın konsol sürümünü aç",
|
"tr-TR": "Fortnite'ın konsol sürümünü aç",
|
||||||
@ -6635,7 +6635,7 @@ class Preferences {
|
|||||||
setting.note = '⚠️ ' + __('browser-unsupported-feature');
|
setting.note = '⚠️ ' + __('browser-unsupported-feature');
|
||||||
} else {
|
} else {
|
||||||
// Set default value to the best codec profile
|
// Set default value to the best codec profile
|
||||||
setting.default = keys[keys.length - 1];
|
// setting.default = keys[keys.length - 1];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -6735,9 +6735,19 @@ class Preferences {
|
|||||||
})(),
|
})(),
|
||||||
'ready': () => {
|
'ready': () => {
|
||||||
const pref = Preferences.SETTINGS[Preferences.MKB_ENABLED];
|
const pref = Preferences.SETTINGS[Preferences.MKB_ENABLED];
|
||||||
const note = __(pref.unsupported ? 'browser-unsupported-feature' : 'mkb-disclaimer');
|
|
||||||
|
let note;
|
||||||
|
let url;
|
||||||
|
if (pref.unsupported) {
|
||||||
|
note = __('browser-unsupported-feature');
|
||||||
|
url = 'https://github.com/redphx/better-xcloud/issues/206#issuecomment-1920475657';
|
||||||
|
} else {
|
||||||
|
note = __('mkb-disclaimer');
|
||||||
|
url = 'https://better-xcloud.github.io/mouse-and-keyboard/#disclaimer';
|
||||||
|
}
|
||||||
|
|
||||||
Preferences.SETTINGS[Preferences.MKB_ENABLED].note = CE('a', {
|
Preferences.SETTINGS[Preferences.MKB_ENABLED].note = CE('a', {
|
||||||
href: 'https://github.com/redphx/better-xcloud/issues/206#issuecomment-1920475657',
|
href: url,
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
}, '⚠️ ' + note);
|
}, '⚠️ ' + note);
|
||||||
},
|
},
|
||||||
@ -6867,7 +6877,7 @@ class Preferences {
|
|||||||
|
|
||||||
|
|
||||||
[Preferences.STATS_ITEMS]: {
|
[Preferences.STATS_ITEMS]: {
|
||||||
'default': [StreamStats.PING, StreamStats.FPS, StreamStats.PACKETS_LOST, StreamStats.FRAMES_LOST],
|
'default': [StreamStats.PING, StreamStats.FPS, StreamStats.BITRATE, StreamStats.DECODE_TIME, StreamStats.PACKETS_LOST, StreamStats.FRAMES_LOST],
|
||||||
'multiple_options': {
|
'multiple_options': {
|
||||||
[StreamStats.PING]: `${StreamStats.PING.toUpperCase()}: ${__('stat-ping')}`,
|
[StreamStats.PING]: `${StreamStats.PING.toUpperCase()}: ${__('stat-ping')}`,
|
||||||
[StreamStats.FPS]: `${StreamStats.FPS.toUpperCase()}: ${__('stat-fps')}`,
|
[StreamStats.FPS]: `${StreamStats.FPS.toUpperCase()}: ${__('stat-fps')}`,
|
||||||
@ -6884,10 +6894,10 @@ class Preferences {
|
|||||||
'default': false,
|
'default': false,
|
||||||
},
|
},
|
||||||
[Preferences.STATS_QUICK_GLANCE]: {
|
[Preferences.STATS_QUICK_GLANCE]: {
|
||||||
'default': false,
|
'default': true,
|
||||||
},
|
},
|
||||||
[Preferences.STATS_POSITION]: {
|
[Preferences.STATS_POSITION]: {
|
||||||
'default': 'top-left',
|
'default': 'top-right',
|
||||||
'options': {
|
'options': {
|
||||||
'top-left': __('top-left'),
|
'top-left': __('top-left'),
|
||||||
'top-center': __('top-center'),
|
'top-center': __('top-center'),
|
||||||
@ -7273,12 +7283,12 @@ if (window.BX_VIBRATION_INTENSITY && window.BX_VIBRATION_INTENSITY < 1) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mkbIsMouseAndKeyboardTitle: function(funcStr) {
|
mkbIsMouseAndKeyboardTitle: function(funcStr) {
|
||||||
const text = 'isMouseAndKeyboardTitle:()=>yn';
|
const text = 'isMouseAndKeyboardTitle:()=>';
|
||||||
if (!funcStr.includes(text)) {
|
if (!funcStr.includes(text)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return funcStr.replace(text, `isMouseAndKeyboardTitle:()=>(function(e) { return e && e.details ? window.NATIVE_MKB_TITLES.includes(e.details.productId) : true; })`);
|
return funcStr.replace(text, `isMouseAndKeyboardTitle:()=>(function(e) { return e && e.details ? window.NATIVE_MKB_TITLES.includes(e.details.productId) : true; }),uwuwu:()=>`);
|
||||||
},
|
},
|
||||||
|
|
||||||
mkbMouseAndKeyboardEnabled: function(funcStr) {
|
mkbMouseAndKeyboardEnabled: function(funcStr) {
|
||||||
@ -7319,6 +7329,7 @@ if (window.BX_VIBRATION_INTENSITY && window.BX_VIBRATION_INTENSITY < 1) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('[Better xCloud] Remaining patches:', Patcher.#PATCH_ORDERS);
|
||||||
Patcher.#PATCH_ORDERS = Patcher.#PATCH_ORDERS.concat(Patcher.#PLAYING_PATCH_ORDERS);
|
Patcher.#PATCH_ORDERS = Patcher.#PATCH_ORDERS.concat(Patcher.#PLAYING_PATCH_ORDERS);
|
||||||
Patcher.#cleanupPatches();
|
Patcher.#cleanupPatches();
|
||||||
|
|
||||||
@ -7372,13 +7383,13 @@ if (window.BX_VIBRATION_INTENSITY && window.BX_VIBRATION_INTENSITY < 1) {
|
|||||||
getPref(Preferences.UI_LAYOUT) === 'tv' && ['tvLayout'],
|
getPref(Preferences.UI_LAYOUT) === 'tv' && ['tvLayout'],
|
||||||
|
|
||||||
ENABLE_XCLOUD_LOGGER && [
|
ENABLE_XCLOUD_LOGGER && [
|
||||||
'enableXcloudLogger',
|
|
||||||
'enableConsoleLogging',
|
'enableConsoleLogging',
|
||||||
|
'enableXcloudLogger',
|
||||||
],
|
],
|
||||||
|
|
||||||
getPref(Preferences.BLOCK_TRACKING) && [
|
getPref(Preferences.BLOCK_TRACKING) && [
|
||||||
'disableTrackEvent',
|
|
||||||
'blockWebRtcStatsCollector',
|
'blockWebRtcStatsCollector',
|
||||||
|
'disableTrackEvent',
|
||||||
],
|
],
|
||||||
|
|
||||||
getPref(Preferences.REMOTE_PLAY_ENABLED) && [
|
getPref(Preferences.REMOTE_PLAY_ENABLED) && [
|
||||||
@ -9041,9 +9052,10 @@ function interceptHttpRequests() {
|
|||||||
|
|
||||||
if (getPref(Preferences.BLOCK_SOCIAL_FEATURES)) {
|
if (getPref(Preferences.BLOCK_SOCIAL_FEATURES)) {
|
||||||
BLOCKED_URLS = BLOCKED_URLS.concat([
|
BLOCKED_URLS = BLOCKED_URLS.concat([
|
||||||
'https://peoplehub.xboxlive.com/users/me',
|
'https://peoplehub.xboxlive.com/users/me/people/social',
|
||||||
// 'https://accounts.xboxlive.com/family/memberXuid',
|
'https://peoplehub.xboxlive.com/users/me/people/recommendations',
|
||||||
'https://notificationinbox.xboxlive.com',
|
'https://notificationinbox.xboxlive.com',
|
||||||
|
// 'https://accounts.xboxlive.com/family/memberXuid',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9120,6 +9132,17 @@ function interceptHttpRequests() {
|
|||||||
let request = arg[0];
|
let request = arg[0];
|
||||||
let url = (typeof request === 'string') ? request : request.url;
|
let url = (typeof request === 'string') ? request : request.url;
|
||||||
|
|
||||||
|
for (let blocked of BLOCKED_URLS) {
|
||||||
|
if (!url.startsWith(blocked)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response('{"acc":1,"webResult":{}}', {
|
||||||
|
status: 200,
|
||||||
|
statusText: '200 OK',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (url.endsWith('/play')) {
|
if (url.endsWith('/play')) {
|
||||||
BxEvent.dispatch(window, BxEvent.STREAM_LOADING);
|
BxEvent.dispatch(window, BxEvent.STREAM_LOADING);
|
||||||
}
|
}
|
||||||
@ -9447,17 +9470,6 @@ function interceptHttpRequests() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let blocked of BLOCKED_URLS) {
|
|
||||||
if (!url.startsWith(blocked)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Response('{"acc":1,"webResult":{}}', {
|
|
||||||
status: 200,
|
|
||||||
statusText: '200 OK',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return NATIVE_FETCH(...arg);
|
return NATIVE_FETCH(...arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10402,7 +10414,7 @@ function setupQuickSettingsBar() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
pref: Preferences.STATS_QUICK_GLANCE,
|
pref: Preferences.STATS_QUICK_GLANCE,
|
||||||
label: __('enable-quick-glance-mode'),
|
label: '👀 ' + __('enable-quick-glance-mode'),
|
||||||
onChange: e => {
|
onChange: e => {
|
||||||
e.target.checked ? StreamStats.quickGlanceSetup() : StreamStats.quickGlanceStop();
|
e.target.checked ? StreamStats.quickGlanceSetup() : StreamStats.quickGlanceStop();
|
||||||
},
|
},
|
||||||
@ -10807,6 +10819,7 @@ if (getPref(Preferences.AUDIO_ENABLE_VOLUME_CONTROL)) {
|
|||||||
window.AudioContext = function() {
|
window.AudioContext = function() {
|
||||||
const ctx = new OrgAudioContext();
|
const ctx = new OrgAudioContext();
|
||||||
STREAM_AUDIO_CONTEXT = ctx;
|
STREAM_AUDIO_CONTEXT = ctx;
|
||||||
|
STREAM_AUDIO_GAIN_NODE = null;
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10854,6 +10867,13 @@ RTCPeerConnection.prototype.createDataChannel = function() {
|
|||||||
const OrgRTCPeerConnection = window.RTCPeerConnection;
|
const OrgRTCPeerConnection = window.RTCPeerConnection;
|
||||||
window.RTCPeerConnection = function() {
|
window.RTCPeerConnection = function() {
|
||||||
STREAM_WEBRTC = new OrgRTCPeerConnection();
|
STREAM_WEBRTC = new OrgRTCPeerConnection();
|
||||||
|
|
||||||
|
STREAM_WEBRTC.addEventListener('connectionstatechange', e => {
|
||||||
|
if (STREAM_WEBRTC.connectionState === 'connecting') {
|
||||||
|
STREAM_AUDIO_GAIN_NODE = null;
|
||||||
|
}
|
||||||
|
console.log('connectionState', STREAM_WEBRTC.connectionState);
|
||||||
|
});
|
||||||
return STREAM_WEBRTC;
|
return STREAM_WEBRTC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user