Difference between revisions of "Network Protocol/SELECT"

From Custom Mario Kart
Jump to navigation Jump to search
Line 18: Line 18:
 
  /*15*/  u8    vehicle_pl1;      // Vehicle of Player 1
 
  /*15*/  u8    vehicle_pl1;      // Vehicle of Player 1
 
  /*16*/  u8 user_track_pl1;  // 0x00-0x1f:course ID, 0x20-0x29:battle course ID, 0x43:none, 0xff:random
 
  /*16*/  u8 user_track_pl1;  // 0x00-0x1f:course ID, 0x20-0x29:battle course ID, 0x43:none, 0xff:random
  /*17*/  u8 unknown_17;       // 0..3
+
  /*17*/  u8 ranking_pl1;     // star ranking of player 1
  
 
  /*18*/  u16 rank_pl2;        // rank of previous race (Player 2. 0x00 if there is only one player)
 
  /*18*/  u16 rank_pl2;        // rank of previous race (Player 2. 0x00 if there is only one player)
Line 25: Line 25:
 
  /*1d*/  u8    vehicle_pl2;      // Vehicle of Player 2 (0x24 when only one player)
 
  /*1d*/  u8    vehicle_pl2;      // Vehicle of Player 2 (0x24 when only one player)
 
  /*1e*/  u8 user_track_pl2;  // 0x00-0x1f:course ID, 0x20-0x29:battle course ID, 0x43:none, 0xff:random (one player: 0x43; two players: same as user_track_pl1)
 
  /*1e*/  u8 user_track_pl2;  // 0x00-0x1f:course ID, 0x20-0x29:battle course ID, 0x43:none, 0xff:random (one player: 0x43; two players: same as user_track_pl1)
  /*1f*/  u8 unknown_1f;       // (nearly) always 0?
+
  /*1f*/  u8 ranking_pl2;     // star ranking of player 2
  
 
  /*20*/  u32 select_id;        // a unique id, changed for every race/battle to a random value.
 
  /*20*/  u32 select_id;        // a unique id, changed for every race/battle to a random value.
Line 56: Line 56:
 
  /*15*/  u8    vehicle_pl1;      // Vehicle of Player 1
 
  /*15*/  u8    vehicle_pl1;      // Vehicle of Player 1
 
  /*16*/  u8 rank_pl1;        // rank of previous race == start position of next race (Player 1)
 
  /*16*/  u8 rank_pl1;        // rank of previous race == start position of next race (Player 1)
  /*17*/  u8 unknown_17;       // 0..3
+
  /*17*/  u8 ranking_pl1;     // star ranking of player 1
  
 
  /*18*/  u16 user_track_pl2;  // 0x0043: not voted yet, 0x0000-0x7fff: VS/BT tracks, 0xffff: Random. 0x0043 if there is only one player
 
  /*18*/  u16 user_track_pl2;  // 0x0043: not voted yet, 0x0000-0x7fff: VS/BT tracks, 0xffff: Random. 0x0043 if there is only one player
Line 63: Line 63:
 
  /*1d*/  u8    vehicle_pl2;      // Vehicle of Player 2 (0x24 when only one player)
 
  /*1d*/  u8    vehicle_pl2;      // Vehicle of Player 2 (0x24 when only one player)
 
  /*1e*/  u8 rank_pl2;        // rank of previous race == start position of next race (Player 2). 0 if there is only one player
 
  /*1e*/  u8 rank_pl2;        // rank of previous race == start position of next race (Player 2). 0 if there is only one player
  /*1f*/  u8 unknown_1f;       // (nearly) always 0?
+
  /*1f*/  u8 ranking_pl2;     // star ranking of player 2
  
 
  /*20*/  u16 select_id;        // a unique id, changed for every race/battle to a random value.
 
  /*20*/  u16 select_id;        // a unique id, changed for every race/battle to a random value.

Revision as of 10:59, 11 July 2019

This page is related to MKWii Network Protocol and describes the record type SELECT in GNU C notation.

During phase 1 (SEL/PREPARE), the Wiis synchronize their clocks using "time_sender" and "time_receiver" so the race starts at the same time on all Wiis.

Original game

This is the SELECT packet used by the original game:

