DKRDS Texture Tileset (File Format)

From Wexos's Wiki
Jump to navigationJump to search

DKRDS Texture Tileset is a nameless file format used in Diddy Kong Racing DS. It stores raw Nintendo DS 8x8 character tile graphics used to build screen backgrounds. It exists in 4bpp (32 bytes per tile) and 8bpp (64 bytes per tile) bit-depth variants, which correspond to different palette modes in the accompanying files. Other filetypes that are commonly associated with texture tilesets, and necessary to create screen backgrounds, are DKRDS Tile Layout, DKRDS Tilemap and DKRDS Palette Bank. Its type identifier in assets.bin is 0x00.

File Format

The file byte order is always little endian.

Header

The file starts with a 4-byte header.

Offset Type Description
0x00 Int32 Number of tiles (T).

Tile Entries

After the header comes the tile entries. The total file size is always 4 + T x size, where size is 32 (4bpp) or 64 (8bpp) depending on the variant.

Variant A

The first variant is used together with a 16-color palette from a DKRDS Palette Bank file. Each tile is an 8x8 pixel block where every pixel is a 4-bit index (0-15) into one of the 16 available palettes.

Tile data layout

Each tile is made of 32 bytes. Pixels are packed two per byte, row-major within the tile:

Offset Description
R * 4 + C / 2 Two pixels from row R: low nibble = pixel at column C (even), high nibble = pixel at column C+1 (odd).

Variant B

The second variant is used together with a 256-color palette from a DKRDS Palette Bank. Each tile is an 8x8 pixel block where every pixel is a full byte (0-255), a direct index into the single 256-color palette.

Tile data layout

Each tile is made of 64 bytes. One byte per pixel, row-major.

Notes

  • Pixel index 0 is always transparent. The corresponding palette entry may contain any value; it is never displayed.
  • Sub-tile IDs referenced from the DKRDS Tile Layout file are direct indices into this file. For Variant B (48-byte two-section layout), the full value must be used without masking, as sub-tile IDs can exceed 1023.
  • The DKRDS Tile Layout file specifies which palette bank to use for each sub-tile. In 4bpp mode this selects one of 16 palettes (each 16 colors x 2 bytes = 32 bytes). In 8bpp mode the whole 512-byte palette block is treated as a single 256-color palette and the palette ID field is ignored.

Tools

The following tools can handle DKRDS Texture Tileset:

  • (none)