From ec6c3fc8a39d12b297b48b63aba9646820e15c13 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Fri, 12 Apr 2024 20:37:45 +0700 Subject: [PATCH] Minor fix in showGamepadToast() --- better-xcloud.user.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/better-xcloud.user.js b/better-xcloud.user.js index 3a987f4..f189e9f 100644 --- a/better-xcloud.user.js +++ b/better-xcloud.user.js @@ -12099,6 +12099,11 @@ MkbHandler.setupEvents(); // Show a toast when connecting/disconecting controller function showGamepadToast(gamepad) { + // Don't show Toast for virtual controller + if (gamepad.id === MkbHandler.VIRTUAL_GAMEPAD_ID) { + return; + } + console.log(gamepad); let text = '🎮'; @@ -12108,12 +12113,6 @@ function showGamepadToast(gamepad) { // Remove "(STANDARD GAMEPAD Vendor: xxx Product: xxx)" from ID const gamepadId = gamepad.id.replace(/ \(.*?Vendor: \w+ Product: \w+\)$/, ''); - - // Don't show Toast for virtual controller - if (gamepadId === MkbHandler.VIRTUAL_GAMEPAD_ID) { - return; - } - text += ` - ${gamepadId}`; let status;