Real Racing Next. Decrypted format.

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Vitalik
Posts: 35
Joined: Wed Apr 07, 2021 9:12 am

Real Racing Next. Decrypted format.

Post by Vitalik »

Who can help decrypted format .pack from Real Racing Next ?
Thank.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Real Racing Next. Decrypted format.

Post by aluigi »

This format is horrible.
There is no encryption, the complex index table is just a gzip at the beginning with the "ZBDS" magic.
I can see the entries containing the relative offset and size of each file but they are mixed with other messy data, the names are referenced easily but they are part of the directory/asset structure.
Very boring to do anything.

Anyway I leave here my work-in-progress script that parses some fields of the index table (it's for debugging, DO NOT USE IT!!!):

Code: Select all

comtype gzip
idstring "PACK"
get INFO_SIZE long
get DATA_OFF long
savepos HEADER_SIZE

idstring "ZBDS"
get SIZE long
savepos OFFSET
xmath ZSIZE "(HEADER_SIZE + INFO_SIZE) - OFFSET"
clog MEMORY_FILE OFFSET ZSIZE SIZE

idstring MEMORY_FILE "SBIN"
get DUMMY long MEMORY_FILE  # ever 4
get MEM_SIZE asize MEMORY_FILE
for MEM_OFF = 0 != MEM_SIZE
    getdstring TYPE_NAME 4 MEMORY_FILE
    get TYPE_SIZE long MEMORY_FILE
    get TYPE_CRC long MEMORY_FILE
    savepos MEM_OFF MEMORY_FILE

    # for debugging
    #getdstring DUMMY TYPE_SIZE MEMORY_FILE

      if TYPE_NAME == "STRU"

    elif TYPE_NAME == "FIEL"

    elif TYPE_NAME == "OHDR"
        get DUMMY long MEMORY_FILE
        get DUMMY long MEMORY_FILE
        get DUMMY long MEMORY_FILE
        get DUMMY long MEMORY_FILE
        get DUMMY long MEMORY_FILE

    elif TYPE_NAME == "DATA"

        # messy stuff here
        # OFFSET (+DATA_OFF), SIZE, ZERO

    elif TYPE_NAME == "CHDR"
        xmath NAMES "TYPE_SIZE / (4 + 4)"
        for i = 0 < NAMES
            get NAME_OFF[i] long MEMORY_FILE
            get NAME_SIZE[i] long MEMORY_FILE
        next i

    elif TYPE_NAME == "CDAT"
        for i = 0 < NAMES
            math NAME_OFF[i] + MEM_OFF MEMORY_FILE
            goto NAME_OFF[i] MEMORY_FILE
            getdstring NAME NAME_SIZE[i] MEMORY_FILE
        next i

    endif

    math MEM_OFF + TYPE_SIZE
    goto MEM_OFF MEMORY_FILE
next
Vitalik
Posts: 35
Joined: Wed Apr 07, 2021 9:12 am

Re: Real Racing Next. Decrypted format.

Post by Vitalik »

aluigi wrote:This format is horrible.
There is no encryption, the complex index table is just a gzip at the beginning with the "ZBDS" magic.
I can see the entries containing the relative offset and size of each file but they are mixed with other messy data, the names are referenced easily but they are part of the directory/asset structure.
Very boring to do anything.

Anyway I leave here my work-in-progress script that parses some fields of the index table (it's for debugging, DO NOT USE IT!!!):

Code: Select all

comtype gzip
idstring "PACK"
get INFO_SIZE long
get DATA_OFF long
savepos HEADER_SIZE

idstring "ZBDS"
get SIZE long
savepos OFFSET
xmath ZSIZE "(HEADER_SIZE + INFO_SIZE) - OFFSET"
clog MEMORY_FILE OFFSET ZSIZE SIZE

idstring MEMORY_FILE "SBIN"
get DUMMY long MEMORY_FILE  # ever 4
get MEM_SIZE asize MEMORY_FILE
for MEM_OFF = 0 != MEM_SIZE
    getdstring TYPE_NAME 4 MEMORY_FILE
    get TYPE_SIZE long MEMORY_FILE
    get TYPE_CRC long MEMORY_FILE
    savepos MEM_OFF MEMORY_FILE

    # for debugging
    #getdstring DUMMY TYPE_SIZE MEMORY_FILE

      if TYPE_NAME == "STRU"

    elif TYPE_NAME == "FIEL"

    elif TYPE_NAME == "OHDR"
        get DUMMY long MEMORY_FILE
        get DUMMY long MEMORY_FILE
        get DUMMY long MEMORY_FILE
        get DUMMY long MEMORY_FILE
        get DUMMY long MEMORY_FILE

    elif TYPE_NAME == "DATA"

        # messy stuff here
        # OFFSET (+DATA_OFF), SIZE, ZERO

    elif TYPE_NAME == "CHDR"
        xmath NAMES "TYPE_SIZE / (4 + 4)"
        for i = 0 < NAMES
            get NAME_OFF[i] long MEMORY_FILE
            get NAME_SIZE[i] long MEMORY_FILE
        next i

    elif TYPE_NAME == "CDAT"
        for i = 0 < NAMES
            math NAME_OFF[i] + MEM_OFF MEMORY_FILE
            goto NAME_OFF[i] MEMORY_FILE
            getdstring NAME NAME_SIZE[i] MEMORY_FILE
        next i

    endif

    math MEM_OFF + TYPE_SIZE
    goto MEM_OFF MEMORY_FILE
next

Thank you very much for your help and time spent on this... Maybe in future some man do final script for this.