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

  • 2 weeks later...

So the script unpacks the files, and I can see all of the DDS files are valid. How do I go about getting the game to read the modified files? Do the files need to be packed back into data.buny?

as it appears the game is hard coded to look for data.buny

date       time     [thread name/id ]                   file:line    v |
2025-01-24 16:32:48 [MainThread     ]                   Log.c:198   INFO| Opened log file SWBH.log
2025-01-24 16:32:48 [MainThread     ]         WindowsBase.cpp:408   INFO| Operating System: Windows PC. Version: 10.0 (Build: 26100). Device Name: Unknown.
2025-01-24 16:32:48 [MainThread     ]       WindowsWindow.cpp:1038   DBG| Monitor index [0] DPI scale = (1.00, 1.00)
2025-01-24 16:32:48 [MainThread     ]       WindowsWindow.cpp:626   INFO| Created window app SWBH
2025-01-24 16:32:48 [MainThread     ]   WindowsFileSystem.cpp:345    ERR| Error opening file: D:\Games\Steam_Games\steamapps\common\STAR WARS Bounty Hunter\data.buny -- rb (error: No such file or directory)
2025-01-24 16:32:48 [MainThread     ]   WindowsFileSystem.cpp:345    ERR| Error opening file: D:\Games\Steam_Games\steamapps\common\STAR WARS Bounty Hunter\data_1.buny -- rb (error: No such file or directory)
2025-01-24 16:32:48 [MainThread     ]           NvApiHelper.h:50    INFO| NVIDIA Display Driver Version 56636
2025-01-24 16:32:48 [MainThread     ]           NvApiHelper.h:51    INFO| NVIDIA Build Branch r566_31
2025-01-24 16:32:49 [MainThread     ]          Direct3D12.cpp:2519  INFO| GPU[0] detected. Vendor ID: 0x10de, Model ID: 0x2204, Revision ID: 0xa1, Preset: ultra, GPU Name: NVIDIA GeForce RTX 3090
2025-01-24 16:32:49 [MainThread     ]   WindowsFileSystem.cpp:345    ERR| Error opening file: D:\Games\Steam_Games\steamapps\common\STAR WARS Bounty Hunter\GPUCfg\gpu.cfg -- rb (error: No such file or directory)
2025-01-24 16:32:49 [MainThread     ]           GPUConfig.cpp:184   WARN| gpu.cfg could not be found, first gpu found set as active gpu.
2025-01-24 16:32:49 [MainThread     ]          Direct3D12.cpp:2204  INFO| GPU[0] is selected as default GPU
2025-01-24 16:32:49 [MainThread     ]          Direct3D12.cpp:2205  INFO| Name of selected gpu: NVIDIA GeForce RTX 3090
2025-01-24 16:32:49 [MainThread     ]          Direct3D12.cpp:2206  INFO| Vendor id of selected gpu: 0x10de
2025-01-24 16:32:49 [MainThread     ]          Direct3D12.cpp:2207  INFO| Model id of selected gpu: 0x2204
2025-01-24 16:32:49 [MainThread     ]          Direct3D12.cpp:2208  INFO| Revision id of selected gpu: 0xa1
2025-01-24 16:32:49 [MainThread     ]          Direct3D12.cpp:2209  INFO| Preset of selected gpu: ultra

 

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...