recompressing into .pxp files (Castlestorm)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
firas724
Posts: 3
Joined: Mon May 04, 2015 9:46 am

recompressing into .pxp files (Castlestorm)

Post by firas724 »

Hi guys, I recently was interested in modding Castle storm and play around with the stats and game rules, I managed to decompress it using quickBMS, first using this code to unpack the .pxp

Code: Select all

# 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


Then I used this code to decompress the files the were in .pxp

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


Until now I have only decompressed the .cfg , and modified the contents, then tried to pack it again into .pxp, by just packing it into a different extension then renaming it,but ultimately failed. I really would appreciate it if someone would give me a way of re-compressing the .cfg into its original form, and packing it into the original extension settings.
firas724
Posts: 3
Joined: Mon May 04, 2015 9:46 am

Re: recompressing into .pxp files (Castlestorm)

Post by firas724 »

Hello again, I have uploaded an example of a file for you to analyse, and the .dll you need to decompress the files within the .pxp

http://www.mediafire.com/download/zw6ny ... eStorm.rar
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: recompressing into .pxp files (Castlestorm)

Post by aluigi »

That's a known problem:
viewtopic.php?t=497
firas724
Posts: 3
Joined: Mon May 04, 2015 9:46 am

Re: recompressing into .pxp files (Castlestorm)

Post by firas724 »

Hi guys,

I came back to castlestorm, and I want to know if a solution to the problem has been found ( a way to compress into pxp).