Jump to content

TIS file format in IESDP


Recommended Posts

I don't understand this.




The Header has a constant length of 18h bytes.


Offset Data type Description

0x0000 (4 char ) Signature ('TIS ')

0x0004 (4 char) Version 'V1 '

0x0008 (4 dword) Count of tiles within this tileset

0x000c (4 dword) Length of Tiles section

0x0010 (4 dword) Size of the header (offset to tiles)

0x0014 (4 dword) Dimension of 1 tile in pixels (64x64).

I extracted several TIS files with NearInfinity, but they don't have this header.. :) :) :(


Screenshot from hex editor to prove this:


This is _AR0153.TIS used in Tutu for the thief guildhall area in BG city. I can open and browse the extracted TIS with NI successfully, so it's not corrupted or anything.


This one is AR0020.TIS, tileset of the gates district area from BG2:


The DWORD value at offset 0x0008 according to IESDP is supposed to contain count of tiles in this TIS. But in the last screenshot, this value equals 0x1C160C = 1840652 ! The real number of tiles in this TIS according to NI = 303.


DLTCEP doesn't recognize this extracted tileset, it either runs out of memory (apparently, while trying to allocate it for 1840652 tiles :D ) or doesn't actually show any tiles after loading. It only works if I load the tileset using "Load MOS" menu option, and then choose one from the BIF. When, and only when, I use "Save TIS as..." button in DLTCEP, TIS file gets saved with that 18h header.


Basically, I just want to read the current number of tiles contained in TIS file. Is there any way at all to do this with WeiDU ?

Link to comment

The tilesets don't have this header while in the .bif, because part of it is embeddded in the .bif structure, part of it is hardcoded in the engine.

The engine (and dltcep) expects this header ONLY for tilesets in the override.

If NI still (after so many years) cannot extract a tileset correctly, then use dltcep for this job.

WeiDU also can extract it (generates the header) correctly. It was implemented in WeiDU about 2 years ago.

Link to comment
WeiDU also can extract it (generates the header) correctly. It was implemented in WeiDU about 2 years ago.

Yeah, but I suppose only when doing weidu --biff-get or --biff-get-rest?


Problem is, I wanted to do something like this:

READ_LONG 0x08 tile_count

I need that %tile_count% for further patching later in TP2.

Link to comment

Right, I settled with this:

READ_LONG 0x08 TIS_tile_count
 OUTER_SET TIS_tile_count = 252  // default value for original biffed file

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...