1

I'm trying to extract game files which contains textures, meshes etc. I wanted to see how hard would it be to make a texture mod. I just have knowledge on editing graphics from school and youtube tutorials and I'm really lazy and give up on something really fast but I thought if I could work on this game from the very beginning, having a whole structure of files which I could make sense of (not like with ninjaripper) maybe I could motivate myself to do this. I tried to use quickbms script and some tools from xentax and zenhax forums but quickbms gave me and error and the tool did nothing. I'm a total beginner to reverse engineering as I've only touched it because I didn't have much to do.
I've got the header of the file which is EPCK, then the next line I guess is unpacked file size (based on offzip scan seeing almost all files with size of 131072) I have the offset refering to first file in the archive? which is 29, and I have a part which is the beginning of each file? which is ".x" or "x". I've tried to understand quickbms script to see if I could make something of it and what was the reason that I got an error but even though I understood that it makes array which stores the offset I couldn't understand the reason behind the error. So long story short I need help with next steps to unpacking the file. I'd like to understand it completely from the beginning so I could help other beginners or so I could just stop asking for help. I guess it'll be really hard to understand for me since this archive is probably encrypted. Quickbms script gives an error on line 42.
Script: https://drive.google.com/open?id=1C1cGRsaY4Kx9xgL4Ov-VYA61wNTqtzC0
File: https://drive.google.com/open?id=1l2eWZmBwxRe6RraLWQRWBTfkz8zW-PRL

idstring "EPCK"
get DUMMY long
get UNPACKED_SIZE long
get OFFSET long
goto OFFSET
get XSIZE long
get SIZE long
get ZSIZE long
savepos OFFSET
#clog MEMORY_FILE OFFSET ZSIZE SIZE  # unused? zlib compression
math OFFSET += XSIZE
goto OFFSET

endian big
comtype xmemdecompress

get EPCK_SIZE asize
putvarchr MEMORY_FILE UNPACKED_SIZE 0
log MEMORY_FILE 0 0
append
for OFFSET = OFFSET < EPCK_SIZE
    math NEXT_OFFSET = OFFSET
    math SIZE = 0
    for STOP = 0 == 0
        goto NEXT_OFFSET
        get CHUNK_ZSIZE byte
        if CHUNK_ZSIZE == 0xFF
            get CHUNK_SIZE short
            get CHUNK_ZSIZE short
            math STOP = 1
        else
            goto NEXT_OFFSET
            get CHUNK_ZSIZE short
            math CHUNK_SIZE = 0x8000
        endif
        math SIZE += CHUNK_SIZE
        savepos NEXT_OFFSET
        math NEXT_OFFSET += CHUNK_ZSIZE
    next
    math NEXT_OFFSET += 5
    xmath ZSIZE "NEXT_OFFSET - OFFSET"
    clog MEMORY_FILE OFFSET ZSIZE SIZE
    math OFFSET = NEXT_OFFSET
next
append

set NAME string "dump_scc_data.bin"
get SIZE asize MEMORY_FILE
goto 0 MEMORY_FILE
findloc OFFSET binary "\0\0\0\0\0\0\0\0" MEMORY_FILE "" 
if OFFSET == ""
    log NAME 0 SIZE MEMORY_FILE
else
    math OFFSET x= 0x10000
    log MEMORY_FILE2 0 OFFSET MEMORY_FILE
    append
    filexor 0xb7
    xmath TMP "SIZE - OFFSET"
    log MEMORY_FILE2 OFFSET TMP MEMORY_FILE
    append
    filexor ""
    log NAME 0 SIZE MEMORY_FILE2
endif

I am alive hexeditor Offzip

3
  • Hello and welcome to RE.SE! As in the current state the question is likely to be closed. A couple of points - 1. Your links aren't working - need decryption key. 2. Always paste code as text, not an image 3. This is not a support forum for other scripts. 4. Write more on the error you encountered, why do you think it fails and methods that you tried based on your assumptions.
    – sudhackar
    Dec 5 '19 at 3:59
  • Edited, as for the 1st thing I thought that I removed the key but it was another function so files are reuploaded to gdrive. I uploaded screenshot because I thought the file would work so if anyone tried to help with it would use the file anyway (also edited). As for the help with script I asked for it because it could be way easier to explain it to me than to explain whole reverse engineering process. As I wrote in the post I'm a total beginner so I just assumed that there's error with program trying to create a file due to possible mistakes in calculations of offsets or sizes.
    – Hassle
    Dec 8 '19 at 0:56
  • Thanks for help really appreciate it. It's hard to find a decent tutorial made in 2020 that's easy to understand as most of the tutorials on that topic I found were from 2009 and had an outdated dead links to example files. I've edited the post as soon as You pointed the errors but never got additional reply from You so I guess noone is willing to help me here. English is not my primary language but whatever I'm gonna try to learn something with outdated tutorials without example files that I could exercise on. Really loved my experience on that forum thanks!
    – Hassle
    Dec 22 '20 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.