Difference between revisions of "Network Protocol/ROOM"

From Custom Mario Kart
Jump to navigation Jump to search
(Rewrite page)
 
Line 2: Line 2:
 
This article describes the record type '''ROOM''' of the [[Network Protocol]]. It is only used in private rooms.
 
This article describes the record type '''ROOM''' of the [[Network Protocol]]. It is only used in private rooms.
  
<pre>
+
{{Network Protocol RACE}}
typedef struct udp_room_t
 
{
 
  /*00*/  u8 mode; // record mode: 0|1|2|3|4
 
  /*01*/  u16 param1; // parameter 1
 
  /*03*/  u8 param2; // parameter 2
 
  /*04*/
 
  
// mode == 0x01 : Start an event, send by host
+
{| class="wikitable"
// param1: Event type 0..3: GP, TEAM, BATTLE, COIN
+
! Offset
// param2: *
+
! Size
 +
! Description
 +
|-
 +
| 0x00 || 1 byte || '''Message Type''':
 +
* 1: Event start
 +
* 2: Player registered another as a friend
 +
* 3: Player joined the room
 +
* 4: Chat message
 +
|-
 +
| 0x01 || 2 bytes || First parameter (different usage depending on message type).
 +
|-
 +
| 0x03 || 1 byte || Second parameter (different usage depending on message type).
 +
|}
  
// mode == 0x02 : Register someone as friend
+
=== Parameter Usage ===
 
+
* For message type 1, the first parameter is the event type:
// mode == 0x03 : Sending "Here I am" message after joining
+
** 0: Grand Prix
 
+
** 1: Team Grand Prix
// mode == 0x04 : Send a room message
+
** 2: Balloon Battle
// param1: message ID
+
** 3: Coin Runners
// param2: sequence counter (client related)
+
* For message type 4, the first parameter is the message index (value 0 to 59) and the second parameter is a sequence counter, used to display chat messages in the correct order.
}
+
* For other message types, the parameters must be zero for the message to be accepted.
__attribute__ ((packed)) udp_room_t;
 
</pre>
 
  
 
{{Network Protocol}}
 
{{Network Protocol}}
 
[[Category:Network Protocol|R]]
 
[[Category:Network Protocol|R]]

Latest revision as of 16:23, 1 March 2024

Overview

This article describes the record type ROOM of the Network Protocol. It is only used in private rooms.

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.


Offset Size Description
0x00 1 byte Message Type:
  • 1: Event start
  • 2: Player registered another as a friend
  • 3: Player joined the room
  • 4: Chat message
0x01 2 bytes First parameter (different usage depending on message type).
0x03 1 byte Second parameter (different usage depending on message type).

Parameter Usage

  • For message type 1, the first parameter is the event type:
    • 0: Grand Prix
    • 1: Team Grand Prix
    • 2: Balloon Battle
    • 3: Coin Runners
  • For message type 4, the first parameter is the message index (value 0 to 59) and the second parameter is a sequence counter, used to display chat messages in the correct order.
  • For other message types, the parameters must be zero for the message to be accepted.