image.bin (fpk) & LZO-compressed fpk | Drakengard / Drag-On Dragoon (PS2) (SOLVED)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
swosho
Posts: 13
Joined: Sun Jul 07, 2019 3:58 pm

image.bin (fpk) & LZO-compressed fpk | Drakengard / Drag-On Dragoon (PS2) (SOLVED)

Post by swosho »

The game's data is stored in .bin archives with "fpk" magic. Here's how the main archive, image.bin, looks like:
Image
From what I gather:
0x08 - amount of files
0x0C - block/sector size
0x18 - TOC length?
0x28 - header size
0x2C - body size
0x40 - archive name
TOC:
0xA0 - null
0xA4 - offset (with the header size subtracted)
0xA8 - size
0xAC - uncompressed size / null if not compressed
...
If this may be important, in every other fpk archive the TOC starts at 0x80, and 0xXC value indicates the file type instead of uncompressed size.

So I used this caveman-made script to dump the contents of image.bin:

Code: Select all

goto 0xA0
for i = 0 < FILES
   get DUMMY long
   get OFFSET long
   math OFFSET + 0x4800
   get SIZE long
   get DUMMY long
   log "" OFFSET SIZE
next i

However, the majority of fpk archives contained there are compressed like so:
Image Image
Which seems to be LZO(1x?) algorithm + some sort of 0x2D-long header (contains: 0x08 - size, 0x0C - csize), but I didn't get a match after manually trying to decompress them
both headered and with the header stripped, and comtype_scan2 gets stuck on these files without the ability to Ctrl+C & N circumvent the hang-up.
Edit: Managed to run comtype_scan all the way through and it didn't result in compression algorithm matches.

If anyone could look into making a script for handling the archive or even tackling the compression alone, I would be eternally grateful. Thank you for your time, and sorry for the bother as always.

Here's a couple of compressed and uncompressed fpk samples and a full image.bin (919 MB) just in case.
Last edited by swosho on Sun Apr 25, 2021 4:11 pm, edited 2 times in total.
chrrox
Posts: 388
Joined: Thu Aug 07, 2014 10:28 pm

Re: image.bin (fpk) & LZO-compressed fpk | Drakengard / Drag-On Dragoon (PS2)

Post by chrrox »

When doing compscan bat file kill quickbms.exe in task manager to have it continue if it hangs.
swosho
Posts: 13
Joined: Sun Jul 07, 2019 3:58 pm

Re: image.bin (fpk) & LZO-compressed fpk | Drakengard / Drag-On Dragoon (PS2)

Post by swosho »

Thanks, following your advice and also refraining from setting the expected size at the end of the command let the process go though all the algorithms!
Unfortunately, there were no decompressed matches. I tried utilising both the untouched compressed FPKs and the ones with the headers stripped.
DKDave
Posts: 136
Joined: Mon Nov 23, 2020 6:01 pm

Re: image.bin (fpk) & LZO-compressed fpk | Drakengard / Drag-On Dragoon (PS2)

Post by DKDave »

Try this script to decompress the files. It does use lz01x - the compressed files are split up into various parts, rather than being 1 compressed section.

My script will extract and decompress all of the files in image.bin. Among the extracted files are many other fpk files. The format of these seems to be just slightly different to the main fpk file table. The extracted files might need to be split further into more sub-files.

fpk.zip
swosho
Posts: 13
Joined: Sun Jul 07, 2019 3:58 pm

Re: image.bin (fpk) & LZO-compressed fpk | Drakengard / Drag-On Dragoon (PS2)

Post by swosho »

It works brilliantly! Thank you so much, DKDave!
swosho
Posts: 13
Joined: Sun Jul 07, 2019 3:58 pm

Re: image.bin (fpk) & LZO-compressed fpk | Drakengard / Drag-On Dragoon (PS2) (SOLVED)

Post by swosho »

It turns out the data inside the archives containing the FMV subtitles is also compressed but with a different algorithm:
Image Image
Could these be decompressed? Sorry for the bother and thanks again for your time.