mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
NetPlayServer: Make pad data unpacking nicer to read
This commit is contained in:
@ -500,7 +500,16 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
|
|||||||
|
|
||||||
PadMapping map = 0;
|
PadMapping map = 0;
|
||||||
GCPadStatus pad;
|
GCPadStatus pad;
|
||||||
packet >> map >> pad.button >> pad.analogA >> pad.analogB >> pad.stickX >> pad.stickY >> pad.substickX >> pad.substickY >> pad.triggerLeft >> pad.triggerRight;
|
packet >> map
|
||||||
|
>> pad.button
|
||||||
|
>> pad.analogA
|
||||||
|
>> pad.analogB
|
||||||
|
>> pad.stickX
|
||||||
|
>> pad.stickY
|
||||||
|
>> pad.substickX
|
||||||
|
>> pad.substickY
|
||||||
|
>> pad.triggerLeft
|
||||||
|
>> pad.triggerRight;
|
||||||
|
|
||||||
// If the data is not from the correct player,
|
// If the data is not from the correct player,
|
||||||
// then disconnect them.
|
// then disconnect them.
|
||||||
@ -512,7 +521,16 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
|
|||||||
// Relay to clients
|
// Relay to clients
|
||||||
sf::Packet spac;
|
sf::Packet spac;
|
||||||
spac << (MessageId)NP_MSG_PAD_DATA;
|
spac << (MessageId)NP_MSG_PAD_DATA;
|
||||||
spac << map << pad.button << pad.analogA << pad.analogB << pad.stickX << pad.stickY << pad.substickX << pad.substickY << pad.triggerLeft << pad.triggerRight;
|
spac << map
|
||||||
|
<< pad.button
|
||||||
|
<< pad.analogA
|
||||||
|
<< pad.analogB
|
||||||
|
<< pad.stickX
|
||||||
|
<< pad.stickY
|
||||||
|
<< pad.substickX
|
||||||
|
<< pad.substickY
|
||||||
|
<< pad.triggerLeft
|
||||||
|
<< pad.triggerRight;
|
||||||
|
|
||||||
SendToClients(spac, player.pid);
|
SendToClients(spac, player.pid);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user