mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-24 13:41:23 +00:00
Send zero state gyro events as reliable traffic
This commit is contained in:
+10
-2
@@ -1424,8 +1424,16 @@ int LiSendControllerMotionEvent(uint8_t controllerNumber, uint8_t motionType, fl
|
|||||||
// Send each controller on a separate channel specific to motion sensors
|
// Send each controller on a separate channel specific to motion sensors
|
||||||
holder->channelId = CTRL_CHANNEL_SENSOR_BASE + controllerNumber;
|
holder->channelId = CTRL_CHANNEL_SENSOR_BASE + controllerNumber;
|
||||||
|
|
||||||
// Motion events are so rapid that we can just drop any events that are lost in transit
|
// Motion events are so rapid that we can just drop any events that are lost in transit,
|
||||||
holder->enetPacketFlags = 0;
|
// but we will treat (0, 0, 0) as a special value for gyro events to allow clients to
|
||||||
|
// reliably set the gyro to a null state when sensor events are halted due to focus loss
|
||||||
|
// or similar client-side constraints.
|
||||||
|
if (motionType == LI_MOTION_TYPE_GYRO && x == 0.0f && y == 0.0f && z == 0.0f) {
|
||||||
|
holder->enetPacketFlags = ENET_PACKET_FLAG_RELIABLE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
holder->enetPacketFlags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
holder->packet.controllerMotion.header.size = BE32(sizeof(SS_CONTROLLER_MOTION_PACKET) - sizeof(uint32_t));
|
holder->packet.controllerMotion.header.size = BE32(sizeof(SS_CONTROLLER_MOTION_PACKET) - sizeof(uint32_t));
|
||||||
holder->packet.controllerMotion.header.magic = LE32(SS_CONTROLLER_MOTION_MAGIC);
|
holder->packet.controllerMotion.header.magic = LE32(SS_CONTROLLER_MOTION_MAGIC);
|
||||||
|
|||||||
Reference in New Issue
Block a user