mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Fix touch controller not working in Remote Play
This commit is contained in:
parent
ba0ccf5213
commit
bcd61833b2
@ -320,11 +320,34 @@ if (match) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const newCode = `
|
||||
const titleInfo = window.BX_EXPOSED.getTitleInfo();
|
||||
if (!titleInfo.details.hasTouchSupport && !titleInfo.details.hasFakeTouchSupport) {
|
||||
let remotePlayCode = '';
|
||||
if (getPref(PrefKey.STREAM_TOUCH_CONTROLLER) !== 'off' && getPref(PrefKey.STREAM_TOUCH_CONTROLLER_AUTO_OFF)) {
|
||||
remotePlayCode = `
|
||||
const gamepads = window.navigator.getGamepads();
|
||||
let gamepadFound = false;
|
||||
|
||||
for (let gamepad of gamepads) {
|
||||
if (gamepad && gamepad.connected) {
|
||||
gamepadFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (gamepadFound) {
|
||||
return;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
const newCode = `
|
||||
if (!!window.BX_REMOTE_PLAY_CONFIG) {
|
||||
${remotePlayCode}
|
||||
} else {
|
||||
const titleInfo = window.BX_EXPOSED.getTitleInfo();
|
||||
if (titleInfo && !titleInfo.details.hasTouchSupport && !titleInfo.details.hasFakeTouchSupport) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
str = str.replace(text, newCode + text);
|
||||
|
Loading…
x
Reference in New Issue
Block a user