Difference between revisions of "Cine/Specifications"
(Added beginnings of Delphine's compression format documentation.) |
(Revised compression format part's introduction a bit.) |
||
Line 113: | Line 113: | ||
The compression algorithm used by all Delphine's adventure games uses | The compression algorithm used by all Delphine's adventure games uses | ||
sliding window compression ( | sliding window compression (Quite like [http://en.wikipedia.org/wiki/LZ77 LZ77]) | ||
combined with a fixed [http://en.wikipedia.org/wiki/Entropy_coding entropy coding] scheme (Not of any type I could recognize). | |||
The compressed data is in big endian 32-bit chunks, working backwards from the buffer's end. | The compressed data is in big endian 32-bit chunks, working backwards from the buffer's end. |
Revision as of 15:09, 13 June 2008
Cine Specifications (version ε)
This is a place intended for information about the Cinématique engine's internals, file formats etc. Adding any additional information here is encouraged. Information probably is inaccurate in places so if you have more accurate information, please add it here.
File formats
Part file format
NOTE: This applies to both Future Wars and Operation Stealth.
Part file's start: Byte Meaning ----- ----------------------------------------------------------- 0-1 Number of elements in this part file (Uint16BE) 2-3 Entry size (Uint16BE). Normally 0x1E i.e. 30 ----- -----------------------------------------------------------
Then comes info for each element (Entry size in length each):
Byte Meaning ------ ----------------------------------------------------------- 0-13 Name (ASCIIZ string) 14-17 Data's starting offset in this part file (Uint32BE) 18-21 Packed size (Uint32BE) 22-25 Unpacked size (Uint32BE) 26-29 ??? ------ -----------------------------------------------------------
After that it's the data for all the elements contained in this part file.
VOL.CNF
NOTE: This file is specific to Operation Stealth.
This file contains list of resource files (e.g. PROCS10, RSC04, SONS2, LABYBASE etc) and a list of files contained in each resource file (e.g. AUTO00.PRC and MASKG.REL in PROCS00).
If the file starts with "ABASECP" the file is compressed, otherwise it's uncompressed.
Compressed file's start: Byte Meaning ----- ----------------------------------------------------------- 0-7 Magic header ("ABASECP" string with the trailing zero) 8-11 Unpacked size of the data after this header (Uint32BE) 12-15 Packed size of the data after this header (Uint32BE) ----- -----------------------------------------------------------
For a compressed file just read the rest of the file after the header and uncompress it with Delphine's unpacking routine and you've got the same data as you'd have had if you'd have had an unpacked file to start with (Except the header, of course).
Uncompressed file's start: Byte Meaning ----- ----------------------------------------------------------- 0-1 Resource files count (Uint16BE) 2-3 Entry size (Uint16BE). 0x14 in all tested files so far ----- -----------------------------------------------------------
Then come resource files count times resource file info structs of entry size bytes length each:
Resource file info struct: x = entry size - 1 Byte Meaning ----- ----------------------------------------------------------- 0-7 Resource file name string (Possibly no trailing zero!) 8-x Unknown data ----- -----------------------------------------------------------
Then for each resource file comes a list of files that are in it.
Each list begins with an unsigned 32-bit big endian integer telling the size of the entry. After that come (size / 11) or (size / 13) filenames of length 11 or 13 respectively. Almost as a rule compressed files use filename length of 11 and uncompressed files use filename length of 13 but it's not always so (At least some Amiga version used a compressed 'vol.cnf' file but still used filenames of length 13).
Filenames of length 11 have no separation of the extension and the basename so that's why we have to convert them first. There's no trailing zero in them either and they're always of the full length 11 with padding spaces. Extension can be always found at offset 8 onwards. Filenames of length 13 are okay as they are, no need for converting them.
Examples of filename mappings: "AEROPORTMSG" -> "AEROPORT.MSG" "MITRAILLHP " -> "MITRAILL.HP" (Notice the trailing space after the extension) "BOND10 " -> "BOND10" "GIRL SET" -> "GIRL.SET"
Compression format
The compression algorithm used by all Delphine's adventure games uses sliding window compression (Quite like LZ77) combined with a fixed entropy coding scheme (Not of any type I could recognize).
The compressed data is in big endian 32-bit chunks, working backwards from the buffer's end. So we start from the data's end and work backwards.
Compression format: NOTE: As the whole data consists of unsigned big endian 32-bit integers, I use indexing in 32-bit addresses here. By -1 I mean the last 32-bits of the data (i.e. bytes src[srcLen-4], src[srcLen-3], src[srcLen-2] and src[srcLen-1]), by -2 the second to last 32-bits etc. Dword Meaning --------- ------------------------------------------------------------------------ -1 Unpacked length (Uint32BE). -2 Error code (Uint32BE). Xor of the whole packed data in Uint32BE chunks. 0 - (-3) The packed data (In Uint32BE chunks). -------- ------------------------------------------------------------------------