snickerbockers / fp-assets

Extractor/archiver tool for Freedom Planet's Assets.dat file.
The Unlicense
5 stars 1 forks source link

Possibility to extend this tools to support other games too? #4

Open runlevel5 opened 3 years ago

runlevel5 commented 3 years ago

I've been poking into the new awsome game Cyber Shadow which is supposed to be FP. Sadly the tool could not extract the compressed data, I ran into following:

[tle@runlevel5 fp-assets]$ ./fp-assets.py -x
Traceback (most recent call last):
  File "./fp-assets.py", line 478, in <module>
    assets_dir_path=assets_dir_path)
  File "./fp-assets.py", line 406, in extract_all_assets
    "img_%d_meta.txt" % index)
  File "./fp-assets.py", line 142, in extract_img
    file_dat = zlib.decompress(assets_file.read(file_len))
zlib.error: Error -3 while decompressing data: incorrect header check

which makes sense, perhaps the assets are not compressed ith zlib after all. So wondering if you have any doc or could give me guidance on how to find out the reverse the image format logic of the game engine? Many thanks in advance

zEasyIDK commented 1 year ago

If you were able to extract the date, let me know the method because I am interested in the same game

snickerbockers commented 1 year ago

the real problem is the offset to the metadata block (represented by OFFSETS_START in the source). This is hardcoded into the game and it's not necessarily the same on every MP2-engine game.

I think I figured it out for Freedom Planet by disassembling and reverse-engineering the executable. An easier alternative method that might work would be to track system calls with a tool like strace and look for the seek call which should be the first thing to happen after opening a file descriptor for assets.dat; whatever offset it uses will probably be the offset to the metadata block.

I should also note that this tool was written for a game which came out in 2014, so it's possible that newer MP2 engine games might have a wholly incompatible format.