The Cave ~.h and ~.p files

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
spider91
Posts: 233
Joined: Sun Aug 24, 2014 5:26 pm

The Cave ~.h and ~.p files

Post by spider91 »

I've been working on translation of the game to russian on android. And all the doublefine tools don't work correct on android version. So here is script for android version of the game (based on aluigi script for brutal legend). Hope it will be usefull for someone.

Code: Select all

open FDDE "~h" 0
open FDDE "~p" 1

endian big
idstring dfpf
get DUMMY long
get DUMMY long
get DUMMY long  # align?
get DUMMY long
get NAME_OFF long
get DUMMY long
get DUMMY long
get FILES long

math INFO_SIZE = FILES
math INFO_SIZE <<= 4
math INFO_OFF = NAME_OFF
math INFO_OFF -= INFO_SIZE
goto INFO_OFF

for i = 0 < FILES
    get SIZE threebyte
    get NAMEX threebyte
    get DUMMY short
    get OFFSET long
    get ZSIZE threebyte
    get COMTYPE byte

    savepos INFO_OFF
    math NAMEX >>= 3
    math NAMEX += NAME_OFF
    goto NAMEX
    get NAME string
    goto INFO_OFF

    if COMTYPE & 2
        comtype XMemDecompress
    else
        comtype zlib
    endif

    math ZSIZE >> 3
    math OFFSET >>= 2
    if SIZE == ZSIZE
        log NAME OFFSET SIZE 1
    else
   math SIZE *= 10
        clog NAME OFFSET ZSIZE SIZE 1
    endif
    math OFFSET += ZSIZE
next i
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The Cave ~.h and ~.p files

Post by aluigi »

Interesting, this format is used not only by Brutal Legend but also by Stacking.
It's one of those file formats that differ from game to game like the audio PCK used in All Points Bulletin, or namco AR / Nascar 2011, Company of Heroes /Warhammer 40000 / Homeworld... they are boring :(