Offtopic: Into Commodore 64 (6502) coding, pixeling or music?
Xentax is looking for new members for the C64 activities!
Just drop us a message at forum@xentax.com and join the Scene Team!

Forum rules: Click here

My quickBMS scripts

Coders and would-be coders alike, this is the place to talk about programming.
Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1645
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 68 times
Been thanked: 825 times

Re: My quickBMS scripts

Post by Ekey » Sun Aug 31, 2014 9:14 am

FASTandFURIOUS wrote:AlphaTwentyThree, you can make a script to unpack the archives of the game Midnight club Los Angeles for Xbox 360?
http://tmacdev.com

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

Re: My quickBMS scripts

Post by AlphaTwentyThree » Sat Oct 11, 2014 1:01 am

Haven't checked with the Xbox 360 version. You'll probably only have to remove the two "endian big" entries.

Code: Select all

# extracts the all_#.bundle files from Payday 2 (PS3)
# written by AlphaTwentyThree 2014-10-09
# script for QuickBMS http://aluigi.org/papers.htm#quickbms

include "func_getTYPE.bms"
get NAME basename 0
string NAME p= "%s_h.bundle" NAME
open FDSE NAME 1 EXIST
if EXIST == 0
	print "Error: be sure you ust this script on an all_#.bundle file! Aborting."
	cleanexit
endif
get FSIZE asize 1
endian big
get DUMMY long 1
get CSIZE long 1 # complete decompressed size
log MEMORY_FILE 0 0
putVarChr MEMORY_FILE2 CSIZE 0
log MEMORY_FILE2 0 0
savepos OFFSET 1
callfunction decompress 1
goto 0 MEMORY_FILE2
get SIZE_TOC long MEMORY_FILE2
get CRC long MEMORY_FILE2
get FILES long MEMORY_FILE2
get FILES long MEMORY_FILE2
get UNK long MEMORY_FILE2
get UNK long MEMORY_FILE2
get UNK long MEMORY_FILE2
get BNAME basename 0
for i = 1 <= FILES
	get FID long MEMORY_FILE2
	get OFFSET long MEMORY_FILE2
	get SIZE long MEMORY_FILE2
	if SIZE != 0
		log MEMORY_FILE OFFSET SIZE 0
		callfunction getTYPE 1
		endian big
		string NAME p= "%s/%s_%d%s" BNAME BNAME FID EXT
		log NAME 0 SIZE MEMORY_FILE
	endif
next i


startfunction decompress
	append
	do
		goto OFFSET 1
		get SIZE long 1
		savepos OFFSET 1
		xmath ZSIZE "SIZE * 100"
		clog MEMORY_FILE2 OFFSET SIZE ZSIZE 1
		math OFFSET += SIZE
	while OFFSET < FSIZE
	append
endfunction
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 ;)

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

Re: My quickBMS scripts

Post by AlphaTwentyThree » Tue Nov 11, 2014 2:17 pm

Dino R-R-rage Defense - data.dat

Code: Select all

# Dino R-R-rage Defense - data.dat
#
# (c) 2014-11-11 by AlphaTwentyThree of XeNTaX
# script for QuickBMS http://quickbms.aluigi.org

get UNK long
idstring "gepack"
get FILES long
for i = 1 <= FILES
	get NAMEL long
	math NAMEL *= 2
	getDstring NAME NAMEL
	set NAME unicode NAME
	get SIZE long
	get OFFSET long
	get DUMMY long
	get DUMMY byte
	log NAME OFFSET SIZE
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 ;)

Heavymetalz
ultra-n00b
Posts: 1
Joined: Fri Sep 27, 2013 3:38 am

Re: My quickBMS scripts

Post by Heavymetalz » Fri Nov 21, 2014 9:19 am

Hi AlphaTwentyThree: .. regarding Midnight Club L.A. , if you are planning on making a script for this game, I can get you some source files to work with if you need them ( xbox360 version)

XeRoX
ultra-n00b
Posts: 1
Joined: Tue Nov 25, 2014 6:54 pm

Re: My quickBMS scripts

Post by XeRoX » Tue Nov 25, 2014 6:57 pm

Hi there,

