Rollcage 2 IMG: Difference between revisions

From XentaxWiki
Jump to navigation Jump to search
No edit summary
Line 115: Line 115:
=== GFXM ===
=== GFXM ===


Contains repeating SEGM and MODL sections.  Format unknown.
Contains repeating SEGM and MODL sections, which appear to be track segments and models, respectively.  Format (mostly) unknown. Coordinates appear to be shared between SEGM and MODLs, and referenced by index.


{{BlockDescription| // GFXM FILE }}
: char {4}     - File Header {{Constant|(GFXM)}}
: uint32 {4}   - ?
: uint32 {4}   - ?
: uint32 {4}   - Number of coords
: uint32 {4}   - Number of SEGM sections
: uint32 {4}   - Table of SEGM locations
: uint32 {4}   - Table of MODL locations.  First MODL immediately follows this table, and infers table length.
At location 0x68
: char {12}     - Coordinate table. 12 bytes for each coordinate = 4 bytes each for XYZ.
Note: MODLs appear to contain sub-MODLs, as more MODL definitions appear than are given in the MODL table.


=== PINP ===
=== PINP ===

Revision as of 13:31, 9 May 2012

Back to index | Edit this page

IMG + IDX

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}     - Data Segment
uint32 {4}   - 'ControlBits'
char {X}     - Data Segment
..


  • ControlBits occur in the Input Stream whenever the algorithm requires another Bit, not when the last Bit in the ControlBits has been read.
  • Uncompressed Data is read verbatim from a Data Segment in the Input Stream, and placed in the Output Stream.
  • The Data Compression method is to copy previously decompressed bytes in the Output Buffer, to the Output Stream.
    • This is always in the form of a negative Offset + Copy Count.


The ControlBits are parsed starting with the least significant bit.
If the Bit is 0 then the next Byte is not compressed, and copied directly from the Input Stream
If the Bit is 1 then the next Bytes are compressed.
The next ControlBit shows how to derive the Offset and Copy Count.
If the Next Bit is 0:
Read the next Byte from the Input Stream.
This Byte-256 is the Offset.
From that position copy 2 bytes to the end of the already decompressed Data.
If the next ControlBit is 1 copy 2 additional Bytes.
If the next ControlBit is 1 copy 1 additional Byte.
If the Next Bit is 1:
Read the next two Bytes from the Input Stream.
The first three bits is the Copy Count-2.
The remaining 13 bits-8192 is the Offset.
If the Copy Count is 0, read the next Byte from the Input Stream.
The most significant bit of this Byte (&128) indicates whether another 8192 should be deducted from the Offset
The rest (&127) is the Copy Count-2.
If this is again 0, read the next 2 Bytes, for the exact Copy Count.


MultiEx BMS

Not written yet

Notes and Comments

  • The *.IDX file contains the directory, the *.IMG file contains the data

Supported Programs


Contents

When extracted, the IMG file contains several file types which can be identified by their header.

  • BMP - Standard Microsoft Bitmap format
  • BTP + GFXM - Track Textures and Models.
  • PINP - Car Textures and Models

BTP

// BTP FILE

char {4}     - File Header (BTP )
uint32 {4}   - ?
uint32 {4}   - ?
uint32 {4}   - ?
uint32 {4}   - ?
uint32 {4}   - Number of COBJECTS
uint32 {4}   - ?
uint32 {4}   - Skybox Data
uint32 {4}   - ?
uint32 {4}   - Texture Data
uint32 {4}   - COBJECTS (Collision Data?)
uint32 {4}   - ?
uint32 {4}   - ?
uint16 {2}   - Number of Textures
uint16 {2}   - Number of Palettes
uint32 {4}   - TPAGE - Texture Page Data
uint32 {4}   - Palette Data


Texture Page Data

Textures are stored as indexed 8-bit images. Each Texture can index against a different Palette. The Texture Page Table section defines the dimensions of the texture, and which colour palette to use for indexing. There is one 12byte texture page entry for each texture in this table.

uint16 {2}   - Width
uint16 {2}   - Height
uint32 {4}   - Palette
uint32 {4}   - Offset of Texture in Texture Data Section

Palette Data

Each colour is stored as four bytes: G/B/R/A. Each palette contains 256 entries.

COBJECTS

Every COBJECT has a size of 56 bytes.

GFXM

Contains repeating SEGM and MODL sections, which appear to be track segments and models, respectively. Format (mostly) unknown. Coordinates appear to be shared between SEGM and MODLs, and referenced by index.

// GFXM FILE

char {4}     - File Header (GFXM)
uint32 {4}   - ?
uint32 {4}   - ?
uint32 {4}   - Number of coords
uint32 {4}   - Number of SEGM sections
uint32 {4}   - Table of SEGM locations
uint32 {4}   - Table of MODL locations. First MODL immediately follows this table, and infers table length.

At location 0x68

char {12}     - Coordinate table. 12 bytes for each coordinate = 4 bytes each for XYZ.

Note: MODLs appear to contain sub-MODLs, as more MODL definitions appear than are given in the MODL table.

PINP

Contains a 128x128 texture, and repeating MODL sections.


Offset:16  - Palette Data (B/G/R)
Offset:784 - Texture Data. 1 Byte per pixel.

Navigation

Jump to a listing by...
All Formats - Common Formats - Standard Formats - Malformed Pages
Platforms
Microsoft:
Xbox
Xbox 360
Nintendo:
GameCube
DS
Desktop:
PC
Sega:
Dreamcast
Sony:
PlayStation
PlayStation 2
PlayStation 3
PlayStation Portable
Type
Animation - Archive - Audio - Image - Mesh - Miscellaneous - Model - Video
Endianness
Little-endian - Big-endian
BMS Scripts
Pages Without a BMS Script

All Pages with Scripts:
Recently Added Scripts

Program Support
No Known Support

MultiEx Commander - Game Extractor

Format Specification Completion
Work in Progress - Almost Done - Completed
Compression and Encryption
No Compression or Encryption Used - Unknown Compression or Encryption Used

One or Both Used:
Compression Used - Both Compression and Encryption Used