Jump to content

Star Wars Bounty Hunter PC archive - BUNY extraction script


enderdrag64

Recommended Posts

Hi, I created this extraction script for the archives of the Aspyr PC port of Star Wars Bounty Hunter earlier today, hopefully it's useful to somebody.

 

endian little
idstring "BunyArchTheForge"
get UNKNOWN longlong
get UNKNOWNTWO longlong
get UNKNOWNTHREE longlong
get HEADERSIZE longlong
get FILENAMETABLEADDR longlong
get FILENAMETABLESIZE longlong
get UNKNOWNADDR longlong
get UNKNOWNSIZE longlong
for i = 0 < HEADERSIZE / 40
	get UNKNOWNFOUR longlong
	get UNKNOWNFIVE longlong
	get FILENAMEADDR long
	get FILENAMESIZE long
	get ADDRESS longlong
	get SIZE longlong
	savepos HEADERLOC
	xmath JUMPPTR "FILENAMETABLEADDR + FILENAMEADDR"
	goto JUMPPTR
	get FILENAME string
	goto HEADERLOC
	log FILENAME ADDRESS SIZE
next i


I would've attached it as a file but it seems .bms isn't an approved attachment format. This is my first post on this forum, please let me know if there's a better way to submit these, thanks!

Link to comment
Share on other sites

  • 1 month later...
comtype "ZSTD"
idstring "BunyArchTheForge"
goto 0x20
get TOC_OFF longlong
get TOC_SIZE longlong
get NAMES_OFF longlong
get NAMES_SIZE longlong
get TOC2_OFF longlong
get TOC2_SIZE longlong

xmath FILES "TOC_SIZE / 0x28"

putVarChr MEMORY_FILE NAMES_SIZE 0
log MEMORY_FILE 0 0
log MEMORY_FILE NAMES_OFF NAMES_SIZE

for i = 0 < FILES
	get TYPE longlong
	get SIZE longlong
	get NAME_OFF long
	get NAME_SIZE long
	get OFFSET longlong
	get ZSIZE longlong
	savepos POS

	goto NAME_OFF MEMORY_FILE
	getdstring NAME NAME_SIZE MEMORY_FILE
	
	if ZSIZE == SIZE
		log NAME OFFSET SIZE
	else
		goto OFFSET
		getdstring DUMMY 0x10
		get NUM long
		math NUM *= 0x08

		math OFFSET += 0x18
		math ZSIZE -= 0x18
		math OFFSET += NUM
		math ZSIZE -= NUM

		if ZSIZE == SIZE
			log NAME OFFSET SIZE
		else
			clog NAME OFFSET ZSIZE SIZE
		endif
	endif

	goto POS
next i

Here is a full script to extract buny files.

Link to comment
Share on other sites

open FDDE "buny" 0
comtype "ZSTD"
idstring "BunyArchTheForge"
goto 0x20
get TOC_OFF longlong
get TOC_SIZE longlong
get NAMES_OFF longlong
get NAMES_SIZE longlong
get TOC2_OFF longlong
get TOC2_SIZE longlong

xmath FILES "TOC_SIZE / 0x28"

putVarChr MEMORY_FILE NAMES_SIZE 0
log MEMORY_FILE 0 0
log MEMORY_FILE NAMES_OFF NAMES_SIZE

get FNAME filename

for i = 0 < FILES
	savepos TOC_OFF
	get TYPE longlong
	get SIZE longlong
	get NAME_OFF long
	get NAME_SIZE long
	get OFFSET longlong
	get ZSIZE longlong
	savepos POS

	goto NAME_OFF MEMORY_FILE
	getdstring NAME NAME_SIZE MEMORY_FILE

	open FDSE NAME 1 CHECK
	if CHECK == 1
		get NEW_SIZE asize 1
		get NEW_OFFSET asize 0

		append
		log FNAME 0 NEW_SIZE 1
		append

		goto TOC_OFF
		put 0x00 longlong
		put NEW_SIZE longlong
		get DUMMY longlong
		put NEW_OFFSET longlong
		put NEW_SIZE longlong
	endif

	goto POS
next i

Script for packing new/modified files to .buny archives (not reimport!). Requires -w option for quickbms.

Link to comment
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
×
×
  • Create New...