diff --git a/src/modules/patcher.ts b/src/modules/patcher.ts index 371ddfd..13f3890 100644 --- a/src/modules/patcher.ts +++ b/src/modules/patcher.ts @@ -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);