The online racing simulator
MPR file header format for LFS S2 : 0.5X9
=========================================


TYPES :
=======

char : 1-byte ascii character
byte : 1-byte integer
word : 2-byte integer
int  : 4-byte integer, lowest byte first


FILE DESCRIPTION :
==================

num   unit    offset  description
---   ----    ------  -----------

6     char    0       LFSMPR              : do not read file if no match
1     byte    6       game version        : ignore
1     byte    7       game revision       : ignore
1     byte    8       MPR version         : ignore
1     byte    9       immediate start     : joined already running game
1     byte    10      reserved            : -
1     byte    11      reserved            : -
1     int     12      rules               : -
1     int     16      flags               : -
1     byte    20      laps byte           : laps / hours (see notes)
1     byte    21      skill               : skill level (0,1,2,3,4)
1     byte    22      wind                : 0=off 1=weak 2=strong
1     byte    23      num players         : players at start of race
8     char    24      LFS version         : text, ends 0
4     char    32      short track name    : e.g. BL2R
1     int     36      start time (UTC)    : seconds from 00:00 1/1/1970
32    char    40      track name          : text, ends 0
1     byte    72      config              : 1,2,3.. (first config is 1)
1     byte    73      reversed            : 0=no 1=yes
1     byte    74      weather             : 0,1,2.. (first weather is 0)
1     byte    75      num finished (NF)   : players in results table
1     int     76      0                   : -
NF    result  80      RESULT INFO         : (see below)

RESULT INFO : size 80 bytes per finished player

24    char    0       player name         : text, ends 0, no colours
8     char    24      number plate        : text, NOTE : NO ZERO AT END
4     char    32      short car name      : text, ends 0
24    byte    36      lfs user name       : text, ends 0
1     word    60      laps done           : total laps completed
1     word    62      player flags        : driver settings (see NOTES)
1     byte    64      confirm flags       : penalties (see NOTES)
1     byte    65      number of stops     : pit stops count
1     word    66      penalty seconds     : penalty time added
1     int     68      overall time        : milliseconds
1     int     72      best lap time       : milliseconds
1     byte    76      0                   : -
1     byte    77      start position      : 0 = unknown, 1 = pole, etc.
1     byte    78      handicap mass       : kg
1     byte    79      intake restriction  : %

The rest of the file is the actual MPR data


NOTES :
=======

Laps Byte (lb) has various meanings :
---------
0            : practice
1-99         : number of laps...   laps  = lb
100-190      : 100 to 1000 laps... laps  = (lb - 100) * 10 + 100
191-238      : 1 to 48 hours...    hours = lb - 190

Player Flags
------------
LEFT HAND DRIVE     1
GEAR CHANGE CUT     2
GEAR CHANGE BLIP    4
AUTO SHIFT          8
SHIFTER             16
RESERVED            32
BRAKING HELP        64
AXIS CLUTCH         128
RESERVED            256
AUTO CLUTCH         512
MOUSE               1024
KB NO HELP          2048
KB STABILISED       4096

Confirmation Flags
------------------
MENTIONED           1
CONFIRMED           2
PENALTY_DT          4   <-- disqualified
PENALTY_SG          8   <-- disqualified
PENALTY_30          16
CONF_PENALTY_45     32
CONF_DID_NOT_PIT    64  <-- disqualified
FGED GREDG RDFGDR GSFDG