mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-02-16 02:21:07 +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 {
|
||||
// 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);
|
||||
|
||||
@@ -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
|
||||
// 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),
|
||||
// these will be sent as controller 0 regardless of the controllerNumber parameter. The activeGamepadMask
|
||||
// parameter is a bitfield with bits set for each controller present up to a maximum of 4 (0xF).
|
||||
// these will be sent as controller 0 regardless of the controllerNumber parameter.
|
||||
//
|
||||
// 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 buttonFlags, unsigned char leftTrigger, unsigned char rightTrigger,
|
||||
short leftStickX, short leftStickY, short rightStickX, short rightStickY);
|
||||
|
||||
Reference in New Issue
Block a user