Difference between revisions of "Network Protocol/RACEHEADER 2"

From Custom Mario Kart
Jump to navigation Jump to search
(Clean up and add more information)
Line 1: Line 1:
 
{{DISPLAYTITLE:{{BASEPAGENAME}}/RACEHEADER_2}}
 
{{DISPLAYTITLE:{{BASEPAGENAME}}/RACEHEADER_2}}
This article describes the record type '''RACEHEADER_2''' of the [[Network Protocol]]. It is not present during a live view.
+
This article describes the record type '''RACEHEADER_2''' of the [[Network Protocol]]. This record is not sent during live view, and its contents depend on the game mode.
  
Here is the record read function in GNU C notation. The function notation is used, because some values are bit packed. This code was created by a code generator.
+
== VS Race Structure ==
 +
{| class="wikitable"
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x00 || 13 bits || Players who have finished the race (1 bit per player + 1).
 +
|-
 +
| 0x01.5 || 13 bits || Players who are participating in the race (1 bit per player + 1).
 +
|-
 +
| 0x03.2 || 13 bits || Players who have disconnected (1 bit per player + 1).
 +
|-
 +
| 0x04.7 || 2 bits || Local player count.
 +
|-
 +
| 0x05.1 || 4 bits || Client slot for Player 1.
 +
|-
 +
| 0x05.5 || 22 bits || Finishing time for Player 1 (6 bits for minutes, 6 for seconds and 10 for milliseconds).
 +
|-
 +
| 0x08.3 || 13 bits || Players who are ahead of Player 1 (1 bit per player + 1).
 +
|-
 +
| 0x0A || 4 bits || Client slot for Player 2.
 +
|-
 +
| 0x0A.4 || 22 bits || Finishing time for Player 2 (6 bits for minutes, 6 for seconds and 10 for milliseconds).
 +
|-
 +
| 0x0D.2 || 13 bits || Players who are ahead of Player 2 (1 bit per player + 1).
 +
|-
 +
| 0x0F || 1 byte || {{Unknown-left|'''Unknown'''. Most likely padding.}}
 +
|-
 +
| 0x10 || 2 bytes || Client slot for each player (repeated).
 +
|-
 +
| 0x12 || 1 byte || {{Unknown-left|'''Unknown'''. Seems to be a unused bitfield for client slots.}}
 +
|-
 +
| 0x13 || 1 byte || Local player count (repeated).
 +
|-
 +
| 0x14 || 4 bytes || Time since the race leader finished (in frames).
 +
|-
 +
| 0x18 || 4 bytes || Minimum time before the race can time out (in frames). The value for each Nintendo track can be found at 0x808903A4 PAL.
 +
|-
 +
| 0x1C || 1 byte || Marks the player as disconnected if set to 1.
 +
|-
 +
| 0x1D || 1 byte || {{Unknown-left|'''Unknown'''. Most likely padding.}}
 +
|-
 +
| 0x1E || 4 bytes || Time (in frames) since each player last moved faster than 30km/h. Caps at 300 (5 seconds).
 +
|-
 +
| 0x22 || 4 bytes || Time (in frames) since the previous countdown value maxed out. Caps at 3600 (1 minute), after which the player is disconnected if in a public room.
 +
|-
 +
| 0x26 || 2 bytes || {{Unknown-left|'''Unknown'''. Most likely padding.}}
 +
|}
  
<pre>
+
== Balloon Battle Structure ==
    d->end_time[0] = be32(src+ 0x005 )  >> 5 & 0x003FFFFFu;
+
The packet structure for this game mode is unknown.
    d->end_time[1] = be32(src+ 0x00a )  >> 6 & 0x003FFFFFu;
 
    d->player_idx[0] =     src[ 0x010 ];
 
    d->player_idx[1] =     src[ 0x011 ];
 
    d->finish_timer = be16(src+ 0x016 );
 
    return 0x30; // last analyzed offset + 1
 
</pre>
 
  
And here the code of a self written code generator script. The script creates data structures and the read function above. The byte offset is hex, all others are decimal numbers.
+
== Coin Runners Structure ==
<pre>
+
The packet structure for this game mode is unknown.
!------------------------------------------------------------------------------------------
 
!                        byte+bit
 
! type name N offset bits comment
 
!------------------------------------------------------------------------------------------
 
  u32  *end_time 2  -  -  - the end time of each user, max is 63:59.999
 
  > *end_time[0] -  05  5 22
 
  > *end_time[1] -  0a  4 22
 
  u8    player_idx 2  10  0  8 race slot of both players
 
  u16  finish_timer -  16  0 16 time since leader finish, 59.94 Hz
 
!------------------------------------------------------------------------------------------
 
</pre>
 
  
 
{{Network Protocol}}
 
{{Network Protocol}}
 
[[Category:Network Protocol|R]]
 
[[Category:Network Protocol|R]]

Revision as of 16:19, 29 April 2023

This article describes the record type RACEHEADER_2 of the Network Protocol. This record is not sent during live view, and its contents depend on the game mode.

VS Race Structure

Offset Size Description
0x00 13 bits Players who have finished the race (1 bit per player + 1).
0x01.5 13 bits Players who are participating in the race (1 bit per player + 1).
0x03.2 13 bits Players who have disconnected (1 bit per player + 1).
0x04.7 2 bits Local player count.
0x05.1 4 bits Client slot for Player 1.
0x05.5 22 bits Finishing time for Player 1 (6 bits for minutes, 6 for seconds and 10 for milliseconds).
0x08.3 13 bits Players who are ahead of Player 1 (1 bit per player + 1).
0x0A 4 bits Client slot for Player 2.
0x0A.4 22 bits Finishing time for Player 2 (6 bits for minutes, 6 for seconds and 10 for milliseconds).
0x0D.2 13 bits Players who are ahead of Player 2 (1 bit per player + 1).
0x0F 1 byte Unknown. Most likely padding.
0x10 2 bytes Client slot for each player (repeated).
0x12 1 byte Unknown. Seems to be a unused bitfield for client slots.
0x13 1 byte Local player count (repeated).
0x14 4 bytes Time since the race leader finished (in frames).
0x18 4 bytes Minimum time before the race can time out (in frames). The value for each Nintendo track can be found at 0x808903A4 PAL.
0x1C 1 byte Marks the player as disconnected if set to 1.
0x1D 1 byte Unknown. Most likely padding.
0x1E 4 bytes Time (in frames) since each player last moved faster than 30km/h. Caps at 300 (5 seconds).
0x22 4 bytes Time (in frames) since the previous countdown value maxed out. Caps at 3600 (1 minute), after which the player is disconnected if in a public room.
0x26 2 bytes Unknown. Most likely padding.

Balloon Battle Structure

The packet structure for this game mode is unknown.

Coin Runners Structure

The packet structure for this game mode is unknown.