My quickBMS scripts

Coders and would-be coders alike, this is the place to talk about programming.
Prince_of_Peace
beginner
Posts: 31
Joined: Fri May 26, 2006 6:41 am
Has thanked: 2 times

Re: My quickBMS scripts

Post by Prince_of_Peace » Sun Jan 26, 2014 12:29 am

AlphaTwentyThree wrote:Wwise sound engine *.pck/AKPK extractor
This is not a re-importable script is it?

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Sun Jan 26, 2014 3:36 pm

Prince_of_Peace wrote:
AlphaTwentyThree wrote:Wwise sound engine *.pck/AKPK extractor
This is not a re-importable script is it?
No, sorry :/
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

Teancum
veteran
Posts: 94
Joined: Tue Nov 27, 2007 8:30 pm
Has thanked: 20 times
Been thanked: 5 times

Re: My quickBMS scripts

Post by Teancum » Wed Feb 12, 2014 6:50 pm

How hard would this psuedocode be to translate into BMS script?

// 1) Read bytes 0x10-0x13, store as num_files[]
// 2) Go to 0x30-0x33, store files_start_offset[], jump to files_start_offset[]
// 3) For each item in num_files[]
// 4) Read first four bytes as file_offset[]
// 5) Read next four bytes as file_size[]
// 6) Jump forward 12 bytes
// 7) Read 16 bytes as file_name[]
// 8) Go to file_offset[]
// 9) Select from file_offset[] to file_offset[]+file_size[]
// 10) Save selection as file_name[]
// 11) num_files[]+=1
// 12) files_start_offset[]+=84 bytes
// 13) fetch next

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Wed Feb 12, 2014 6:58 pm

Teancum wrote:How hard would this psuedocode be to translate into BMS script?

// 1) Read bytes 0x10-0x13, store as num_files[]
// 2) Go to 0x30-0x33, store files_start_offset[], jump to files_start_offset[]
// 3) For each item in num_files[]
// 4) Read first four bytes as file_offset[]
// 5) Read next four bytes as file_size[]
// 6) Jump forward 12 bytes
// 7) Read 16 bytes as file_name[]
// 8) Go to file_offset[]
// 9) Select from file_offset[] to file_offset[]+file_size[]
// 10) Save selection as file_name[]
// 11) num_files[]+=1
// 12) files_start_offset[]+=84 bytes
// 13) fetch next

Code: Select all

goto 0x10
get num_files long
goto 0x30
get files_start_offset long
goto files_start_offset
savepos MYOFF
for i = 0 < num_files
   goto MYOFF
   get file_offset long
   get file_size long
   getDstring dummy 12
   getDstring file_name 16
   log file_name file_offset file_size
   math MYOFF += 84
next i
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

Teancum
veteran
Posts: 94
Joined: Tue Nov 27, 2007 8:30 pm
Has thanked: 20 times
Been thanked: 5 times

Re: My quickBMS scripts

Post by Teancum » Wed Feb 12, 2014 8:46 pm

I'm getting an error, it may be my problem:

Code: Select all

Error: incomplete input file number 0, can't read 4 bytes.
Here's the offsets 0x10 and 0x30, maybe I'm reading those wrong, are those the correct addresses.

Image

***EDIT***

Here's the basic file structure: http://wiki.xentax.com/index.php?title= ... Apocalypse -- I'm just getting "Number Of Items In Directory 1", then "Offset To Directory Data 3". From there I would grab the data I need (offset, size, name), then jump to the actual files. I can manually rip them, but it's hundreds of files.

Incidentally, directories 4-7 in the wiki don't actually exist in the files. I'm not sure if anyone can edit that data or not.

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Thu Feb 13, 2014 1:24 am

Sorry to ask but why do you need a BMS script when Game Extractor already supports the archive type?
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

Teancum
veteran
Posts: 94
Joined: Tue Nov 27, 2007 8:30 pm
Has thanked: 20 times
Been thanked: 5 times

Re: My quickBMS scripts

Post by Teancum » Thu Feb 13, 2014 9:17 am

It doesn't, though. Supposedly it does, but the table structure is platform-specific, so GameExtractor can only do one platform. A QuickBMS script would allow me to adjust sizes and offsets should I ever need to. The Unknown{4} in the // Directory Data 3 is a different size on each platform. For example, the 360 is 12 bytes instead of 4.

MacDougal
ultra-n00b
Posts: 4
Joined: Tue Mar 04, 2014 12:20 am
Has thanked: 1 time

Re: My quickBMS scripts

Post by MacDougal » Tue Mar 04, 2014 11:33 pm

Is there any chance of a script for the pak & bin files of LOTR Conquest?

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Wed Mar 05, 2014 10:47 am

MacDougal wrote:Is there any chance of a script for the pak & bin files of LOTR Conquest?
Only if they contain the music, which is what I'm after. ;)
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

Kein
advanced
Posts: 40
Joined: Fri Nov 06, 2009 12:57 pm

Re: My quickBMS scripts

Post by Kein » Wed Apr 02, 2014 1:38 am

Any chance you could update XNB to WAV to support XNA 4.0 XNB format?

Milesgboy
advanced
Posts: 43
Joined: Sat Jul 03, 2010 5:02 pm
Has thanked: 3 times
Been thanked: 1 time

Re: My quickBMS scripts

Post by Milesgboy » Wed Apr 30, 2014 1:02 am

AlphaTwentyThree wrote:The Amazing Spider-Man *.pkz decompressor

Decompresses the pkz archives from the game and writes the header and decompressed data to disk. I can't make any sense of the given offsets in the header, but if anyone wants to take a look, I can provide a sample.
Nothing special here, so again, it's just another example for the QuickBMS-curious (comments provided). ;)

