pro5 Posted February 19, 2007 Share Posted February 19, 2007 I don't understand this. Header 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 ) 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
Avenger Posted February 19, 2007 Share Posted February 19, 2007 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
pro5 Posted February 19, 2007 Author Share Posted February 19, 2007 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: COPY_EXISTING ~_AR0153.TIS~ ~OVERRIDE~ READ_LONG 0x08 tile_count BUT_ONLY_IF_IT_CHANGES I need that %tile_count% for further patching later in TP2. Link to comment
Avenger Posted February 19, 2007 Share Posted February 19, 2007 Hmm, maybe you could hunt for the tileset's original size. Or assume that if it is biffed (does not exist in override), then it is the official size. Link to comment
pro5 Posted February 19, 2007 Author Share Posted February 19, 2007 Right, I settled with this: ACTION_IF FILE_EXISTS ~OVERRIDE\_AR0153.TIS~ THEN BEGIN COPY_EXISTING ~_AR0153.TIS~ ~OVERRIDE~ READ_LONG 0x08 TIS_tile_count BUT_ONLY_IF_IT_CHANGES END ELSE BEGIN OUTER_SET TIS_tile_count = 252 // default value for original biffed file END Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.