Anyone still interested in this? I have the droids you are looking for ...
This QuickBMS script (exactly the same as the one above but with clog replaced by log) extracts the raw compressed data into separate files:
Code: Select all
# Pinball FX2 .PXP resource extractor
# Extracts the compressed resources from the .PXP
# file but does NOT decompress them
idstring "PX"
get DUMMY short
get INFO_SIZE long
get DATA_OFFSET long
get FILES long
get DUMMY long
for i = 0 < FILES
get OFFSET long
get SIZE long
get TYPE byte
get NAMESZ byte
getdstring NAME NAMESZ
padding 4
get ZSIZE long
log NAME OFFSET ZSIZE
next i
You can use the -f option if you only want to extract particular kinds of files.
Here's the good bit - the following script will take one of the single files that you extracted above and will decompress it:
Code: Select all
# Zen Studios .PXP file decompresser
# (CastleStorm, Pinball FX2)
# Adrian Dale 09/10/2013
#
# Needs NeoWizLib.dll provided by Ekey
# http://forum.xentax.com/viewtopic.php?f=10&t=10654
#
# This script decompresses a single resource file that has previously
# been extracted from a .PXP file.
# This has been tested with files from Pinball FX2 and appears to
# successfully decompress most of the files in the archives.
log MEMORY_FILE3 0 0
do
get CHUNKTYPE byte
If CHUNKTYPE == 0x03
get ZSIZE threebyte
SavePos IN_OFFSET
set SIZE long 0x80000
#print "%CHUNKTYPE% %ZSIZE|hex% %SIZE|hex% %IN_OFFSET|hex%\n"
log MEMORY_FILE IN_OFFSET ZSIZE
putvarchr MEMORY_FILE2 SIZE 0
CallDLL NeoWizLib.dll NWDecompress stdcall "" MEMORY_FILE MEMORY_FILE2 SIZE
math IN_OFFSET + ZSIZE
goto IN_OFFSET
ElseIf CHUNKTYPE == 0x04
get SIZE threebyte
get ZSIZE threebyte
SavePos IN_OFFSET
#print "%CHUNKTYPE% %SIZE% %ZSIZE|hex% %IN_OFFSET|hex%\n"
log MEMORY_FILE IN_OFFSET ZSIZE
putvarchr MEMORY_FILE2 SIZE 0
CallDLL NeoWizLib.dll NWDecompress stdcall "" MEMORY_FILE MEMORY_FILE2 SIZE
Endif
# Now tag MEMORY_FILE2, which is the decompressed chunk
# onto the end of MEMORY_FILE3
append
log MEMORY_FILE3 0 SIZE MEMORY_FILE2
append
while CHUNKTYPE != 0x04
get NAME basename
get EXT extension
string NAME += "_unpacked."
string NAME += EXT
get FULL_SIZE asize MEMORY_FILE3
log NAME 0 FULL_SIZE MEMORY_FILE3
To run this you'll need the NeoWizLib.dll file from Ekey's CastleStorm decompression tool. That's attached to his post
here. Drop that so that QuickBMS can find it when you run it.
I can't guarantee that this works on every file. In fact it crashes on dotmatrix\csicsa.dmv in the two archives I tried. This makes Ekey's tool crash, otherwise you could just use that to unpack the whole pxp file. I've got round that by allowing you to decompress files individually. Note that I used the PC version of the game from Steam to test this.
I don't know where Ekey got the NeoWizLib.dll file from - did it come with CastleStorm? I checked that because it is also made by Zen Studios. Anyway, the code in that dll looks identical to the code compiled into the PFX2 exe.
I have a rough idea of how it works - it seems to be a variant of the Deflate algorithm but with a different file format and slightly different way of storing the data. I can post more if anyone is interested? It would be great if there was already an existing compressor for this format, as then it would be possible to mod the PFX2 files and put them back into the game.
There are some interesting files in the archives. There is an obfuscated python file for each table, which appears to describe how the various switches and lights connect together.
There are also the .dmv files which are the Dot Matrix Video files. Their format is pretty simple:
A two byte frame count; then for each frame four bytes of unknown purpose, possibly frame timing info; then 1024 bytes of frame data. So, 32 rows, x 32 bytes is 1024, which means a byte is 4 pixels. This translates to a 128x32 pixel three colour screen with the other bit being an alpha flag.
I may have a look at extracting the model and animation data as there are some cool resources in this game. If you are curious, you can download the main game for free on Steam
here and it comes with one playable table, with the rest available as paid DLC. If you're only interested in extracting the resources, then you won't even need to pay to unlock the DLC as the files are already there on your PC for the preview versions of the tables.
Adrian