mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-07-09 07:41:42 +02:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
c2f9f129d0 | |||
aa50261726 | |||
bb32d97ae8 | |||
3d2abf6b12 | |||
4c8a49a43a | |||
256f28695e | |||
9e851fbd15 | |||
c829f74dcc | |||
62cf045f05 | |||
fdb4e58b5d | |||
b1407c2447 | |||
b5ba6e9600 | |||
a3094d2c9f | |||
3290a36886 |
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 6.5.0
|
// @version 6.6.0
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
104
dist/better-xcloud.pretty.user.js
vendored
104
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.5.0
|
// @version 6.6.0
|
||||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||||
// @author redphx
|
// @author redphx
|
||||||
// @license MIT
|
// @license MIT
|
||||||
@ -120,6 +120,7 @@ var ALL_PREFS = {
|
|||||||
"video.position",
|
"video.position",
|
||||||
"video.player.powerPreference",
|
"video.player.powerPreference",
|
||||||
"video.processing",
|
"video.processing",
|
||||||
|
"video.processing.mode",
|
||||||
"video.ratio",
|
"video.ratio",
|
||||||
"video.saturation",
|
"video.saturation",
|
||||||
"video.processing.sharpness"
|
"video.processing.sharpness"
|
||||||
@ -192,7 +193,7 @@ class UserAgent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var SCRIPT_VERSION = "6.5.0", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
|
var SCRIPT_VERSION = "6.6.0", 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,
|
||||||
@ -438,6 +439,7 @@ var SUPPORTED_LANGUAGES = {
|
|||||||
center: "Center",
|
center: "Center",
|
||||||
chat: "Chat",
|
chat: "Chat",
|
||||||
"clarity-boost": "Clarity boost",
|
"clarity-boost": "Clarity boost",
|
||||||
|
"clarity-boost-mode": "Clarity boost mode",
|
||||||
"clarity-boost-warning": "These settings don't work when the Clarity Boost mode is ON",
|
"clarity-boost-warning": "These settings don't work when the Clarity Boost mode is ON",
|
||||||
clear: "Clear",
|
clear: "Clear",
|
||||||
"clear-data": "Clear data",
|
"clear-data": "Clear data",
|
||||||
@ -600,6 +602,7 @@ var SUPPORTED_LANGUAGES = {
|
|||||||
"only-supports-some-games": "Only supports some games",
|
"only-supports-some-games": "Only supports some games",
|
||||||
opacity: "Opacity",
|
opacity: "Opacity",
|
||||||
other: "Other",
|
other: "Other",
|
||||||
|
performance: "Performance",
|
||||||
playing: "Playing",
|
playing: "Playing",
|
||||||
playtime: "Playtime",
|
playtime: "Playtime",
|
||||||
poland: "Poland",
|
poland: "Poland",
|
||||||
@ -637,6 +640,7 @@ var SUPPORTED_LANGUAGES = {
|
|||||||
],
|
],
|
||||||
"press-to-bind": "Press a key or do a mouse click to bind...",
|
"press-to-bind": "Press a key or do a mouse click to bind...",
|
||||||
"prompt-preset-name": "Preset's name:",
|
"prompt-preset-name": "Preset's name:",
|
||||||
|
quality: "Quality",
|
||||||
recommended: "Recommended",
|
recommended: "Recommended",
|
||||||
"recommended-settings-for-device": [
|
"recommended-settings-for-device": [
|
||||||
e => `Recommended settings for ${e.device}`,
|
e => `Recommended settings for ${e.device}`,
|
||||||
@ -692,6 +696,7 @@ var SUPPORTED_LANGUAGES = {
|
|||||||
"separate-touch-controller": "Separate Touch controller & Controller #1",
|
"separate-touch-controller": "Separate Touch controller & Controller #1",
|
||||||
"separate-touch-controller-note": "Touch controller is Player 1, Controller #1 is Player 2",
|
"separate-touch-controller-note": "Touch controller is Player 1, Controller #1 is Player 2",
|
||||||
server: "Server",
|
server: "Server",
|
||||||
|
"server-list-error": "Can't get the server list",
|
||||||
"server-locations": "Server locations",
|
"server-locations": "Server locations",
|
||||||
settings: "Settings",
|
settings: "Settings",
|
||||||
"settings-for": "Settings for",
|
"settings-for": "Settings for",
|
||||||
@ -741,6 +746,7 @@ var SUPPORTED_LANGUAGES = {
|
|||||||
"tc-custom-layout-style": "Custom layout's button style",
|
"tc-custom-layout-style": "Custom layout's button style",
|
||||||
"tc-muted-colors": "Muted colors",
|
"tc-muted-colors": "Muted colors",
|
||||||
"tc-standard-layout-style": "Standard layout's button style",
|
"tc-standard-layout-style": "Standard layout's button style",
|
||||||
|
"test-controller": "Test controller",
|
||||||
"text-size": "Text size",
|
"text-size": "Text size",
|
||||||
theme: "Theme",
|
theme: "Theme",
|
||||||
toggle: "Toggle",
|
toggle: "Toggle",
|
||||||
@ -2395,6 +2401,18 @@ class StreamSettingsStorage extends BaseSettingsStorage {
|
|||||||
highest: "cas"
|
highest: "cas"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"video.processing.mode": {
|
||||||
|
label: t("clarity-boost-mode"),
|
||||||
|
default: "performance",
|
||||||
|
options: {
|
||||||
|
performance: t("performance"),
|
||||||
|
quality: t("quality")
|
||||||
|
},
|
||||||
|
suggest: {
|
||||||
|
lowest: "performance",
|
||||||
|
highest: "quality"
|
||||||
|
}
|
||||||
|
},
|
||||||
"video.player.powerPreference": {
|
"video.player.powerPreference": {
|
||||||
label: t("renderer-configuration"),
|
label: t("renderer-configuration"),
|
||||||
default: "default",
|
default: "default",
|
||||||
@ -4415,6 +4433,10 @@ class SettingsManager {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"video.processing": {
|
"video.processing": {
|
||||||
|
onChange: updateVideoPlayer,
|
||||||
|
onChangeUi: onChangeVideoPlayerType
|
||||||
|
},
|
||||||
|
"video.processing.mode": {
|
||||||
onChange: updateVideoPlayer
|
onChange: updateVideoPlayer
|
||||||
},
|
},
|
||||||
"video.processing.sharpness": {
|
"video.processing.sharpness": {
|
||||||
@ -4565,13 +4587,13 @@ class SettingsManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onChangeVideoPlayerType() {
|
function onChangeVideoPlayerType() {
|
||||||
let playerType = getStreamPref("video.player.type"), settingsManager = SettingsManager.getInstance();
|
let playerType = getStreamPref("video.player.type"), processing = getStreamPref("video.processing"), settingsManager = SettingsManager.getInstance();
|
||||||
if (!settingsManager.hasElement("video.processing")) return;
|
if (!settingsManager.hasElement("video.processing")) return;
|
||||||
let isDisabled = !1, $videoProcessing = settingsManager.getElement("video.processing"), $videoSharpness = settingsManager.getElement("video.processing.sharpness"), $videoPowerPreference = settingsManager.getElement("video.player.powerPreference"), $videoMaxFps = settingsManager.getElement("video.maxFps"), $optCas = $videoProcessing.querySelector(`option[value=${"cas"}]`);
|
let isDisabled = !1, $videoProcessing = settingsManager.getElement("video.processing"), $videoProcessingMode = settingsManager.getElement("video.processing.mode"), $videoSharpness = settingsManager.getElement("video.processing.sharpness"), $videoPowerPreference = settingsManager.getElement("video.player.powerPreference"), $videoMaxFps = settingsManager.getElement("video.maxFps"), $optCas = $videoProcessing.querySelector(`option[value=${"cas"}]`);
|
||||||
if (playerType === "default") {
|
if (playerType === "default") {
|
||||||
if ($videoProcessing.value = "usm", setStreamPref("video.processing", "usm", "direct"), $optCas && ($optCas.disabled = !0), UserAgent.isSafari()) isDisabled = !0;
|
if ($videoProcessing.value = "usm", setStreamPref("video.processing", "usm", "direct"), $optCas && ($optCas.disabled = !0), UserAgent.isSafari()) isDisabled = !0;
|
||||||
} else $optCas && ($optCas.disabled = !1);
|
} else $optCas && ($optCas.disabled = !1);
|
||||||
$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 === "default");
|
$videoProcessing.disabled = isDisabled, $videoSharpness.dataset.disabled = isDisabled.toString(), $videoProcessingMode.closest(".bx-settings-row").classList.toggle("bx-gone", !(playerType === "webgl2" && processing === "cas")), $videoPowerPreference.closest(".bx-settings-row").classList.toggle("bx-gone", playerType !== "webgl2"), $videoMaxFps.closest(".bx-settings-row").classList.toggle("bx-gone", playerType === "default");
|
||||||
}
|
}
|
||||||
function limitVideoPlayerFps(targetFps) {
|
function limitVideoPlayerFps(targetFps) {
|
||||||
STATES.currentStream.streamPlayerManager?.getCanvasPlayer()?.setTargetFps(targetFps);
|
STATES.currentStream.streamPlayerManager?.getCanvasPlayer()?.setTargetFps(targetFps);
|
||||||
@ -4581,6 +4603,7 @@ function updateVideoPlayer() {
|
|||||||
if (!streamPlayerManager) return;
|
if (!streamPlayerManager) return;
|
||||||
let options = {
|
let options = {
|
||||||
processing: getStreamPref("video.processing"),
|
processing: getStreamPref("video.processing"),
|
||||||
|
processingMode: getStreamPref("video.processing.mode"),
|
||||||
sharpness: getStreamPref("video.processing.sharpness"),
|
sharpness: getStreamPref("video.processing.sharpness"),
|
||||||
saturation: getStreamPref("video.saturation"),
|
saturation: getStreamPref("video.saturation"),
|
||||||
contrast: getStreamPref("video.contrast"),
|
contrast: getStreamPref("video.contrast"),
|
||||||
@ -5078,11 +5101,11 @@ class TouchController {
|
|||||||
var controller_customization_default = "var shareButtonPressed=currentGamepad.buttons[17]?.pressed,shareButtonHandled=!1,xCloudGamepad=$xCloudGamepadVar$;if(currentGamepad.id in window.BX_STREAM_SETTINGS.controllers){let controller=window.BX_STREAM_SETTINGS.controllers[currentGamepad.id];if(controller?.customization){let{mapping,ranges}=controller.customization,pressedButtons={},releasedButtons={},isModified=!1;if(ranges.LeftTrigger){let[from,to]=ranges.LeftTrigger;xCloudGamepad.LeftTrigger=xCloudGamepad.LeftTrigger>to?1:xCloudGamepad.LeftTrigger,xCloudGamepad.LeftTrigger=xCloudGamepad.LeftTrigger<from?0:xCloudGamepad.LeftTrigger}if(ranges.RightTrigger){let[from,to]=ranges.RightTrigger;xCloudGamepad.RightTrigger=xCloudGamepad.RightTrigger>to?1:xCloudGamepad.RightTrigger,xCloudGamepad.RightTrigger=xCloudGamepad.RightTrigger<from?0:xCloudGamepad.RightTrigger}if(ranges.LeftThumb){let[from,to]=ranges.LeftThumb,xAxis=xCloudGamepad.LeftThumbXAxis,yAxis=xCloudGamepad.LeftThumbYAxis,range=Math.abs(Math.sqrt(xAxis*xAxis+yAxis*yAxis)),newRange=range>to?1:range;if(newRange=newRange<from?0:newRange,newRange!==range)xCloudGamepad.LeftThumbXAxis=xAxis*(newRange/range),xCloudGamepad.LeftThumbYAxis=yAxis*(newRange/range)}if(ranges.RightThumb){let[from,to]=ranges.RightThumb,xAxis=xCloudGamepad.RightThumbXAxis,yAxis=xCloudGamepad.RightThumbYAxis,range=Math.abs(Math.sqrt(xAxis*xAxis+yAxis*yAxis)),newRange=range>to?1:range;if(newRange=newRange<from?0:newRange,newRange!==range)xCloudGamepad.RightThumbXAxis=xAxis*(newRange/range),xCloudGamepad.RightThumbYAxis=yAxis*(newRange/range)}if(shareButtonPressed&&\"Share\"in mapping){let targetButton=mapping.Share;if(typeof targetButton===\"string\")pressedButtons[targetButton]=1;shareButtonHandled=!0,delete mapping.Share}let key;for(key in mapping){let mappedKey=mapping[key];if(key===\"LeftStickAxes\"||key===\"RightStickAxes\"){let sourceX,sourceY,targetX,targetY;if(key===\"LeftStickAxes\")sourceX=\"LeftThumbXAxis\",sourceY=\"LeftThumbYAxis\",targetX=\"RightThumbXAxis\",targetY=\"RightThumbYAxis\";else sourceX=\"RightThumbXAxis\",sourceY=\"RightThumbYAxis\",targetX=\"LeftThumbXAxis\",targetY=\"LeftThumbYAxis\";if(typeof mappedKey===\"string\"){let rangeX=xCloudGamepad[sourceX],rangeY=xCloudGamepad[sourceY];if(Math.abs(Math.sqrt(rangeX*rangeX+rangeY*rangeY))>=0.1)pressedButtons[targetX]=rangeX,pressedButtons[targetY]=rangeY}releasedButtons[sourceX]=0,releasedButtons[sourceY]=0,isModified=!0}else if(typeof mappedKey===\"string\"){let pressed=!1,value=0;if(key===\"LeftTrigger\"||key===\"RightTrigger\"){let currentRange=xCloudGamepad[key];if(mappedKey===\"LeftTrigger\"||mappedKey===\"RightTrigger\")pressed=currentRange>=0.1,value=currentRange;else pressed=!0,value=currentRange>=0.9?1:0}else if(xCloudGamepad[key])pressed=!0,value=xCloudGamepad[key];if(pressed)pressedButtons[mappedKey]=value,releasedButtons[key]=0,isModified=!0}else if(mappedKey===!1)pressedButtons[key]=0,isModified=!0}isModified&&Object.assign(xCloudGamepad,releasedButtons,pressedButtons)}}if(shareButtonPressed&&!shareButtonHandled)window.dispatchEvent(new Event(BxEvent.CAPTURE_SCREENSHOT));\n";
|
var controller_customization_default = "var shareButtonPressed=currentGamepad.buttons[17]?.pressed,shareButtonHandled=!1,xCloudGamepad=$xCloudGamepadVar$;if(currentGamepad.id in window.BX_STREAM_SETTINGS.controllers){let controller=window.BX_STREAM_SETTINGS.controllers[currentGamepad.id];if(controller?.customization){let{mapping,ranges}=controller.customization,pressedButtons={},releasedButtons={},isModified=!1;if(ranges.LeftTrigger){let[from,to]=ranges.LeftTrigger;xCloudGamepad.LeftTrigger=xCloudGamepad.LeftTrigger>to?1:xCloudGamepad.LeftTrigger,xCloudGamepad.LeftTrigger=xCloudGamepad.LeftTrigger<from?0:xCloudGamepad.LeftTrigger}if(ranges.RightTrigger){let[from,to]=ranges.RightTrigger;xCloudGamepad.RightTrigger=xCloudGamepad.RightTrigger>to?1:xCloudGamepad.RightTrigger,xCloudGamepad.RightTrigger=xCloudGamepad.RightTrigger<from?0:xCloudGamepad.RightTrigger}if(ranges.LeftThumb){let[from,to]=ranges.LeftThumb,xAxis=xCloudGamepad.LeftThumbXAxis,yAxis=xCloudGamepad.LeftThumbYAxis,range=Math.abs(Math.sqrt(xAxis*xAxis+yAxis*yAxis)),newRange=range>to?1:range;if(newRange=newRange<from?0:newRange,newRange!==range)xCloudGamepad.LeftThumbXAxis=xAxis*(newRange/range),xCloudGamepad.LeftThumbYAxis=yAxis*(newRange/range)}if(ranges.RightThumb){let[from,to]=ranges.RightThumb,xAxis=xCloudGamepad.RightThumbXAxis,yAxis=xCloudGamepad.RightThumbYAxis,range=Math.abs(Math.sqrt(xAxis*xAxis+yAxis*yAxis)),newRange=range>to?1:range;if(newRange=newRange<from?0:newRange,newRange!==range)xCloudGamepad.RightThumbXAxis=xAxis*(newRange/range),xCloudGamepad.RightThumbYAxis=yAxis*(newRange/range)}if(shareButtonPressed&&\"Share\"in mapping){let targetButton=mapping.Share;if(typeof targetButton===\"string\")pressedButtons[targetButton]=1;shareButtonHandled=!0,delete mapping.Share}let key;for(key in mapping){let mappedKey=mapping[key];if(key===\"LeftStickAxes\"||key===\"RightStickAxes\"){let sourceX,sourceY,targetX,targetY;if(key===\"LeftStickAxes\")sourceX=\"LeftThumbXAxis\",sourceY=\"LeftThumbYAxis\",targetX=\"RightThumbXAxis\",targetY=\"RightThumbYAxis\";else sourceX=\"RightThumbXAxis\",sourceY=\"RightThumbYAxis\",targetX=\"LeftThumbXAxis\",targetY=\"LeftThumbYAxis\";if(typeof mappedKey===\"string\"){let rangeX=xCloudGamepad[sourceX],rangeY=xCloudGamepad[sourceY];if(Math.abs(Math.sqrt(rangeX*rangeX+rangeY*rangeY))>=0.1)pressedButtons[targetX]=rangeX,pressedButtons[targetY]=rangeY}releasedButtons[sourceX]=0,releasedButtons[sourceY]=0,isModified=!0}else if(typeof mappedKey===\"string\"){let pressed=!1,value=0;if(key===\"LeftTrigger\"||key===\"RightTrigger\"){let currentRange=xCloudGamepad[key];if(mappedKey===\"LeftTrigger\"||mappedKey===\"RightTrigger\")pressed=currentRange>=0.1,value=currentRange;else pressed=!0,value=currentRange>=0.9?1:0}else if(xCloudGamepad[key])pressed=!0,value=xCloudGamepad[key];if(pressed)pressedButtons[mappedKey]=value,releasedButtons[key]=0,isModified=!0}else if(mappedKey===!1)pressedButtons[key]=0,isModified=!0}isModified&&Object.assign(xCloudGamepad,releasedButtons,pressedButtons)}}if(shareButtonPressed&&!shareButtonHandled)window.dispatchEvent(new Event(BxEvent.CAPTURE_SCREENSHOT));\n";
|
||||||
var poll_gamepad_default = "var self=this;if(window.BX_EXPOSED.disableGamepadPolling){self.inputConfiguration.useIntervalWorkerThreadForInput&&self.intervalWorker?self.intervalWorker.scheduleTimer(50):self.pollGamepadssetTimeoutTimerID=window.setTimeout(self.pollGamepads,50);return}var currentGamepad=$gamepadVar$,btnHome=currentGamepad.buttons[16];if(btnHome){if(!self.bxHomeStates)self.bxHomeStates={};let intervalMs=0,hijack=!1;if(btnHome.pressed)if(hijack=!0,intervalMs=16,self.gamepadIsIdle.set(currentGamepad.index,!1),self.bxHomeStates[currentGamepad.index]){let lastTimestamp=self.bxHomeStates[currentGamepad.index].timestamp;if(currentGamepad.timestamp!==lastTimestamp){if(self.bxHomeStates[currentGamepad.index].timestamp=currentGamepad.timestamp,window.BX_EXPOSED.handleControllerShortcut(currentGamepad))self.bxHomeStates[currentGamepad.index].shortcutPressed+=1}}else window.BX_EXPOSED.resetControllerShortcut(currentGamepad.index),self.bxHomeStates[currentGamepad.index]={shortcutPressed:0,timestamp:currentGamepad.timestamp};else if(self.bxHomeStates[currentGamepad.index]){hijack=!0;let info=structuredClone(self.bxHomeStates[currentGamepad.index]);if(self.bxHomeStates[currentGamepad.index]=null,info.shortcutPressed===0){let fakeGamepadMappings=[{GamepadIndex:currentGamepad.index,A:0,B:0,X:0,Y:0,LeftShoulder:0,RightShoulder:0,LeftTrigger:0,RightTrigger:0,View:0,Menu:0,LeftThumb:0,RightThumb:0,DPadUp:0,DPadDown:0,DPadLeft:0,DPadRight:0,Nexus:1,LeftThumbXAxis:0,LeftThumbYAxis:0,RightThumbXAxis:0,RightThumbYAxis:0,PhysicalPhysicality:0,VirtualPhysicality:0,Dirty:!0,Virtual:!1}];intervalMs=currentGamepad.timestamp-info.timestamp>=500?500:100,self.inputSink.onGamepadInput(performance.now()-intervalMs,fakeGamepadMappings)}else intervalMs=window.BX_STREAM_SETTINGS.controllerPollingRate}if(hijack&&intervalMs){self.inputConfiguration.useIntervalWorkerThreadForInput&&self.intervalWorker?self.intervalWorker.scheduleTimer(intervalMs):self.pollGamepadssetTimeoutTimerID=setTimeout(self.pollGamepads,intervalMs);return}}\n";
|
var poll_gamepad_default = "var self=this;if(window.BX_EXPOSED.disableGamepadPolling){self.inputConfiguration.useIntervalWorkerThreadForInput&&self.intervalWorker?self.intervalWorker.scheduleTimer(50):self.pollGamepadssetTimeoutTimerID=window.setTimeout(self.pollGamepads,50);return}var currentGamepad=$gamepadVar$,btnHome=currentGamepad.buttons[16];if(btnHome){if(!self.bxHomeStates)self.bxHomeStates={};let intervalMs=0,hijack=!1;if(btnHome.pressed)if(hijack=!0,intervalMs=16,self.gamepadIsIdle.set(currentGamepad.index,!1),self.bxHomeStates[currentGamepad.index]){let lastTimestamp=self.bxHomeStates[currentGamepad.index].timestamp;if(currentGamepad.timestamp!==lastTimestamp){if(self.bxHomeStates[currentGamepad.index].timestamp=currentGamepad.timestamp,window.BX_EXPOSED.handleControllerShortcut(currentGamepad))self.bxHomeStates[currentGamepad.index].shortcutPressed+=1}}else window.BX_EXPOSED.resetControllerShortcut(currentGamepad.index),self.bxHomeStates[currentGamepad.index]={shortcutPressed:0,timestamp:currentGamepad.timestamp};else if(self.bxHomeStates[currentGamepad.index]){hijack=!0;let info=structuredClone(self.bxHomeStates[currentGamepad.index]);if(self.bxHomeStates[currentGamepad.index]=null,info.shortcutPressed===0){let fakeGamepadMappings=[{GamepadIndex:currentGamepad.index,A:0,B:0,X:0,Y:0,LeftShoulder:0,RightShoulder:0,LeftTrigger:0,RightTrigger:0,View:0,Menu:0,LeftThumb:0,RightThumb:0,DPadUp:0,DPadDown:0,DPadLeft:0,DPadRight:0,Nexus:1,LeftThumbXAxis:0,LeftThumbYAxis:0,RightThumbXAxis:0,RightThumbYAxis:0,PhysicalPhysicality:0,VirtualPhysicality:0,Dirty:!0,Virtual:!1}];intervalMs=currentGamepad.timestamp-info.timestamp>=500?500:100,self.inputSink.onGamepadInput(performance.now()-intervalMs,fakeGamepadMappings)}else intervalMs=window.BX_STREAM_SETTINGS.controllerPollingRate}if(hijack&&intervalMs){self.inputConfiguration.useIntervalWorkerThreadForInput&&self.intervalWorker?self.intervalWorker.scheduleTimer(intervalMs):self.pollGamepadssetTimeoutTimerID=setTimeout(self.pollGamepads,intervalMs);return}}\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 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=$productId$;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("/play/consoles/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("/play/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 = `window.BX_EXPOSED.showStreamMenu=$onShowStreamMenu$;$guideUI$=null;window.BX_EXPOSED.reactUseEffect(()=>{window.BxEventBus.Stream.emit("ui.streamHud.rendered",{expanded:$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",{})}`;
|
||||||
class PatcherUtils {
|
class PatcherUtils {
|
||||||
static indexOf(txt, searchString, startIndex, maxRange = 0, after = !1) {
|
static indexOf(txt, searchString, startIndex, maxRange = 0, after = !1) {
|
||||||
@ -5133,8 +5156,8 @@ class PatcherUtils {
|
|||||||
end += 1;
|
end += 1;
|
||||||
return str.substring(start, end);
|
return str.substring(start, end);
|
||||||
}
|
}
|
||||||
static injectUseEffect(str, index, group, eventName) {
|
static injectUseEffect(str, index, group, eventName, separator = ";") {
|
||||||
let newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}), []);`;
|
let newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}), [])${separator}`;
|
||||||
return str = PatcherUtils.insertAt(str, index, newCode), str;
|
return str = PatcherUtils.insertAt(str, index, newCode), str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5319,11 +5342,20 @@ if (titleInfo && !titleInfo.details.hasTouchSupport && !titleInfo.details.hasFak
|
|||||||
return str = str.replace(text, "this.useCombinedAudioVideoStream=true"), str;
|
return str = str.replace(text, "this.useCombinedAudioVideoStream=true"), str;
|
||||||
},
|
},
|
||||||
patchStreamHud(str) {
|
patchStreamHud(str) {
|
||||||
let index = str.indexOf("let{onCollapse");
|
let index = str.indexOf("({onCollapse:");
|
||||||
if (index < 0) return !1;
|
if (index < 0) return !1;
|
||||||
let newCode = stream_hud_default;
|
try {
|
||||||
if (getGlobalPref("touchController.mode") === "off") newCode += "options.canShowTakHUD = false;";
|
let canShowTakHUDVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "canShowTakHUD", index, 500, !0) + 1), guideUIVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "guideUI", index, 500, !0) + 1), onShowStreamMenuVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "onShowStreamMenu", index, 500, !0) + 1), offsetVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "offset", index, 500, !0) + 1), newCode = renderString(stream_hud_default, {
|
||||||
return str = PatcherUtils.insertAt(str, index, newCode), str;
|
guideUI: guideUIVar,
|
||||||
|
onShowStreamMenu: onShowStreamMenuVar,
|
||||||
|
offset: offsetVar
|
||||||
|
});
|
||||||
|
if (getGlobalPref("touchController.mode") === "off") newCode += `${canShowTakHUDVar} = false;`;
|
||||||
|
let bracketIndex = PatcherUtils.indexOf(str, "}){", index, 500, !0);
|
||||||
|
return str = PatcherUtils.insertAt(str, bracketIndex, newCode), str;
|
||||||
|
} catch (e) {
|
||||||
|
return !1;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
broadcastPollingMode(str) {
|
broadcastPollingMode(str) {
|
||||||
let text = ".setPollingMode=e=>{";
|
let text = ".setPollingMode=e=>{";
|
||||||
@ -5398,9 +5430,9 @@ true` + text;
|
|||||||
return str = str.replace(text, newCode), str;
|
return str = str.replace(text, newCode), str;
|
||||||
},
|
},
|
||||||
skipFeedbackDialog(str) {
|
skipFeedbackDialog(str) {
|
||||||
let text = "shouldTransitionToFeedback(e){";
|
let index = str.indexOf("}shouldTransitionToFeedback(");
|
||||||
if (!str.includes(text)) return !1;
|
if (index >= 0 && (index = PatcherUtils.indexOf(str, "}){", index, 200, !0)), index < 0) return !1;
|
||||||
return str = str.replace(text, text + "return !1;"), str;
|
return str = PatcherUtils.insertAt(str, index, "return !1;"), str;
|
||||||
},
|
},
|
||||||
enableNativeMkb(str) {
|
enableNativeMkb(str) {
|
||||||
let index = str.indexOf(".mouseSupported&&");
|
let index = str.indexOf(".mouseSupported&&");
|
||||||
@ -5441,7 +5473,7 @@ true` + text;
|
|||||||
let match = /render:.*?jsx\)\(([^,]+),/.exec(str.substring(index, index + 100));
|
let match = /render:.*?jsx\)\(([^,]+),/.exec(str.substring(index, index + 100));
|
||||||
if (!match) return !1;
|
if (!match) return !1;
|
||||||
let funcName = match[1];
|
let funcName = match[1];
|
||||||
if (index = str.indexOf(`const ${funcName}=e=>{`), index > -1 && (index = str.indexOf("return ", index)), index > -1 && (index = str.indexOf("?", index)), index < 0) return !1;
|
if (index = str.indexOf(`const ${funcName}=({children`), index > -1 && (index = PatcherUtils.indexOf(str, "return ", 300)), index > -1 && (index = PatcherUtils.indexOf(str, "?", 100)), index < 0) return !1;
|
||||||
return str = str.substring(0, index) + "|| true" + str.substring(index), str;
|
return str = str.substring(0, index) + "|| true" + str.substring(index), str;
|
||||||
},
|
},
|
||||||
ignoreNewsSection(str) {
|
ignoreNewsSection(str) {
|
||||||
@ -5452,8 +5484,8 @@ true` + text;
|
|||||||
ignorePlayWithFriendsSection(str) {
|
ignorePlayWithFriendsSection(str) {
|
||||||
let index = str.indexOf('location:"PlayWithFriendsRow",');
|
let index = str.indexOf('location:"PlayWithFriendsRow",');
|
||||||
if (index < 0) return !1;
|
if (index < 0) return !1;
|
||||||
if (index = PatcherUtils.lastIndexOf(str, "return", index, 50), index < 0) return !1;
|
if (index = PatcherUtils.lastIndexOf(str, "=>", index, 50), index < 0) return !1;
|
||||||
return str = PatcherUtils.replaceWith(str, index, "return", "return null;"), str;
|
return str = PatcherUtils.replaceWith(str, index, "=>", "=> true ? null :"), str;
|
||||||
},
|
},
|
||||||
ignoreAllGamesSection(str) {
|
ignoreAllGamesSection(str) {
|
||||||
let index = str.indexOf('className:"AllGamesRow-module__allGamesRowContainer');
|
let index = str.indexOf('className:"AllGamesRow-module__allGamesRowContainer');
|
||||||
@ -5543,8 +5575,8 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
|
|||||||
return str = PatcherUtils.replaceWith(str, index, '"All"', '"Locked"'), str;
|
return str = PatcherUtils.replaceWith(str, index, '"All"', '"Locked"'), str;
|
||||||
},
|
},
|
||||||
disableTouchContextMenu(str) {
|
disableTouchContextMenu(str) {
|
||||||
let index = str.indexOf("arguments.length>2&&void 0!==arguments[2]?arguments[2]:500;");
|
let index = str.indexOf('.addEventListener("touchstart",');
|
||||||
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 = PatcherUtils.indexOf(str, '.addEventListener("touchend"', index, 200)), 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;
|
||||||
},
|
},
|
||||||
modifyPreloadedState(str) {
|
modifyPreloadedState(str) {
|
||||||
@ -5597,12 +5629,12 @@ ${subsVar} = subs;
|
|||||||
if (initialIndex < 0) return !1;
|
if (initialIndex < 0) return !1;
|
||||||
let returnIndex = PatcherUtils.lastIndexOf(str, "return ", str.indexOf("SupportedInputsBadge"));
|
let returnIndex = PatcherUtils.lastIndexOf(str, "return ", str.indexOf("SupportedInputsBadge"));
|
||||||
if (returnIndex < 0) return !1;
|
if (returnIndex < 0) return !1;
|
||||||
let arrowIndex = PatcherUtils.lastIndexOf(str, "=>{", initialIndex, 300);
|
let productIdIndex = PatcherUtils.lastIndexOf(str, ",productId:", initialIndex, 300);
|
||||||
if (arrowIndex < 0) return !1;
|
if (productIdIndex < 0) return !1;
|
||||||
let paramVar = PatcherUtils.getVariableNameBefore(str, arrowIndex), supportedInputIconsVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "supportedInputIcons:", initialIndex, 100, !0));
|
let productIdVar = PatcherUtils.getVariableNameAfter(str, productIdIndex + 11), supportedInputIconsVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, "supportedInputIcons:", initialIndex, 100, !0));
|
||||||
if (!paramVar || !supportedInputIconsVar) return !1;
|
if (!productIdVar || !supportedInputIconsVar) return !1;
|
||||||
let newCode = renderString(game_card_icons_default, {
|
let newCode = renderString(game_card_icons_default, {
|
||||||
param: paramVar,
|
productId: productIdVar,
|
||||||
supportedInputIcons: supportedInputIconsVar
|
supportedInputIcons: supportedInputIconsVar
|
||||||
});
|
});
|
||||||
return str = PatcherUtils.insertAt(str, returnIndex, newCode), str;
|
return str = PatcherUtils.insertAt(str, returnIndex, newCode), str;
|
||||||
@ -5628,8 +5660,8 @@ ${subsVar} = subs;
|
|||||||
},
|
},
|
||||||
injectErrorPageUseEffect(str) {
|
injectErrorPageUseEffect(str) {
|
||||||
let index = str.indexOf('"PureErrorPage-module__container');
|
let index = str.indexOf('"PureErrorPage-module__container');
|
||||||
if (index > -1 && (index = PatcherUtils.lastIndexOf(str, "return", index, 200)), index < 0) return !1;
|
if (index > -1 && (index = PatcherUtils.lastIndexOf(str, "})=>(0,", index, 200)), index < 0) return !1;
|
||||||
return PatcherUtils.injectUseEffect(str, index, "Script", "ui.error.rendered");
|
return str = PatcherUtils.insertAt(str, index + 4, "{"), str = PatcherUtils.injectUseEffect(str, index + 5, "Script", "ui.error.rendered"), str += "}", str;
|
||||||
},
|
},
|
||||||
injectStreamMenuUseEffect(str) {
|
injectStreamMenuUseEffect(str) {
|
||||||
let index = str.indexOf('"StreamMenu-module__container');
|
let index = str.indexOf('"StreamMenu-module__container');
|
||||||
@ -5841,20 +5873,20 @@ class PatcherCache {
|
|||||||
PATCH_ORDERS = this.cleanupPatches(PATCH_ORDERS), STREAM_PAGE_PATCH_ORDERS = this.cleanupPatches(STREAM_PAGE_PATCH_ORDERS), PRODUCT_DETAIL_PAGE_PATCH_ORDERS = this.cleanupPatches(PRODUCT_DETAIL_PAGE_PATCH_ORDERS), BxLogger.info(LOG_TAG2, "PATCH_ORDERS", PATCH_ORDERS.slice(0));
|
PATCH_ORDERS = this.cleanupPatches(PATCH_ORDERS), STREAM_PAGE_PATCH_ORDERS = this.cleanupPatches(STREAM_PAGE_PATCH_ORDERS), PRODUCT_DETAIL_PAGE_PATCH_ORDERS = this.cleanupPatches(PRODUCT_DETAIL_PAGE_PATCH_ORDERS), BxLogger.info(LOG_TAG2, "PATCH_ORDERS", PATCH_ORDERS.slice(0));
|
||||||
}
|
}
|
||||||
getSignature() {
|
getSignature() {
|
||||||
let scriptVersion = SCRIPT_VERSION, patches = JSON.stringify(ALL_PATCHES), webVersion = "", $link = document.querySelector('link[data-chunk="client"][as="script"][href*="/client."]');
|
let scriptVersion = SCRIPT_VERSION, patches = JSON.stringify(ALL_PATCHES), clientHash = "", $link = document.querySelector('link[data-chunk="client"][as="script"][href*="/client."]');
|
||||||
if ($link) {
|
if ($link) {
|
||||||
let match = /\/client\.([^\.]+)\.js/.exec($link.href);
|
let match = /\/client\.([^\.]+)\.js/.exec($link.href);
|
||||||
match && (webVersion = match[1]);
|
match && (clientHash = match[1]);
|
||||||
}
|
}
|
||||||
if (!webVersion) webVersion = document.querySelector("meta[name=gamepass-app-version]")?.content ?? "";
|
let webVersion = document.querySelector("meta[name=gamepass-app-version]")?.content ?? "", webVersionDate = document.querySelector("meta[name=gamepass-app-date]")?.content ?? "";
|
||||||
return hashCode(scriptVersion + webVersion + patches);
|
return `${scriptVersion}:${clientHash}:${webVersion}:${webVersionDate}:${hashCode(patches)}`;
|
||||||
}
|
}
|
||||||
clear() {
|
clear() {
|
||||||
window.localStorage.removeItem(this.KEY_CACHE), this.CACHE = {};
|
window.localStorage.removeItem(this.KEY_CACHE), this.CACHE = {};
|
||||||
}
|
}
|
||||||
checkSignature() {
|
checkSignature() {
|
||||||
let storedSig = window.localStorage.getItem(this.KEY_SIGNATURE) || 0, currentSig = this.getSignature();
|
let storedSig = window.localStorage.getItem(this.KEY_SIGNATURE) || 0, currentSig = this.getSignature();
|
||||||
if (currentSig !== parseInt(storedSig)) BxLogger.warning(LOG_TAG2, "Signature changed"), window.localStorage.setItem(this.KEY_SIGNATURE, currentSig.toString()), this.clear();
|
if (currentSig !== storedSig) BxLogger.warning(LOG_TAG2, "Signature changed"), window.localStorage.setItem(this.KEY_SIGNATURE, currentSig.toString()), this.clear();
|
||||||
else BxLogger.info(LOG_TAG2, "Signature unchanged");
|
else BxLogger.info(LOG_TAG2, "Signature unchanged");
|
||||||
}
|
}
|
||||||
cleanupPatches(patches) {
|
cleanupPatches(patches) {
|
||||||
@ -7393,6 +7425,7 @@ class SettingsDialog extends NavigationDialog {
|
|||||||
"video.maxFps",
|
"video.maxFps",
|
||||||
"video.player.powerPreference",
|
"video.player.powerPreference",
|
||||||
"video.processing",
|
"video.processing",
|
||||||
|
"video.processing.mode",
|
||||||
"video.ratio",
|
"video.ratio",
|
||||||
"video.position",
|
"video.position",
|
||||||
"video.processing.sharpness",
|
"video.processing.sharpness",
|
||||||
@ -9382,7 +9415,7 @@ class WebGL2Player extends BaseCanvasPlayer {
|
|||||||
updateCanvas() {
|
updateCanvas() {
|
||||||
console.log("updateCanvas", this.options);
|
console.log("updateCanvas", this.options);
|
||||||
let gl = this.gl, program = this.program, filterId = this.toFilterId(this.options.processing);
|
let gl = this.gl, program = this.program, filterId = this.toFilterId(this.options.processing);
|
||||||
gl.uniform2f(gl.getUniformLocation(program, "iResolution"), this.$canvas.width, this.$canvas.height), gl.uniform1i(gl.getUniformLocation(program, "filterId"), filterId), gl.uniform1f(gl.getUniformLocation(program, "sharpenFactor"), this.options.sharpness), gl.uniform1f(gl.getUniformLocation(program, "brightness"), this.options.brightness / 100), gl.uniform1f(gl.getUniformLocation(program, "contrast"), this.options.contrast / 100), gl.uniform1f(gl.getUniformLocation(program, "saturation"), this.options.saturation / 100);
|
gl.uniform2f(gl.getUniformLocation(program, "iResolution"), this.$canvas.width, this.$canvas.height), gl.uniform1i(gl.getUniformLocation(program, "filterId"), filterId), gl.uniform1i(gl.getUniformLocation(program, "qualityMode"), this.options.processingMode === "quality" ? 1 : 0), gl.uniform1f(gl.getUniformLocation(program, "sharpenFactor"), this.options.sharpness / (this.options.processingMode === "quality" ? 1 : 1.2)), gl.uniform1f(gl.getUniformLocation(program, "brightness"), this.options.brightness / 100), gl.uniform1f(gl.getUniformLocation(program, "contrast"), this.options.contrast / 100), gl.uniform1f(gl.getUniformLocation(program, "saturation"), this.options.saturation / 100);
|
||||||
}
|
}
|
||||||
updateFrame() {
|
updateFrame() {
|
||||||
let gl = this.gl;
|
let gl = this.gl;
|
||||||
@ -9404,7 +9437,7 @@ class WebGL2Player extends BaseCanvasPlayer {
|
|||||||
in vec4 position;void main() {gl_Position = position;}`), gl.compileShader(vShader);
|
in vec4 position;void main() {gl_Position = position;}`), gl.compileShader(vShader);
|
||||||
let fShader = gl.createShader(gl.FRAGMENT_SHADER);
|
let fShader = gl.createShader(gl.FRAGMENT_SHADER);
|
||||||
gl.shaderSource(fShader, `#version 300 es
|
gl.shaderSource(fShader, `#version 300 es
|
||||||
precision mediump float;uniform sampler2D data;uniform vec2 iResolution;const int FILTER_UNSHARP_MASKING = 1;const float CAS_CONTRAST_PEAK = 0.8 * -3.0 + 8.0;const vec3 LUMINOSITY_FACTOR = vec3(0.299, 0.587, 0.114);uniform int filterId;uniform float sharpenFactor;uniform float brightness;uniform float contrast;uniform float saturation;out vec4 fragColor;vec3 clarityBoost(sampler2D tex, vec2 coord, vec3 e) {vec2 texelSize = 1.0 / iResolution.xy;vec3 a = texture(tex, coord + texelSize * vec2(-1, 1)).rgb;vec3 b = texture(tex, coord + texelSize * vec2(0, 1)).rgb;vec3 c = texture(tex, coord + texelSize * vec2(1, 1)).rgb;vec3 d = texture(tex, coord + texelSize * vec2(-1, 0)).rgb;vec3 f = texture(tex, coord + texelSize * vec2(1, 0)).rgb;vec3 g = texture(tex, coord + texelSize * vec2(-1, -1)).rgb;vec3 h = texture(tex, coord + texelSize * vec2(0, -1)).rgb;vec3 i = texture(tex, coord + texelSize * vec2(1, -1)).rgb;if (filterId == FILTER_UNSHARP_MASKING) {vec3 gaussianBlur = (a + c + g + i) * 1.0 + (b + d + f + h) * 2.0 + e * 4.0;gaussianBlur /= 16.0;return e + (e - gaussianBlur) * sharpenFactor / 3.0;}vec3 minRgb = min(min(min(d, e), min(f, b)), h);minRgb += min(min(a, c), min(g, i));vec3 maxRgb = max(max(max(d, e), max(f, b)), h);maxRgb += max(max(a, c), max(g, i));vec3 reciprocalMaxRgb = 1.0 / maxRgb;vec3 amplifyRgb = clamp(min(minRgb, 2.0 - maxRgb) * reciprocalMaxRgb, 0.0, 1.0);amplifyRgb = inversesqrt(amplifyRgb);vec3 weightRgb = -(1.0 / (amplifyRgb * CAS_CONTRAST_PEAK));vec3 reciprocalWeightRgb = 1.0 / (4.0 * weightRgb + 1.0);vec3 window = b + d + f + h;vec3 outColor = clamp((window * weightRgb + e) * reciprocalWeightRgb, 0.0, 1.0);return mix(e, outColor, sharpenFactor / 2.0);}void main() {vec2 uv = gl_FragCoord.xy / iResolution.xy;vec3 color = texture(data, uv).rgb;color = sharpenFactor > 0.0 ? clarityBoost(data, uv, color) : color;color = saturation != 1.0 ? mix(vec3(dot(color, LUMINOSITY_FACTOR)), color, saturation) : color;color = contrast * (color - 0.5) + 0.5;color = brightness * color;fragColor = vec4(color, 1.0);}`), gl.compileShader(fShader);
|
precision mediump float;uniform sampler2D data;uniform vec2 iResolution;const int FILTER_UNSHARP_MASKING = 1;const int FILTER_CAS = 2;const float CAS_CONTRAST_PEAK = 0.8 * -3.0 + 8.0;const vec3 LUMINOSITY_FACTOR = vec3(0.299, 0.587, 0.114);uniform int filterId;uniform bool qualityMode;uniform float sharpenFactor;uniform float brightness;uniform float contrast;uniform float saturation;out vec4 fragColor;vec3 clarityBoost(sampler2D tex, vec2 coord, vec3 e) {vec2 texelSize = 1.0 / iResolution.xy;vec3 b = texture(tex, coord + texelSize * vec2(0, 1)).rgb;vec3 d = texture(tex, coord + texelSize * vec2(-1, 0)).rgb;vec3 f = texture(tex, coord + texelSize * vec2(1, 0)).rgb;vec3 h = texture(tex, coord + texelSize * vec2(0, -1)).rgb;vec3 a;vec3 c;vec3 g;vec3 i;if (filterId == FILTER_UNSHARP_MASKING || qualityMode) {a = texture(tex, coord + texelSize * vec2(-1, 1)).rgb;c = texture(tex, coord + texelSize * vec2(1, 1)).rgb;g = texture(tex, coord + texelSize * vec2(-1, -1)).rgb;i = texture(tex, coord + texelSize * vec2(1, -1)).rgb;}if (filterId == FILTER_UNSHARP_MASKING) {vec3 gaussianBlur = (a + c + g + i) * 1.0 + (b + d + f + h) * 2.0 + e * 4.0;gaussianBlur /= 16.0;return e + (e - gaussianBlur) * sharpenFactor / 3.0;}vec3 minRgb = min(min(min(d, e), min(f, b)), h);vec3 maxRgb = max(max(max(d, e), max(f, b)), h);if (qualityMode) {minRgb += min(min(a, c), min(g, i));maxRgb += max(max(a, c), max(g, i));}vec3 reciprocalMaxRgb = 1.0 / maxRgb;vec3 amplifyRgb = clamp(min(minRgb, 2.0 - maxRgb) * reciprocalMaxRgb, 0.0, 1.0);amplifyRgb = inversesqrt(amplifyRgb);vec3 weightRgb = -(1.0 / (amplifyRgb * CAS_CONTRAST_PEAK));vec3 reciprocalWeightRgb = 1.0 / (4.0 * weightRgb + 1.0);vec3 window = b + d + f + h;vec3 outColor = clamp((window * weightRgb + e) * reciprocalWeightRgb, 0.0, 1.0);return mix(e, outColor, sharpenFactor / 2.0);}void main() {vec2 uv = gl_FragCoord.xy / iResolution.xy;vec3 color = texture(data, uv).rgb;if (sharpenFactor > 0.0) {color = clarityBoost(data, uv, color);}color = mix(vec3(dot(color, LUMINOSITY_FACTOR)), color, saturation);color = contrast * (color - 0.5) + 0.5;color = brightness * color;fragColor = vec4(color, 1.0);}`), gl.compileShader(fShader);
|
||||||
let program = gl.createProgram();
|
let program = gl.createProgram();
|
||||||
if (this.program = program, gl.attachShader(program, vShader), gl.attachShader(program, fShader), gl.linkProgram(program), gl.useProgram(program), !gl.getProgramParameter(program, gl.LINK_STATUS)) console.error(`Link failed: ${gl.getProgramInfoLog(program)}`), console.error(`vs info-log: ${gl.getShaderInfoLog(vShader)}`), console.error(`fs info-log: ${gl.getShaderInfoLog(fShader)}`);
|
if (this.program = program, gl.attachShader(program, vShader), gl.attachShader(program, fShader), gl.linkProgram(program), gl.useProgram(program), !gl.getProgramParameter(program, gl.LINK_STATUS)) console.error(`Link failed: ${gl.getProgramInfoLog(program)}`), console.error(`vs info-log: ${gl.getShaderInfoLog(vShader)}`), console.error(`fs info-log: ${gl.getShaderInfoLog(fShader)}`);
|
||||||
this.updateCanvas();
|
this.updateCanvas();
|
||||||
@ -9567,6 +9600,7 @@ function patchVideoApi() {
|
|||||||
if (this.style.visibility = "visible", !this.videoWidth) return;
|
if (this.style.visibility = "visible", !this.videoWidth) return;
|
||||||
let playerOptions = {
|
let playerOptions = {
|
||||||
processing: getStreamPref("video.processing"),
|
processing: getStreamPref("video.processing"),
|
||||||
|
processingMode: getStreamPref("video.processing.mode"),
|
||||||
sharpness: getStreamPref("video.processing.sharpness"),
|
sharpness: getStreamPref("video.processing.sharpness"),
|
||||||
saturation: getStreamPref("video.saturation"),
|
saturation: getStreamPref("video.saturation"),
|
||||||
contrast: getStreamPref("video.contrast"),
|
contrast: getStreamPref("video.contrast"),
|
||||||
|
40
dist/better-xcloud.user.js
vendored
40
dist/better-xcloud.user.js
vendored
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
|||||||
import type { BaseSettingsStorage } from "@/utils/settings-storages/base-settings-storage";
|
import type { BaseSettingsStorage } from "@/utils/settings-storages/base-settings-storage";
|
||||||
import type { BlockFeature, CodecProfile, DeviceVibrationMode, GameBarPosition, LoadingScreenRocket, NativeMkbMode, StreamPlayerType, StreamResolution, StreamStat, StreamStatPosition, StreamVideoProcessing, TouchControllerMode, TouchControllerStyleCustom, TouchControllerStyleStandard, UiLayout, UiSection, UiTheme, VideoPosition, VideoPowerPreference, VideoRatio } from "./pref-values"
|
import type { BlockFeature, CodecProfile, DeviceVibrationMode, GameBarPosition, LoadingScreenRocket, NativeMkbMode, StreamPlayerType, StreamResolution, StreamStat, StreamStatPosition, StreamVideoProcessing, StreamVideoProcessingMode, TouchControllerMode, TouchControllerStyleCustom, TouchControllerStyleStandard, UiLayout, UiSection, UiTheme, VideoPosition, VideoPowerPreference, VideoRatio } from "./pref-values"
|
||||||
|
|
||||||
export const enum StorageKey {
|
export const enum StorageKey {
|
||||||
GLOBAL = 'BetterXcloud',
|
GLOBAL = 'BetterXcloud',
|
||||||
@ -156,6 +156,7 @@ export const enum StreamPref {
|
|||||||
VIDEO_PLAYER_TYPE = 'video.player.type',
|
VIDEO_PLAYER_TYPE = 'video.player.type',
|
||||||
VIDEO_POWER_PREFERENCE = 'video.player.powerPreference',
|
VIDEO_POWER_PREFERENCE = 'video.player.powerPreference',
|
||||||
VIDEO_PROCESSING = 'video.processing',
|
VIDEO_PROCESSING = 'video.processing',
|
||||||
|
VIDEO_PROCESSING_MODE = 'video.processing.mode',
|
||||||
VIDEO_SHARPNESS = 'video.processing.sharpness',
|
VIDEO_SHARPNESS = 'video.processing.sharpness',
|
||||||
VIDEO_MAX_FPS = 'video.maxFps',
|
VIDEO_MAX_FPS = 'video.maxFps',
|
||||||
VIDEO_RATIO = 'video.ratio',
|
VIDEO_RATIO = 'video.ratio',
|
||||||
@ -205,6 +206,7 @@ export type StreamPrefTypeMap = {
|
|||||||
[StreamPref.VIDEO_POSITION]: VideoPosition;
|
[StreamPref.VIDEO_POSITION]: VideoPosition;
|
||||||
[StreamPref.VIDEO_POWER_PREFERENCE]: VideoPowerPreference;
|
[StreamPref.VIDEO_POWER_PREFERENCE]: VideoPowerPreference;
|
||||||
[StreamPref.VIDEO_PROCESSING]: StreamVideoProcessing;
|
[StreamPref.VIDEO_PROCESSING]: StreamVideoProcessing;
|
||||||
|
[StreamPref.VIDEO_PROCESSING_MODE]: StreamVideoProcessingMode;
|
||||||
[StreamPref.VIDEO_RATIO]: VideoRatio;
|
[StreamPref.VIDEO_RATIO]: VideoRatio;
|
||||||
[StreamPref.VIDEO_SATURATION]: number;
|
[StreamPref.VIDEO_SATURATION]: number;
|
||||||
[StreamPref.VIDEO_SHARPNESS]: number;
|
[StreamPref.VIDEO_SHARPNESS]: number;
|
||||||
@ -294,6 +296,7 @@ export const ALL_PREFS: {
|
|||||||
StreamPref.VIDEO_POSITION,
|
StreamPref.VIDEO_POSITION,
|
||||||
StreamPref.VIDEO_POWER_PREFERENCE,
|
StreamPref.VIDEO_POWER_PREFERENCE,
|
||||||
StreamPref.VIDEO_PROCESSING,
|
StreamPref.VIDEO_PROCESSING,
|
||||||
|
StreamPref.VIDEO_PROCESSING_MODE,
|
||||||
StreamPref.VIDEO_RATIO,
|
StreamPref.VIDEO_RATIO,
|
||||||
StreamPref.VIDEO_SATURATION,
|
StreamPref.VIDEO_SATURATION,
|
||||||
StreamPref.VIDEO_SHARPNESS,
|
StreamPref.VIDEO_SHARPNESS,
|
||||||
|
@ -130,6 +130,11 @@ export const enum StreamVideoProcessing {
|
|||||||
CAS = 'cas',
|
CAS = 'cas',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const enum StreamVideoProcessingMode {
|
||||||
|
QUALITY = 'quality',
|
||||||
|
PERFORMANCE = 'performance',
|
||||||
|
}
|
||||||
|
|
||||||
export const enum BlockFeature {
|
export const enum BlockFeature {
|
||||||
CHAT = 'chat',
|
CHAT = 'chat',
|
||||||
FRIENDS = 'friends',
|
FRIENDS = 'friends',
|
||||||
|
@ -104,8 +104,8 @@ export class PatcherUtils {
|
|||||||
return str.substring(start, end);
|
return str.substring(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
static injectUseEffect<T extends 'Stream' | 'Script'>(str: string, index: number, group: T, eventName: T extends 'Stream' ? keyof StreamEvents : keyof ScriptEvents) {
|
static injectUseEffect<T extends 'Stream' | 'Script'>(str: string, index: number, group: T, eventName: T extends 'Stream' ? keyof StreamEvents : keyof ScriptEvents, separator: string = ';') {
|
||||||
const newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}), []);`;
|
const newCode = `window.BX_EXPOSED.reactUseEffect(() => window.BxEventBus.${group}.emit('${eventName}', {}), [])${separator}`;
|
||||||
str = PatcherUtils.insertAt(str, index, newCode);
|
str = PatcherUtils.insertAt(str, index, newCode);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
@ -389,20 +389,35 @@ if (titleInfo && !titleInfo.details.hasTouchSupport && !titleInfo.details.hasFak
|
|||||||
},
|
},
|
||||||
|
|
||||||
patchStreamHud(str: string) {
|
patchStreamHud(str: string) {
|
||||||
let index = str.indexOf('let{onCollapse');
|
let index = str.indexOf('({onCollapse:');
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let newCode = codeStreamHud;
|
try {
|
||||||
|
const canShowTakHUDVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, 'canShowTakHUD', index, 500, true) + 1);
|
||||||
|
const guideUIVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, 'guideUI', index, 500, true) + 1);
|
||||||
|
const onShowStreamMenuVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, 'onShowStreamMenu', index, 500, true) + 1);
|
||||||
|
const offsetVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, 'offset', index, 500, true) + 1);
|
||||||
|
|
||||||
|
let newCode = renderString(codeStreamHud, {
|
||||||
|
guideUI: guideUIVar,
|
||||||
|
onShowStreamMenu: onShowStreamMenuVar,
|
||||||
|
offset: offsetVar,
|
||||||
|
});
|
||||||
|
|
||||||
// Remove the TAK Edit button when the touch controller is disabled
|
// Remove the TAK Edit button when the touch controller is disabled
|
||||||
if (getGlobalPref(GlobalPref.TOUCH_CONTROLLER_MODE) === TouchControllerMode.OFF) {
|
if (getGlobalPref(GlobalPref.TOUCH_CONTROLLER_MODE) === TouchControllerMode.OFF) {
|
||||||
newCode += 'options.canShowTakHUD = false;';
|
newCode += `${canShowTakHUDVar} = false;`;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = PatcherUtils.insertAt(str, index, newCode);
|
const bracketIndex = PatcherUtils.indexOf(str, '}){', index, 500, true);
|
||||||
|
str = PatcherUtils.insertAt(str, bracketIndex, newCode);
|
||||||
return str;
|
return str;
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
broadcastPollingMode(str: string) {
|
broadcastPollingMode(str: string) {
|
||||||
@ -568,12 +583,13 @@ true` + text;
|
|||||||
},
|
},
|
||||||
|
|
||||||
skipFeedbackDialog(str: string) {
|
skipFeedbackDialog(str: string) {
|
||||||
let text = 'shouldTransitionToFeedback(e){';
|
let index = str.indexOf('}shouldTransitionToFeedback(');
|
||||||
if (!str.includes(text)) {
|
index >= 0 && (index = PatcherUtils.indexOf(str, '}){', index, 200, true));
|
||||||
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str.replace(text, text + 'return !1;');
|
str = PatcherUtils.insertAt(str, index, 'return !1;');
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -664,9 +680,9 @@ true` + text;
|
|||||||
|
|
||||||
// Replace *qe*'s return value
|
// Replace *qe*'s return value
|
||||||
// `return a && r ?` => `return a && r || true ?`
|
// `return a && r ?` => `return a && r || true ?`
|
||||||
index = str.indexOf(`const ${funcName}=e=>{`);
|
index = str.indexOf(`const ${funcName}=({children`);
|
||||||
index > -1 && (index = str.indexOf('return ', index));
|
index > -1 && (index = PatcherUtils.indexOf(str, 'return ', 300));
|
||||||
index > -1 && (index = str.indexOf('?', index));
|
index > -1 && (index = PatcherUtils.indexOf(str, '?', 100));
|
||||||
|
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
@ -695,12 +711,12 @@ true` + text;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = PatcherUtils.lastIndexOf(str, 'return', index, 50);
|
index = PatcherUtils.lastIndexOf(str, '=>', index, 50);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = PatcherUtils.replaceWith(str, index, 'return', 'return null;');
|
str = PatcherUtils.replaceWith(str, index, '=>', '=> true ? null :');
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -891,8 +907,8 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
|
|||||||
|
|
||||||
// Disable long touch activating context menu
|
// Disable long touch activating context menu
|
||||||
disableTouchContextMenu(str: string) {
|
disableTouchContextMenu(str: string) {
|
||||||
let index = str.indexOf('arguments.length>2&&void 0!==arguments[2]?arguments[2]:500;');
|
let index = str.indexOf('.addEventListener("touchstart",');
|
||||||
index >= 0 && (index = str.indexOf('addEventListener("touchstart"', index));
|
index >= 0 && (index = PatcherUtils.indexOf(str, '.addEventListener("touchend"', index, 200));
|
||||||
index >= 0 && (index = PatcherUtils.lastIndexOf(str, 'return ', index, 50));
|
index >= 0 && (index = PatcherUtils.lastIndexOf(str, 'return ', index, 50));
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
@ -1006,22 +1022,22 @@ ${subsVar} = subs;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find function's parameter
|
// Find function's parameter
|
||||||
const arrowIndex = PatcherUtils.lastIndexOf(str, '=>{', initialIndex, 300);
|
const productIdIndex = PatcherUtils.lastIndexOf(str, ',productId:', initialIndex, 300);
|
||||||
if (arrowIndex < 0) {
|
if (productIdIndex < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const paramVar = PatcherUtils.getVariableNameBefore(str, arrowIndex);
|
const productIdVar = PatcherUtils.getVariableNameAfter(str, productIdIndex + 11);
|
||||||
|
|
||||||
// Find supportedInputIcons and title var names
|
// Find supportedInputIcons and title var names
|
||||||
const supportedInputIconsVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, 'supportedInputIcons:', initialIndex, 100, true));
|
const supportedInputIconsVar = PatcherUtils.getVariableNameAfter(str, PatcherUtils.indexOf(str, 'supportedInputIcons:', initialIndex, 100, true));
|
||||||
|
|
||||||
if (!paramVar || !supportedInputIconsVar) {
|
if (!productIdVar || !supportedInputIconsVar) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newCode = renderString(codeGameCardIcons, {
|
const newCode = renderString(codeGameCardIcons, {
|
||||||
param: paramVar,
|
productId: productIdVar,
|
||||||
supportedInputIcons: supportedInputIconsVar,
|
supportedInputIcons: supportedInputIconsVar,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1102,12 +1118,15 @@ ${subsVar} = subs;
|
|||||||
|
|
||||||
injectErrorPageUseEffect(str: string) {
|
injectErrorPageUseEffect(str: string) {
|
||||||
let index = str.indexOf('"PureErrorPage-module__container');
|
let index = str.indexOf('"PureErrorPage-module__container');
|
||||||
index > -1 && (index = PatcherUtils.lastIndexOf(str, 'return', index, 200));
|
index > -1 && (index = PatcherUtils.lastIndexOf(str, '})=>(0,', index, 200));
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PatcherUtils.injectUseEffect(str, index, 'Script', 'ui.error.rendered');
|
str = PatcherUtils.insertAt(str, index + 4, '{');
|
||||||
|
str = PatcherUtils.injectUseEffect(str, index + 5, 'Script', 'ui.error.rendered');
|
||||||
|
str += '}';
|
||||||
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
injectStreamMenuUseEffect(str: string) {
|
injectStreamMenuUseEffect(str: string) {
|
||||||
@ -1565,26 +1584,25 @@ export class PatcherCache {
|
|||||||
/**
|
/**
|
||||||
* Get patch's signature
|
* Get patch's signature
|
||||||
*/
|
*/
|
||||||
private getSignature(): number {
|
private getSignature(): string {
|
||||||
const scriptVersion = SCRIPT_VERSION;
|
const scriptVersion = SCRIPT_VERSION;
|
||||||
const patches = JSON.stringify(ALL_PATCHES);
|
const patches = JSON.stringify(ALL_PATCHES);
|
||||||
|
|
||||||
// Get client.js's hash
|
// Get client.js's hash
|
||||||
let webVersion = '';
|
let clientHash = '';
|
||||||
const $link = document.querySelector<HTMLLinkElement>('link[data-chunk="client"][as="script"][href*="/client."]');
|
const $link = document.querySelector<HTMLLinkElement>('link[data-chunk="client"][as="script"][href*="/client."]');
|
||||||
if ($link) {
|
if ($link) {
|
||||||
const match = /\/client\.([^\.]+)\.js/.exec($link.href);
|
const match = /\/client\.([^\.]+)\.js/.exec($link.href);
|
||||||
match && (webVersion = match[1]);
|
match && (clientHash = match[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!webVersion) {
|
|
||||||
// Get version from <meta>
|
// Get version from <meta>
|
||||||
// Sometimes this value is missing
|
// Sometimes this value is missing
|
||||||
webVersion = (document.querySelector<HTMLMetaElement>('meta[name=gamepass-app-version]'))?.content ?? '';
|
const webVersion = (document.querySelector<HTMLMetaElement>('meta[name=gamepass-app-version]'))?.content ?? '';
|
||||||
}
|
const webVersionDate = (document.querySelector<HTMLMetaElement>('meta[name=gamepass-app-date]'))?.content ?? '';
|
||||||
|
|
||||||
// Calculate signature
|
// Calculate signature
|
||||||
const sig = hashCode(scriptVersion + webVersion + patches)
|
const sig = `${scriptVersion}:${clientHash}:${webVersion}:${webVersionDate}:${hashCode(patches)}`;
|
||||||
return sig;
|
return sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1598,7 +1616,7 @@ export class PatcherCache {
|
|||||||
const storedSig = window.localStorage.getItem(this.KEY_SIGNATURE) || 0;
|
const storedSig = window.localStorage.getItem(this.KEY_SIGNATURE) || 0;
|
||||||
const currentSig = this.getSignature();
|
const currentSig = this.getSignature();
|
||||||
|
|
||||||
if (currentSig !== parseInt(storedSig as string)) {
|
if (currentSig !== storedSig) {
|
||||||
// Save new signature
|
// Save new signature
|
||||||
BxLogger.warning(LOG_TAG, 'Signature changed');
|
BxLogger.warning(LOG_TAG, 'Signature changed');
|
||||||
window.localStorage.setItem(this.KEY_SIGNATURE, currentSig.toString());
|
window.localStorage.setItem(this.KEY_SIGNATURE, currentSig.toString());
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
declare const $supportedInputIcons$: Array<any>;
|
declare const $supportedInputIcons$: Array<any>;
|
||||||
declare const $param$: { productId: string };
|
declare const $productId$: string;
|
||||||
|
|
||||||
const supportedInputIcons = $supportedInputIcons$;
|
const supportedInputIcons = $supportedInputIcons$;
|
||||||
const { productId } = $param$;
|
const productId = $productId$;
|
||||||
|
|
||||||
// Remove controller icon
|
// Remove controller icon
|
||||||
supportedInputIcons.shift();
|
supportedInputIcons.shift();
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
declare const arguments: any;
|
declare let $guideUI$: any;
|
||||||
|
declare const $onShowStreamMenu$: any;
|
||||||
const options = arguments[0];
|
declare const $offset$: any;
|
||||||
|
|
||||||
// Expose onShowStreamMenu
|
// Expose onShowStreamMenu
|
||||||
window.BX_EXPOSED.showStreamMenu = options.onShowStreamMenu;
|
window.BX_EXPOSED.showStreamMenu = $onShowStreamMenu$;
|
||||||
// Restore the "..." button
|
// Restore the "..." button
|
||||||
options.guideUI = null;
|
$guideUI$ = null;
|
||||||
|
|
||||||
window.BX_EXPOSED.reactUseEffect(() => {
|
window.BX_EXPOSED.reactUseEffect(() => {
|
||||||
window.BxEventBus.Stream.emit('ui.streamHud.rendered', { expanded: options.offset.x === 0 });
|
window.BxEventBus.Stream.emit('ui.streamHud.rendered', { expanded: $offset$.x === 0 });
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,7 @@ uniform sampler2D data;
|
|||||||
uniform vec2 iResolution;
|
uniform vec2 iResolution;
|
||||||
|
|
||||||
const int FILTER_UNSHARP_MASKING = 1;
|
const int FILTER_UNSHARP_MASKING = 1;
|
||||||
// const int FILTER_CAS = 2;
|
const int FILTER_CAS = 2;
|
||||||
|
|
||||||
// constrast = 0.8
|
// constrast = 0.8
|
||||||
const float CAS_CONTRAST_PEAK = 0.8 * -3.0 + 8.0;
|
const float CAS_CONTRAST_PEAK = 0.8 * -3.0 + 8.0;
|
||||||
@ -14,6 +14,7 @@ const float CAS_CONTRAST_PEAK = 0.8 * -3.0 + 8.0;
|
|||||||
const vec3 LUMINOSITY_FACTOR = vec3(0.299, 0.587, 0.114);
|
const vec3 LUMINOSITY_FACTOR = vec3(0.299, 0.587, 0.114);
|
||||||
|
|
||||||
uniform int filterId;
|
uniform int filterId;
|
||||||
|
uniform bool qualityMode;
|
||||||
uniform float sharpenFactor;
|
uniform float sharpenFactor;
|
||||||
uniform float brightness;
|
uniform float brightness;
|
||||||
uniform float contrast;
|
uniform float contrast;
|
||||||
@ -28,16 +29,22 @@ vec3 clarityBoost(sampler2D tex, vec2 coord, vec3 e) {
|
|||||||
// a b c
|
// a b c
|
||||||
// d e f
|
// d e f
|
||||||
// g h i
|
// g h i
|
||||||
vec3 a = texture(tex, coord + texelSize * vec2(-1, 1)).rgb;
|
|
||||||
vec3 b = texture(tex, coord + texelSize * vec2(0, 1)).rgb;
|
vec3 b = texture(tex, coord + texelSize * vec2(0, 1)).rgb;
|
||||||
vec3 c = texture(tex, coord + texelSize * vec2(1, 1)).rgb;
|
|
||||||
|
|
||||||
vec3 d = texture(tex, coord + texelSize * vec2(-1, 0)).rgb;
|
vec3 d = texture(tex, coord + texelSize * vec2(-1, 0)).rgb;
|
||||||
vec3 f = texture(tex, coord + texelSize * vec2(1, 0)).rgb;
|
vec3 f = texture(tex, coord + texelSize * vec2(1, 0)).rgb;
|
||||||
|
|
||||||
vec3 g = texture(tex, coord + texelSize * vec2(-1, -1)).rgb;
|
|
||||||
vec3 h = texture(tex, coord + texelSize * vec2(0, -1)).rgb;
|
vec3 h = texture(tex, coord + texelSize * vec2(0, -1)).rgb;
|
||||||
vec3 i = texture(tex, coord + texelSize * vec2(1, -1)).rgb;
|
|
||||||
|
vec3 a;
|
||||||
|
vec3 c;
|
||||||
|
vec3 g;
|
||||||
|
vec3 i;
|
||||||
|
|
||||||
|
if (filterId == FILTER_UNSHARP_MASKING || qualityMode) {
|
||||||
|
a = texture(tex, coord + texelSize * vec2(-1, 1)).rgb;
|
||||||
|
c = texture(tex, coord + texelSize * vec2(1, 1)).rgb;
|
||||||
|
g = texture(tex, coord + texelSize * vec2(-1, -1)).rgb;
|
||||||
|
i = texture(tex, coord + texelSize * vec2(1, -1)).rgb;
|
||||||
|
}
|
||||||
|
|
||||||
// USM
|
// USM
|
||||||
if (filterId == FILTER_UNSHARP_MASKING) {
|
if (filterId == FILTER_UNSHARP_MASKING) {
|
||||||
@ -55,10 +62,12 @@ vec3 clarityBoost(sampler2D tex, vec2 coord, vec3 e) {
|
|||||||
// g h i h
|
// g h i h
|
||||||
// These are 2.0x bigger (factored out the extra multiply).
|
// These are 2.0x bigger (factored out the extra multiply).
|
||||||
vec3 minRgb = min(min(min(d, e), min(f, b)), h);
|
vec3 minRgb = min(min(min(d, e), min(f, b)), h);
|
||||||
minRgb += min(min(a, c), min(g, i));
|
|
||||||
|
|
||||||
vec3 maxRgb = max(max(max(d, e), max(f, b)), h);
|
vec3 maxRgb = max(max(max(d, e), max(f, b)), h);
|
||||||
|
|
||||||
|
if (qualityMode) {
|
||||||
|
minRgb += min(min(a, c), min(g, i));
|
||||||
maxRgb += max(max(a, c), max(g, i));
|
maxRgb += max(max(a, c), max(g, i));
|
||||||
|
}
|
||||||
|
|
||||||
// Smooth minimum distance to signal limit divided by smooth max.
|
// Smooth minimum distance to signal limit divided by smooth max.
|
||||||
vec3 reciprocalMaxRgb = 1.0 / maxRgb;
|
vec3 reciprocalMaxRgb = 1.0 / maxRgb;
|
||||||
@ -85,10 +94,12 @@ void main() {
|
|||||||
vec3 color = texture(data, uv).rgb;
|
vec3 color = texture(data, uv).rgb;
|
||||||
|
|
||||||
// Clarity boost
|
// Clarity boost
|
||||||
color = sharpenFactor > 0.0 ? clarityBoost(data, uv, color) : color;
|
if (sharpenFactor > 0.0) {
|
||||||
|
color = clarityBoost(data, uv, color);
|
||||||
|
}
|
||||||
|
|
||||||
// Saturation
|
// Saturation
|
||||||
color = saturation != 1.0 ? mix(vec3(dot(color, LUMINOSITY_FACTOR)), color, saturation) : color;
|
color = mix(vec3(dot(color, LUMINOSITY_FACTOR)), color, saturation);
|
||||||
|
|
||||||
// Contrast
|
// Contrast
|
||||||
color = contrast * (color - 0.5) + 0.5;
|
color = contrast * (color - 0.5) + 0.5;
|
||||||
|
@ -3,7 +3,7 @@ import { compressCodeFile } from "@macros/build" with { type: "macro" };
|
|||||||
import { StreamPref } from "@/enums/pref-keys";
|
import { StreamPref } from "@/enums/pref-keys";
|
||||||
import { getStreamPref } from "@/utils/pref-utils";
|
import { getStreamPref } from "@/utils/pref-utils";
|
||||||
import { BaseCanvasPlayer } from "../base-canvas-player";
|
import { BaseCanvasPlayer } from "../base-canvas-player";
|
||||||
import { StreamPlayerType } from "@/enums/pref-values";
|
import { StreamPlayerType, StreamVideoProcessingMode } from "@/enums/pref-values";
|
||||||
|
|
||||||
|
|
||||||
export class WebGL2Player extends BaseCanvasPlayer {
|
export class WebGL2Player extends BaseCanvasPlayer {
|
||||||
@ -25,7 +25,8 @@ export class WebGL2Player extends BaseCanvasPlayer {
|
|||||||
gl.uniform2f(gl.getUniformLocation(program, 'iResolution'), this.$canvas.width, this.$canvas.height);
|
gl.uniform2f(gl.getUniformLocation(program, 'iResolution'), this.$canvas.width, this.$canvas.height);
|
||||||
|
|
||||||
gl.uniform1i(gl.getUniformLocation(program, 'filterId'), filterId);
|
gl.uniform1i(gl.getUniformLocation(program, 'filterId'), filterId);
|
||||||
gl.uniform1f(gl.getUniformLocation(program, 'sharpenFactor'), this.options.sharpness);
|
gl.uniform1i(gl.getUniformLocation(program, 'qualityMode'), this.options.processingMode === StreamVideoProcessingMode.QUALITY ? 1 : 0);
|
||||||
|
gl.uniform1f(gl.getUniformLocation(program, 'sharpenFactor'), this.options.sharpness / (this.options.processingMode === StreamVideoProcessingMode.QUALITY ? 1 : 1.2));
|
||||||
gl.uniform1f(gl.getUniformLocation(program, 'brightness'), this.options.brightness / 100);
|
gl.uniform1f(gl.getUniformLocation(program, 'brightness'), this.options.brightness / 100);
|
||||||
gl.uniform1f(gl.getUniformLocation(program, 'contrast'), this.options.contrast / 100);
|
gl.uniform1f(gl.getUniformLocation(program, 'contrast'), this.options.contrast / 100);
|
||||||
gl.uniform1f(gl.getUniformLocation(program, 'saturation'), this.options.saturation / 100);
|
gl.uniform1f(gl.getUniformLocation(program, 'saturation'), this.options.saturation / 100);
|
||||||
|
@ -82,6 +82,10 @@ export class SettingsManager {
|
|||||||
},
|
},
|
||||||
[StreamPref.VIDEO_PROCESSING]: {
|
[StreamPref.VIDEO_PROCESSING]: {
|
||||||
onChange: updateVideoPlayer,
|
onChange: updateVideoPlayer,
|
||||||
|
onChangeUi: onChangeVideoPlayerType,
|
||||||
|
},
|
||||||
|
[StreamPref.VIDEO_PROCESSING_MODE]: {
|
||||||
|
onChange: updateVideoPlayer,
|
||||||
},
|
},
|
||||||
[StreamPref.VIDEO_SHARPNESS]: {
|
[StreamPref.VIDEO_SHARPNESS]: {
|
||||||
onChange: updateVideoPlayer,
|
onChange: updateVideoPlayer,
|
||||||
|
@ -8,6 +8,7 @@ import type { StreamPlayerOptions } from "@/types/stream";
|
|||||||
|
|
||||||
export function onChangeVideoPlayerType() {
|
export function onChangeVideoPlayerType() {
|
||||||
const playerType = getStreamPref(StreamPref.VIDEO_PLAYER_TYPE);
|
const playerType = getStreamPref(StreamPref.VIDEO_PLAYER_TYPE);
|
||||||
|
const processing = getStreamPref(StreamPref.VIDEO_PROCESSING);
|
||||||
const settingsManager = SettingsManager.getInstance();
|
const settingsManager = SettingsManager.getInstance();
|
||||||
if (!settingsManager.hasElement(StreamPref.VIDEO_PROCESSING)) {
|
if (!settingsManager.hasElement(StreamPref.VIDEO_PROCESSING)) {
|
||||||
return;
|
return;
|
||||||
@ -16,6 +17,7 @@ export function onChangeVideoPlayerType() {
|
|||||||
let isDisabled = false;
|
let isDisabled = false;
|
||||||
|
|
||||||
const $videoProcessing = settingsManager.getElement(StreamPref.VIDEO_PROCESSING) as HTMLSelectElement;
|
const $videoProcessing = settingsManager.getElement(StreamPref.VIDEO_PROCESSING) as HTMLSelectElement;
|
||||||
|
const $videoProcessingMode = settingsManager.getElement(StreamPref.VIDEO_PROCESSING_MODE) as HTMLSelectElement;
|
||||||
const $videoSharpness = settingsManager.getElement(StreamPref.VIDEO_SHARPNESS);
|
const $videoSharpness = settingsManager.getElement(StreamPref.VIDEO_SHARPNESS);
|
||||||
const $videoPowerPreference = settingsManager.getElement(StreamPref.VIDEO_POWER_PREFERENCE);
|
const $videoPowerPreference = settingsManager.getElement(StreamPref.VIDEO_POWER_PREFERENCE);
|
||||||
const $videoMaxFps = settingsManager.getElement(StreamPref.VIDEO_MAX_FPS);
|
const $videoMaxFps = settingsManager.getElement(StreamPref.VIDEO_MAX_FPS);
|
||||||
@ -40,6 +42,7 @@ export function onChangeVideoPlayerType() {
|
|||||||
$videoSharpness.dataset.disabled = isDisabled.toString();
|
$videoSharpness.dataset.disabled = isDisabled.toString();
|
||||||
|
|
||||||
// Hide Power Preference setting if renderer isn't WebGL2
|
// Hide Power Preference setting if renderer isn't WebGL2
|
||||||
|
$videoProcessingMode.closest('.bx-settings-row')!.classList.toggle('bx-gone', !(playerType === StreamPlayerType.WEBGL2 && processing === StreamVideoProcessing.CAS));
|
||||||
$videoPowerPreference.closest('.bx-settings-row')!.classList.toggle('bx-gone', playerType !== StreamPlayerType.WEBGL2);
|
$videoPowerPreference.closest('.bx-settings-row')!.classList.toggle('bx-gone', playerType !== StreamPlayerType.WEBGL2);
|
||||||
$videoMaxFps.closest('.bx-settings-row')!.classList.toggle('bx-gone', playerType === StreamPlayerType.VIDEO);
|
$videoMaxFps.closest('.bx-settings-row')!.classList.toggle('bx-gone', playerType === StreamPlayerType.VIDEO);
|
||||||
}
|
}
|
||||||
@ -59,6 +62,7 @@ export function updateVideoPlayer() {
|
|||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
processing: getStreamPref(StreamPref.VIDEO_PROCESSING),
|
processing: getStreamPref(StreamPref.VIDEO_PROCESSING),
|
||||||
|
processingMode: getStreamPref(StreamPref.VIDEO_PROCESSING_MODE),
|
||||||
sharpness: getStreamPref(StreamPref.VIDEO_SHARPNESS),
|
sharpness: getStreamPref(StreamPref.VIDEO_SHARPNESS),
|
||||||
saturation: getStreamPref(StreamPref.VIDEO_SATURATION),
|
saturation: getStreamPref(StreamPref.VIDEO_SATURATION),
|
||||||
contrast: getStreamPref(StreamPref.VIDEO_CONTRAST),
|
contrast: getStreamPref(StreamPref.VIDEO_CONTRAST),
|
||||||
|
@ -452,6 +452,7 @@ export class SettingsDialog extends NavigationDialog {
|
|||||||
StreamPref.VIDEO_MAX_FPS,
|
StreamPref.VIDEO_MAX_FPS,
|
||||||
StreamPref.VIDEO_POWER_PREFERENCE,
|
StreamPref.VIDEO_POWER_PREFERENCE,
|
||||||
StreamPref.VIDEO_PROCESSING,
|
StreamPref.VIDEO_PROCESSING,
|
||||||
|
StreamPref.VIDEO_PROCESSING_MODE,
|
||||||
StreamPref.VIDEO_RATIO,
|
StreamPref.VIDEO_RATIO,
|
||||||
StreamPref.VIDEO_POSITION,
|
StreamPref.VIDEO_POSITION,
|
||||||
StreamPref.VIDEO_SHARPNESS,
|
StreamPref.VIDEO_SHARPNESS,
|
||||||
|
3
src/types/stream.d.ts
vendored
3
src/types/stream.d.ts
vendored
@ -1,7 +1,8 @@
|
|||||||
import type { StreamVideoProcessing } from "@/enums/pref-values";
|
import type { StreamVideoProcessing, StreamVideoProcessingMode } from "@/enums/pref-values";
|
||||||
|
|
||||||
type StreamPlayerOptions = {
|
type StreamPlayerOptions = {
|
||||||
processing: StreamVideoProcessing,
|
processing: StreamVideoProcessing,
|
||||||
|
processingMode: StreamVideoProcessingMode,
|
||||||
sharpness: number,
|
sharpness: number,
|
||||||
saturation: number,
|
saturation: number,
|
||||||
contrast: number,
|
contrast: number,
|
||||||
|
@ -22,6 +22,7 @@ export function patchVideoApi() {
|
|||||||
|
|
||||||
const playerOptions = {
|
const playerOptions = {
|
||||||
processing: getStreamPref(StreamPref.VIDEO_PROCESSING),
|
processing: getStreamPref(StreamPref.VIDEO_PROCESSING),
|
||||||
|
processingMode: getStreamPref(StreamPref.VIDEO_PROCESSING_MODE),
|
||||||
sharpness: getStreamPref(StreamPref.VIDEO_SHARPNESS),
|
sharpness: getStreamPref(StreamPref.VIDEO_SHARPNESS),
|
||||||
saturation: getStreamPref(StreamPref.VIDEO_SATURATION),
|
saturation: getStreamPref(StreamPref.VIDEO_SATURATION),
|
||||||
contrast: getStreamPref(StreamPref.VIDEO_CONTRAST),
|
contrast: getStreamPref(StreamPref.VIDEO_CONTRAST),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { StreamPref, StorageKey, type PrefTypeMap } from "@/enums/pref-keys";
|
import { StreamPref, StorageKey, type PrefTypeMap } from "@/enums/pref-keys";
|
||||||
import { DeviceVibrationMode, StreamPlayerType, StreamVideoProcessing, VideoPowerPreference, VideoRatio, VideoPosition, StreamStat, StreamStatPosition } from "@/enums/pref-values";
|
import { DeviceVibrationMode, StreamPlayerType, StreamVideoProcessing, VideoPowerPreference, VideoRatio, VideoPosition, StreamStat, StreamStatPosition, StreamVideoProcessingMode } from "@/enums/pref-values";
|
||||||
import { STATES } from "../global";
|
import { STATES } from "../global";
|
||||||
import { KeyboardShortcutDefaultId } from "../local-db/keyboard-shortcuts-table";
|
import { KeyboardShortcutDefaultId } from "../local-db/keyboard-shortcuts-table";
|
||||||
import { MkbMappingDefaultPresetId } from "../local-db/mkb-mapping-presets-table";
|
import { MkbMappingDefaultPresetId } from "../local-db/mkb-mapping-presets-table";
|
||||||
@ -179,6 +179,18 @@ export class StreamSettingsStorage extends BaseSettingsStorage<StreamPref> {
|
|||||||
highest: StreamVideoProcessing.CAS,
|
highest: StreamVideoProcessing.CAS,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
[StreamPref.VIDEO_PROCESSING_MODE]: {
|
||||||
|
label: t('clarity-boost-mode'),
|
||||||
|
default: StreamVideoProcessingMode.PERFORMANCE,
|
||||||
|
options: {
|
||||||
|
[StreamVideoProcessingMode.PERFORMANCE]: t('performance'),
|
||||||
|
[StreamVideoProcessingMode.QUALITY]: t('quality'),
|
||||||
|
},
|
||||||
|
suggest: {
|
||||||
|
lowest: StreamVideoProcessingMode.PERFORMANCE,
|
||||||
|
highest: StreamVideoProcessingMode.QUALITY,
|
||||||
|
},
|
||||||
|
},
|
||||||
[StreamPref.VIDEO_POWER_PREFERENCE]: {
|
[StreamPref.VIDEO_POWER_PREFERENCE]: {
|
||||||
label: t('renderer-configuration'),
|
label: t('renderer-configuration'),
|
||||||
default: VideoPowerPreference.DEFAULT,
|
default: VideoPowerPreference.DEFAULT,
|
||||||
|
@ -65,6 +65,7 @@ const Texts = {
|
|||||||
"center": "Center",
|
"center": "Center",
|
||||||
"chat": "Chat",
|
"chat": "Chat",
|
||||||
"clarity-boost": "Clarity boost",
|
"clarity-boost": "Clarity boost",
|
||||||
|
"clarity-boost-mode": "Clarity boost mode",
|
||||||
"clarity-boost-warning": "These settings don't work when the Clarity Boost mode is ON",
|
"clarity-boost-warning": "These settings don't work when the Clarity Boost mode is ON",
|
||||||
"clear": "Clear",
|
"clear": "Clear",
|
||||||
"clear-data": "Clear data",
|
"clear-data": "Clear data",
|
||||||
@ -227,6 +228,7 @@ const Texts = {
|
|||||||
"only-supports-some-games": "Only supports some games",
|
"only-supports-some-games": "Only supports some games",
|
||||||
"opacity": "Opacity",
|
"opacity": "Opacity",
|
||||||
"other": "Other",
|
"other": "Other",
|
||||||
|
"performance": "Performance",
|
||||||
"playing": "Playing",
|
"playing": "Playing",
|
||||||
"playtime": "Playtime",
|
"playtime": "Playtime",
|
||||||
"poland": "Poland",
|
"poland": "Poland",
|
||||||
@ -264,6 +266,7 @@ const Texts = {
|
|||||||
],
|
],
|
||||||
"press-to-bind": "Press a key or do a mouse click to bind...",
|
"press-to-bind": "Press a key or do a mouse click to bind...",
|
||||||
"prompt-preset-name": "Preset's name:",
|
"prompt-preset-name": "Preset's name:",
|
||||||
|
"quality": "Quality",
|
||||||
"recommended": "Recommended",
|
"recommended": "Recommended",
|
||||||
"recommended-settings-for-device": [
|
"recommended-settings-for-device": [
|
||||||
(e: any) => `Recommended settings for ${e.device}`,
|
(e: any) => `Recommended settings for ${e.device}`,
|
||||||
@ -319,6 +322,7 @@ const Texts = {
|
|||||||
"separate-touch-controller": "Separate Touch controller & Controller #1",
|
"separate-touch-controller": "Separate Touch controller & Controller #1",
|
||||||
"separate-touch-controller-note": "Touch controller is Player 1, Controller #1 is Player 2",
|
"separate-touch-controller-note": "Touch controller is Player 1, Controller #1 is Player 2",
|
||||||
"server": "Server",
|
"server": "Server",
|
||||||
|
"server-list-error": "Can't get the server list",
|
||||||
"server-locations": "Server locations",
|
"server-locations": "Server locations",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"settings-for": "Settings for",
|
"settings-for": "Settings for",
|
||||||
@ -368,6 +372,7 @@ const Texts = {
|
|||||||
"tc-custom-layout-style": "Custom layout's button style",
|
"tc-custom-layout-style": "Custom layout's button style",
|
||||||
"tc-muted-colors": "Muted colors",
|
"tc-muted-colors": "Muted colors",
|
||||||
"tc-standard-layout-style": "Standard layout's button style",
|
"tc-standard-layout-style": "Standard layout's button style",
|
||||||
|
"test-controller": "Test controller",
|
||||||
"text-size": "Text size",
|
"text-size": "Text size",
|
||||||
"theme": "Theme",
|
"theme": "Theme",
|
||||||
"toggle": "Toggle",
|
"toggle": "Toggle",
|
||||||
|
Reference in New Issue
Block a user