mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 15:47:18 +02:00
Update dist
This commit is contained in:
parent
8e88af5f8c
commit
82ee00b4ae
72
dist/better-xcloud.lite.user.js
vendored
72
dist/better-xcloud.lite.user.js
vendored
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name Better xCloud (Lite)
|
||||
// @namespace https://github.com/redphx
|
||||
// @version 5.8.4
|
||||
// @version 5.8.5-beta
|
||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||
// @author redphx
|
||||
// @license MIT
|
||||
@ -111,7 +111,7 @@ function deepClone(obj) {
|
||||
if (!obj) return {};
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
}
|
||||
var SCRIPT_VERSION = "5.8.4", SCRIPT_VARIANT = "lite", AppInterface = window.AppInterface;
|
||||
var SCRIPT_VERSION = "5.8.5-beta", SCRIPT_VARIANT = "lite", AppInterface = window.AppInterface;
|
||||
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, supportMkb = AppInterface || !userAgent.match(/(android|iphone|ipad)/), STATES = {
|
||||
supportedRegion: !0,
|
||||
@ -936,10 +936,7 @@ class BaseSettingsStore {
|
||||
}
|
||||
class StreamStatsCollector {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!StreamStatsCollector.instance) StreamStatsCollector.instance = new StreamStatsCollector;
|
||||
return StreamStatsCollector.instance;
|
||||
}
|
||||
static getInstance = () => StreamStatsCollector.instance ?? (StreamStatsCollector.instance = new StreamStatsCollector);
|
||||
static INTERVAL_BACKGROUND = 60000;
|
||||
calculateGrade(value, grades) {
|
||||
return value > grades[2] ? "bad" : value > grades[1] ? "ok" : value > grades[0] ? "good" : "";
|
||||
@ -1807,10 +1804,7 @@ var MouseMapTo;
|
||||
})(MouseMapTo ||= {});
|
||||
class StreamStats {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!StreamStats.instance) StreamStats.instance = new StreamStats;
|
||||
return StreamStats.instance;
|
||||
}
|
||||
static getInstance = () => StreamStats.instance ?? (StreamStats.instance = new StreamStats);
|
||||
intervalId;
|
||||
REFRESH_INTERVAL = 1000;
|
||||
stats = {
|
||||
@ -2141,14 +2135,13 @@ function onChangeVideoPlayerType() {
|
||||
else if ($videoProcessing.value = "usm", setPref("video_processing", "usm"), $optCas && ($optCas.disabled = !0), UserAgent.isSafari()) isDisabled = !0;
|
||||
$videoProcessing.disabled = isDisabled, $videoSharpness.dataset.disabled = isDisabled.toString(), $videoPowerPreference.closest(".bx-settings-row").classList.toggle("bx-gone", playerType !== "webgl2"), $videoMaxFps.closest(".bx-settings-row").classList.toggle("bx-gone", playerType !== "webgl2"), updateVideoPlayer();
|
||||
}
|
||||
function limitVideoPlayerFps() {
|
||||
const targetFps = getPref("video_max_fps");
|
||||
function limitVideoPlayerFps(targetFps) {
|
||||
STATES.currentStream.streamPlayer?.getWebGL2Player()?.setTargetFps(targetFps);
|
||||
}
|
||||
function updateVideoPlayer() {
|
||||
const streamPlayer = STATES.currentStream.streamPlayer;
|
||||
if (!streamPlayer) return;
|
||||
limitVideoPlayerFps();
|
||||
limitVideoPlayerFps(getPref("video_max_fps"));
|
||||
const options = {
|
||||
processing: getPref("video_processing"),
|
||||
sharpness: getPref("video_sharpness"),
|
||||
@ -2381,10 +2374,7 @@ class KeyHelper {
|
||||
var LOG_TAG = "PointerClient";
|
||||
class PointerClient {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!PointerClient.instance) PointerClient.instance = new PointerClient;
|
||||
return PointerClient.instance;
|
||||
}
|
||||
static getInstance = () => PointerClient.instance ?? (PointerClient.instance = new PointerClient);
|
||||
socket;
|
||||
mkbHandler;
|
||||
start(port, mkbHandler) {
|
||||
@ -2516,11 +2506,8 @@ class PointerLockMouseDataProvider extends MouseDataProvider {
|
||||
#disableContextMenu = (e) => e.preventDefault();
|
||||
}
|
||||
class EmulatedMkbHandler extends MkbHandler {
|
||||
static #instance;
|
||||
static getInstance() {
|
||||
if (!EmulatedMkbHandler.#instance) EmulatedMkbHandler.#instance = new EmulatedMkbHandler;
|
||||
return EmulatedMkbHandler.#instance;
|
||||
}
|
||||
static instance;
|
||||
static getInstance = () => EmulatedMkbHandler.instance ?? (EmulatedMkbHandler.instance = new EmulatedMkbHandler);
|
||||
#CURRENT_PRESET_DATA = MkbPreset.convert(MkbPreset.DEFAULT_PRESET);
|
||||
static DEFAULT_PANNING_SENSITIVITY = 0.001;
|
||||
static DEFAULT_DEADZONE_COUNTERWEIGHT = 0.01;
|
||||
@ -2798,10 +2785,7 @@ class NavigationDialog {
|
||||
}
|
||||
class NavigationDialogManager {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!NavigationDialogManager.instance) NavigationDialogManager.instance = new NavigationDialogManager;
|
||||
return NavigationDialogManager.instance;
|
||||
}
|
||||
static getInstance = () => NavigationDialogManager.instance ?? (NavigationDialogManager.instance = new NavigationDialogManager);
|
||||
static GAMEPAD_POLLING_INTERVAL = 50;
|
||||
static GAMEPAD_KEYS = [
|
||||
12,
|
||||
@ -3171,10 +3155,7 @@ if (getPref("block_social_features")) FeatureGates.EnableGuideChatTab = !1;
|
||||
if (BX_FLAGS.FeatureGates) FeatureGates = Object.assign(BX_FLAGS.FeatureGates, FeatureGates);
|
||||
class FullscreenText {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!FullscreenText.instance) FullscreenText.instance = new FullscreenText;
|
||||
return FullscreenText.instance;
|
||||
}
|
||||
static getInstance = () => FullscreenText.instance ?? (FullscreenText.instance = new FullscreenText);
|
||||
$text;
|
||||
constructor() {
|
||||
this.$text = CE("div", {
|
||||
@ -3190,10 +3171,7 @@ class FullscreenText {
|
||||
}
|
||||
class SettingsNavigationDialog extends NavigationDialog {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!SettingsNavigationDialog.instance) SettingsNavigationDialog.instance = new SettingsNavigationDialog;
|
||||
return SettingsNavigationDialog.instance;
|
||||
}
|
||||
static getInstance = () => SettingsNavigationDialog.instance ?? (SettingsNavigationDialog.instance = new SettingsNavigationDialog);
|
||||
$container;
|
||||
$tabs;
|
||||
$settings;
|
||||
@ -3458,7 +3436,9 @@ class SettingsNavigationDialog extends NavigationDialog {
|
||||
onChange: onChangeVideoPlayerType
|
||||
}, {
|
||||
pref: "video_max_fps",
|
||||
onChange: limitVideoPlayerFps
|
||||
onChange: (e) => {
|
||||
limitVideoPlayerFps(parseInt(e.target.value));
|
||||
}
|
||||
}, {
|
||||
pref: "video_power_preference",
|
||||
onChange: () => {
|
||||
@ -4185,10 +4165,7 @@ class HeaderSection {
|
||||
}
|
||||
class RemotePlayNavigationDialog extends NavigationDialog {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!RemotePlayNavigationDialog.instance) RemotePlayNavigationDialog.instance = new RemotePlayNavigationDialog;
|
||||
return RemotePlayNavigationDialog.instance;
|
||||
}
|
||||
static getInstance = () => RemotePlayNavigationDialog.instance ?? (RemotePlayNavigationDialog.instance = new RemotePlayNavigationDialog);
|
||||
STATE_LABELS = {
|
||||
On: t("powered-on"),
|
||||
Off: t("powered-off"),
|
||||
@ -4254,10 +4231,7 @@ class RemotePlayNavigationDialog extends NavigationDialog {
|
||||
var LOG_TAG2 = "RemotePlay";
|
||||
class RemotePlayManager {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!this.instance) this.instance = new RemotePlayManager;
|
||||
return this.instance;
|
||||
}
|
||||
static getInstance = () => RemotePlayManager.instance ?? (RemotePlayManager.instance = new RemotePlayManager);
|
||||
isInitialized = !1;
|
||||
XCLOUD_TOKEN;
|
||||
XHOME_TOKEN;
|
||||
@ -4544,10 +4518,7 @@ class GuideMenu {
|
||||
}
|
||||
class StreamBadges {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!StreamBadges.instance) StreamBadges.instance = new StreamBadges;
|
||||
return StreamBadges.instance;
|
||||
}
|
||||
static getInstance = () => StreamBadges.instance ?? (StreamBadges.instance = new StreamBadges);
|
||||
serverInfo = {};
|
||||
badges = {
|
||||
playtime: {
|
||||
@ -5107,7 +5078,7 @@ class WebGL2Player {
|
||||
this.options.saturation = 1 + (saturation - 100) / 100, update && this.updateCanvas();
|
||||
}
|
||||
setTargetFps(target) {
|
||||
this.targetFps = target, this.frameInterval = Math.ceil(1000 / target);
|
||||
this.targetFps = target, this.lastFrameTime = 0, this.frameInterval = target ? Math.floor(1000 / target) : 0;
|
||||
}
|
||||
getCanvas() {
|
||||
return this.$canvas;
|
||||
@ -5117,6 +5088,7 @@ class WebGL2Player {
|
||||
gl.uniform2f(gl.getUniformLocation(program, "iResolution"), this.$canvas.width, this.$canvas.height), gl.uniform1i(gl.getUniformLocation(program, "filterId"), this.options.filterId), gl.uniform1f(gl.getUniformLocation(program, "sharpenFactor"), this.options.sharpenFactor), gl.uniform1f(gl.getUniformLocation(program, "brightness"), this.options.brightness), gl.uniform1f(gl.getUniformLocation(program, "contrast"), this.options.contrast), gl.uniform1f(gl.getUniformLocation(program, "saturation"), this.options.saturation);
|
||||
}
|
||||
drawFrame() {
|
||||
if (this.targetFps === 0) return;
|
||||
if (this.targetFps < 60) {
|
||||
const currentTime = performance.now();
|
||||
if (currentTime - this.lastFrameTime < this.frameInterval) return;
|
||||
@ -5171,9 +5143,9 @@ class WebGL2Player {
|
||||
BxLogger.info(this.LOG_TAG, "Destroy"), this.stop();
|
||||
const gl = this.gl;
|
||||
if (gl) {
|
||||
gl.getExtension("WEBGL_lose_context")?.loseContext();
|
||||
gl.getExtension("WEBGL_lose_context")?.loseContext(), gl.useProgram(null);
|
||||
for (let resource of this.resources)
|
||||
if (resource instanceof WebGLProgram) gl.useProgram(null), gl.deleteProgram(resource);
|
||||
if (resource instanceof WebGLProgram) gl.deleteProgram(resource);
|
||||
else if (resource instanceof WebGLShader) gl.deleteShader(resource);
|
||||
else if (resource instanceof WebGLTexture) gl.deleteTexture(resource);
|
||||
else if (resource instanceof WebGLBuffer) gl.deleteBuffer(resource);
|
||||
|
138
dist/better-xcloud.user.js
vendored
138
dist/better-xcloud.user.js
vendored
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name Better xCloud
|
||||
// @namespace https://github.com/redphx
|
||||
// @version 5.8.4
|
||||
// @version 5.8.5-beta
|
||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||
// @author redphx
|
||||
// @license MIT
|
||||
@ -113,7 +113,7 @@ function deepClone(obj) {
|
||||
if (!obj) return {};
|
||||
return JSON.parse(JSON.stringify(obj));
|
||||
}
|
||||
var SCRIPT_VERSION = "5.8.4", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
||||
var SCRIPT_VERSION = "5.8.5-beta", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
||||
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, supportMkb = AppInterface || !userAgent.match(/(android|iphone|ipad)/), STATES = {
|
||||
supportedRegion: !0,
|
||||
@ -963,10 +963,7 @@ class BaseSettingsStore {
|
||||
}
|
||||
class StreamStatsCollector {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!StreamStatsCollector.instance) StreamStatsCollector.instance = new StreamStatsCollector;
|
||||
return StreamStatsCollector.instance;
|
||||
}
|
||||
static getInstance = () => StreamStatsCollector.instance ?? (StreamStatsCollector.instance = new StreamStatsCollector);
|
||||
static INTERVAL_BACKGROUND = 60000;
|
||||
calculateGrade(value, grades) {
|
||||
return value > grades[2] ? "bad" : value > grades[1] ? "ok" : value > grades[0] ? "good" : "";
|
||||
@ -1878,10 +1875,7 @@ var MouseMapTo;
|
||||
})(MouseMapTo ||= {});
|
||||
class StreamStats {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!StreamStats.instance) StreamStats.instance = new StreamStats;
|
||||
return StreamStats.instance;
|
||||
}
|
||||
static getInstance = () => StreamStats.instance ?? (StreamStats.instance = new StreamStats);
|
||||
intervalId;
|
||||
REFRESH_INTERVAL = 1000;
|
||||
stats = {
|
||||
@ -2258,14 +2252,13 @@ function onChangeVideoPlayerType() {
|
||||
else if ($videoProcessing.value = "usm", setPref("video_processing", "usm"), $optCas && ($optCas.disabled = !0), UserAgent.isSafari()) isDisabled = !0;
|
||||
$videoProcessing.disabled = isDisabled, $videoSharpness.dataset.disabled = isDisabled.toString(), $videoPowerPreference.closest(".bx-settings-row").classList.toggle("bx-gone", playerType !== "webgl2"), $videoMaxFps.closest(".bx-settings-row").classList.toggle("bx-gone", playerType !== "webgl2"), updateVideoPlayer();
|
||||
}
|
||||
function limitVideoPlayerFps() {
|
||||
const targetFps = getPref("video_max_fps");
|
||||
function limitVideoPlayerFps(targetFps) {
|
||||
STATES.currentStream.streamPlayer?.getWebGL2Player()?.setTargetFps(targetFps);
|
||||
}
|
||||
function updateVideoPlayer() {
|
||||
const streamPlayer = STATES.currentStream.streamPlayer;
|
||||
if (!streamPlayer) return;
|
||||
limitVideoPlayerFps();
|
||||
limitVideoPlayerFps(getPref("video_max_fps"));
|
||||
const options = {
|
||||
processing: getPref("video_processing"),
|
||||
sharpness: getPref("video_sharpness"),
|
||||
@ -2498,10 +2491,7 @@ class KeyHelper {
|
||||
var LOG_TAG = "PointerClient";
|
||||
class PointerClient {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!PointerClient.instance) PointerClient.instance = new PointerClient;
|
||||
return PointerClient.instance;
|
||||
}
|
||||
static getInstance = () => PointerClient.instance ?? (PointerClient.instance = new PointerClient);
|
||||
socket;
|
||||
mkbHandler;
|
||||
start(port, mkbHandler) {
|
||||
@ -2575,6 +2565,7 @@ class MouseDataProvider {
|
||||
class MkbHandler {}
|
||||
class NativeMkbHandler extends MkbHandler {
|
||||
static instance;
|
||||
static getInstance = () => NativeMkbHandler.instance ?? (NativeMkbHandler.instance = new NativeMkbHandler);
|
||||
#pointerClient;
|
||||
#enabled = !1;
|
||||
#mouseButtonsPressed = 0;
|
||||
@ -2584,10 +2575,6 @@ class NativeMkbHandler extends MkbHandler {
|
||||
#mouseHorizontalMultiply = 0;
|
||||
#inputSink;
|
||||
#$message;
|
||||
static getInstance() {
|
||||
if (!NativeMkbHandler.instance) NativeMkbHandler.instance = new NativeMkbHandler;
|
||||
return NativeMkbHandler.instance;
|
||||
}
|
||||
#onKeyboardEvent(e) {
|
||||
if (e.type === "keyup" && e.code === "F8") {
|
||||
e.preventDefault(), this.toggle();
|
||||
@ -2793,11 +2780,8 @@ class PointerLockMouseDataProvider extends MouseDataProvider {
|
||||
#disableContextMenu = (e) => e.preventDefault();
|
||||
}
|
||||
class EmulatedMkbHandler extends MkbHandler {
|
||||
static #instance;
|
||||
static getInstance() {
|
||||
if (!EmulatedMkbHandler.#instance) EmulatedMkbHandler.#instance = new EmulatedMkbHandler;
|
||||
return EmulatedMkbHandler.#instance;
|
||||
}
|
||||
static instance;
|
||||
static getInstance = () => EmulatedMkbHandler.instance ?? (EmulatedMkbHandler.instance = new EmulatedMkbHandler);
|
||||
#CURRENT_PRESET_DATA = MkbPreset.convert(MkbPreset.DEFAULT_PRESET);
|
||||
static DEFAULT_PANNING_SENSITIVITY = 0.001;
|
||||
static DEFAULT_DEADZONE_COUNTERWEIGHT = 0.01;
|
||||
@ -3081,10 +3065,7 @@ class NavigationDialog {
|
||||
}
|
||||
class NavigationDialogManager {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!NavigationDialogManager.instance) NavigationDialogManager.instance = new NavigationDialogManager;
|
||||
return NavigationDialogManager.instance;
|
||||
}
|
||||
static getInstance = () => NavigationDialogManager.instance ?? (NavigationDialogManager.instance = new NavigationDialogManager);
|
||||
static GAMEPAD_POLLING_INTERVAL = 50;
|
||||
static GAMEPAD_KEYS = [
|
||||
12,
|
||||
@ -4551,10 +4532,7 @@ class PatcherCache {
|
||||
}
|
||||
class FullscreenText {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!FullscreenText.instance) FullscreenText.instance = new FullscreenText;
|
||||
return FullscreenText.instance;
|
||||
}
|
||||
static getInstance = () => FullscreenText.instance ?? (FullscreenText.instance = new FullscreenText);
|
||||
$text;
|
||||
constructor() {
|
||||
this.$text = CE("div", {
|
||||
@ -4570,10 +4548,7 @@ class FullscreenText {
|
||||
}
|
||||
class SettingsNavigationDialog extends NavigationDialog {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!SettingsNavigationDialog.instance) SettingsNavigationDialog.instance = new SettingsNavigationDialog;
|
||||
return SettingsNavigationDialog.instance;
|
||||
}
|
||||
static getInstance = () => SettingsNavigationDialog.instance ?? (SettingsNavigationDialog.instance = new SettingsNavigationDialog);
|
||||
$container;
|
||||
$tabs;
|
||||
$settings;
|
||||
@ -4838,7 +4813,9 @@ class SettingsNavigationDialog extends NavigationDialog {
|
||||
onChange: onChangeVideoPlayerType
|
||||
}, {
|
||||
pref: "video_max_fps",
|
||||
onChange: limitVideoPlayerFps
|
||||
onChange: (e) => {
|
||||
limitVideoPlayerFps(parseInt(e.target.value));
|
||||
}
|
||||
}, {
|
||||
pref: "video_power_preference",
|
||||
onChange: () => {
|
||||
@ -5832,10 +5809,7 @@ class HeaderSection {
|
||||
}
|
||||
class RemotePlayNavigationDialog extends NavigationDialog {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!RemotePlayNavigationDialog.instance) RemotePlayNavigationDialog.instance = new RemotePlayNavigationDialog;
|
||||
return RemotePlayNavigationDialog.instance;
|
||||
}
|
||||
static getInstance = () => RemotePlayNavigationDialog.instance ?? (RemotePlayNavigationDialog.instance = new RemotePlayNavigationDialog);
|
||||
STATE_LABELS = {
|
||||
On: t("powered-on"),
|
||||
Off: t("powered-off"),
|
||||
@ -5901,10 +5875,7 @@ class RemotePlayNavigationDialog extends NavigationDialog {
|
||||
var LOG_TAG5 = "RemotePlay";
|
||||
class RemotePlayManager {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!this.instance) this.instance = new RemotePlayManager;
|
||||
return this.instance;
|
||||
}
|
||||
static getInstance = () => RemotePlayManager.instance ?? (RemotePlayManager.instance = new RemotePlayManager);
|
||||
isInitialized = !1;
|
||||
XCLOUD_TOKEN;
|
||||
XHOME_TOKEN;
|
||||
@ -6413,10 +6384,7 @@ class GuideMenu {
|
||||
}
|
||||
class StreamBadges {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!StreamBadges.instance) StreamBadges.instance = new StreamBadges;
|
||||
return StreamBadges.instance;
|
||||
}
|
||||
static getInstance = () => StreamBadges.instance ?? (StreamBadges.instance = new StreamBadges);
|
||||
serverInfo = {};
|
||||
badges = {
|
||||
playtime: {
|
||||
@ -7015,7 +6983,7 @@ class WebGL2Player {
|
||||
this.options.saturation = 1 + (saturation - 100) / 100, update && this.updateCanvas();
|
||||
}
|
||||
setTargetFps(target) {
|
||||
this.targetFps = target, this.frameInterval = Math.ceil(1000 / target);
|
||||
this.targetFps = target, this.lastFrameTime = 0, this.frameInterval = target ? Math.floor(1000 / target) : 0;
|
||||
}
|
||||
getCanvas() {
|
||||
return this.$canvas;
|
||||
@ -7025,6 +6993,7 @@ class WebGL2Player {
|
||||
gl.uniform2f(gl.getUniformLocation(program, "iResolution"), this.$canvas.width, this.$canvas.height), gl.uniform1i(gl.getUniformLocation(program, "filterId"), this.options.filterId), gl.uniform1f(gl.getUniformLocation(program, "sharpenFactor"), this.options.sharpenFactor), gl.uniform1f(gl.getUniformLocation(program, "brightness"), this.options.brightness), gl.uniform1f(gl.getUniformLocation(program, "contrast"), this.options.contrast), gl.uniform1f(gl.getUniformLocation(program, "saturation"), this.options.saturation);
|
||||
}
|
||||
drawFrame() {
|
||||
if (this.targetFps === 0) return;
|
||||
if (this.targetFps < 60) {
|
||||
const currentTime = performance.now();
|
||||
if (currentTime - this.lastFrameTime < this.frameInterval) return;
|
||||
@ -7079,9 +7048,9 @@ class WebGL2Player {
|
||||
BxLogger.info(this.LOG_TAG, "Destroy"), this.stop();
|
||||
const gl = this.gl;
|
||||
if (gl) {
|
||||
gl.getExtension("WEBGL_lose_context")?.loseContext();
|
||||
gl.getExtension("WEBGL_lose_context")?.loseContext(), gl.useProgram(null);
|
||||
for (let resource of this.resources)
|
||||
if (resource instanceof WebGLProgram) gl.useProgram(null), gl.deleteProgram(resource);
|
||||
if (resource instanceof WebGLProgram) gl.deleteProgram(resource);
|
||||
else if (resource instanceof WebGLShader) gl.deleteShader(resource);
|
||||
else if (resource instanceof WebGLTexture) gl.deleteTexture(resource);
|
||||
else if (resource instanceof WebGLBuffer) gl.deleteBuffer(resource);
|
||||
@ -7343,6 +7312,9 @@ class BaseGameBarAction {
|
||||
onClick(e) {
|
||||
BxEvent.dispatch(window, BxEvent.GAME_BAR_ACTION_ACTIVATED);
|
||||
}
|
||||
render() {
|
||||
return this.$content;
|
||||
}
|
||||
}
|
||||
class ScreenshotAction extends BaseGameBarAction {
|
||||
$content;
|
||||
@ -7358,9 +7330,6 @@ class ScreenshotAction extends BaseGameBarAction {
|
||||
onClick(e) {
|
||||
super.onClick(e), Screenshot.takeScreenshot();
|
||||
}
|
||||
render() {
|
||||
return this.$content;
|
||||
}
|
||||
}
|
||||
class TouchControlAction extends BaseGameBarAction {
|
||||
$content;
|
||||
@ -7378,23 +7347,19 @@ class TouchControlAction extends BaseGameBarAction {
|
||||
onClick: this.onClick.bind(this),
|
||||
classes: ["bx-activated"]
|
||||
});
|
||||
this.$content = CE("div", {}, $btnEnable, $btnDisable), this.reset();
|
||||
this.$content = CE("div", {}, $btnEnable, $btnDisable);
|
||||
}
|
||||
onClick(e) {
|
||||
super.onClick(e);
|
||||
const isVisible = TouchController.toggleVisibility();
|
||||
this.$content.dataset.activated = (!isVisible).toString();
|
||||
}
|
||||
render() {
|
||||
return this.$content;
|
||||
}
|
||||
reset() {
|
||||
this.$content.dataset.activated = "false";
|
||||
}
|
||||
}
|
||||
class MicrophoneAction extends BaseGameBarAction {
|
||||
$content;
|
||||
visible = !1;
|
||||
constructor() {
|
||||
super();
|
||||
const $btnDefault = createButton({
|
||||
@ -7407,7 +7372,7 @@ class MicrophoneAction extends BaseGameBarAction {
|
||||
icon: BxIcon.MICROPHONE_MUTED,
|
||||
onClick: this.onClick.bind(this)
|
||||
});
|
||||
this.$content = CE("div", {}, $btnMuted, $btnDefault), this.reset(), window.addEventListener(BxEvent.MICROPHONE_STATE_CHANGED, (e) => {
|
||||
this.$content = CE("div", {}, $btnMuted, $btnDefault), window.addEventListener(BxEvent.MICROPHONE_STATE_CHANGED, (e) => {
|
||||
const enabled = e.microphoneState === "Enabled";
|
||||
this.$content.dataset.activated = enabled.toString(), this.$content.classList.remove("bx-gone");
|
||||
});
|
||||
@ -7417,11 +7382,8 @@ class MicrophoneAction extends BaseGameBarAction {
|
||||
const enabled = MicrophoneShortcut.toggle(!1);
|
||||
this.$content.dataset.activated = enabled.toString();
|
||||
}
|
||||
render() {
|
||||
return this.$content;
|
||||
}
|
||||
reset() {
|
||||
this.visible = !1, this.$content.classList.add("bx-gone"), this.$content.dataset.activated = "false";
|
||||
this.$content.classList.add("bx-gone"), this.$content.dataset.activated = "false";
|
||||
}
|
||||
}
|
||||
class TrueAchievementsAction extends BaseGameBarAction {
|
||||
@ -7431,16 +7393,12 @@ class TrueAchievementsAction extends BaseGameBarAction {
|
||||
this.$content = createButton({
|
||||
style: 4,
|
||||
icon: BxIcon.TRUE_ACHIEVEMENTS,
|
||||
title: t("true-achievements"),
|
||||
onClick: this.onClick.bind(this)
|
||||
});
|
||||
}
|
||||
onClick(e) {
|
||||
super.onClick(e), TrueAchievements.open(!1);
|
||||
}
|
||||
render() {
|
||||
return this.$content;
|
||||
}
|
||||
}
|
||||
class SpeakerAction extends BaseGameBarAction {
|
||||
$content;
|
||||
@ -7456,7 +7414,7 @@ class SpeakerAction extends BaseGameBarAction {
|
||||
onClick: this.onClick.bind(this),
|
||||
classes: ["bx-activated"]
|
||||
});
|
||||
this.$content = CE("div", {}, $btnEnable, $btnMuted), this.reset(), window.addEventListener(BxEvent.SPEAKER_STATE_CHANGED, (e) => {
|
||||
this.$content = CE("div", {}, $btnEnable, $btnMuted), window.addEventListener(BxEvent.SPEAKER_STATE_CHANGED, (e) => {
|
||||
const enabled = e.speakerState === 0;
|
||||
this.$content.dataset.activated = (!enabled).toString();
|
||||
});
|
||||
@ -7464,9 +7422,6 @@ class SpeakerAction extends BaseGameBarAction {
|
||||
onClick(e) {
|
||||
super.onClick(e), SoundShortcut.muteUnmute();
|
||||
}
|
||||
render() {
|
||||
return this.$content;
|
||||
}
|
||||
reset() {
|
||||
this.$content.dataset.activated = "false";
|
||||
}
|
||||
@ -7475,7 +7430,9 @@ class RendererShortcut {
|
||||
static toggleVisibility() {
|
||||
const $mediaContainer = document.querySelector('#game-stream div[data-testid="media-container"]');
|
||||
if (!$mediaContainer) return !0;
|
||||
return $mediaContainer.classList.toggle("bx-gone"), !$mediaContainer.classList.contains("bx-gone");
|
||||
$mediaContainer.classList.toggle("bx-gone");
|
||||
const isShowing = !$mediaContainer.classList.contains("bx-gone");
|
||||
return limitVideoPlayerFps(isShowing ? getPref("video_max_fps") : 0), isShowing;
|
||||
}
|
||||
}
|
||||
class RendererAction extends BaseGameBarAction {
|
||||
@ -7492,26 +7449,20 @@ class RendererAction extends BaseGameBarAction {
|
||||
onClick: this.onClick.bind(this),
|
||||
classes: ["bx-activated"]
|
||||
});
|
||||
this.$content = CE("div", {}, $btnDefault, $btnActivated), this.reset();
|
||||
this.$content = CE("div", {}, $btnDefault, $btnActivated);
|
||||
}
|
||||
onClick(e) {
|
||||
super.onClick(e);
|
||||
const isVisible = RendererShortcut.toggleVisibility();
|
||||
this.$content.dataset.activated = (!isVisible).toString();
|
||||
}
|
||||
render() {
|
||||
return this.$content;
|
||||
}
|
||||
reset() {
|
||||
this.$content.dataset.activated = "false";
|
||||
}
|
||||
}
|
||||
class GameBar {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!GameBar.instance) GameBar.instance = new GameBar;
|
||||
return GameBar.instance;
|
||||
}
|
||||
static getInstance = () => GameBar.instance ?? (GameBar.instance = new GameBar);
|
||||
static VISIBLE_DURATION = 2000;
|
||||
$gameBar;
|
||||
$container;
|
||||
@ -7535,8 +7486,7 @@ class GameBar {
|
||||
if (e.target !== $gameBar) return;
|
||||
$container.classList.contains("bx-show") ? this.hideBar() : this.showBar();
|
||||
}), window.addEventListener(BxEvent.GAME_BAR_ACTION_ACTIVATED, this.hideBar.bind(this)), $container.addEventListener("pointerover", this.clearHideTimeout.bind(this)), $container.addEventListener("pointerout", this.beginHideTimeout.bind(this)), $container.addEventListener("transitionend", (e) => {
|
||||
const classList = $container.classList;
|
||||
if (classList.contains("bx-hide")) classList.remove("bx-hide"), classList.add("bx-offscreen");
|
||||
$container.classList.replace("bx-hide", "bx-offscreen");
|
||||
}), document.documentElement.appendChild($gameBar), this.$gameBar = $gameBar, this.$container = $container, getPref("game_bar_position") !== "off" && window.addEventListener(BxEvent.XCLOUD_POLLING_MODE_CHANGED, ((e) => {
|
||||
if (!STATES.isPlaying) {
|
||||
this.disable();
|
||||
@ -7554,30 +7504,24 @@ class GameBar {
|
||||
this.timeoutId && clearTimeout(this.timeoutId), this.timeoutId = null;
|
||||
}
|
||||
enable() {
|
||||
this.$gameBar && this.$gameBar.classList.remove("bx-gone");
|
||||
this.$gameBar.classList.remove("bx-gone");
|
||||
}
|
||||
disable() {
|
||||
this.hideBar(), this.$gameBar && this.$gameBar.classList.add("bx-gone");
|
||||
this.hideBar(), this.$gameBar.classList.add("bx-gone");
|
||||
}
|
||||
showBar() {
|
||||
if (!this.$container) return;
|
||||
this.$container.classList.remove("bx-offscreen", "bx-hide", "bx-gone"), this.$container.classList.add("bx-show"), this.beginHideTimeout();
|
||||
}
|
||||
hideBar() {
|
||||
if (this.clearHideTimeout(), clearFocus(), !this.$container) return;
|
||||
this.$container.classList.remove("bx-show"), this.$container.classList.add("bx-hide");
|
||||
this.clearHideTimeout(), clearFocus(), this.$container.classList.replace("bx-show", "bx-hide");
|
||||
}
|
||||
reset() {
|
||||
for (let action of this.actions)
|
||||
action.reset();
|
||||
this.actions.forEach((action) => action.reset());
|
||||
}
|
||||
}
|
||||
class XcloudApi {
|
||||
static instance;
|
||||
static getInstance() {
|
||||
if (!XcloudApi.instance) XcloudApi.instance = new XcloudApi;
|
||||
return XcloudApi.instance;
|
||||
}
|
||||
static getInstance = () => XcloudApi.instance ?? (XcloudApi.instance = new XcloudApi);
|
||||
CACHE_TITLES = {};
|
||||
CACHE_WAIT_TIME = {};
|
||||
async getTitleInfo(id2) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user