Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: halkun on 2014-06-28 02:10:52

Title: Squaresoft's TIZ format
Post by: halkun on 2014-06-28 02:10:52
I have been playing an early square game from the 1990s called "Another Mind". It a text FMV game and it has a bunch of files I'm trying to figure out.

The main one is the compressed TIM format or .TIZ

I have an example file It's located here (https://drive.google.com/file/d/0B3iNoDVsrYhVZzJsN2xWYk95ak0/edit?usp=sharing)

The name of the file is Kanji.tiz From what I gather it's the main TIM with all the kanji loaded into video memory on load and is used thought the game (as it is a Text adventure game). I picked this one because the kanji is 1BPP and I have a "snapshot" of it in PSX memory. (It's in the lower left hand corner)

(http://i.imgur.com/pYIsWxP.png)

The file is obviously compressed with, I'm assuming, some kind of Lempel–Ziv compression due to it's popularity with Japanese and Squaresoft in general. (LZS/LZH)  Most likely Lempel–Ziv–Stac. as Square obviously had a library already.

Bytes 0x00-0x05 seem to be a header of sorts (0x04 and 0x05 are double zeros, which is imposable with compression.) Strangely, running it though LZSCDec does produce output, but I think it was blindly decompressing and the end result gives me no TIM headers.

You guys want to help take a stab at it?


Title: Re: Squaresoft's TIZ format
Post by: myst6re on 2014-06-28 11:28:01
Bytes 0x02-0x05 is the size of the file.
Title: Re: Squaresoft's TIZ format
Post by: halkun on 2014-06-28 20:08:11
That's what I thought, as the LZSCDec doesn't barf on it I wish there was an way way in no$psx to set a breakpoint at the decompressor.
Title: Re: Squaresoft's TIZ format
Post by: Kranmer on 2014-06-29 16:28:54
You just want to decompress the TIZ ?
here is your sample TIZ converted to PNG (atleast i think this is right)
(http://i.imgur.com/AHmxQsc.png)

EDIT - Forgot to post the TIZ converted to TIM (oops)
http://www.mediafire.com/download/1y9sbhpwmo5j3p2
Title: Re: Squaresoft's TIZ format
Post by: myst6re on 2014-06-29 17:37:16
So there is a header of 6 bytes, with 2 unknown bytes followed by the full (compressed) file size. And data are simply LZS-ed.
Title: Re: Squaresoft's TIZ format
Post by: Kranmer on 2014-06-29 18:03:39
So there is a header of 6 bytes, with 2 unknown bytes followed by the full (compressed) file size. And data are simply LZS-ed.

Yeah after removing the first 2 bytes then decompressing the LZS you get the TIM
Title: Re: Squaresoft's TIZ format
Post by: myst6re on 2014-06-29 19:04:59
Yeah after removing the first 2 bytes then decompressing the LZS you get the TIM

Normally the LZS header should be the compressed data size (file size - header size <=> file size - 4).
Title: Re: Squaresoft's TIZ format
Post by: Kranmer on 2014-06-30 11:41:41
Normally the LZS header should be the compressed data size (file size - header size <=> file size - 4).
I just compared the sample TIZ file halkun posted to the FF7 PSX TIZ file for the Sub Minigame and the header was very similar (excluding the first 2 bytes) so i removed them and then decompressed the LZS.
Also Halkun are you planning to do something with the game ? Translation ? or just a personal project ?
Title: Re: Squaresoft's TIZ format
Post by: halkun on 2014-07-01 02:48:20
It turns out every compressed file in the disk (anything that ends in .__Z) starts with that those two bytes (C3 FF) so it appears to be just a magic number identifying a compressed  file. This includes executable (.BIZ), pictures (.TIZ) dialogs (.ZZZ) answers (.ANZ) 

I can decrypt the movies, pictures, and probably sound/music data so far.  The game itself is pretty tiny, only about a meg a and a half.

I would love to get a dialog dump of the game and write my own engine around it. I have yet to decipher the text encoding, but that would be pretty awesome. The game engine has it's scripting opcodes in enshlish peppered around the main executable.

It's a shame the game is so rare, I'd like to have a tiny team help pick it apart.

I don't know how tolerate the game is to file re-insets, if it goes by filename of disk sector.  The game isn't exactly made for speed so who knows....
Title: Re: Squaresoft's TIZ format
Post by: myst6re on 2014-07-01 21:52:21
This time (http://forums.qhimm.com/index.php?topic=388.0), anything is possible.
Title: Re: Squaresoft's TIZ format
Post by: halkun on 2014-07-01 22:34:21
Yea, I've been here for a while :P
Title: Re: Squaresoft's TIZ format
Post by: halkun on 2014-07-27 23:06:52
myst6re, Can you add a command-line switch to qt-lzs so I can decompress "Another Mind" style LZS files. (The ones with the "CC FF" in the header)

Better yet, if it detects "C3 FF" at the beginning of the file to ignore them and decompress the rest. It's a pain to edit several hundred files one at a time to remove those two bytes.