Jump to content
Lt_Parsons

[Tool] Xenonauts PFPK archive packer/unpacker

Recommended Posts

Some time ago (almost exactly a year, it seems) i discovered a great tool for unpacking game pfp archives that helped people with mapping/modding since then.

This time as an exercise i tried to step up the game a little and made a packer/unpacker by myself.

Here it is - xen_packer

It can unpack pfp's and pack any files into archive again.

Maybe it will be helpful to package new tilesets or something.

This is a command line utility, if you launch it directly, it will run with default parameters.

Instructions/info:

xen_unpack.bat,

xen_unpack_log.bat

Unpacks files from PFPK archives, used by Xenonauts.

Outputs processing info in console (xen_unpack.bat) or in log file (xen_unpack_log.bat).

Usage: xen_unpack [[path]archive] [[path]output_folder|-l]

[] - optional parameters, | - alternative parameters

archive - path to archive file to unpack files from, defaults to 'GC_TilesXML.pfp'

output_folder - path to folder to write output files into, default to archive folder

Script unpacks all files found in the archive and creates in the same folder a text file that lists all output files separated by newline.

if instead of output_folder there is '-l' parameter, script only reads archive and creates file that lists archive content.

------------------------------------------------

xen_pack.bat,

xen_pack_log.bat

Packs files into PFPK archive, used by Xenonauts.

Outputs processing info in console (xen_pack.bat) or in log file (xen_pack_log.bat).

Usage: xen_pack [[path]file_list] [[path]archive]

[] - optional parameters

file_list - path to text file with input file names separated by newline, defaults to 'GC_TilesXML_list.txt'

archive - output archive file path, defaults to 'file_list_1.pfp' in the same folder as the file_list

Script assumes that all files mentioned in file_list are in the same foler as file_list.

Ignores files in file_list with paths longer then 255 characters, because of archive format.

Tested it on existing game archives (GC_TilesXML.pfp and GC_UnitsXML.pfp) by unpacking/repacking several time in a row - results seem bit-perfect when comparing with original archives and quickbms output.

Game recognizes new archives automatically.

It seems like any new or original content can be packed - tested by replacing all xmls from assets folder with archive containing them and by packing small test mod with sprites into new archive.

Whole thing is written in JavaScript and uses node.js as script processor (because if you have one hammer, why use anything else, right? =).

I'll be much obliged for any testing/suggestions/critique about the packer and its code.

Edited by Lt_Parsons

Share this post


Link to post
Share on other sites

So, I'm being a bit stupid: I'd like to unpack the unit files, but I can't work out how I direct the unpacker towards the GC_UnitsXML archive. Any chance you could point me in the right direction?

Share this post


Link to post
Share on other sites

Sure.

If archive is in the same folder as packer command would be:

xen_unpack GC_UnitsXML.pfp

Or if you want to unpack to different folder (e:\xenonauts units\ for example):

xen_unpack GC_UnitsXML.pfp "e:\xenonauts units\"

And example with full path to the game:

xen_unpack e:\Steam\steamapps\common\Xenonauts\assets\GC_UnitsXML.pfp "e:\xenonauts units\"

Quotation marks are needed only if path contains spaces.

P.s. If you have any suggestions how to rephrase the instructions more clearly, i'll be glad to do so.

Edited by Lt_Parsons

Share this post


Link to post
Share on other sites

I just tried that, and it started extracting from the default archive (the map one) instead.

Copy-pasted from the file name: xen_unpack GC_UnitsXML.pfp

It is the .bat file I need to rename, and not the script file in the 'node' folder, isn't it?

Share this post


Link to post
Share on other sites

No need to rename anything - it's a command line utility, you just type the command and it runs bat file with parameters.

Forget to mention in description that it is command line, sorry.

Edit: Or you can just copy the .bat file and edit "%1 %2" to any parameters you need and then just run it.

Edited by Lt_Parsons

Share this post


Link to post
Share on other sites

Ah, yeah, thought I needed to change the file somehow and run it. But I've got it running now, thanks!

(Also, it was helpful having this thread linked to off of the mod list after all).

Share this post


Link to post
Share on other sites

Hey I've been trying to unpack the specters for a mod I'm creating and the xen_unpack command doesn't seem to be working. I've tried putting it in both folders in the packer program and I've also tried putting in the file path to the GC_unitsXML archive http://imgur.com/RnM7jHe. I'm not getting an output file anywhere. What am I doing wrong?

Edit: I think I found a solution elsewhere. Thanks for making this awesome tool though!

Edited by comandercom

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×