mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Add "patchSetCurrentlyFocusedInteractable" patch
This commit is contained in:
parent
b9e78f09d3
commit
18a8b8330c
@ -186,6 +186,14 @@ window.addEventListener(BxEvent.STREAM_ERROR_PAGE, e => {
|
||||
BxEvent.dispatch(window, BxEvent.STREAM_STOPPED);
|
||||
});
|
||||
|
||||
window.addEventListener(BxEvent.NAVIGATION_FOCUS_CHANGED, e => {
|
||||
const $elm = (e as any).element;
|
||||
if (($elm.tagName === 'BUTTON' && $elm.className.includes('MruGameCard')) || ($elm.tagName === 'A' && $elm.className.includes('GameCard'))) {
|
||||
console.dir($elm);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function unload() {
|
||||
if (!STATES.isPlaying) {
|
||||
return;
|
||||
|
@ -9,6 +9,7 @@ import { BxEvent } from "@/utils/bx-event";
|
||||
import codeControllerShortcuts from "./patches/controller-shortcuts.js" with { type: "text" };
|
||||
import codeExposeStreamSession from "./patches/expose-stream-session.js" with { type: "text" };
|
||||
import codeLocalCoOpEnable from "./patches/local-co-op-enable.js" with { type: "text" };
|
||||
import codeSetCurrentlyFocusedInteractable from "./patches/set-currently-focused-interactable.js" with { type: "text" };
|
||||
import codeRemotePlayEnable from "./patches/remote-play-enable.js" with { type: "text" };
|
||||
import codeRemotePlayKeepAlive from "./patches/remote-play-keep-alive.js" with { type: "text" };
|
||||
import codeVibrationAdjust from "./patches/vibration-adjust.js" with { type: "text" };
|
||||
@ -775,6 +776,18 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
|
||||
str = str.substring(0, commaIndex) + ',true' + str.substring(index);
|
||||
return str;
|
||||
},
|
||||
|
||||
// 24225.js#4127, 24.17.11
|
||||
patchSetCurrentlyFocusedInteractable(str: string) {
|
||||
let index = str.indexOf('.setCurrentlyFocusedInteractable=(');
|
||||
if (index === -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
index = str.indexOf('{', index) + 1;
|
||||
str = str.substring(0, index) + codeSetCurrentlyFocusedInteractable + str.substring(index);
|
||||
return str;
|
||||
},
|
||||
};
|
||||
|
||||
let PATCH_ORDERS: PatchArray = [
|
||||
@ -797,6 +810,7 @@ let PATCH_ORDERS: PatchArray = [
|
||||
'enableTvRoutes',
|
||||
|
||||
'overrideStorageGetSettings',
|
||||
'patchSetCurrentlyFocusedInteractable',
|
||||
|
||||
getPref(PrefKey.UI_LAYOUT) !== 'default' && 'websiteLayout',
|
||||
getPref(PrefKey.LOCAL_CO_OP_ENABLED) && 'supportLocalCoOp',
|
||||
|
@ -0,0 +1 @@
|
||||
e && BxEvent.dispatch(window, BxEvent.NAVIGATION_FOCUS_CHANGED, {element: e});
|
@ -38,6 +38,8 @@ export enum BxEvent {
|
||||
POINTER_LOCK_REQUESTED = 'bx-pointer-lock-requested',
|
||||
POINTER_LOCK_EXITED = 'bx-pointer-lock-exited',
|
||||
|
||||
NAVIGATION_FOCUS_CHANGED = 'bx-nav-focus-changed',
|
||||
|
||||
// xCloud Dialog events
|
||||
XCLOUD_DIALOG_SHOWN = 'bx-xcloud-dialog-shown',
|
||||
XCLOUD_DIALOG_DISMISSED = 'bx-xcloud-dialog-dismissed',
|
||||
|
Loading…
x
Reference in New Issue
Block a user