Allow exceeding 4 controllers for Sunshine hosts

This commit is contained in:
Cameron Gutman committed 2023-06-18 16:36:34 -05:00
1 parent 9bf09d681e
commit 812ec0e2b7
2 files changed
+12 -2

No files matched your search

+8
View File
@@ -961,6 +961,7 @@ static int sendControllerEventInternal(short controllerNumber, short activeGamep
else {
// Generation 4+ servers support passing the controller number
holder->packet.multiController.header.size = BE32(sizeof(NV_MULTI_CONTROLLER_PACKET) - sizeof(uint32_t));
// On Gen 5 servers, the header code is decremented by one
if (AppVersionQuad[0] >= 5) {
holder->packet.multiController.header.magic = LE32(MULTI_CONTROLLER_MAGIC_GEN5);
@@ -968,6 +969,13 @@ static int sendControllerEventInternal(short controllerNumber, short activeGamep
else {
holder->packet.multiController.header.magic = LE32(MULTI_CONTROLLER_MAGIC);
}
// GFE only supports a maximum of 4 controllers
if (!IS_SUNSHINE()) {
controllerNumber %= 4;
activeGamepadMask &= 0xF;
}
holder->packet.multiController.headerB = LE16(MC_HEADER_B);
holder->packet.multiController.controllerNumber = LE16(controllerNumber);
holder->packet.multiController.activeGamepadMask = LE16(activeGamepadMask);