im new to this forum, and I am actually looking for a script to unpack PAK files for the game titles Legend of Edda Global Edition.
Wonder if there is anyone who can help me out with?

Many thanks in advance!

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

Re: My quickBMS scripts

Post by AlphaTwentyThree » Fri Dec 12, 2014 9:59 pm

Frozen Synapse Prime ~ 2014 ~ PC - FSalldata.pkdwin/.pkiwin

Grab the func_getTYPE.bms from here: viewtopic.php?f=13&t=4450&p=69577#p69577

Code: Select all

# extracts the FSalldata archive from "Frozen Synapse Prime ~ 2014 ~ PC"
# (c) 2014-12-12 by AlphaTwentyThree
# script for QuickBMS http://quickbms.aluigi.org

include "func_getTYPE.bms"
open FDDE "pkiwin" 0
open FDDE "pkdwin" 1
get INFOSIZE long 0
get ZERO long 0
get FILES long 0
get FOLDER basename
for i = 1 <= FILES
	get SIZE long 0
	get OFFSET long 0
	get CRC long 0
	putVarChr MEMORY_FILE SIZE 0
	log MEMORY_FILE 0 0
	append
	log MEMORY_FILE OFFSET SIZE 1
	append
	callfunction getTYPE 1
	string NAME p= "%s/0x%08x%s" FOLDER CRC EXT
	log NAME 0 SIZE MEMORY_FILE
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 ;)

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

Re: My quickBMS scripts

Post by AlphaTwentyThree » Mon Feb 02, 2015 1:17 am

Real Warfare: 1242 - data.000.pak

Code: Select all

# extracts the data.000.pak from Real Warfare: 1242
# written by AlphaTwentyThree 2015-02-02
# script for QuickBMS http://aluigi.org/papers.htm#quickbms

idstring "PACK"
get UNK long
get INFO long
get UNK long
get FILES long
get SIZE asize
math SIZE -= INFO
log MEMORY_FILE INFO SIZE
goto 0 MEMORY_FILE
for i = 1 <= FILES
	get OFFSET longlong MEMORY_FILE
	get SIZE longlong MEMORY_FILE
	get NAMEL long MEMORY_FILE
	get UNK long MEMORY_FILE
	savepos MYOFF MEMORY_FILE
	getDstring NAME NAMEL MEMORY_FILE
	math MYOFF += NAMEL
	goto MYOFF MEMORY_FILE
	log NAME OFFSET SIZE
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 ;)

eriger777
beginner
Posts: 25
Joined: Wed Sep 24, 2014 10:30 pm

Re: My quickBMS scripts

Post by eriger777 » Thu Feb 05, 2015 2:24 am

Could you take a look at this file format?
viewtopic.php?f=21&t=12572&p=103469#p103469

User avatar
makcar
veteran
Posts: 152
Joined: Mon May 12, 2014 10:41 pm
Has thanked: 22 times
Been thanked: 45 times

Re: My quickBMS scripts

Post by makcar » Mon Feb 16, 2015 2:53 am

AlphaTwentyThree wrote:Iron Sky: Invasion (2012) PC

All file information is stored in an XML file, so parsing is a bit more ugly than usual.

Code: Select all

# Iron Sky: Invasion (2012) PC - *.gpk extractor ( input file: *.mod)
# (c) 2012-11-30 by AlphaTwenyThree of XeNTaX
reimport?

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

Re: My quickBMS scripts

Post by AlphaTwentyThree » Mon Feb 16, 2015 2:05 pm

makcar wrote:
AlphaTwentyThree wrote:Iron Sky: Invasion (2012) PC

All file information is stored in an XML file, so parsing is a bit more ugly than usual.

Code: Select all

# Iron Sky: Invasion (2012) PC - *.gpk extractor ( input file: *.mod)
# (c) 2012-11-30 by AlphaTwenyThree of XeNTaX
reimport?
No clue, 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 ;)

A20Group
beginner
Posts: 22
Joined: Thu Nov 27, 2014 5:36 pm
Has thanked: 3 times

Re: My quickBMS scripts

Post by A20Group » Sun Mar 01, 2015 5:15 pm

Milesgboy wrote:
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.
on THE AMAZING SPIDER MAN 2 is not working
plz new code

