-
Notifications
You must be signed in to change notification settings - Fork 4
Protocol
UDPWiiHook uses a extended version of Dolphin's UDPWii protocol, which is backward compatible with the original. Here documents both protocols, for a easier future reference.
Consult cemuhook-protocol for DSU/Cemuhook-side protocols.
- The most relible UDPWii doc I could find is a random post on Dolphin Forums, which unfortunately also contains errors when compared with actual Dolphin source code. Helpful still, kudos to da_petcu21.
- Data types use a C#-like naming convention:
Byte
s are unsigned,IntNN
/UIntNN
means signed/unsignedNN
-bit integer,[Flags]
marks a bitfield. - Any multi-byte integer in a UDPWii packet is in network byte order, which is different from most common platforms.
-
Float
s are actually 32-bit signed integers (Int32
s) - they are scaled by a factor of1024 * 1024
and kept only the integral part. - UDPWiiHook extensions are highlighted with a italic font.
After each given interval (33ms in case of UDPMote), a Data packet is sent from UDPWii apps to Dolphin.
Exists in every Data packet.
Offset | Length | Type | Description |
---|---|---|---|
0 | 1 | Byte | Signature; should be 0xde |
1 | 1 | [Flags] Byte | Header flags; mark which data chunks exist in this packet |
2 | ? | ? | Data chunks |
NOTE: Data chunks are ordered by their bit offset, with no padding bytes in place of a missing chunk.
Bit No. | Value | Description |
---|---|---|
0 | 1 | Acceleration |
1 | 2 | Buttons |
2 | 4 | IR |
3 | 8 | Nunchuk |
4 | 16 | Nunchuk Acceleration |
5 | 32 | Acceleration Timestamp |
6 | 64 | Gyroscope |
Accelerometer readings are in Gs.
Offset | Length | Type | Description |
---|---|---|---|
0 | 4 | Float | Accelerometer X axis |
4 | 4 | Float | Accelerometer Y axis |
8 | 4 | Float | Accelerometer Z axis |
12 | - | - | Data chunk ends |
The whole Buttons data chunk is a unsigned 32-bit bitfield ([Flags] UInt32
, 4 bytes). Definitions for each bit are as follows.
Bit No. | Value | Description |
---|---|---|
0 | 1 | Key 1 |
1 | 2 | Key 2 |
2 | 4 | Key A |
3 | 8 | Key B |
4 | 16 | Key + |
5 | 32 | Key - |
6 | 64 | Key Home |
7 | 128 | Key Up |
8 | 256 | Key Down |
9 | 512 | Key Left |
10 | 1024 | Key Right |
11 | 2048 | Key "SK" (Sync button?) |
IR coordinates in a UDPWii packet has its origin at the bottom-left corner of the screen, with (1.0, 1.0)
at the top-right corner.
These coordinates are absloute; meaning that they just tell the current position Wiimote is pointing at, no fancy delta calculations.
Offset | Length | Type | Description |
---|---|---|---|
0 | 4 | Float | IR X position |
4 | 4 | Float | IR Y position |
8 | - | - | Data chunk ends |
Unused in most UDPWii apps and UDPWiiHook.
Offset | Length | Type | Description |
---|---|---|---|
0 | 1 | [Flags] Byte | Nunchuk buttons |
1 | 4 | Float | Analog stick X position |
5 | 4 | Float | Analog stick Y position |
9 | - | - | Data chunk ends |
Bit No. | Value | Description |
---|---|---|
0 | 1 | Key C |
1 | 2 | Key Z |
Unused in most UDPWii apps and UDPWiiHook.
Accelerometer readings are in Gs.
Offset | Length | Type | Description |
---|---|---|---|
0 | 4 | Float | Accelerometer X axis |
4 | 4 | Float | Accelerometer Y axis |
8 | 4 | Float | Accelerometer Z axis |
12 | - | - | Data chunk ends |
The whole Acceleration Timestamp data chunk is a unsigned 64-bit integer (UInt64
, 8 bytes), in nanoseconds.
Gyroscope readings are in radians per second.
Offset | Length | Type | Description |
---|---|---|---|
0 | 4 | Float | Gyroscope pitch |
4 | 4 | Float | Gyroscope yaw |
8 | 4 | Float | Gyroscope roll |
12 | - | - | Data chunk ends |
A Broadcast packet is sent periodically for each free Wiimote slot by Dolphin to 255.255.255.255 to announce it's presence.
Offset | Length | Type | Description |
---|---|---|---|
0 | 1 | Byte | Signature; should be 0xdf |
1 | 2 | UInt16 | Random numbers; should be unique per-Wiimote |
3 | 1 | Byte | Slot number (0-3) |
4 | 2 | UInt16 | UDP port number for clients to send Data packets to |
6 | 1 | Byte | Length of the display name |
7 | ? | Byte[] | The display name; length given above |