Archivo de la categoría ‘File format’
Death Rally: file formats explanation
Hi all, Due to my last post about the advances in the graphic engine and the lighting system, I have spent some time documenting all the types of files that intervene in the game.
For each of them I have explained in a quick way how to read them. In this way I can say that, except for the texture text of the circuits TRX_SCE.BPK, the rest of the files already understand the information they have, and I also know what and how they are used in the game.
I leave the link to the project wiki where I will be adding more information: https://github.com/enriquesomolinos/DreeRally/wiki
I hope this information will help you.
Death Rally config file
I think the file dr.cfg is the only file in this game that there is not crypted!
The structure is as follows:
Offset (byte) | Size (bytes) | Information |
---|---|---|
0 | 4 | Master volume |
4 | 4 | Music volume |
8 | 4 | ? |
12 | 4 | Difficulty |
16 | 4 | Use joystick |
20 | 4 | ? |
24 | 4 | ? |
28 | 4 | ? |
32 | 4 | ? |
36 | 4 | ? |
40 | 1 | ? |
41 | 4 | ? |
45 | 4 | ? |
49 | 4 | ? |
53 | 4 | ? |
57 | 4 | ? |
61 | 1 | ? |
62 | 4 | ? |
66 | 4 | ? |
70 | 4 | ? |
74 | 4 | ? |
78 | 2592 | Circuit record |
2670 | 200 | Hall of fame record |
2870 | 4 | Acceletate key |
2874 | 4 | Brake key |
2878 | 4 | Left steering key |
2882 | 4 | Right steering key |
2886 | 4 | Turbo key |
2890 | 4 | Gun key |
2894 | 4 | Mine key |
2898 | 4 | Horn key |
2902 | 4 | Acceletate gamepad key |
2906 | 4 | Brake gamepad key |
2910 | 4 | Left steering gamepad key |
2914 | 4 | Right steering gamepad key |
2918 | 4 | Turbo gamepad key |
2922 | 4 | Gun gamepad key |
2926 | 4 | Mine gamepad key |
2930 | 4 | Horn gamepad key |
2934 | 4 | Times played |
Death Rally Shareware/Full version savegame in detail
Hi to all,
As user Simo develops a savegame editor (great utility!) based on my investigations of the Death Rally executable I want to publish the format of the savegames in the full and shareware version.
Savegame files are crypted using the first byte of the file.
The file structure is:
Offset (byte) | Size (bytes) | Information |
---|---|---|
0 | 1 | Crypt key |
1 | 1 | Driver id |
2 | 1 | Use weapons (true-false) |
3 | 1 | Dificulty (1-3) |
4 | 15 | Savegame name |
19 | 108*20 | Drivers’s data |
Driver’s data is as follows:
Offset (byte) | Size (bytes) | Information |
---|---|---|
0 | 12 | Name |
12 | 4 | Damage |
16 | 4 | Engine upgrade (0-4) |
20 | 4 | Tyre upgrade (0-4) |
24 | 4 | Armour upgrade (0-4) |
28 | 4 | Car type(0-5) |
32 | 4 | ? |
36 | 4 | ? |
40 | 4 | ? |
44 | 4 | Colour |
48 | 4 | Money |
52 | 4 | Loan Type |
56 | 4 | Loan races left |
60 | 4 | Actual car value |
64 | 4 | Face id |
68 | 4 | Points |
72 | 4 | Rank |
76 | 4 | Races won |
80 | 4 | Total races |
84 | 4 | Last race income |
88 | 4 | Total income |
92 | 4 | Mines purchased (number of mines) |
96 | 4 | Spikes purchased |
100 | 4 | Rocket purchased |
104 | 4 | Sabotage purchased |
The main diference between shareware and full version it is that full version savegame is a 2179 bytes file while shareware savegame occupies 2195 bytes. The only difference are the extra bytes that the shareware version has.
To know how to decrypt the full version file see https://github.com/enriquesomolinos/DreeRally/blob/master/tools/savegameDecrypt.py
In order to crypt the full version file you can use: https://github.com/enriquesomolinos/DreeRally/blob/master/tools/savegameCrypt.py
To know how to decrypt the shareware file see Shareware savegame decryptor
In order to crypt the shareware file you can use: Sahreware savegame crypt
Bpa files
All this information is extractd from http://www.shikadi.net/moddingwiki/Death_Rally_BPA_Format thanks to Ceidwad.
Header
======
| Data type | Description|
| UINT32LE numFiles | Number of files in the archive|
| FILEREC[255] fileRecords | Encrypted FAT |
Each FILEREC is of the form
| Data type |Name | Description|
| char[13] | encryptedName | Encrypted filename, padded with non-encrypted 0x00 bytes|
| UINT32LE | size | Size of the file data |
The FILEREC table has a fixed size of 255 * 17 bytes, padded with null bytes, and cannot contain more than 255 FILERECs. Compressed file data begins immediately after the table, at offset 0x10F3. Because the header does not store offsets, these must be calculated by accumulating through the table.
The file content is not compressed or encrypted by the archive itself, however many of the files typically found in this archive are already encrypted as part of their respective file formats.
Filename encryption
================
To restore a filename, subtract 117 – 3 * index from each byte, where index is the 0-based index of the byte in the filename. This will yield a non-null-terminated string in uppercase. The encrypted filename is null-terminated (the terminating/padding null bytes are not encrypted).
Tools
=======
To extract Bpa files you can use the tool called bpaextractor.py in the project.
Pal files
Is most cases this is files are standard VGA palettes that contains 256 colours. Each color is represented in 3 bytes.
Death rally file formats uncovered
In the next few days I will explain how to undestand the most important files in Death Rally.
At this moment, before a decompilation phase I kwon how to extract the BPA files, how is the HAF format, how to transform the CMF files (music files) to a understandable format that you can play with VLC, and the most difficult one, the BKP (images) files that needs the use of the PAL files.
This information is very useful to the begining of the project, because the idea is to use the original files.