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