How to make repack script?

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
OneCombo
Posts: 67
Joined: Mon Jul 20, 2015 1:12 pm

How to make repack script?

Post by OneCombo »

As you know, I have a unpack script .

But I need repack script.

Because If I repack this file, File size will change.

So, I can't use reimport.bat file.

This game is Date A Live - Twin Edition Rio Reincarnation (Ps Vita)

Originally Ps3 script is "Big Endian"

But Ps Vita is "Little Endian"

Here's your Script.

# PS3 Date Alive Arusu
# Modified Hyperdevotion Noire: Goddess Black Heart PC
# Uncompressed .pck; "Filename" ID
#
# script for QuickBMS http://quickbms.aluigi.org

endian little
idstring "Filename" # magic ID

get DUMMY long # skip pointer to next symbol after the last null-terminated filename
# may or may not point to "Pack " ID
# or it's the size of filename array?..
savepos NAMEOFFSETGLOBAL # pointer to the first filename offset
# is used as zero for all filename offsets
set NAMEOFFSETLOCAL NAMEOFFSETGLOBAL # save the zero for iteration

#get FILES long # first filename offset is also 4*filecount(?)
#math FILES /= 4 # filecount

findloc OFFSET string "Pack " # find the real "Pack " ID pointer
# it should be aligned to 4B
math OFFSET += 8 # add 8 to go past the ID
goto OFFSET # ditto

get DUMMY long # skip the size of "Pack " ID & file offset/size pairs
# ID pointer plus this value point to next 4B after the last file offset/size pair
# or it's the size of offset/size array?..
get FILES long # filecount, for real
savepos FILEOFFSET # save the position of first file offset

if FILES > 1 # if there is more than 1 file in archive
set PATH string ""
get PATH basename # get input filename w/o extension
string PATH += / # make it a directory(?)
endif

for i = 0 < FILES
goto NAMEOFFSETLOCAL
get NAMEOFFSET long
savepos NAMEOFFSETLOCAL
math NAMEOFFSET += NAMEOFFSETGLOBAL
goto NAMEOFFSET
get NAME string
if FILES > 1 # if there is more than 1 file in archive
string TMP = PATH
string TMP += NAME
string NAME = TMP
endif

goto FILEOFFSET
get OFFSET long
get SIZE long
savepos FILEOFFSET
log NAME OFFSET SIZE
next i

Please make repack script.