mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-24 13:41:23 +00:00
Allow exceeding 4 controllers for Sunshine hosts
This commit is contained in:
@@ -961,6 +961,7 @@ static int sendControllerEventInternal(short controllerNumber, short activeGamep
|
|||||||
else {
|
else {
|
||||||
// Generation 4+ servers support passing the controller number
|
// Generation 4+ servers support passing the controller number
|
||||||
holder->packet.multiController.header.size = BE32(sizeof(NV_MULTI_CONTROLLER_PACKET) - sizeof(uint32_t));
|
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
|
// On Gen 5 servers, the header code is decremented by one
|
||||||
if (AppVersionQuad[0] >= 5) {
|
if (AppVersionQuad[0] >= 5) {
|
||||||
holder->packet.multiController.header.magic = LE32(MULTI_CONTROLLER_MAGIC_GEN5);
|
holder->packet.multiController.header.magic = LE32(MULTI_CONTROLLER_MAGIC_GEN5);
|
||||||
@@ -968,6 +969,13 @@ static int sendControllerEventInternal(short controllerNumber, short activeGamep
|
|||||||
else {
|
else {
|
||||||
holder->packet.multiController.header.magic = LE32(MULTI_CONTROLLER_MAGIC);
|
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.headerB = LE16(MC_HEADER_B);
|
||||||
holder->packet.multiController.controllerNumber = LE16(controllerNumber);
|
holder->packet.multiController.controllerNumber = LE16(controllerNumber);
|
||||||
holder->packet.multiController.activeGamepadMask = LE16(activeGamepadMask);
|
holder->packet.multiController.activeGamepadMask = LE16(activeGamepadMask);
|
||||||
|
|||||||
+4
-2
@@ -664,8 +664,10 @@ int LiSendControllerEvent(short buttonFlags, unsigned char leftTrigger, unsigned
|
|||||||
// This function queues a controller event to be sent to the remote server. The controllerNumber
|
// This function queues a controller event to be sent to the remote server. The controllerNumber
|
||||||
// parameter is a zero-based index of which controller this event corresponds to. The largest legal
|
// parameter is a zero-based index of which controller this event corresponds to. The largest legal
|
||||||
// controller number is 3 (for a total of 4 controllers, the Xinput maximum). On generation 3 servers (GFE 2.1.x),
|
// controller number is 3 (for a total of 4 controllers, the Xinput maximum). On generation 3 servers (GFE 2.1.x),
|
||||||
// these will be sent as controller 0 regardless of the controllerNumber parameter. The activeGamepadMask
|
// these will be sent as controller 0 regardless of the controllerNumber parameter.
|
||||||
// parameter is a bitfield with bits set for each controller present up to a maximum of 4 (0xF).
|
//
|
||||||
|
// The activeGamepadMask parameter is a bitfield with bits set for each controller present.
|
||||||
|
// On GFE, activeGamepadMask is limited to a maximum of 4 (0xF). On Sunshine, it is limited to 16 (0xFFFF).
|
||||||
int LiSendMultiControllerEvent(short controllerNumber, short activeGamepadMask,
|
int LiSendMultiControllerEvent(short controllerNumber, short activeGamepadMask,
|
||||||
int buttonFlags, unsigned char leftTrigger, unsigned char rightTrigger,
|
int buttonFlags, unsigned char leftTrigger, unsigned char rightTrigger,
|
||||||
short leftStickX, short leftStickY, short rightStickX, short rightStickY);
|
short leftStickX, short leftStickY, short rightStickX, short rightStickY);
|
||||||
|
|||||||
Reference in New Issue
Block a user