Pokémon: Alpha Sapphire 3DS "CRAG" - decompression problem

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Pokémon: Alpha Sapphire 3DS "CRAG" - decompression problem

Post by AlphaTwentyThree »

Hello!
I'm currently trying to correctly extract files from these archives. A comtype scan revealed that either LZ77WII or DS_LZX seems to be working. For most of the files this works fine but sometimes I get the message that some files are not compressed with this particular compression. There's no identifier for the compression either.
Here's the really simple script:

Code: Select all

idstring "CRAG"
comtype LZ77WII
#comtype DS_LZX
get BNAME basename
goto 0x1c
getDstring IDENT 4
get MYOFF long
math MYOFF += 0x1c
goto MYOFF
getDstring IDENT 4
get BLOCKSIZE long
get FILES long
savepos GOTOHERE
math MYOFF += BLOCKSIZE
goto MYOFF
getDstring IDENT 4
get BLOCKSIZE long
xmath BIAS "MYOFF + BLOCKSIZE"
goto GOTOHERE
for i = 1 <= FILES
   get UNK long
   get OFFSET long
   math OFFSET += BIAS
   get OFFSET2 long
   get ZSIZE long
   xmath SIZE "ZSIZE * 0x100"
   clog "" OFFSET ZSIZE SIZE
next i


Examples 1: http://www91.zippyshare.com/v/jcjRXGWe/file.html
Examples 2: http://www116.zippyshare.com/v/jr6KwuzF/file.html (quickBMS crashes)


Thanks for taking a look!
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Pokémon: Alpha Sapphire 3DS "CRAG" - decompression problem

Post by aluigi »

You are right, there is nothing saying if that block of data is compressed or not
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Pokémon: Alpha Sapphire 3DS "CRAG" - decompression problem

Post by aluigi »

This is my script:
http://aluigi.org/bms/pokemon_grac.bms

Obviously I had to use a work-around to know if files are compressed or not.

Please note that your file 9 in the second archive was incomplete because the last file doesn't fit in the archive.
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Pokémon: Alpha Sapphire 3DS "CRAG" - decompression problem

Post by AlphaTwentyThree »

Cool, that's another way to get to the according block. :)
Thanks for the script so far!
I merged all the archives with another installment of Pokemon and these are the ones where the script crashes:
http://www57.zippyshare.com/v/iNK3frhj/file.html
Thanks for further analysis.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Pokémon: Alpha Sapphire 3DS "CRAG" - decompression problem

Post by aluigi »

Ok script updated but I can do absolutely nothing about the compressed vs non-compressed files so be prepared to "algorithm 115" errors.
Script 0.2
AlphaTwentyThree
Posts: 909
Joined: Sat Aug 09, 2014 11:21 am

Re: Pokémon: Alpha Sapphire 3DS "CRAG" - decompression problem

Post by AlphaTwentyThree »

Thanks a lot!!