Tomba! 2: The Evil Swine Return/Technical information

From Tomba! Wiki
Jump to navigation Jump to search

This page contains technical information on the ROM data.

Video analysis

Video description Link
Compression in Tomba 2 https://youtu.be/f6Vh9b1Kiw8
CVRAM files https://youtu.be/iMHLHivs4mM

TOMBA2.IDX

The IDX is the most important file in the entire game. It consists of several chunks of data, all with a size of 0x800. One Chunk represents one area or "scene" so to speak and contains explicit information on what data to load to RAM for the assets and data and which VRAM to use, etc. We aren't loading anything to RAM, but extracting this data to real binary files to look closer.

For example, the demo IDX is 0x18000 bytes big, so it contains 0x30 chunks, as 0x18000/0x800=0x30. To get to the address of a given chunk_index, just seek to chunk_index * 0x800. A chunk is made from two parts; the starting 0x100 part and the trailing 0x700 part. The first 0x100 bytes of a given chunk are:

"<5I" = img_start, img_end, dat_start, dat_end, pointer_amount
  • img_start and img_end determine the range of bytes to get from the IMG to create CVRAM for chunk_index.
  • dat_start and dat_end determine the range of bytes to get from the DAT to create SDAT for chunk_index. Notice: neither of these variables determines a "size" or "amount." Only the range.
  • pointer_amount determines the amount of pointers to read immediately after, so read "<~I" (where ~ is pointer_amount).

The list you get from doing so will contain items that each hold two values:

item >> 24 = dat_id
item & 0x00FFFFFF = dat_ptr

These two values should be put into a tuple, and all the

tuples should be put to a list called sdat_pointers.

sdat_pointers = [ (dat_id,dat_ptr), (dat_id,dat_ptr), ... ]

Any data left up until the trailing 0x700 part should be ignored.

The trailing 0x700 bytes of a given chunk are:

"<224I" = tomba_list
  • Iterate through this list with a step of 2 with iterator t, where:
 tomba_list[t], tomba_list[t+1] = dat_tomba_start, dat_tomba_end

Much like its img_ and dat_ counterparts, these values represent addresses in

the DAT that contain relevant Tomba model data to use for that particular chunk_index.

There are multiple addresses in tomba_list, but any value of 0 should be ignored.

What the information in one chunk_index in the IDX gives us:

CVRAM file a small piece cut from the IMG file (Use unIMG.py to decompress)
SDAT file a small piece cut from the DAT file
A list called sdat_pointers a list with pointers to all data in the SDAT. Every pointer is accompanied by an index value (why?)
A list called tomba_list a list with data ranges to Tomba in his various suits

TOMBA2.DAT

DAT file contains:

- spirtes

- 3D models (characters and level geometry)

- text https://www.youtube.com/watch?v=Bbk2eXQPL68

- asset animation data

- level collision data

- "drawmaps"

- background tiles

BIN files

BIN files contain asset placement data in every level. The file seems to be compressed.