From 7a719aa88649a21bdeed94469da701b2b228748d Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 18 Jun 2023 16:39:24 -0500 Subject: [PATCH] Allow up to 16 gamepads with Sunshine hosts --- app/streaming/input/gamepad.cpp | 4 ++-- app/streaming/input/input.h | 4 +++- moonlight-common-c/moonlight-common-c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/streaming/input/gamepad.cpp b/app/streaming/input/gamepad.cpp index aa0c9d52..7fdec99d 100644 --- a/app/streaming/input/gamepad.cpp +++ b/app/streaming/input/gamepad.cpp @@ -45,8 +45,8 @@ SdlInputHandler::findStateForGamepad(SDL_JoystickID id) } } - // This should only happen with > 4 gamepads - SDL_assert(SDL_NumJoysticks() > 4); + // This should only happen with too many gamepads + SDL_assert(SDL_NumJoysticks() > MAX_GAMEPADS); return nullptr; } diff --git a/app/streaming/input/input.h b/app/streaming/input/input.h index 415e7d34..848f1421 100644 --- a/app/streaming/input/input.h +++ b/app/streaming/input/input.h @@ -31,7 +31,9 @@ struct GamepadState { unsigned char lt, rt; }; -#define MAX_GAMEPADS 4 +// activeGamepadMask is a short, so we're bounded by the number of mask bits +#define MAX_GAMEPADS 16 + #define MAX_FINGERS 2 #define GAMEPAD_HAPTIC_METHOD_NONE 0 diff --git a/moonlight-common-c/moonlight-common-c b/moonlight-common-c/moonlight-common-c index 9bf09d68..812ec0e2 160000 --- a/moonlight-common-c/moonlight-common-c +++ b/moonlight-common-c/moonlight-common-c @@ -1 +1 @@ -Subproject commit 9bf09d681ef21e5a1284b50a850fe4e5df3afbe3 +Subproject commit 812ec0e2b7d1a84c13ebae5f821aeedc80bd1ea2