MKWii Network Protocol/EVENT

From Custom Mario Kart
Jump to: navigation, search

This pages is related to MKWii Network Protocol and describes the record type EVENT.

Record structure of a complete racing packet
Size Count Type Description
0x08 0–1 SLOT Only used for redirected data via a proxy. The record identifies the original client by its slot number.
0x10 1 HEADER A header for a race packet.
0x28 1 RACEHEADER_1 Basic race data, 1 record per client.
0x28 0-1 RACEHEADER_2 Basic race data, 1 record per client. Not present in live view.
0x40 1–2 RACEDATA Race data (with positions) for each player of a client.
0xc0 0–1 USER A USER record containing mii data and friendcode(s).
0x08 1–2 ITEM Item in the box for each player of a client incl. handshaking to limit some items.
>= 0x18 1 EVENT A list with 24 byte entries. If a value is not 0x10, it declares an EVENTDATA field is following. After that list, up to 24 EVENTDATA records follow.

The record EVENT transmits events. Events are:

  • Activating an item.
  • Lose an item.
  • Pick up an item.

A new event is placed in the first free slot of EVENT. The data of all events are stored after the slot list. This announcement is active for 200/60 seconds and the data is not modified during this time. This means that each Wii calculates the item routes and the interaction by its own.

Event Types

There are 256 (0x100) possible event codes and many of them are used. After a first analysis, it seems that the lower 4 bits defines the item type (other than these item codes) and the 4 upper bits the action code. The value 0x10 declares an unused slot.

Item codes for record EVENTHEAD
Code Data
Size
Data
Type
Description
0x10 The neutral value for unused slots.
0x23 0x03 USED Mushroom used
0x24 0x03 USED Star activated
0x26 0x03 USED Lightning activated
0x28 0x03 USED Mega Mushroom activated
0x2a 0x03 USED Blooper activated
0x2b 0x03 USED  ? POW Block activated
0x2c 0x03 USED Golden Mushroom finished or lost
0x2e 0x03 USED Thundercloud found and activated
0x40 0x14 SHOT Green Shell shot
0x41 0x15 SHOT Red Shell shot forward
0x42 0x14 SHOT  ? Banana thrown forward
0x45 0x15 SHOT Spiny Shell shot
0x47 0x14 SHOT  ? Fake Item Box thrown
0x49 0x15 SHOT Bob-omb thrown
0x60 0x14  ?  ?
0x61 0x14  ?  ?
0x62 0x14  ?  ? Item at tail lost
0x63 0x14  ?  ?
0x64 0x14  ?  ?
0x65 0x14  ?  ?
0x66 0x14  ?  ? Mushroom lost
0x67 0x14  ? Fake Item Box hit
0x68 0x14  ?  ?
0x69 0x14  ? Bob-omb touched (tail of rival)
0x6a 0x14  ?  ?
0x6b 0x14  ?  ?
0x6c 0x14  ?  ?
0x6d 0x14  ?  ?
0x80 0x05 MISC looping, wheely, hop, ...
0x81 0x05 MISC Red Shell disintegrated (not only hit)
0x82 0x05 MISC Banana touched
0x83 0x05 MISC Mushroom picked up and activated
0x84 0x05 MISC Star picked up and activated
0x85 0x05 MISC  ?
0x87 0x05 MISC  ?
0x89 0x05 MISC  ? Bob-omb exploded
0x8e 0x05 MISC Thundercloud lost (Respawn)
0xa1 0x05 MISC  ? miscellaneous
0xae 0x05 MISC Thundercloud caught
0xc1 0x04  ?  ?
0xe0 0x14 DROP  ?
0xe1 0x14 DROP Red Shell dropped
0xe2 0x14 DROP Banana dropped
0xe3 0x14 DROP Mushroom dropped
0xe4 0x14 DROP Star dropped
0xe5 0x14 DROP  ?
0xe6 0x14 DROP  ?
0xe7 0x14 DROP  ?
0xe8 0x14 DROP  ?
0xe9 0x14 DROP  ?
0xea 0x14 DROP  ?
0xeb 0x14 DROP  ?
0xec 0x14 DROP  ?
0xed 0x14 DROP  ?


To find the DATA for a specific slot, the slots must be iterated to skip the previous data.

Event Data Structure

The data structure depends on the data types defined by the slot list of EVENT. A data size for a single event differs from 3 to 21 bytes. The data is not aligned. It seems, that each event data starts with a 2 byte time stamp, a copy of the timer of record RACE at offset 0x02.

Type USED

An event of type "USED" is sent when you use an item, i. e. a Mushroom, a Blooper or a Lightning. It's sent when using an item which won't land on the road.

Type SHOT

An event of type "SHOT" is sent when you throw a Green Shell, Red Shell or Spiny Shell, or throw (not drop) a Banana, a Bob-omb or a Fake Item Box.

Type DROP

An event of type "DROP" is sent when you drop/put an item. Either by putting it on the road or by getting hit by a Lightning/POW Block.

Type MISC

Type misc is used for different things. All records have 5 byte, the first two being the time stamp, the last three being a sub-ID indicating the actual event.