RalliSport Challenge

RalliSport Challenge Reference

1 Archives

1.1 File recognization

RalliSport Challenge has a pretty good archive recognization, and the files doesn't even have to be in an archive to be used in the game. The locale\yourlocale\ directory is a nice place to put files that will override all files in the game archives, except of tracks. Tracks need to be in an archive inside the archive\tracks\ directory with the filename that is decribed in the respective meme file (menu file). All other archives should be located inn archives\. Here is the standard game archives:

+-------------+---------------------------------------------------------------+
| Audio.rff   | Sound effects in PCM .wav, sorted by samplerates 11/22/44kHz. |
+-------------+---------------------------------------------------------------+
| Cars.rff    | Config and sound scripts for all cars.                        |
+-------------+---------------------------------------------------------------+
| Locale*.rff | Locale specific voices, text strings and splash screens       |
+-------------+---------------------------------------------------------------+
| Menu.rff    | Dice's Meme menu system files                                 |
+-------------+---------------------------------------------------------------+
| Misc.rff    | Everything else :) Meshes, textures, shaders, config, etc.    |
+-------------+---------------------------------------------------------------+

1.2 Directory structure

To add new stuff or override existing files used by the game you'll need to arrange your files in the correct directory structure, whether you use archives or not. There is no point in listing the entire directory tree here, you should extract the stock archives instead, and use them as template for your modding.

1.3 The .rff archive format

The archive format used is .rff, "Refractor2 FinkelArchive 1.0". They have a fairly simple structure, and is quite easy to understand. The only downside is that the archives are blowfish encrypted as well as compressed with zlib. However, Moseley (well-known from the Battlefield 1942 community) managed to crack the encryption key with his godlike reverse engineering skills.

A .rff file starts with a header that contains the magic string "Refractor2 FinkelArchive 1.0" followed by four NULL bytes. The next longs is offset to the file index table and the archive type. There are three types of FinkelArchives, type 0 (store), 1 (encrypted) and 2 (encrypted and compressed). But the game only take type 2, so we stick to that one. The next part is the actual data content of the archive, so we jump to the file table. The first long is number of files in the index table, then are the RFF_Subfile struct repeated until all the files are read in. The data is fetched by reffering to the offset and compressed file size and then decrypted with the 8 byte key thru a modified blowfish algorithm. Note that this size have to be multiple of 8 due to the nature of blowfish. At last the decrypted data is uncompressed using zlib. Here is a piece of C-style pseudo code that might help you. Feel free to grab the source code of our RFFTool at the download section for an in-depth study of the format.

unsigned char KEY [8] = {0x72, 0x03, 0x17, 0xF4, 0x12, 0x43, 0x92, 0x88};

RFF {
	char[28] MagicString = "Refractor2 FinkelArchive 1.0";
	unsigned long Zeroooo;
	unsigned long FileTableOffset;
	unsigned long ArchiveType;
	// Jump to FileTableOffset
	RFF_FileTable;
	// Read in data based on RFF_Subfile.Size and RFF_Subfile.DataOffset
	// Process data according to ArchiveType
}

RFF_FileTable {
	unsignedLong nFiles;
	RFF_Subfile[nFiles] Files;
}

RFF_Subfile {
	unsigned long FileNameLength;
	char[FileNameLength] FileName;
	unsigned long Size;
	unsigned long UncompressedSize;
	unsigned long DataOffset;
	unsigned long Type;
}

1.4 Tools

Use our RFFTool to extract existing and pack your own .rff files. Get binaries and source code from our download section. You can download it as .zip, .rar and even .rff! :) Be sure to check out the enclosed readme file for usage, details and tips.