DKRDS Model (File Format): Difference between revisions

From Wexos's Wiki
Jump to navigationJump to search
mNo edit summary
No edit summary
Line 6: Line 6:


== Header ==
== Header ==
The file starts with a header that is 48 bytes long.
The file starts with a header that is 48 bytes long. Unused models that might use an older version of the format have been seen with a 44-byte long header.


{|class=wikitable
{|class=wikitable
! Offset !! Type !! Description
! Offset !! Type !! Description
|-
|-
| 0x00 || Byte[8] || {{unknown-left|'''Unknown flags'''.}}
| 0x00 || UInt16 || '''Size flag'''. This flag indicates how much the vertex data is divided by in the short-to-float conversion:
* 0 = Divided by 16 (?)
* 1 = Divided by 4096 (?)
|-
|-
| 0x08 || Int32 || '''Number of textures'''.
| 0x02 || UInt16 || {{unknown-left|'''Unknown various flags'''. Each bit seems to correspond to a different flag:}}
* 0 = If 1, bone IDs are attached to each vertex
|-
|-
| 0x0C || Byte[16] || {{unknown-left|'''Unknown'''. Padding?}}
| 0x04 || UInt16 || '''Number of models'''.
|-
|-
| 0x1C || Int32 || '''[[#Model Data|Model Data]]''' offset.
| 0x06 || UInt16 || {{unknown-left|'''Unknown'''.}}
|-
|-
| 0x20 || Int32 || '''[[#Texture Data|Texture Group]]''' offset.
| 0x08 || UInt16 || '''Number of textures'''.
|-
| 0x0A || UInt16 || {{unknown-left|'''Unknown'''.}}
|-
| 0x0C || Int32 || {{unknown-left|'''Unknown'''.}}
|-
| 0x10 || Byte[12] || {{unknown-left|'''Unknown'''. Padding? In earlier versions this would be an 8-byte padding instead}}
|-
| 0x1C || Int32 || '''[[#Model Group|Model Group]]''' offset.
|-
| 0x20 || Int32 || '''[[#Texture Group|Texture Group]]''' offset.
|-
|-
| 0x24 || Int32 || '''[[#Texture Reference Table|Texture Reference Table]]''' offset.
| 0x24 || Int32 || '''[[#Texture Reference Table|Texture Reference Table]]''' offset.
|-
|-
| 0x28 || Int32 || {{unknown-left|'''Unknown'''. Always the same value as the texture reference table offset?}}
| 0x28 || Int32 || {{unknown-left|'''Unknown'''.}}
|-
|-
| 0x2C || Int32 || {{unknown-left|'''Unknown'''. Sometimes 0, sometimes the size of the entire file?}}
| 0x2C || Int32 || {{unknown-left|'''Unknown'''.}}
|-
|-
| 0x30 || colspan=2 {{unknown|End of header}}
| 0x30 || colspan=2 {{unknown|End of header}}
|}
|}


== Model Data ==
== Model Group ==
''TBD''
''TBD''


== Texture Group ==
== Texture Group ==
This section starts with a 4-byte header:
See '''[[DKRDS Texture Group]]'''.


{|class=wikitable
== Texture Reference Table ==
! Offset !! Type !! Description
This section lists each 4-byte texture UID directly, in order. The index of each reference is used in the model data to know which texture corresponds to which triangle.
|-
| 0x00  || UInt16 || '''Number of textures'''.
|-
| 0x02 || UInt16 || {{unknown-left|'''Unknown'''.}}
|-
| 0x04 || colspan=2 {{unknown|End of Texture Group header, start of Texture Entries}}
|}
 
=== Texture Entry ===
After the texture data header there's an entry for each texture. This entry consists of a 20-byte header followed by the texture data. The textures are referenced in the [[#Texture Reference Table|Texture Reference Table]] using 4-byte UIDs.


{|class=wikitable
{|class=wikitable
! Offset !! Type !! Description
! Offset !! Type !! Description
|-
|-
| 0x00 || Byte[4] || '''Texture UID'''. Referenced as is in the [[#Texture Reference Table|Texture Reference Table]].
| 0x00 || Byte[4]['''Number of Textures in [[#Texture Group|Texture Group]]'''] || '''Texture UID'''.
|-
| 0x04 || Int32 || {{unknown-left|'''Unknown'''.}}
|-
| 0x08 || Byte || '''Texture format''':
* 1 = A3I5
* 2 = 4-Color Palette
* 3 = 16-Color Palette
* 4 = 256-Color Palette
* 5 = 4x4-Texel Compressed
* 6 = A5I3
* 7 = Direct Color (RGB5551)
|-
| 0x09 || Byte || {{unknown-left|'''Unknown'''.}}
|-
| 0x0A || Byte || {{unknown-left|'''Unknown'''.}}
|-
| 0x0B || Byte || {{unknown-left|'''Unknown'''.}}
|-
| 0x0C || Byte[4] || {{unknown-left|'''Unknown'''.}}
|-
| 0x10 || UInt16[2] || '''Texture dimensions'''.
|-
| 0x14 || colspan=2 {{unknown|End of Texture Entry header, start of texture data}}
|}
|}
== Texture Reference Table ==
This section lists each 4-byte texture UID directly, in order.


= Tools =
= Tools =

Revision as of 13:17, 22 June 2024

Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling.

DKRDS Model is the nameless file format used in Diddy Kong Racing DS that stores models and textures.

File Format

The file byte order is always little endian.

Header

The file starts with a header that is 48 bytes long. Unused models that might use an older version of the format have been seen with a 44-byte long header.

Offset Type Description
0x00 UInt16 Size flag. This flag indicates how much the vertex data is divided by in the short-to-float conversion:
  • 0 = Divided by 16 (?)
  • 1 = Divided by 4096 (?)
0x02 UInt16 Unknown various flags. Each bit seems to correspond to a different flag:
  • 0 = If 1, bone IDs are attached to each vertex
0x04 UInt16 Number of models.
0x06 UInt16 Unknown.
0x08 UInt16 Number of textures.
0x0A UInt16 Unknown.
0x0C Int32 Unknown.
0x10 Byte[12] Unknown. Padding? In earlier versions this would be an 8-byte padding instead
0x1C Int32 Model Group offset.
0x20 Int32 Texture Group offset.
0x24 Int32 Texture Reference Table offset.
0x28 Int32 Unknown.
0x2C Int32 Unknown.
0x30 End of header

Model Group

TBD

Texture Group

See DKRDS Texture Group.

Texture Reference Table

This section lists each 4-byte texture UID directly, in order. The index of each reference is used in the model data to know which texture corresponds to which triangle.

Offset Type Description
0x00 Byte[4][Number of Textures in Texture Group] Texture UID.

Tools

The following tools can handle DKRDS Model:

  • (none)