typedef struct udp_select_t
{
 /*00*/  u64	time_sender;      // NULL or time of sender (milliseconds since 2000-01-01, based on real time clock)
 /*08*/  u64	time_receiver;    // NULL or assumed time of the receiver, based on the last received time

 /*10*/  u16	rank_pl1;         // rank of previous race == start position of next race (Player 1)
 /*12*/  u16	sum_pts_pl1;      // accumulated event points (Player 1)
 /*14*/  u8     driver_pl1;       // Driver of Player 1
 /*15*/  u8     vehicle_pl1;      // Vehicle of Player 1
 /*16*/  u8	user_track_pl1;   // 0x00-0x1f:course ID, 0x20-0x29:battle course ID, 0x43:none, 0xff:random
 /*17*/  u8	ranking_pl1;      // star ranking of player 1

 /*18*/  u16	rank_pl2;         // rank of previous race (Player 2. 0x00 if there is only one player)
 /*1a*/  u16	sum_pts_pl2;      // accumulated event points (Player 2. 0x00 if there is only one player)
 /*1c*/  u8     driver_pl2;       // Driver of Player 2 (0x30 when only one player)
 /*1d*/  u8     vehicle_pl2;      // Vehicle of Player 2 (0x24 when only one player)
 /*1e*/  u8	user_track_pl2;   // 0x00-0x1f:course ID, 0x20-0x29:battle course ID, 0x43:none, 0xff:random (one player: 0x43; two players: same as user_track_pl1)
 /*1f*/  u8 	ranking_pl2;      // star ranking of player 2

 /*20*/  u32 	select_id;        // a unique id, changed for every race/battle to a random value.
 /*24*/  u8	battle_type;      // Value indicating if COIN or BOSS-Battle (in SEL1) (0x00: UNKNOWN or COIN, 0x80: BOSS)
 /*25*/  u24	team;             // 2 bits for each client slot. Bit is set for red team.

 /*28*/  u8	client_slot[12];  // relation race_slot(index) : client slot (0xff=none)
 /*34*/  u8	sel_track;        // game: selected track: 0xff:none
 /*35*/  u8	sel_phase;        // selection phase: 0:prepare, 1:wait, 2:lottery
 /*36*/  u8	sel_client;       // client index: who has selected the track (0xff: none)
 /*37*/  u8	sel_engine;       // 0:none, 1:100cc, 2:150cc 3:mirror (WW and 1st race of GP)
 /*38*/
}
__attribute__ ((packed)) udp_select_t;

LE-CODE

This is the modified SELECT packet used by the LE-CODE to allow for up to 0x7ffe = 32766 slots online:

typedef struct udp_select_t
{
 /*00*/  u64	time_sender;      // NULL or time of sender (milliseconds since 2000-01-01, based on real time clock)
 /*08*/  u64	time_receiver;    // NULL or assumed time of the receiver, based on the last received time

 /*10*/  u16	user_track_pl1;   // 0x0043: not voted yet, 0x0000-0x7fff: VS/BT tracks, 0xffff: Random
 /*12*/  u16	sum_pts_pl1;      // accumulated event points (Player 1)
 /*14*/  u8     driver_pl1;       // Driver of Player 1
 /*15*/  u8     vehicle_pl1;      // Vehicle of Player 1
 /*16*/  u8	rank_pl1;         // rank of previous race == start position of next race (Player 1)
 /*17*/  u8	ranking_pl1;      // star ranking of player 1

 /*18*/  u16	user_track_pl2;   // 0x0043: not voted yet, 0x0000-0x7fff: VS/BT tracks, 0xffff: Random. 0x0043 if there is only one player
 /*1a*/  u16	sum_pts_pl2;      // accumulated event points (Player 2. 0x00 if there is only one player)
 /*1c*/  u8     driver_pl2;       // Driver of Player 2 (0x30 when only one player)
 /*1d*/  u8     vehicle_pl2;      // Vehicle of Player 2 (0x24 when only one player)
 /*1e*/  u8	rank_pl2;         // rank of previous race == start position of next race (Player 2). 0 if there is only one player
 /*1f*/  u8 	ranking_pl2;      // star ranking of player 2

 /*20*/  u16 	select_id;        // a unique id, changed for every race/battle to a random value.
 /*22*/  u16 	ram_junk;         // random data from RAM that just happened to be laying around
 /*24*/  u8	battle_type;      // Value indicating if COIN or BOSS-Battle (in SEL1) (0x00: UNKNOWN or COIN, 0x80: BOSS)
 /*25*/  u24	team;             // 2 bits for each client slot. Bit is set for red team.

 /*28*/  u8	client_slot[12];  // relation race_slot(index) : client slot (0xff=none)
 /*34*/  u16	sel_track;        // game: selected track: 0xffff: none
 /*36*/  u8	sel_client;       // client index: who has selected the track (0xff: none)
 /*37*/  u8	sel_engine_phase; // highest four bits: selection phase: 0:prepare, 1:wait, 2:lottery
                                  // lowest four bits: 0:none, 1:100cc, 2:150cc 3:mirror (WW and 1st race of GP)
 /*38*/
}
__attribute__ ((packed)) udp_select_t;


Template:MKWii Network Protocol