Page 1 of 1

Tales of Vesperia / Graces TLZC compression

Posted: Sun Apr 08, 2012 9:10 pm
by oathkeeper9918
so some guy reverse-engineered the TLZC compression format used in most of the Tales of games.

http://blog.lse.epita.fr/articles/8-sta ... ormat.html

There's a python program at the bottom of the post, I couldn't get it to work though (I would get a 'list index out of range' error on line 37). Any way to convert it to a quickbms script?? Or if someone could get that python program to work, that's be great too!

sample TLZC-compressed files: http://www.mediafire.com/?6423f9rml64tsmd

Re: TLZC compression

Posted: Sun Apr 08, 2012 9:37 pm
by finale00
What game is this?
I couldn't get it to work either.

Code: Select all

Traceback (most recent call last):
  File "decompress.py", line 39, in <module>
    decompress_tlzc(buf, open(sys.argv[2], "w"))
  File "decompress.py", line 31, in decompress_tlzc
    decompress_block(lzma_params, block, out, remaining)
  File "decompress.py", line 11, in decompress_block
    out.write(pylzma.decompress(block, size, maxlength=size))
TypeError: Error while decompressing: 6
.............
You should send the samples to the author.

Re: TLZC compression

Posted: Sun Apr 08, 2012 10:08 pm
by oathkeeper9918
They're from Tales of Vesperia. But hey, you got farther than I did in executing it, at least.

I sent the samples to the author, not expecting to get too much though.

Re: TLZC compression

Posted: Sun Apr 08, 2012 11:12 pm
by chrrox
I made a quickbms script based on his post enjoy.

Code: Select all

idstring "TLZC"
get name basename
string name + ".FPS4"
comtype MSF
get version long
get tzsize long
get tsize long
goto 0x1D
set blockcount tsize
math blockcount += 0xFFFF
math blockcount /= 0x10000
for i = 0 < blockcount
get zsize short
putarray 0 i zsize
next i
for i = 0 < blockcount
savepos offset
getarray ZSIZE 0 i
if tsize >= 0x10000
append
clog MEMORY_FILE OFFSET ZSIZE 0x10000
append
else
append
if ZSIZE == 0
log MEMORY_FILE OFFSET tsize
else
clog MEMORY_FILE OFFSET ZSIZE tsize
endif
append
endif
math tsize -= 0x10000
math offset + ZSIZE
goto offset
next i
get SIZE asize MEMORY_FILE
log name 0 SIZE MEMORY_FILE

Re: Tales of Vesperia TLZC compression

Posted: Mon Apr 09, 2012 12:03 am
by finale00
Doesn't work for the book_enemy files.

Re: Tales of Vesperia TLZC compression

Posted: Mon Apr 09, 2012 12:10 am
by chrrox
those files are null?

Re: Tales of Vesperia TLZC compression

Posted: Mon Apr 09, 2012 12:13 am
by chrrox
oops my bad
change the one line
i left a hard coded number in there from a file i tested.
updated post

Re: Tales of Vesperia TLZC compression

Posted: Mon Apr 09, 2012 12:21 am
by finale00
Now it works for book_enemy_20, but still fails on the other non-null books_enemy's (eg: 18, 19).

It fails on the very last iteration of the loop.
Maybe you have to deal with the remaining block separately?

Re: Tales of Vesperia TLZC compression

Posted: Mon Apr 09, 2012 12:33 am
by chrrox
done

Re: Tales of Vesperia TLZC compression

Posted: Mon Apr 09, 2012 12:54 am
by oathkeeper9918
Thanks! The script works perfectly for Vesperia's and Graces' files

Re: Tales of Vesperia TLZC compression

Posted: Sat May 10, 2014 8:50 am
by albert1905
oathkeeper9918 wrote:Thanks! The script works perfectly for Vesperia's and Graces' files
Did I make a mistake..? It doesn't work.
K-85.png

Re: Tales of Vesperia TLZC compression

Posted: Sat May 10, 2014 4:35 pm
by Ekey
albert1905 wrote:
oathkeeper9918 wrote:Thanks! The script works perfectly for Vesperia's and Graces' files
Did I make a mistake..? It doesn't work.
K-85.png
replace

Code: Select all

math blockcount + 0xFFFF
math blockcount / 0x10000
to

Code: Select all

math blockcount += 0xFFFF
math blockcount /= 0x10000

Re: Tales of Vesperia TLZC compression

Posted: Sun May 11, 2014 3:14 pm
by albert1905
Ekey wrote:
albert1905 wrote:
oathkeeper9918 wrote:Thanks! The script works perfectly for Vesperia's and Graces' files
Did I make a mistake..? It doesn't work.
K-85.png
replace

Code: Select all

math blockcount + 0xFFFF
math blockcount / 0x10000
to

Code: Select all

math blockcount += 0xFFFF
math blockcount /= 0x10000
Thanks a lot.

Re: Tales of Vesperia / Graces TLZC compression

Posted: Thu May 15, 2014 12:29 am
by jrush
Does this mean you can extract models from Tales of Graces F or Tales of Graces? I have some models from Vesperia Xbox but I want to know if you can get models from Vesperia PS3.