Content cache

DS game only γ¨γ‚“γŒγ‚Šγƒœγ‚¦γ‚·γ¨γŠγ—γ‚ƒγ‚Œγͺまほう぀かい The field guide documents the DS game's internals.

Runtime asset loader. Master table at 0x020AA740, 712 references. Path strings live in a 28 KB region at 0x020A1000.

Master cache table

SymbolRAMRefs in arm9Role
master cache table0x020AA740712Indexed pointer-to-asset table; each slot identifies one loaded resource.
path string region0x020A1000..0x020A8000β€”~28 KB of static path strings (131 unique paths). Each path is a NUL-terminated ASCII string like "item/itemicon.ofs".
game state struct (pointer)0x021A55C0750Pointer to runtime game state; most engine functions take this in R0.

Generic loader

All asset load requests funnel through the generic loader FUN_02009894:

FUN_02009894(
    void *table,        // r0 β€” usually 0x020AA740
    const char *path,   // r1 β€” pointer into 0x020A1000..0x020A8000
    u16 sub_index,      // r2 β€” TOC entry index inside the container
    u32 size,           // r3 β€” expected payload size (or 0 = use TOC length)
    u32 flag1,          // stack
    u32 type_code,      // stack β€” e.g. 0x7800 for item icons
    u32 flag2,          // stack
    u32 flag3           // stack
);

The loader reads the file at path from the NDS filesystem, decompresses it if LZS-wrapped, walks its RESO TOC to find sub_index, and writes a pointer/handle into the master cache table at the slot the caller has prepared.

Documented loader call sites

CallerPathAsset class
ov0032d/buyitem.lzsShop chrome
ov0032d/itemorderwnd.lzsShop order window
arm9 0x02052D20item/itemicon.ofsItem icon (per item-icon index)
arm9 0x02052D20global.lzs entry 5Item icon palette (256-color)
arm9 (boot)global.lzs entry 0Font (NFTR)
ov1372d/inputmagic/mgcall.ofsMagic glyph atlas
ov1372d/inputmagic/mgc80.ofsMagic glyph palette
variousdata/npc/NpcDataOfs.ofsNPC personality / portrait data
variousdata/item/itemname.ofsItem name strings
map overlaysmap/static.lzs3D map textures
map overlaysmap/weather/*.ofsWeather 3D models
title screen2d/mainmenu/title_pack.ofsTitle-screen background variants (5 seasons)
title screentitle/titledata.lzsTitle splash sprites

Cache table entry layout (inferred)

Each slot in the master table is a struct accessed by:

struct CacheEntry {
    u32   flags;
    void *data_ptr;            // points into a heap-allocated decompressed RESO blob
    u32   size;
    u32   path_hash_or_id;
    ...
};

Exact layout has not been fully decoded; the loader and consumers agree on offsets via LDR/STR with specific [rN, #imm] offsets (e.g. [r5, #0x84] for the item-icon sub-index).

Generic asset loader at 0x02052D20

Disassembly (THUMB, item-icon site):

02052D4C  LDR  R0, [PC, #0x30]      ; r0 = 0x020AA740   (master table)
02052D4E  LDR  R1, [PC, #0x34]      ; r1 = 0x020A55D8   ("item/itemicon.ofs")
02052D50  LSLS R3, R3, #0xA          ; r3 = 0x7800       (flags / type_code)
02052D52  BLX  0x02009894            ; call generic file-loader
                                     ; r2 = u16 sub-index from caller's [r5+0x84]

Source