DKRDS Interactor (File Format)

From Wexos's Wiki
Jump to navigationJump to search
Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling.

DKRDS Interactor is the nameless file format used in Diddy Kong Racing DS that stores a model's bone hierarchy and indexed keyframe poses for each bone. Bones defined here are referenced by ID from a corresponding DKRDS Model file's vertex data. Its type identifier in assets.bin is 0x2E.

File Format

The file byte order is always little endian.

Header

The file starts with a header that is 68 bytes long.

Offset Type Description
0x00 UInt16 Mode flags. AXXX XXXX XXXX XXBB:
  • A: Identity scale. When set, the scale channel is skipped and every bone's scale is set to 1.
  • B: Decode mode. Unknown exact usage. The format described here is documented from files that use mode 2.
0x02 UInt16 Unknown.
0x04 Int32 Unknown.
0x08 Int32 Unknown.
0x0C Int32 Number of bones (B).
0x10 Int32 Skeleton Tree offset.
0x14 Int32 Unknown. Number of bones again?
0x18 Int32 Unknown.
0x1C Int32 Number of frames (F).
0x20 Int32 Unknown. Affects interpolation between frames?
0x24 Int32 Axis Data offset.
0x28 UInt16 Bits per frame (I). Total size in bits of one frame's worth of keyframe index data across all bones (B * (PIW + RIW + SIW)).
0x2A UInt16 Position Value Width (PVW) in bits per component.
0x2C UInt16 Position Index Width (PIW) in bits.
0x2E UInt16 Rotation Value Width (PVW) in bits per component.
0x30 UInt16 Rotation Index Width (RIW) in bits.
0x32 UInt16 Scale Value Width (SVW) in bits per component.
0x34 UInt16 Scale Index Width (SIW) in bits.
0x36 UInt16 Unknown. Maybe padding?
0x38 Int32 Position Value Stream offset (PVO), relative to the Axis Data section.
0x3C Int32 Rotation Value Stream offset (RVO), relative to the Axis Data section.
0x40 Int32 Scale Value Stream offset (SVO), relative to the Axis Data section.
0x44 End of header

Skeleton Tree

This section defines the hierarchy of the bones, and it's always 2 * (B + 1) in length. The first entry corresponds to a default root bone and its parent index is always 0xFFFF (no parent).

Offset Type Description
0x00 UInt16[B + 1] Parent bone indices for each bone.

Axis Data

This entire section defines up to three channels (position, rotation and scale), each with its own index bit width and value bit width.

Offset Size Description
0x00 Ceiling(I * F / 32) * 4 Index Bitstream. For frame F, the bit cursor starts at I * F. Then for each bone in order, read unsigned bits for its keyframe indices in the order PIW + RIW + SIW (this last one skipped if identity scale mode is set in the header).

Bits are packed with no padding between bones or channels, and multiple bones can share the same index. The end position is aligned by 4.

0x00 + PVO Variable Position Value Stream. A sequence of XYZ signed entries (PVW bits per component). Entry K starts at bit offset K * 3 * PVW within this stream. Same coordinate scale as DKRDS Model's vertex positions.
0x00 + RVO Variable Rotation Value Stream. Same layout as the Position Value Stream, using RVW instead of PVW. A full rotation equals 2^RVW; each component is a plain signed angle in units of 1/2^RVW of a full rotation.
0x00 + SVO Variable Scale Value Stream. Same layout as the two previous streams. Final values are divided by 4096. Not present when identity scale mode is set in the header.

Tools

The following tools can handle DKRDS Interactor:

  • (none)