User avatar
SILENTpavel
advanced
Posts: 54
Joined: Fri Aug 05, 2011 5:53 am
Has thanked: 86 times
Been thanked: 15 times

Re: My quickBMS scripts

Post by SILENTpavel » Sun Mar 15, 2015 11:58 pm

AlphaTwentyThree wrote:Extractor for Broken Sword: Shadow of the Templars
Another good example for the use of external scripts.
Something wrong with that. What i did wrong? (SPEECH .DAT/.TAB extracted with CDmage from the SLUS_004.84)

Image

Code: Select all

QuickBMS generic files extractor and reimporter 0.5.29
by Luigi Auriemma

- start the scanning of the input folder: E:\!BS\New folder
- open input file E:\!BS\New folder\.\SPEECH.DAT
- open script E:\!BS\BS.bms
- c_structs: "if" "NAME" "=="

Error: invalid command "if" or arguments -1 at line 25

Press RETURN to quit
upd: also tested with 0.6.1d = same error.

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

Re: My quickBMS scripts

Post by AlphaTwentyThree » Tue Mar 24, 2015 12:22 pm

SILENTpavel wrote:
AlphaTwentyThree wrote:Extractor for Broken Sword: Shadow of the Templars
Another good example for the use of external scripts.
Something wrong with that. What i did wrong? (SPEECH .DAT/.TAB extracted with CDmage from the SLUS_004.84)

Image

Code: Select all

QuickBMS generic files extractor and reimporter 0.5.29
by Luigi Auriemma

- start the scanning of the input folder: E:\!BS\New folder
- open input file E:\!BS\New folder\.\SPEECH.DAT
- open script E:\!BS\BS.bms
- c_structs: "if" "NAME" "=="

Error: invalid command "if" or arguments -1 at line 25

Press RETURN to quit
upd: also tested with 0.6.1d = same error.
That error doesn't correspond to my script - make sure you copied it correctly.
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 ;)

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

Re: My quickBMS scripts

Post by AlphaTwentyThree » Tue Mar 24, 2015 12:22 pm

The Awakened Fate: Ultimatum (PS3) - *.dat

Makes nice use of the array and sortarray functions. :)

Code: Select all

# extract the *.dat files from "The Awakened Fate: Ultimatum" (PS3)
# written by AlphaTwentyThree
# script for QuickBMS http://quickbms.aluigi.org

endian big
idstring "CASN"
get VERSION short
goto 0x6
get FILES short
get FSIZE long
get DATASTART long
get TOCSIZE long
savepos NAMEPOS
math NAMEPOS += TOCSIZE
get NAMESIZE long
get UNK long
for i = 0 < FILES
	get FID short
	get OFFSET long
	get SIZE long
	putArray 0 i OFFSET
	putArray 1 i SIZE
next i
sortarray 0
for i = 0 < FILES
	get NAMEL short
	get OFFSET long
	get SIZE long
	getDstring NAME NAMEL
	putArray 2 i NAME
	get DUMMY byte # zero
next i
for i = 0 < FILES
	getArray NAME 2 i
	getArray OFFSET 0 i
	getArray SIZE 1 i
	log NAME OFFSET SIZE
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 ;)

User avatar
makcar
veteran
Posts: 152
Joined: Mon May 12, 2014 10:41 pm
Has thanked: 22 times
Been thanked: 45 times

Re: My quickBMS scripts

Post by makcar » Sat Jun 13, 2015 12:00 pm

AlphaTwentyThree wrote:Glacier engine - WHD/WAV pairs

Games like the Hitman series, Freedom Fighters or Kane & Lynch. You will need to put all whd/wav pairs as well as the streams.wav (if available) into the same folder.
Not all tested, though. So if you have problems with any of the Glacier games, post here.

Code: Select all

# extracts the WHD/WAV pairs from the Glacier engine
# needs the streams.wav in the same folder as the whd/wav pair(s)
# tested with Hitman 2: Silent Assassin (Xbox, PS2)
# (c) 2013-08-30 by AlphaTwentyThree of XeNTaX
# script for QuickBMS http://quickbms.aluigi.org
Kane & Lynch: Dead Men™ PC version?
Example: https://yadi.sk/d/Lzd_2w2NhEM2r

Post Reply