.RPY File Format
last updated: 3/Jan/2002

File Header
RPLY (0x52504C59)
0x00000002
file size

Replay Header
RPHD (0x52504844)
0x00000000
header size (0x4C)
--
track name (8 bytes)
float
0x0000ffff
number of frames
int
int
int
local player first name (12 bytes, 4 0x00 padding)
local player last name (12 bytes, 4 0x00 padding)
0
1
1

Weekend Info
WKNF (0x574B4E46)
0x00000000
section size (0xB5)
track name (16 bytes)
car selection (16 bytes)
bits (0x20 padded)

Driver List
DRLS (0x44524C53)
0x00000000
section size (num drivers * 152)
--
DRNT's

Driver Entry
DRNT (0x44524E54)
0x00000000
section size (0x8B, 139  (1 0x20 padding at end))
first name (12 + 4 0x00 padding)
last name (12 + 4 0x00 padding)
int: 0/
int: nationality
string: home town + 0x00 padding up to 32 bytes
string: team "AI" / "NOT APPLICABLE" + 0x00 padding up to 32 bytes
int: 1/3/4/
int: 4/3/0/
int: 3/3/3/
int: 0xFF7B1717/0xFFEBD700/0xFFD7DFE7  (helmet colour?)
int: 3/3/3/
int: 0/2/3/
int: car number
int: 0x96/0xFA/
byte 0/1/
byte 0/1/
byte 0/1/
byte 0x20 (padding)

Lap Table
LPTB (0x4C505442)
0x00000000
section size (can be zero)
--
LPRO's

Lap Records
LPRO (0x4C50524F)
0x00000000
section size
--
driver number (?)
--laps--
3 bytes - lap time (integer, /1000 to get time in seconds)
1 byte - flags (0x40 = off track; 0x10 = invalid; 0x80 = unknown; )

Replay Tape (?)
RPTP (0x52505450)
0x00000000
section size

--Frames--
2bytes frame sizeA (including these 2 bytes)
2bytes frame sizeB (size of prev/next frame?)
4bytes frame ID (int)

--Sections (in frames)--
2bytes section type
2bytes section length

section types
0x01:  players car section
--structure--
3bytes: long coordinate
1byte: gear etc.
4bytes: lat coordinate / altitude
2bytes: rpm
1byte: orientation
1byte: pitch
4bytes: steering & engine noise & roll
4bytes: unk2
4bytes: unk3
4bytes: unk4
----------------
bottom 2 bits of gearetc. is part of longcoordinate
gear is bits 111100 of gearetc. -1
altitude is latcoordalt 0xfff00000
orientation&rpm bundled together
rpm is bottom 10bits of rpm
 
 
 

0x02:  unknown section
0x03:  ai-cars (10 bytes per ai?)
0x04:  not interesting here
0x05:
0x06:  not interesting here
0x07:
0x08:  not interesting here
0x09:  flaggers?
0x0a:  not interesting here
0x0b:  not interesting here
0x0c:  not interesting here
0x0d:  time section
0x0e:  frame info section
0x0f:  not interesting here
 
 
 
Nationality ID
Country
0
Argentina
1
Australia
2
Austria
3
Belgium
4
Brazil
5
Canada
6
Chile
7
Colombia
8
Denmark
9
Finland
10
France
11
Germany
12
Great Britain
13
Ireland
14
Italy
15
Japan
16
Mexico
17
Monaco
18
Morocco
19
Netherlands
20
New Zealand
21
Portugal
22
South Africa
23
Spain
24
Sweden
25
Switzerland
26
United States
27
Uruguay
28
Venezuala