A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
System::RawGhostFile Class Reference

#include <GhostFile.hh>

Description

The binary data of a ghost saved to a file.

Offset Size Description
0x00 4 bytes RKGD in ASCII.
0x04 7 bits Minutes field of finishing time
0x04.7 7 bits Seconds field of finishing time
0x05.6 10 bits Milliseconds field of finishing time
0x07 6 bits Track ID
0x07.6 2 bits Unknown. Probably padding.
0x08 6 bits Vehicle ID
0x08.6 6 bits Character ID
0x09.4 7 bits Year relative to 2000
0x0A.3 4 bits Month
0x0A.7 5 bits Day
0x0B.4 4 bits Controller ID
0x0C 4 bits Unknown. Always 0?
0x0C.4 1 bit Compressed flag (1 for compressed, 0 for raw)
0x0C.5 2 bits Unknown. Always 0?
0x0C.7 7 bits Ghost type
0x0D.6 1 bit Drift type (1 for auto, 0 for manual)
0x0E 2 bytes Input data length (measured after decompression)
0x10 1 byte Lap count
0x11 5 x 3 bytes Lap split times. Stored in the same 7-7-10 format as the finish time.
0x20 0x14 bytes Unknown
0x34 1 byte Country code or 0xFF if sharing location disabled.
0x35 1 byte Status code or 0xFF if sharing location disabled.
0x36 2 bytes Location code or 0xFFFF if sharing location disabled.
0x38 4 bytes Unknown
0x3C 0x4A bytes Mii data
0x86 2 bytes CRC-16-CCITT-XModem of Mii data

Source: https://wiki.tockdom.com/wiki/RKG_(File_Format)

Definition at line 45 of file GhostFile.hh.

Public Member Functions

 RawGhostFile (const u8 *rkg)
 
RawGhostFileoperator= (const u8 *rkg)
 
void init (const u8 *rkg)
 
bool decompress (const u8 *rkg)
 
bool isValid (const u8 *rkg) const
 
const u8 * buffer () const
 
template<typename T >
parseAt (size_t offset) const
 

Private Member Functions

bool compressed (const u8 *rkg) const
 

Private Attributes

u8 m_buffer [0x2800]
 

Constructor & Destructor Documentation

◆ RawGhostFile() [1/2]

System::RawGhostFile::RawGhostFile ( )

Definition at line 64 of file GhostFile.cc.

◆ RawGhostFile() [2/2]

System::RawGhostFile::RawGhostFile ( const u8 * rkg)

Definition at line 68 of file GhostFile.cc.

Member Function Documentation

◆ buffer()

const u8 * System::RawGhostFile::buffer ( ) const
inlinenodiscard

Definition at line 57 of file GhostFile.hh.

◆ compressed()

bool System::RawGhostFile::compressed ( const u8 * rkg) const
inlinenodiscardprivate

Definition at line 67 of file GhostFile.hh.

◆ decompress()

bool System::RawGhostFile::decompress ( const u8 * rkg)
nodiscard0x8051D1B4

Definition at line 95 of file GhostFile.cc.

◆ init()

void System::RawGhostFile::init ( const u8 * rkg)

Definition at line 80 of file GhostFile.cc.

◆ isValid()

bool System::RawGhostFile::isValid ( const u8 * rkg) const
nodiscard0x8051C120
Todo

Check for valid controller type?

Check lap times sum to race time?

Definition at line 120 of file GhostFile.cc.

◆ operator=()

RawGhostFile & System::RawGhostFile::operator= ( const u8 * rkg)

Definition at line 74 of file GhostFile.cc.

◆ parseAt()

template<typename T >
T System::RawGhostFile::parseAt ( size_t offset) const
inlinenodiscard

Definition at line 62 of file GhostFile.hh.

Member Data Documentation

◆ m_buffer

u8 System::RawGhostFile::m_buffer[0x2800]
private

Definition at line 71 of file GhostFile.hh.