Network Protocol/USER

From Custom Mario Kart
Jump to navigation Jump to search

Overview

This article describes the record type USER of the Network Protocol.

Race Packet Sections
Name Amount Size Description
SLOT 0-1 0x08 Only used for redirected data via a proxy. The record identifies the original client by its slot number.
HEADER 1 0x10 A header for a race packet.
RACEHEADER_1 1 0x28 A record with basic race data.
RACEHEADER_2 0-1 0x28 A record with game-mode specific race data (not present in live view).
ROOM 0-1 0x04 A record containing a friend room message (not present outside friend room lobbies).
SELECT 0-1 0x38 A record containing data to set up a match (not present during races).
RACEDATA 1-2 0x40 A record containing race data for each player, such as positions or inputs.
USER 0-1 0xC0 A record containing user data such as Miis and friend codes.
ITEM 1-2 0x08 A record containing information about players' items.
EVENT 1 ≥ 0x18 A record transmitting item events.


typedef struct udp_user_t
{
  /*00*/   u32		record_id;	// bitfield for present miis (previously record ID)
  /*04*/   u16		max_mii_count;	// max amount of Miis in packet (always 0x0002)
  /*06*/   u16		unknown_06;	// always 0x0000 ?

  /*08*/   mii_t	mii[2];		// Mii data, 2*76 = 2*0x4c = 0x98 bytes
					// 0x0a,0x56: Mii name (10*u16)
					// 0x3e,0x8a: Creator name (10*u16)
					// ==> 76 instead of 74 bytes
					//     because of alignment

  /*a0*/   u64		wii_fc;         // Wii Friend code
  /*a8*/   u64		friend_code;	// FC, decimal view: 1234-5678-9012

  /*b0*/   u8		country;	// country flag code of user
  /*b1*/   u8           state;          // state / province code of user
  /*b2*/   u16		city;	        // always 0x0000 because MKWii doesn't transmit the city ID. only used in apps like the weather channel where the city matters
                   			// ==> country, state and city are "0xFF FF FFFF" 
					// ==> if the user disabled sharing his country information

  /*b4*/   u16		location_lon;	// longitude on world map (the actual degree value is approximately multiplied by 182.25)
  /*b6*/   u16		location_lat;	// latitude on world map  (the actual degree value is approximately multiplied by 182.25)

  /*b8*/   u16		racing_rankpts;	// online race ranking points
  /*ba*/   u16		battle_rankpts;	// online battle ranking points
  /*bc*/   u8		game_id3;	// 3. char of game_id, E|P
  /*bd*/   u8		region;		// Region. 0=NTSC-J, 1=NTSC-U, 2=PAL/EUR, 3=PAL/AUS, 4=Taiwan 5=South Korea
  /*be*/   u16		unknown_be;	// always 0
}
__attribute__ ((packed)) udp_user_t;

See WiiBrew.org for the country codes and this page for the state codes.