From d055599608a9c50b9b5426790dad40fa3ab70687 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 5 Oct 2023 20:29:18 -0500 Subject: [PATCH] Map Misc button to Guide for GFE hosts --- src/InputStream.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/InputStream.c b/src/InputStream.c index d2c5589..587902d 100644 --- a/src/InputStream.c +++ b/src/InputStream.c @@ -983,10 +983,19 @@ static int sendControllerEventInternal(short controllerNumber, short activeGamep return -2; } - // GFE only supports a maximum of 4 controllers if (!IS_SUNSHINE()) { + // GFE only supports a maximum of 4 controllers controllerNumber %= 4; activeGamepadMask &= 0xF; + + // GFE doesn't support buttons that aren't present on an Xbox 360 controller, + // so the extended button flags won't even be sent. For convenience, let's + // map the MISC button to the SPECIAL (Guide) button. Some platforms reserve + // the Guide button for OS functionality (Game Bar, Home button, etc.), so + // this allows otherwise unused buttons to activate that functionality. + if (buttonFlags & MISC_FLAG) { + buttonFlags |= SPECIAL_FLAG; + } } else { // Sunshine supports up to 16 (max number of bits in activeGamepadMask)