Important information: this site is currently scheduled to go offline indefinitely by December 1st 2023.
If you wish to donate to attempt the preservation of tools and software somewhere else before it goes down, check the GoFundMe

creating a new pak file when extracting method is known

The Original Forum. Game archives, full of resources. How to open them? Get help here.
Post Reply
DJRehab
ultra-n00b
Posts: 8
Joined: Sat May 14, 2011 10:18 pm
Has thanked: 1 time

creating a new pak file when extracting method is known

Post by DJRehab »

I am attempting to create a new battleforge .pak file but I am getting nowhere...the following in the MexScript used to unpack the files

Code: Select all

# BattleForge
# script for QuickBMS http://quickbms.aluigi.org

idstring "PAK\x01"
get INFO_OFF long
get INFO_SIZE long
get INFO_ZSIZE long
clog MEMORY_FILE INFO_OFF INFO_ZSIZE INFO_SIZE

get FILES long MEMORY_FILE
for i = 0 < FILES
    get NAMESZ long MEMORY_FILE
    getdstring NAME NAMESZ MEMORY_FILE
    get OFFSET long MEMORY_FILE
    get SIZE long MEMORY_FILE
    math SIZE -= OFFSET
    log NAME OFFSET SIZE
next i
How would I use this information to create a new pak file using the same file structure?
Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1823
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 92 times
Been thanked: 1058 times

Re: creating a new pak file when extracting method is known

Post by Ekey »

Read section 3 (Reimport the extracted files) in QuickBMS readme.
DJRehab
ultra-n00b
Posts: 8
Joined: Sat May 14, 2011 10:18 pm
Has thanked: 1 time

Re: creating a new pak file when extracting method is known

Post by DJRehab »

You misunderstand...I want to create a new pak file implementing completely new files into the game...I know how to inject already but I am not trying to replace an asset, I am trying to add a new one.

EDIT - I could probably just copy this file, change the name of the directory structure/filename sure but this would also limit me on file size and path/filename character length so I would prefer (if possible) to create a new pak file

EDIT2 - Also this:

Code: Select all

- for the maximum compatibility within the thousands of available file
  formats I have decided to not use tricks for modifying the original
  size and compressed_size values (think to those formats that use
  encrypted information tables or the scripts that use MEMORY_FILEs
  for such tables or that use things like "math SIZE *= 0x800")
and this: (both from the reimport section of quickbms documentation)

Code: Select all

- if the original archive uses complex encryptions that require the
  usage of MEMORY_FILEs to perform temporary decryptions then it's NOT
  supported and the same is valid for chunked content (like the usage
  of the command Append)
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: creating a new pak file when extracting method is known

Post by finale00 »

If you already know the structure of the format then all you need to do is write a program that will take a bunch of files and put them inside an archive using the format specified in the extract script.

Or write a program that will read the BMS script for the format and then create your archive based on the parsed format.
Post Reply