Update better-xcloud.user.js

This commit is contained in:
redphx 2024-08-14 18:26:23 +07:00
parent 344b6bb2c9
commit 8ca6a9e08c

View File

@ -3810,9 +3810,11 @@ if (window.BX_EXPOSED.stopTakRendering) {
disableTakRenderer(str) { disableTakRenderer(str) {
if (!str.includes("const{TakRenderer:")) if (!str.includes("const{TakRenderer:"))
return !1; return !1;
let remotePlayCode = ""; let autoOffCode = "";
if (getPref("stream_touch_controller") !== "off" && getPref("stream_touch_controller_auto_off")) if (getPref("stream_touch_controller") === "off")
remotePlayCode = ` autoOffCode = "return;";
else if (getPref("stream_touch_controller_auto_off"))
autoOffCode = `
const gamepads = window.navigator.getGamepads(); const gamepads = window.navigator.getGamepads();
let gamepadFound = false; let gamepadFound = false;
@ -3828,14 +3830,12 @@ if (gamepadFound) {
} }
`; `;
const newCode = ` const newCode = `
if (!!window.BX_REMOTE_PLAY_CONFIG) { ${autoOffCode}
${remotePlayCode}
} else {
const titleInfo = window.BX_EXPOSED.getTitleInfo(); const titleInfo = window.BX_EXPOSED.getTitleInfo();
if (titleInfo && !titleInfo.details.hasTouchSupport && !titleInfo.details.hasFakeTouchSupport) { if (titleInfo && !titleInfo.details.hasTouchSupport && !titleInfo.details.hasFakeTouchSupport) {
return; return;
} }
}
`; `;
return str = str.replace("const{TakRenderer:", newCode + "const{TakRenderer:"), str; return str = str.replace("const{TakRenderer:", newCode + "const{TakRenderer:"), str;
}, },
@ -5735,7 +5735,15 @@ var BxExposed = {
const navigationDialogManager = NavigationDialogManager.getInstance(); const navigationDialogManager = NavigationDialogManager.getInstance();
if (navigationDialogManager.isShowing()) if (navigationDialogManager.isShowing())
return navigationDialogManager.hide(), !0; return navigationDialogManager.hide(), !0;
return !1; const dict = {
bubbles: !0,
cancelable: !0,
key: "XF86Back",
code: "XF86Back",
keyCode: 4,
which: 4
};
return document.body.dispatchEvent(new KeyboardEvent("keydown", dict)), document.body.dispatchEvent(new KeyboardEvent("keyup", dict)), !1;
} }
}; };