Jump to content

I have an extractor, I want a repacker for a PS2 game.

Recommended Posts

I want to turn this into a repacker. Please help. Thanks.


endian little
get myname FILENAME
get myext EXTENSION
if myext != "RAX"
    print "Please run this script on a .RAX file"

get DAT_SIZE asize
idstring "RAX\x00"
get rax->RESERVED1_ long
get rax->RESERVED2_ long
get rax->entcount long

math i = 0

for OFFSET = 0x10 < DAT_SIZE
    getdstring query->sig 4
    get        query->blksize long
    get        query->fnamelen long
    get        query->usize long

    math i += 1

    if query->fnamelen > 0x100
        print "(%myname% at OFFSET=%OFFSET%) entry filename overly long, maybe bad value [query->fnamelen=%query->fnamelen%]"
    if query->fnamelen > 0
        getdstring query->fname query->fnamelen
        string query->fname p= "--%03d--.bin" i

    set        query->zsize query->blksize
    math query->zsize -= 0x10
    math query->zsize -= query->fnamelen

    savepos tmpOFFSET
    get magic long
    goto tmpOFFSET
    string dumpext = ".slz"
    if magic u!= 0x53535A4C # LZSS
        string dumpext = ".raw"

    set fname query->fname
    string fname R= "/" "!"
    string fname R= "\\" "!"

    get NAME basename
    string NAME p= "%s# [%s]%s" NAME fname dumpext
    if magic u== 0x53535A4C # LZSS
        log NAME tmpOFFSET query->zsize
        log NAME tmpOFFSET query->usize

    goto query->zsize 0 SEEK_CUR

    savepos OFFSET

if i != rax->entcount
    print "(%myname%) Expected %rax->entcount% entries, found %i%"

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