Network Protocol/RACEHEADER_2

From Custom Mario Kart
< Network Protocol
Revision as of 14:16, 22 September 2019 by Wiimm (talk | contribs)
Jump to navigation Jump to search

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

RACEHEADRER_2 is not present during being in a live view (but RACEHEADER_1 is).

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.

    d->end_time[0]	= be32(src+ 0x005 )   >> 5 & 0x003FFFFFu;
    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

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.

 !------------------------------------------------------------------------------------------
 !                        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
 !------------------------------------------------------------------------------------------


Template:MKWii Network Protocol