Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Making a simple repack script

Featured Replies

  • Author
  • Localization

sigroon365, posted Tue Jun 30, 2015 2:02 pm (6030)


I know quickbms doesn't support repacking but I want to learn how to make a repack script.
(Use Open FDDE or.. well, I'm not sure.) Is there a tutorial for it?

For example, http://aluigi.altervista.org/papers/bms/others/gunpoint.bms

Code:
# Gunpoint
# script for QuickBMS http://quickbms.aluigi.org

get BASE_OFF long
get FILES long
for i = 0 < FILES
    get NAMESZ long
    getdstring NAME NAMESZ
    get SIZE long
    get OFFSET long
    math OFFSET BASE_OFF
    log NAME OFFSET SIZE
next i
  • Author
  • Localization

aluigi, posted Tue Jun 30, 2015 4:29 pm (6032)


There are tons of ways for creating a rebuilder script with quickbms, just in case the reimport feature is not enough.

The following is the rebuilding script for Gunpoint:
Code:
# 1) script.bms
# 2) the input file is ignored, select the same script
# 3) the output folder is the folder containing the files to pack

set OUTPUT_ARCHIVE string "dump.pak"

# init the buffers
log MEMORY_FILE  0 0
log MEMORY_FILE2 0 0

# placeholders
put 0 long MEMORY_FILE  # BASE_OFF
put 0 long MEMORY_FILE  # FILES

for FILES = 0

    # copy&paste code
    scanDir "." NAME SIZE       # get the file from the current folder
    if NAME == ""               # no other files are available so append index
        break
    endif
    open "." NAME
    string NAME << 2            # remove ".\"
    if NAME != OUTPUT_ARCHIVE   # in case the archive already exists
        # end of copy&paste code

        # add information to the index table
        string NAME R \ /
        strlen NAMESZ NAME
        put NAMESZ long MEMORY_FILE
        putdstring NAME NAMESZ MEMORY_FILE
        put SIZE long MEMORY_FILE
        get OFFSET asize MEMORY_FILE2
        put OFFSET long MEMORY_FILE

        # add the file to the archive
        append
        log MEMORY_FILE2 0 SIZE
        append
        math FILES 1
    endif

next

get BASE_OFF asize MEMORY_FILE
putvarchr MEMORY_FILE 0 BASE_OFF long   # BASE_OFF
putvarchr MEMORY_FILE 4 FILES    long   # FILES

get SIZE asize MEMORY_FILE2
append
log MEMORY_FILE 0 SIZE MEMORY_FILE2
append

get SIZE asize MEMORY_FILE
log OUTPUT_ARCHIVE 0 SIZE MEMORY_FILE


I opted for the solution of using the output folder as also input folder where retrieving the files to add.
The input file is useless so you can just select the same script, example:
quickbms script.bms script.bms input_output_folder

If you want another example of rebulder that uses different methods, take a look at the one for Beats of Rage:
http://aluigi.org/papers/bms/bor_rebuilder.bms
  • Author
  • Localization

sigroon365, posted Tue Jun 30, 2015 10:45 pm (6036)


aluigi wrote:
There are tons of ways for creating a rebuilder script with quickbms, just in case the reimport feature is not enough.

I opted for the solution of using the output folder as also input folder where retrieving the files to add.
The input file is useless so you can just select the same script, example:
quickbms script.bms script.bms input_output_folder

If you want another example of rebulder that uses different methods, take a look at the one for Beats of Rage:
http://aluigi.org/papers/bms/bor_rebuilder.bms


Thank you! Great works! :P I have a question though. Would it be possible to write /(2F) instead of \(5C)?
For example, the original file name is 'GL/Assets/GL/splash.png.phyre', not 'GL\Assets\GL\splash.png.phyre'.
I found all of the data files was written in this format.
It doesn't matter when unpacking or repacking but it causes error when the game read the file.

Hmm.. For example, another game's file path is also written in this case; 'cache/itf_cooked/pc32/enginedata/textures/'.
When I change all of \(5C) to /(2F) then the game works well, but it is hard to edit manually all of \(5C) to /(2F).
  • Author
  • Localization

aluigi, posted Wed Jul 01, 2015 1:43 am (6039)


Sure, put the following before "strlen NAMESZ NAME":
string NAME R \ /

Just a quick note about the '\' character, it's a special char so in this case I preferred to not delimit it by quotes.
  • Author
  • Localization

sigroon365, posted Wed Jul 01, 2015 12:14 pm (6049)


aluigi wrote:
Sure, put the following before "strlen NAMESZ NAME":
string NAME R \ /

Just a quick note about the '\' character, it's a special char so in this case I preferred to not delimit it by quotes.


Thank you! :P
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.