007 Everything or Nothing

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Not Available
Posts: 9
Joined: Fri Nov 13, 2015 6:09 pm

007 Everything or Nothing

Post by Not Available »

Just a parallel post of something I posted on xentax.

N/A wrote:Yes there are filenames, 8 byte filename field in the 2nd table to be precise. (kinda like fsh texure files in a way)

I unpacked it to the correct file offset within each data stream, simple nested for loop. (and memory file)
Took me longer to debug than to add new code though..

Code: Select all

# James Bond 007 Everything or Nothing
# script for QuickBMS http://aluigi.org/papers.htm#quickbms
#
# initially coded by Alugi, further documentation of .chk file and expansion of functionality by N/A

set INCLUDEARCHIVENAME 0 //boolean to avoid name conflicts if unpacking 2 or more .chk files

comtype dk2 //quickbms.txt doesn't list ea type, I tried dk2 from on quickbms.txt comments, did a byte-by-byte comparison, identical.
get DUMMY long
if DUMMY > 0xffff
    endian big
endif
get DUMMY long
get TABLEWIDTH long //possibly clarified width of table throughout file.
get DATSTREAMCOUNT long //clarified purpose of integer
get OFFSET long
get XFILES long
math TMP = XFILES
math TMP *= TABLEWIDTH
math OFFSET += TMP
for i = 0 < DATSTREAMCOUNT
    get fileTablePtr long //abs offset of first table pointer.
    get filesInStream long //number of files in each stream
    get XSIZE long
    get SIZE long
    get ZERO long
    get FLAGS long
    math OFFSET x= 0x800
    putvarchr MEMORY_FILE XSIZE 0  //allocates internal memory
    if FLAGS & 0x04000000 //little end
        clog MEMORY_FILE OFFSET SIZE XSIZE
    elif FLAGS & 0x00000400 //big end
        clog MEMORY_FILE OFFSET SIZE XSIZE
    else
        log MEMORY_FILE OFFSET SIZE
    endif
    savepos dataStreamTablePtr 0 //saves pointer to revert to after finish parsing datastream
    goto fileTablePtr 0
    for j = 0 < filesInStream
        getdstring NAME 8 0 //gets filename
        //assembles filename to export, to prevent naming conflicts with 2 or more .chk files
        if INCLUDEARCHIVENAME > 0
            get ChkFN BASENAME 0
            String EXPNAME = ChkFN
            String EXPNAME + "."
            String EXPNAME + NAME
        else
            String EXPNAME = NAME
        endif
        get DUMMY long 0
        get DUMMY long 0 //value = compressed file size it seems
        get FILEOFFSET long 0
        get FILESIZE long 0
        log EXPNAME FILEOFFSET FILESIZE -1
    next j
    goto dataStreamTablePtr 0
    //no need to keep fileTablePtr as next dataStream gives the offset for the first file in next data stream.
    math OFFSET += SIZE
next i


So now I'm trying to read the .spt files now.
Other than finding the long value that tells the size of each data chunk, I noticed the Filename+directory seems to be compressed along with the data. (look at master.def)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: 007 Everything or Nothing

Post by aluigi »

Maybe post a sample spt file.
AnonBaiter
Posts: 1125
Joined: Tue Feb 02, 2016 2:35 am

Re: 007 Everything or Nothing

Post by AnonBaiter »

I'll probably have one by the time I have all three versions of the game(PS2, GC, XBOX).