Add documentation for some of the formats

This could not have been done without the amazing https://github.com/szymski/Rayman2Lib. (i have not verified if it works, it might be crap)
This commit is contained in:
Hannes Mann 2016-06-16 04:25:48 +02:00
parent 26c6e69844
commit 5de095de75
2 changed files with 90 additions and 1 deletions

View file

@ -72,3 +72,9 @@ You might also need `mingw32-make -j8` instead of `make -j8`.
Mac OS X is not supported at the moment (might work with CMake?).
## Special thanks to
https://github.com/szymski/Rayman2Lib

View file

@ -1,7 +1,90 @@
This file attempts to document the Rayman 2: The Great Escape file formats and engine as best possible.
Note: OpenRayman could not have been possible without the amazing szymski on GitHub (https://github.com/szymski/Rayman2Lib), who seems to have reverse engineered the encoding algorithm used in Rayman 2 and the file formats that are used within the engine. Most of this information was scrapped together from the Rayman2Lib repository.
## Progress
Currently no progress has been made in reverse engineering.
Some progress have been made in decoding and reading files.
Note: some of this information may not be incorrect, as i have not verified any of this information yet
## Formats
.cnt = archive
.gf (graphics file?) (TODO: rayman2lib has both gf3 and gf?) = textures
.sna = ? scripts / events / level / everything?!?! (TODO: figure out what rayman2lib is doing with seeking)
.dat = pointers to file?!? file database?!?!
.dsb = same?!? scripts?!?!
.gpt = ?!?!?!?
.bnm = probably sound files (based off of rayman2lib)
## Decoding
Some files used by the Rayman 2: The Great Escape engine are encoded via a simple encoding algorithm.
The general formula for decoding these files (as provided by Rayman2Lib) in psuedo code is
```
skip int32 (magic number)
magic = 1790299257
for each byte
byte ^= (magic >> 8) & 255
magic = 16807 * (magic ^ 0x75BD924) - 0x7FFFFFFF * ((magic ^ 0x75BD924u) / 0x1F31D)
```
## .cnt files
.cnt files are archive files, used for storing textures (more?).
The structure of a .cnt file in psuedo code is as follows:
```
uint32 directory_count
uint32 file_count
uint16 signature
uint8 xor_key
directories
uint32 name_length
char[] name
uint8 version_id
files
uint32 directory;
uint32 name_length;
char[] name
uint32 unknown (TODO)
uint32 pointer (in file)
uint32 size
```
## .gf files
.gf files are texture files (graphics file), in RGB24 or RGBA32 format.
The structure of a .gf file in psuedo code is as follows:
```
uint32 signature
uint32 width
uint32 height
uint8 channels
uint8 repeat_byte
for each pixel
uint8 color
if color equals repeat_byte
uint8 color
uint8 repeat_count
```