Fix not able to control Remote Play dialog using controller (#509)

This commit is contained in:
redphx 2024-09-20 07:05:39 +07:00
parent dabab9acb1
commit 037927b9be
3 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Better xCloud // @name Better xCloud
// @namespace https://github.com/redphx // @namespace https://github.com/redphx
// @version 5.7.4 // @version 5.7.5-beta
// @description Improve Xbox Cloud Gaming (xCloud) experience // @description Improve Xbox Cloud Gaming (xCloud) experience
// @author redphx // @author redphx
// @license MIT // @license MIT
@ -139,7 +139,7 @@ function deepClone(obj) {
return {}; return {};
return JSON.parse(JSON.stringify(obj)); return JSON.parse(JSON.stringify(obj));
} }
var SCRIPT_VERSION = "5.7.4", AppInterface = window.AppInterface; var SCRIPT_VERSION = "5.7.5-beta", 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,
@ -2507,7 +2507,7 @@ class NavigationDialog {
return !1; return !1;
} }
handleGamepad(button) { handleGamepad(button) {
return !0; return !1;
} }
} }
@ -6236,7 +6236,8 @@ class RemotePlayNavigationDialog extends NavigationDialog {
label: t("help") label: t("help")
}), createButton({ }), createButton({
style: 4 | 32, style: 4 | 32,
label: t("close") label: t("close"),
onClick: (e) => this.hide()
}))), this.$container = $fragment; }))), this.$container = $fragment;
} }
getDialog() { getDialog() {

View File

@ -80,7 +80,7 @@ export abstract class NavigationDialog {
} }
handleGamepad(button: GamepadKey): boolean { handleGamepad(button: GamepadKey): boolean {
return true; return false;
} }
} }

View File

@ -125,6 +125,7 @@ export class RemotePlayNavigationDialog extends NavigationDialog {
createButton({ createButton({
style: ButtonStyle.GHOST | ButtonStyle.FOCUSABLE, style: ButtonStyle.GHOST | ButtonStyle.FOCUSABLE,
label: t('close'), label: t('close'),
onClick: e => this.hide(),
}), }),
), ),
); );