Page 1 of 1

Scarlet Legacy

Posted: Fri Aug 12, 2011 3:01 am
by finale00
The contents of this post was deleted because of possible forum rules violation.

Re: Scarlet Legacy

Posted: Fri Aug 12, 2011 2:51 pm
by WRS
you know what's annoying? i can parse the entire file - but trying to label one last 2 bytes value which has no obvious purpose ..... :twisted:

Re: Scarlet Legacy

Posted: Fri Aug 12, 2011 6:00 pm
by finale00
Impressive. I was looking at it and going "hmm...so what am I looking at"

Re: Scarlet Legacy

Posted: Fri Aug 12, 2011 10:37 pm
by WRS
nice simple example of recursion :)

i only downloaded 2 samples - and the login sample contains more compressed data

Code: Select all

# Scarlet Legacy PAK files
# script for QuickBMS
# WRS, xentax.com

idstring "PAK\0"
get ver byte
getdstring DUMMY 16
get headSize long

get cdOffset long
get cdSize long
get cdZSize long

get dataStart long
get dataSize long

get fileSize long

clog MEMORY_FILE cdOffset cdZSize cdSize

set base string ""

callfunction recursiveDir

cleanexit



startfunction recursiveDir

  get subFils long MEMORY_FILE
  get subDirs long MEMORY_FILE
  get dirName string MEMORY_FILE

  # quick fix for the initial dir

  if dirName != "/"
    string base += /
    string base += dirName
  endif

  for subd = 0 < subDirs
    callfunction recursiveDir
  next subd

  for subf = 0 < subFils
    callfunction extractFile
  next subf

endfunction


startfunction extractFile

  get fileOffs long MEMORY_FILE
  get fileSize long MEMORY_FILE
  get fileName string MEMORY_FILE

  math fileOffs += dataStart

  set filePath string base
  string filePath += /
  string filePath += fileName

  log filePath fileOffs fileSize

endfunction