If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

User:Pslehisl/HIP format (incomplete)

From The Cutting Room Floor
Jump to navigation Jump to search

This is a sub-page of User:Pslehisl.

HIP is an archive file format created and used by Heavy Iron Studios to store and organize game assets. They have the extensions *.hip and *.hop, which store different types of assets.

The HIP format was used in the games:

  • Scooby-Doo! Night of 100 Frights
  • SpongeBob SquarePants: Battle for Bikini Bottom
  • The SpongeBob SquarePants Movie
  • The Incredibles
  • The Incredibles: Rise of the Underminer


Strings

Every string is null-terminated and 2-byte aligned. This means that each string will either have one or two 00s at the end of it. I call it pstring in the specification below, it just means "padded string".

Blocks

A HIP file is made up of a hierarchical structure of blocks, similar to chunks in other formats. Every block starts with an 8-byte header and can contain data as well as other blocks. Its header contains two things:

  • char[4] ID
  • uint32 Length

The ID determines what data/blocks should be expected within the block, and the Length is the total length of all data and blocks within the block (not including the header).

HIPA

PACK

  • PVER
  • PFLG
  • PCNT
  • PCRT
  • PMOD
  • PLAT

PVER

  • uint32 Sub-Version
  • uint16 Client Version (major)
  • uint16 Client Version (minor)
  • uint32 Compatible

PFLG

  • uint32 Unknown Flags

PCNT

  • uint32 Number of Assets
  • uint32 Number of Layers
  • uint32 Size of Largest SOURCE_FILE Asset
  • uint32 Size of Largest Layer
  • uint32 Size of Largest SOURCE_VIRTUAL Asset

PCRT

  • time_t Creation Time
  • HIPString Creation Time String (ddd MMM dd HH:mm:ss yyyy)

PMOD

  • time_t Modification Time

PLAT

Battle for Bikini Bottom:

  • HIPString Target Platform (short)
  • HIPString Target Platform (long)
  • HIPString Format
  • HIPString Language
  • HIPString Game Title

SpongeBob Movie & later games

  • HIPString Target Platform (short)
  • HIPString Language
  • HIPString Format
  • HIPString Game Title

DICT

  • ATOC
  • LTOC

ATOC

  • AINF
  • AHDR[]

AINF

  • uint32 Unknown

AHDR

  • uint32 ID
  • char[4] Type
  • uint32 Offset
  • uint32 Size
  • uint32 Plus
  • uint32 Flags
  • ADBG

ADBG

  • uint32 Custom Alignment
  • HIPString Name
  • HIPString Filename
  • uint32 Checksum

LTOC

  • LINF
  • LHDR[]

LINF

  • uint32 Unknown

LHDR

  • uint32 Type
  • uint32 Number of Assets
  • uint32[] Asset IDs
  • LDBG

LDBG

  • uint32 Custom Alignment

STRM

  • DHDR
  • DPAK

DHDR

  • uint32 Unknown
  • DPAK

DPAK

  • uint32 Padding Amount
  • char[] Padding
  • Asset Data

Structure

  • HIPA
  • PACK
    • PVER
    • PFLG
    • PCNT
    • PCRT
    • PMOD
    • PLAT
  • DICT
    • ATOC
      • AINF
      • AHDR
        • ADBG
    • LTOC
      • LINF
      • LHDR
        • LDBG
  • STRM
    • DHDR
    • DPAK

Format

  • Byte Order: Big Endian
// Package Signature
char[4]             Block ID (HIPA)
long                Length (0)

// Package Header
char[4]             Block ID (PACK)
long                Length (144)

    // Package Version
    char[4]             Block ID (PVER)
    long                Length (12)
    long                Sub-Version (2)
    short               Client Major (10)
    short               Client Minor (15)
    long                Compatible (1)
    
    // Package Flags
    char[4]             Block ID (PFLG)
    long                Length (4)
    long                Flags (0x2E) ? // 02 29 00 2E - BFBB
                                       // 00 00 00 2E - all other games
                                       //               + BFBB GC font2.hip
    
    // Package Count
    char[4]             Block ID (PCNT)
    long                Length (20)
    long                # of Assets (303)
    long                # of Layers (13)
    long                Size of Largest SOURCE_FILE Asset (403704)
    long                Size of Largest Layer (403704)
    long                Size of Largest SOURCE_VIRTUAL Asset (403704)
    
    // Package Creation Date
    char[4]             Block ID (PCRT)
    long                Length (30)
    time_t              Date (09/02/2004 11:30:55)
    pstring             Date String (Thu Sep 02 04:30:55 2004)
    
    // Package Platform (Not present in Scooby Doo and BFBB GC font2.hip)
    char[4]             Block ID (PLAT)
    long                Length (26)

        // Spongebob Movie and later games only
        pstring             Target Platform (GC)
        pstring             Language (US)
        pstring             Format (NTSC)
        pstring             Game (Incredibles)

        // Battle for Bikini Bottom only
        pstring             Target Platform (GC)
        pstring             Target Platform Name (GameCube)
        pstring             Format (NTSC)
        pstring             Language (US Common)
        pstring             Game (Sponge Bob)
    
