Godzilla PS3 LZS Compressed Files

Read or post about compression. And decompression. Or ask questions how to decompress your files.
User avatar
ThatGodzillaFan
n00b
Posts: 15
Joined: Thu May 14, 2015 9:15 pm
Has thanked: 7 times
Been thanked: 1 time

Godzilla PS3 LZS Compressed Files

Post by ThatGodzillaFan » Thu May 14, 2015 9:35 pm

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!

trexjones
veteran
Posts: 108
Joined: Mon Oct 13, 2014 6:54 am
Has thanked: 52 times
Been thanked: 6 times

Re: Godzilla PS3 LZS Compressed Files

Post by trexjones » Tue Aug 04, 2015 3:27 am

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!

Xasoduste
ultra-n00b
Posts: 2
Joined: Thu Sep 17, 2015 12:26 pm

Re: Godzilla PS3 LZS Compressed Files

Post by Xasoduste » Thu Sep 17, 2015 12:36 pm

It is not strange, yet it would have been talking about for a long time.

User avatar
Acewell
VIP member
VIP member
Posts: 1228
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2368 times
Been thanked: 710 times

Re: Godzilla PS3 LZS Compressed Files

Post by Acewell » Tue Nov 29, 2016 5:24 am

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
Last edited by Acewell on Sun Dec 18, 2016 1:42 pm, edited 1 time in total.

trexjones
veteran
Posts: 108
Joined: Mon Oct 13, 2014 6:54 am
Has thanked: 52 times
Been thanked: 6 times

Re: Godzilla PS3 LZS Compressed Files

Post by trexjones » Tue Nov 29, 2016 5:23 pm

Would love to know what it is -- this game has EASILY the best and broadest selection of Godzilla models to date!

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1789
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 39 times
Been thanked: 1260 times

Re: Godzilla PS3 LZS Compressed Files

Post by daemon1 » Wed Dec 14, 2016 5:56 pm

Unpacked the files. Now getting models
Image

textures
Image

and skeletons
Image

trexjones
veteran
Posts: 108
Joined: Mon Oct 13, 2014 6:54 am
Has thanked: 52 times
Been thanked: 6 times

Re: Godzilla PS3 LZS Compressed Files

Post by trexjones » Wed Dec 14, 2016 9:53 pm

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

User avatar
Acewell
VIP member
VIP member
Posts: 1228
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2368 times
Been thanked: 710 times

Re: Godzilla PS3 LZS Compressed Files

Post by Acewell » Wed Dec 14, 2016 11:49 pm

daemon1 wrote:Unpacked the files....
what was the solution to the lzs compression so aluigi can fix his script :D

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1789
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 39 times
Been thanked: 1260 times

Re: Godzilla PS3 LZS Compressed Files

Post by daemon1 » Thu Dec 15, 2016 4:39 pm

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.

User avatar
Acewell
VIP member
VIP member
Posts: 1228
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2368 times
Been thanked: 710 times

Re: Godzilla PS3 LZS Compressed Files

Post by Acewell » Thu Dec 15, 2016 5:07 pm

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:

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1789
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 39 times
Been thanked: 1260 times

Re: Godzilla PS3 LZS Compressed Files

Post by daemon1 » Thu Dec 15, 2016 5:36 pm

meanwhile i found bone remaps and it seems it all work ok

Image

User avatar
Acewell
VIP member
VIP member
Posts: 1228
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2368 times
Been thanked: 710 times

Re: Godzilla PS3 LZS Compressed Files

Post by Acewell » Thu Dec 15, 2016 10:06 pm

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

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1789
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 39 times
Been thanked: 1260 times

Re: Godzilla PS3 LZS Compressed Files

Post by daemon1 » Fri Dec 16, 2016 5:50 am

sure i will post the code as soon as i get back home this evening

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1789
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 39 times
Been thanked: 1260 times

Re: Godzilla PS3 LZS Compressed Files

Post by daemon1 » Fri Dec 16, 2016 4:57 pm

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.

User avatar
ThatGodzillaFan
n00b
Posts: 15
Joined: Thu May 14, 2015 9:15 pm
Has thanked: 7 times
Been thanked: 1 time

Re: Godzilla PS3 LZS Compressed Files

Post by ThatGodzillaFan » Sun Dec 18, 2016 8:23 am

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?

Post Reply