Binary specifications are written as C-like 010 Editor Templates. Most data types should be self-explanatory.

Kingdom Hearts 2

IDX

//--- 010 Binary Template
//   Authors: Crazycatz00
//   Version: 0.9.0
//  Category: Game
// File Mask: *.idx
RequiresVersion(3, 1);
LittleEndian();
BitfieldLeftToRight();

typedef struct {
  uint32 CRC;
  uint32 ConflictCRC : 1;
  uint32 Compress    : 1;
  uint32 SectorSize  : 14;  // Compressed size = `(SectorSize + 1) * 2048`
  uint32 SubCRC      : 16;
  uint32 Offset;
  uint32 Size;
} INDEX;
Assert(sizeof(INDEX) == 0x10);

typedef struct {
  int32 Num;
  INDEX __indexes[Num];
} INDEX_BUFF;

INDEX_BUFF idx  <open=true>;

Kingdom Hearts 2.5

KH2.5 shares most of its formats with the PS2 version with some platform-specific changes.

Index

Replaces the PS2 IDX files.

//--- 010 Binary Template
//   Authors: Crazycatz00
//   Version: 0.1.0
//  Category: Game
// File Mask: index.dat
RequiresVersion(3, 1);
BigEndian();

typedef struct {
  uint64 hash;
  uint32 size;
  uint32 index;
} entry  <optimize=true>;
Assert(sizeof(entry) == 0x10);

entry entries[FileSize() / sizeof(entry)];

Common Header

This encapsulates every file in the game (except movies) and is used to bundle updated assets with their original file.

//--- 010 Binary Template
//   Authors: Crazycatz00
//   Version: 0.2.0
//  Category: Game
RequiresVersion(3, 1);
// Endian depends on platform.

typedef struct {
  char   _name[32];
  uint32 _offset;
  uint32 _mage_offset;
  uint32 _size;
  uint32 _pad        <hidden=true>;
} ReplaceInfo  <optimize=true>;
Assert(sizeof(ReplaceInfo) == 0x30);

typedef struct {
  int32 _size;   // Wrapped file size
  int32 _rcnt;
  int32 _pad[2]  <hidden=true>;
} FileInfo  <optimize=false>;
Assert(sizeof(FileInfo) == 0x10);

FileInfo    __fi              <open=true>;
ReplaceInfo __ri[__fi._rcnt];