// Directory Header
char[4]             Block ID (DICT)
long                Length (25854)

    // Asset TOC
    char[4]             Block ID (ATOC)
    long                Length (24250)
    
        // Asset Info
        char[4]             Block ID (AINF)
        long                Length (4)
        long                Unknown (always 0)
        
        // Asset Entries [# of Assets]
            // Asset Header 1
            char[4]             Block ID (AHDR)
            long                Length (46)
            long                Asset ID (0x0013401F) // no idea how it's determined
            char[4]             Asset Type (RWTX)
            long                Asset Offset (515488)
            long                Asset Size (1208)
            long                Asset Plus (8) // padding at end of asset
            long                Asset Flags (0b0110) // 1 - SOURCE_FILE
                                                     // 2 - SOURCE_VIRTUAL
                                                     // 4 - READ_TRANSFORM
                                                     // 8 - WRITE_TRANSFORM
            
                // Asset Debug
                char[4]             Block ID (ADBG)
                long                Length (14)
                long                Alignment (0) // if <= 0, use default alignment
                pstring             Name (ice)
                pstring             Source Filename // for example 
                    "\\Job\sb04\cg\objects_all\dff\krabby_patty_grey_bind.ini"
                pstring             Checksum (0x996D6F3E) ? // no idea what algorithm.
                                                            // game doesn't care if
                                                            // checksum is wrong
            
            ...
            
            // Asset Header N
            
    // Layer TOC
    char[4]             Block ID (LTOC)
    long                Length (1588)
    
        // Layer Info
        char[4]             Block ID (LINF)
        long                Length (4)
        long                Unknown (always 0)
        
        // Layer Entries [# of Layers]
            // Layer Header 1
            char[4]             Block ID (LHDR)
            long                Length (88)
            long                Layer Type (1)
            long                # of Assets in Layer (17)
            
                // Assets [# of Assets in Layer]
                    // Asset 1
                    char[4]             Asset ID (0x215B6561)
                    
                    // Asset 2
                    char[4]             Asset ID (0xD234B549)
                    
                    ...
                    
                    // Asset N
                    
                // Layer Debug
                char[4]             Block ID (LDBG)
                long                Length (4)
                long                Alignment? (always -1) // default alignment
            
            ...
            
            // Layer Header N
            
// Data Stream
char[4]             Block ID (STRM)
long                Length (1159890)

    // Data Header
    char[4]             Block ID (DHDR)
    long                Length (4)
    long                Unknown (always -1)
    
    // Data Pack
    char[4]             Block ID (DPAK)
    long                Length (115870)
    char[x]             Asset Data
         ^ remaining bytes
(Source: Xentax Wiki, Unhipper)

Alignment

Default Alignments

These should be useful for building new HIPs.

Scooby Doo

All types are 16-byte aligned.

BFBB

CSN, SND, and SNDS are 32-byte aligned. CRDT is 4-byte aligned. All other types are 16-byte aligned.

Asset Types

ANIM

Despite having .anm as a common extension, an ANIM asset is not a RenderWare animation.

Specification

Endian:

  • PS2, Xbox - Little Endian
  • GameCube - Big Endian
Header:
    char[4]         Signature (SKB1)
    uint32          unknown
    uint16          Number of Bones
    uint16          Animation Length (number of frames)
    uint32          Total Number of Keyframes
    uint32          unknown
    uint32          unknown
    uint32          unknown
Keyframe List:
    Keyframe[0]:
        uint16          Frame Number
        int16           Rotation X
        int16           Rotation Y
        int16           Rotation Z
        int16           Unknown, possibly Scale (all axes)...
        int16           Position X
        int16           Position Y
        int16           Position Z
    ...
    Keyframe[N-1] // N = total number of keyframes
Frame Timings:
    Frame[0]:
        float           Time of Frame in Seconds
    ...
    Frame[N-1] // N = number of frames
Bone Keyframe Indices:
    Frame[0]:
        uint16          Bone[0] Start Index in Keyframe List
        ...
        uint16          Bone[N-1] Start Index in Keyframe List // N = number of bones
    ...
    Frame[N-1] // N = number of frames

I think what happens is the game reads all the keyframes into one list and then uses the Bone Keyframe Indices to figure out which keyframes should be assigned to each bone.

Rotation and Position values should probably be normalized from (-32768 to 32767) to (-1.0 to 1.0). I don't know yet how the game calculates the actual bone transforms from these values.