Rollcage 2 IMG: Difference between revisions
Jump to navigation
Jump to search
imported>Dinoguy1000 (update/cleanup) |
(→Format Specifications: Readability + bugfix (2^13 not 2^14)) |
||
| Line 29: | Line 29: | ||
: The ControlBits say how to decompress the data. | : The ControlBits say how to decompress the data. | ||
:: | :: If the Bit is 0 then the next Byte is not compressed, and copied directly from the Input buffer | ||
:: | :: If the Bit is 1 then the next Bytes are compressed. The next ControlBit shows how it is compressed. | ||
::: The Next Bit is 0: | ::: The Next Bit is 0: | ||
:::: The decompressor reads the next Byte from the | :::: The decompressor reads the next Byte from the Input buffer. | ||
:::: This Byte | :::: This Byte-256 tells the decompressor how many bytes to go back in the Output buffer. | ||
:::: From that position the decompressor copies 2 bytes to the end of the already decompressed Data. | :::: From that position the decompressor copies 2 bytes to the end of the already decompressed Data. | ||
:::: If the next ControlBit is 1 the decompressor copies 2 additional Bytes. | :::: If the next ControlBit is 1 the decompressor copies 2 additional Bytes. | ||
:::: If the next ControlBit is 1 the decompressor copies 1 additional Byte. | :::: If the next ControlBit is 1 the decompressor copies 1 additional Byte. | ||
::: The Next Bit is 1: | ::: The Next Bit is 1: | ||
:::: The decompressor reads the two next Bytes. | :::: The decompressor reads the two next Bytes from the Input buffer. | ||
:::: The first three bits of theese is the number of bytes to copy-2. | :::: The first three bits of theese is the number of bytes to copy-2. | ||
:::: The | :::: The remaining 13 bits-8192 tells the decompressor how many bytes to go back in the Output buffer. | ||
:::: If the number of bytes to copy is 0, the decompressor reads also the next byte. | :::: If the number of bytes to copy is 0, the decompressor reads also the next byte from the Input buffer. | ||
::::: The first bit of this byte indicates that | ::::: The first bit of this byte indicates that another 8192 should be deducated from the position from where the bytes have to be copied. | ||
::::: The rest is the number of bytes to copy-2. If this is again 0, the decompressor have to read the next 2 bytes, which is the number of bytes to copy. | ::::: The rest is the number of bytes to copy-2. If this is again 0, the decompressor have to read the next 2 bytes, which is the exact number of bytes to copy. | ||
Example: | Example: | ||
Revision as of 14:51, 26 April 2012
Back to index | Edit this page
IMG + IDX
- Format type: Archive
- Endianness: Little-endian
Format Specifications
// IDX FILE
- // for each file
- uint32 {4} - File Offset
- uint32 {4} - Compressed File Length
- uint32 {4} - Decompressed File Length
- uint32 {4} - Unused
// IMG FILE
- // for each file
- char {4} - File Header (GT20)
- uint32 {4} - Decompressed File Length
- uint32 {4} - Unused (Same as the Unused field in the IDX File)
- uint32 {4} - Length of additional Information
- char {X} - Additional Information
- byte {X} - Compressed Data
Compressed Data:
- uint32 {4} - 'ControlBits'
- char {X} - Compressed Data
- uint32 {4} - 'ControlBits'
- char {X} - Compressed Data
- ..
- The ControlBits say how to decompress the data.
- If the Bit is 0 then the next Byte is not compressed, and copied directly from the Input buffer
- If the Bit is 1 then the next Bytes are compressed. The next ControlBit shows how it is compressed.
- The Next Bit is 0:
- The decompressor reads the next Byte from the Input buffer.
- This Byte-256 tells the decompressor how many bytes to go back in the Output buffer.
- From that position the decompressor copies 2 bytes to the end of the already decompressed Data.
- If the next ControlBit is 1 the decompressor copies 2 additional Bytes.
- If the next ControlBit is 1 the decompressor copies 1 additional Byte.
- The Next Bit is 1:
- The decompressor reads the two next Bytes from the Input buffer.
- The first three bits of theese is the number of bytes to copy-2.
- The remaining 13 bits-8192 tells the decompressor how many bytes to go back in the Output buffer.
- If the number of bytes to copy is 0, the decompressor reads also the next byte from the Input buffer.
- The first bit of this byte indicates that another 8192 should be deducated from the position from where the bytes have to be copied.
- The rest is the number of bytes to copy-2. If this is again 0, the decompressor have to read the next 2 bytes, which is the exact number of bytes to copy.
- The Next Bit is 0:
MultiEx BMS
Not written yet
Notes and Comments
- The *.IDX file contains the directory, the *.IMG file contains the data