Astonia - Compressed Archives (.pak/zlib/libpng) [gfx.c conversion]

Textures, recreate headers, conversions, algorithms and parsing of image files
DJMD713
Posts: 2
Joined: Wed Aug 15, 2018 1:33 pm

Astonia - Compressed Archives (.pak/zlib/libpng) [gfx.c conversion]

Post by DJMD713 »

Copying a post I had made to another forum:

I have been working on figuring out Astonia's .pak files but have not had much success. The game is now open source (see Github below). So far I have determined the following:

- It takes folders with .png files and converts them to .pak files. (Examples - https://drive.google.com/open?id=1Ej6O0 ... 7zRcTq5jL1)
- The code for the .pak conversion process is here (Function - gfx_make_pak - https://github.com/AstoniaDev/Astonia-3 ... moac/gfx.c)
- The app is written in C++ and uses zlib and libpng.
- I have tried accessing the files using multiple applications with no luck (MultiEx Commander, Game Extractor, etc)


I am trying to learn more about C++ to figure out a way to reverse the process but it is currently beyond what I am capable of. Does anyone have suggested guides or tutorials I can learn from? If anyone else is up to the task of deconstructing the files that would be much appreciated as well.


Someone had suggested using Offzip to open the .pak

chrrox wrote:use offzip
offzip.exe -a c:\file.pak c:\extractDir 0x0



Thanks for the suggestion. It seems to extract the correct number of files but does not get the correct data. Here is a screenshot with the extracted files (left) vs the expected output (right). Not sure what to make of this. Is it an offset issue or is there more to it?

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

Re: Astonia - Compressed Archives (.pak/zlib/libpng)

Post by aluigi »

DJMD713
Posts: 2
Joined: Wed Aug 15, 2018 1:33 pm

Re: Astonia - Compressed Archives (.pak/zlib/libpng)

Post by DJMD713 »

aluigi wrote:http://aluigi.org/bms/astonia.bms


Unfortunately this does not output correct files. If I rename them as .png files and attempt to open them it is unsuccessful.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Astonia - Compressed Archives (.pak/zlib/libpng)

Post by aluigi »

Because the data is not the original image "as-is", it's a custom format as in fact it's visible in that gfx.c code you have there.
The script and the suggestion of chrrox are correct and the data is correctly extracted.
Converting the extracted data in a "readable" format is a completely different thing, even with that source code it's probably a long work to do and I'm not sure if someone is interested (maybe there is some hope since the source code is available but time is precious for everybody).

Now I'm going to move the topic in the Graphics section since it's not a problem related to extraction.