One piece kaizoku musou 3 [Edit]

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

One piece kaizoku musou 3 [Edit]

Post by sigroon365 »

About LINKDATA.A, some data has offset and ZSIZE values.
But actually there are more file between them that doesn't have offset and ZSIZE and offzip can't extract some files. (Maybe not a zlib)
This is same for other files. Especially, LINKDATA.B contains also some kind of files that offzip can not extract properly.

samples https://drive.google.com/file/d/0B8iw-j0BGWKIeFhCeDQzSzBzM2M/view?usp=sharing

Comparing results. I don't know what does 'CSTB' means. Is it a type..?
Image
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One piece kaizoku musou 3 [Edit]

Post by aluigi »

It looks a sequence of ZERO, OFFSET (to be multiplied by 0x800), SIZE and, yes, a type or an extension.
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: One piece kaizoku musou 3 [Edit]

Post by sigroon365 »

aluigi wrote:It looks a sequence of ZERO, OFFSET (to be multiplied by 0x800), SIZE and, yes, a type or an extension.


There are also meaningful data. At the end of file, 00 00 01 42 is a ZSIZE.
Image

Code: Select all

#This code has some problems..
endian big
get UNK1 long
get Chunks long
get offjump long
get null long

for i = 0 < Chunks
get null long
get tbloff long
get Chunks_ZSIZE1 long
get Chunks_SIZE1 long
savepos tmp
xmath Chunk_OFFSET1 "tbloff * offjump"

get null long
get Next_tbloff long
xmath Next_Chunk_OFFSET "Next_tbloff * offjump"

goto Chunk_OFFSET1
get Chunks_SIZE2 long
get Chunks_ZSIZE2 long
savepos Chunk_OFFSET2
xmath End_of_Chunk "Chunk_OFFSET2 + Chunks_ZSIZE2"

if End_of_Chunk > Next_Chunk_OFFSET
xmath Chunks_ZSIZE2 "Chunks_ZSIZE2 - 0x8"
clog "" Chunk_OFFSET2 Chunks_ZSIZE2 Chunks_SIZE2
else
clog "" Chunk_OFFSET2 Chunks_ZSIZE2 Chunks_SIZE2
endif

goto End_of_Chunk

do
get ZSIZE long
savepos OFFSET

if ZSIZE == 0
goto Next_Chunk_OFFSET
savepos OFFSET


else
xmath End_of_file "OFFSET + ZSIZE"
clog "" OFFSET ZSIZE 0x10000
goto End_of_file
savepos OFFSET
endif

while OFFSET < Next_Chunk_OFFSET

goto tmp

next i


Error message.
Image
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One piece kaizoku musou 3 [Edit]

Post by aluigi »

Maybe if Chunks_ZSIZE2 is equal to Chunks_SIZE2 then no compression is used and you should use Log instead of Clog, try that.
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: One piece kaizoku musou 3 [Edit]

Post by sigroon365 »

aluigi wrote:Maybe if Chunks_ZSIZE2 is equal to Chunks_SIZE2 then no compression is used and you should use Log instead of Clog, try that.


There was null ZSIZE. :D I solved it. Thank you.
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: One piece kaizoku musou 3 [Edit]

Post by sigroon365 »

Is there are way to automatically combine extracted files?
Most of the game files were divided into 0x8000 SIZE, so it is hard to get the original form.

For example, look at this. Real SIZE of 00006adb.g1t is 8B340.
Image

But unpacked size of 00006adb.g1t is 0x8000(32KB). Actually, it was divided into 18 files.
Image

So, I merge 18 files into one then I get the right one.

I also tried another case and it was right.
Image

My bms script unpacked most of files, but it is not perfect. Some files that doesn't have size values are missing.

Code: Select all

endian big
get UNK1 long
get Chunks long
get offjump long
get null long

for i = 0 < Chunks
get null long
get tbloff long
get Chunks_ZSIZE1 long
get Chunks_SIZE1 long
savepos tmp
xmath Chunk_OFFSET1 "tbloff * offjump"

get null long
get Next_tbloff long
xmath Next_Chunk_OFFSET "Next_tbloff * offjump"

if Chunks_SIZE1 == 0 || Chunks_SIZE1 == 1129534530
set Chunks_SIZE = Chunks_ZSIZE1

get packname filename
string packname += _unpacked/
string name += ""

log packname Chunk_OFFSET1 Chunks_SIZE
goto tmp

else

goto Chunk_OFFSET1
get Chunks_SIZE2 long
get Chunks_ZSIZE2 long
savepos Chunk_OFFSET2
xmath End_of_Chunk "Chunk_OFFSET2 + Chunks_ZSIZE2"

get packname filename
string packname += _unpacked/
string name += ""

clog packname Chunk_OFFSET2 Chunks_ZSIZE2 Chunks_SIZE2

goto End_of_Chunk

do
get ZSIZE long
savepos OFFSET

if ZSIZE == 0
goto Next_Chunk_OFFSET
savepos OFFSET

else
xmath End_of_file "OFFSET + ZSIZE"

get packname filename
string packname += _unpacked/
string name += ""

clog packname OFFSET ZSIZE 0x10000

goto End_of_file
savepos OFFSET
endif

while OFFSET < Next_Chunk_OFFSET

goto tmp

endif

next i
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One piece kaizoku musou 3 [Edit]

Post by aluigi »

It means they are chunked.
Combining them means that you need to know the exact number of chunks, create a MEMORY_FILE, append mode, log to MEMORY_FILE, disable append mode, dump to file.

I give you a basic template:

Code: Select all

log MEMORY_FILE 0
append
...
log MEMORY_FILE ...
...
append
get SIZE asize MEMORY_FILE
log "desired_output.dat" 0 SIZE MEMORY_FILE
sigroon365
Posts: 330
Joined: Fri Nov 21, 2014 4:03 am

Re: One piece kaizoku musou 3 [Edit]

Post by sigroon365 »

aluigi wrote:It means they are chunked.
Combining them means that you need to know the exact number of chunks, create a MEMORY_FILE, append mode, log to MEMORY_FILE, disable append mode, dump to file.

I give you a basic template:

Code: Select all

log MEMORY_FILE 0
append
...
log MEMORY_FILE ...
...
append
get SIZE asize MEMORY_FILE
log "desired_output.dat" 0 SIZE MEMORY_FILE


Thanks for your advice. :) I'll try it.