Page 1 of 2

Godzilla PS3 LZS Compressed Files

Posted: Thu May 14, 2015 9:35 pm
by mr rocket
I'm trying to extract the 3D Models from the Godzilla game for PS3, which at the moment is only released in Japan. The game contains .pac files which can easily be extracted, but all of the files appear to be LZS compressed. The game apparently uses the PhyreEngine, if that information can be of any help.

Here's a link to all of the files I've extracted from ch01a_00.pac: http://www.mediafire.com/download/g1qd2 ... 282%29.rar

Any help decompressing these files would be appreciated!

Re: Godzilla PS3 LZS Compressed Files

Posted: Tue Aug 04, 2015 3:27 am
by trexjones
Just wanted to bump this one to see if you, or anyone else had managed to get anywhere with this. The models in this game look fantastic!

Re: Godzilla PS3 LZS Compressed Files

Posted: Thu Sep 17, 2015 12:36 pm
by Xasoduste
It is not strange, yet it would have been talking about for a long time.

Re: Godzilla PS3 LZS Compressed Files

Posted: Tue Nov 29, 2016 5:24 am
by Acewell
it looks like aluigi's lzs bms script should decompress your samples but it goes off track somewhere :?
http://aluigi.altervista.org/bms/lzs.bms

*edit*
thanks to daemon1 for posting the source code that revealed the
byte swap so aluigi could fix the script to decompress properly :D

Code: Select all

# LZS (PSP_Nanoha) (script 0.1.1)
# script for QuickBMS http://quickbms.aluigi.org

quickbmsver "0.5.25"
idstring "LZS\0"
getdstring DUMMY 4
get OFFSET long
if OFFSET u> 0x10000
	endian big
	reverselong OFFSET
endif
get DICT_OFFSET long
get SIZE long
get ZSIZE long
getdstring DUMMY 8
get NAME string
goto DICT_OFFSET
math DICT_SIZE = ZSIZE
math DICT_SIZE -= DICT_OFFSET
getdstring DICT DICT_SIZE
comtype LZS_UNZIP DICT DICT_SIZE
math ZSIZE = DICT_OFFSET
math ZSIZE -= OFFSET
encryption swap 16                  #this line was the fix
clog NAME OFFSET ZSIZE SIZE

Re: Godzilla PS3 LZS Compressed Files

Posted: Tue Nov 29, 2016 5:23 pm
by trexjones
Would love to know what it is -- this game has EASILY the best and broadest selection of Godzilla models to date!

Re: Godzilla PS3 LZS Compressed Files

Posted: Wed Dec 14, 2016 5:56 pm
by daemon1
Unpacked the files. Now getting models
Image

textures
Image

and skeletons
Image

Re: Godzilla PS3 LZS Compressed Files

Posted: Wed Dec 14, 2016 9:53 pm
by trexjones
Hey there! Would someone be able to perhaps take a look into these .pac files? Looking for a way to get at the assets inside... It appears to be using a different compression method to the NTSC version of the game, which I find interesting!

https://mega.nz/#F!nZ4V0TqC!sKjWNJu1VTrpkowRTa288Q

Re: Godzilla PS3 LZS Compressed Files

Posted: Wed Dec 14, 2016 11:49 pm
by Acewell
daemon1 wrote:Unpacked the files....
what was the solution to the lzs compression so aluigi can fix his script :D

Re: Godzilla PS3 LZS Compressed Files

Posted: Thu Dec 15, 2016 4:39 pm
by daemon1
AceWell wrote:what was the solution to the lzs compression so aluigi can fix his script :D
This is what I did:

I took the quickbms LZS code, and rewritten it looking at the file data. It was all done correct, as luigi's code describes. So I don't know why script is not working, maybe some endianess issue.

Re: Godzilla PS3 LZS Compressed Files

Posted: Thu Dec 15, 2016 5:07 pm
by Acewell
i guess the byte order could be the problem here since the script follows the file structure
perfectly and ps3 files sometimes has big endian headers with little endian data :eek:

Re: Godzilla PS3 LZS Compressed Files

Posted: Thu Dec 15, 2016 5:36 pm
by daemon1
meanwhile i found bone remaps and it seems it all work ok

Image

Re: Godzilla PS3 LZS Compressed Files

Posted: Thu Dec 15, 2016 10:06 pm
by Acewell
Compressed files and methods
Godzilla PS3 LZS Compressed Files
all of the files appear to be LZS compressed....Any help decompressing these files would be appreciated!
i've spent more time than i care to admit trying to figure out why the bms script didn't work, which is why i am curious
about this elusive solution you have figured out, so to avoid spinning our tires further here i'll just go ahead and ask -

how did you decompress the files properly and can you post your code associated with this lzs decompression?

forget about the bms script, i'm asking how you solved the decompression, i'm sure it wasn't accidental. :D

Re: Godzilla PS3 LZS Compressed Files

Posted: Fri Dec 16, 2016 5:50 am
by daemon1
sure i will post the code as soon as i get back home this evening

Re: Godzilla PS3 LZS Compressed Files

Posted: Fri Dec 16, 2016 4:57 pm
by daemon1
ok this is the code. First reading the header:

Code: Select all

            fs.Seek(8, SeekOrigin.Begin);
            int dataoff = br.ReadInt32();
            int dictoff = br.ReadInt32();
            int usize = br.ReadInt32();
            int psize = br.ReadInt32();

then reading the whole data block into memory:

Code: Select all

            int datasize = (dictoff - dataoff) / 2;
            fs.Seek(dataoff, SeekOrigin.Begin);
            int[] data = new int[datasize + 16];
            int tmp, flags;
            for (int i = 0; i < datasize; i++)
            {
                tmp = br.ReadByte();
                data[i] = (tmp << 8) + br.ReadByte();
            }
and then decompressing it according to Luigi's code. Note that I was too lazy to make any checks present in his code.

Code: Select all

            fs.Seek(dictoff, SeekOrigin.Begin);
            byte[] outb = new byte[usize + 16];
            int outs = 0;
            int roff, rsize;

            for (int i = 0; i < datasize; i++)
            {
                flags = data[i];
                for (int j = 0; j < 16; j++)
                {
                    if (((flags >> j) & 1) > 0)
                    {
                        // copy byte from dictionary
                        outb[outs++] = br.ReadByte();
                    }
                    else
                    {
                        // repeat already unpacked bytes
                        rsize = (data[i + 1] & 0x1f) + 2;
                        roff = (data[i + 1] >> 5);
                        for (int k = 0; k < rsize; k++, outs++) outb[outs] = outb[outs - roff];
                        i++;
                    }
                }
            }
in the end write output to file

Code: Select all

            File.WriteAllBytes("out.bin", outb);
As you can see, this code does exactly the same what LZS code from quickbmx does.

Re: Godzilla PS3 LZS Compressed Files

Posted: Sun Dec 18, 2016 8:23 am
by mr rocket
Woah, that's awesome! Thanks a lot! :D

EDIT: How did you get the model itself? Should I try to extract it with Hex2Obj or is there an easier way to do it?