Skip to content
MegaMech edited this page Aug 6, 2022 · 4 revisions

The Kart DMA (Direct Memory Access) file loads the player's kart textures. These are the animated kart textures you see while playing the game. Each one needs to be loaded from the cartridge into memory, decompressed, and rendered every frame.

Definitions

  • Direct Memory Access - An N64 OS function that grabs memory from cartridge and places it in ram.
  • Palette - A special file containing common pixels from one or more textures. A method to save data. Lets say the colour rgb(253, 49, 193) exists ten thousand times throughout a variety of textures. A palette allows this pixel to exist only once, stripping that pixel out of all the textures that its applicable to. This data can be displayed like a texture. Calling it a texture is a bit of a misnomer. It's really just a binary file represented by hexadecimal numbers.

This functionality can be relatively confusing as its setup in a rather odd manner.

First off, lets look at these two arrays. They act as buffers that contain this dynamically changing content.

u8 D_802DFB80[2][2][0x4900];
u16 D_802F1F80[2][4][0x800];

D_802DFB80

The first contains mio0 compressed kart textures. Laid out as such:

BLOCK 1 SECTION 1
802DFB80 0x920       // size of 0x920
802E04A0 0x920       // All of the mio0 files are smaller than 0x920 remaining space is filled with zeros.
802E0DC0 0x920       // One mio0 file per member (there are never two files in one 0x920, only one).
802E16E0 0x920
802E2000 0x920
802E2920 0x920
802E3240 0x920
802E3B60 0x920
802E4480 // BLOCK 1 SECTION 2 START

There are two blocks, each containing two sections, which each in-turn contains eight textures. One section is the size of 0x4900.

An easier way to imagine this is: four blocks each containing eight textures. However, the developers appear to not have constructed the data in this manner.

In-code, the game accesses this data like so:

D_802DFB80[arg4][arg3][arg1 * 0x920],

Parameters:

arg1: 0-7 // Selects a texture
arg4: 0-1 // Selects Block 1 or 2 (sections 1 and 2 or sections 3 and 4).
arg3: 0-1 // Selects the first or second section in the chosen block. (1 or 2 || 3 or 4).

D_802F1F80

This array contains kart and tyre colour palettes. Laid out as such:

802F1F80 0x200 // mio0 files like above
802F2180 0x200
802F2380 0x200
802F2580 0x200
802F2780 0x200
802F2980 0x200
802F2B80 0x200
802F2D80 0x200
802F2F80 // BLOCK 1 SECTION 2 START

There are two blocks containing two sections, which each in-turn contains eight members. Each member has two elements:

Kart palette texture: 0x180
Tyre palette texture: 0x80 // total size: 0x200

Both textures are not compressed and the tyre palette data may alter dynamically depending on environmental factors [Needs verification] such as driving through mud.

Clone this wiki locally