Code: Select all

# decompresses the *.pkz files from The Amazing Spider-Man (PC)
# no extraction of individual files at the moment (TOC offsets don't fit)
# (c) 2012-10-09 by AlphaTwentyThree of XeNTaX

comtype zlib_noerror
get IDENT long
if IDENT == 0xb0b1bEbA
	endian big
elif IDENT == 0xbabeb1b0
else
	cleanexit
endif
get DATA_OFF long              # start of compressed data
get NAME basename
string NAME += ".header"
log NAME 0 DATA_OFF            # write header to disk for later research
get BLOCKSIZE long             # length of one zlib block
get LOOPS asize                # calculate the number of loops
math LOOPS -= DATA_OFF
math LOOPS /= BLOCKSIZE
# memory pre-allocation
get SIZE asize
math SIZE -= DATA_OFF
math SIZE *= 10
putVarChr MEMORY_FILE SIZE 0
log MEMORY_FILE 0 0
set OFFSET DATA_OFF  # initialize first offset
set SIZE BLOCKSIZE
math SIZE *= 10      # set decompressed size to some default
append
for i = 1 <= LOOPS
	clog MEMORY_FILE OFFSET BLOCKSIZE SIZE # decompress block to memory
	math OFFSET += BLOCKSIZE               # jump to next block
next i
append
get NAME basename
string NAME += ".decomp"
get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE
Any chance you'll ever be able to figure this out so we can have some modding scene go on for these games. So many of their Spiderman games use PKZ and so many costumes that could be ported now into each game now. Surprised no one has figured this out yet. Since ASM2 just came out recently and nothing seems to have changed.

namquang93
veteran
Posts: 116
Joined: Mon Apr 09, 2012 8:40 am
Has thanked: 50 times
Been thanked: 5 times

Re: My quickBMS scripts

Post by namquang93 » Tue Jul 01, 2014 4:51 am

AlphaTwentyThree wrote:The Amazing Spider-Man *.pkz decompressor

Decompresses the pkz archives from the game and writes the header and decompressed data to disk. I can't make any sense of the given offsets in the header, but if anyone wants to take a look, I can provide a sample.
Nothing special here, so again, it's just another example for the QuickBMS-curious (comments provided). ;)

Code: Select all

# decompresses the *.pkz files from The Amazing Spider-Man (PC)
# no extraction of individual files at the moment (TOC offsets don't fit)
# (c) 2012-10-09 by AlphaTwentyThree of XeNTaX

comtype zlib_noerror
get IDENT long
if IDENT == 0xb0b1bEbA
	endian big
elif IDENT == 0xbabeb1b0
else
	cleanexit
endif
get DATA_OFF long              # start of compressed data
get NAME basename
string NAME += ".header"
log NAME 0 DATA_OFF            # write header to disk for later research
get BLOCKSIZE long             # length of one zlib block
get LOOPS asize                # calculate the number of loops
math LOOPS -= DATA_OFF
math LOOPS /= BLOCKSIZE
# memory pre-allocation
get SIZE asize
math SIZE -= DATA_OFF
math SIZE *= 10
putVarChr MEMORY_FILE SIZE 0
log MEMORY_FILE 0 0
set OFFSET DATA_OFF  # initialize first offset
set SIZE BLOCKSIZE
math SIZE *= 10      # set decompressed size to some default
append
for i = 1 <= LOOPS
	clog MEMORY_FILE OFFSET BLOCKSIZE SIZE # decompress block to memory
	math OFFSET += BLOCKSIZE               # jump to next block
next i
append
get NAME basename
string NAME += ".decomp"
get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE
I used this script with THE AMAZING SPIDER MAN 2. But get error! Can you updated for new pkz format? Thanks in advance!

DoubleDare
ultra-n00b
Posts: 1
Joined: Tue Jul 01, 2014 7:48 pm
Has thanked: 4 times

Re: My quickBMS scripts

Post by DoubleDare » Wed Jul 02, 2014 7:21 am

AlphaTwentyThree wrote:AFL Live 2 (2013) X360 - .wad0/.wad1

Be sure to get the latest func_getTYPE.bms for this one!

Code: Select all

snip
Hey A23!

Thank you so much for your time and effort :)

I am a little stuck and maybe you can help?

When I run your great qBMS script, I am able to extract:
  • XMA - Which I have already used your other great XMA decoder script for ToWav and works great
  • DDS - All of the textures are great and works a treat
The only problem is that there are no 3D model files extracted :( I can see there are a lot of '.000000xx' files, which I presume some are the model files.

How can I go about exploring these files to see?

Thanks so much! :wink:

AlphaTwentyThree
double-veteran
double-veteran
Posts: 985
Joined: Mon Aug 24, 2009 10:55 pm
Has thanked: 75 times
Been thanked: 621 times

Re: My quickBMS scripts

Post by AlphaTwentyThree » Thu Jul 03, 2014 11:24 am

Well, you could look at them using a hex editor but you probably have to write your own conversion script to access them with a 3D program. As I'm neither familiar with nor interested in model files I wish you luck with your quest. ;)
If you like what you see, why not click the little Thank You button? ;) It will definitely motivate me! :)
And here's Mr.Mouse's Facebook link: http://www.facebook.com/permalink.php?s ... 8469022795 - thanks ;)

FASTandFURIOUS
ultra-n00b
Posts: 1
Joined: Thu Aug 14, 2014 9:48 am

Re: My quickBMS scripts

Post by FASTandFURIOUS » Thu Aug 14, 2014 10:54 am

AlphaTwentyThree, you can make a script to unpack the archives of the game Midnight club Los Angeles for Xbox 360?

Post Reply