Difference between revisions of ".rpl"
(→Some Explanations) |
|||
Line 214: | Line 214: | ||
Notice that there's no tailing \0 to mark the end of the string. | Notice that there's no tailing \0 to mark the end of the string. | ||
And yes, this means strings can't be longer than 255 characters. | And yes, this means strings can't be longer than 255 characters. | ||
+ | To confirm : according to the code, the size is not limited to 256 chars, but 256^4 | ||
BUFFERs are like STRINGs without the first byte "how long the string is". | BUFFERs are like STRINGs without the first byte "how long the string is". |
Revision as of 12:16, 18 February 2008
It's a binary file, and below is a description of it's format.
Contents
Format
Header
n Bytes | Type | Name | Default Value | Comment |
---|---|---|---|---|
1 | Byte | Version | 0x01 | Version of the replay |
4 | Little-endian integer | N/A | 0x12345678 | Little/big endian safety check |
? | STRING | LevelID | Level ID | |
? | STRING | PlayerName | Player name | |
4 | Little-endian float | FrameRate | 25 | Replay frame rate |
4 | Little-endian integer | StateSize | State size | |
1 | Boolean | Finished | 0x00 or 0x01 | Level finished ? (0x01 = true) |
4 | Little-endian float | FinishTime | Finish time (in seconds) |
Events
.rpl version 1 includes event data :
n Bytes | Type | Name | Default Value | Comment |
---|---|---|---|---|
4 | Little-endian integer | InputEventsDataSize | Uncompressed events' size | |
1 | Boolean | N/A | 0x00 or 0x01 | Are events' data compressed ? (0x01 = true) |
If events' data are compressed :
n Bytes | Type | Name | Default Value | Comment |
---|---|---|---|---|
4 | Little-endian integer | CompressedEventsSize | Compressed events' size | |
CompressedEventsSize | BUFFER | CompressedEvents | Compressed events |
else if events' data aren't compressed :
n Bytes | Type | Name | Default Value | Comment |
---|---|---|---|---|
InputEventsDataSize | BUFFER | InputEventsData | Not compressed events |
Chunks
n Bytes | Type | Name | Default Value | Comment |
---|---|---|---|---|
4 | Little-endian integer | NumChunks | Number of chunks |
For each chunk :
n Bytes | Type | Name | Default Value | Comment |
---|---|---|---|---|
4 | Little-endian integer | NumStates | Number of states in the chunk | |
1 | Boolean | N/A | 0x00 or 0x01 | Are states' data compressed ? (0x01 = true) |
If states' data are compressed :
n Bytes | Type | Name | Default Value | Comment |
---|---|---|---|---|
4 | Little-endian integer | CompressedSize | Compressed states' size | |
CompressedSize | BUFFER | Compressed | Compressed states |
else if states' data aren't compressed :
n Bytes | Type | Name | Default Value | Comment |
---|---|---|---|---|
NumStates * StateSize | BUFFER | ChunkData | Not compressed states |
Some Explanations
STRINGs are stored in a Pascal-like way, where the first byte tells how long the string is, followed by the actual string. Notice that there's no tailing \0 to mark the end of the string. And yes, this means strings can't be longer than 255 characters.
To confirm : according to the code, the size is not limited to 256 chars, but 256^4
BUFFERs are like STRINGs without the first byte "how long the string is". Notice that there's maybe no tailing \0 to mark the end of the buffer !
Compressed data are in GZip format.
States
TODO
Chunks
TODO
"States" follow "Serialized bike state". (in MotoGame.h line ~200)