User Tools

Site Tools


yoshis_story:overlay_files

Overlay Files

Yoshi's Story uses overlays to save memory. The structure of an overlay file is as follows:

u8  text[textSize]
u8  data[dataSize]
u8  rodata[rodataSize]
meta {
    u32 textSize
    u32 dataSize
    u32 rodataSize
    u32 bssSize
    u32 numRelocations
    u32 relocations[numRelocations]
}
u32 metaSize
  • The position of the meta section is calculated by subtracting metaSize from the total size of the overlay file.
  • The .bss section is allocated immediately after the overlay file in memory.

Relocation bitfields:

ss -- rrrr oooooooooooooooooooooooo
BitfieldDescription
sSection (0 = invalid?, 1 = .text, 2 = .data, 3 = .rodata)
-Unused?
rRelocation type (4 = R_MIPS_26, 5 = R_MIPS_HI16, 6 = R_MIPS_LO16)
oOffset

The dynamic linker routine is located at 0x80081430 in RAM.

func_80081430(void *overlay_block, void *meta_section);

The game keeps track of active overlays using an array of the following struct at 0x800DA840 in RAM.

struct OverlayEntry
{
    /*00*/ void *location;     // actual location in memory
    /*04*/ u16   objectId;     // id of the object that this overlay belongs to
           u8    _pad[2];
    /*08*/ void *fakeMemStart; // fake start address
    /*0C*/ void *fakeMemEnd;   // fake end address
};
yoshis_story/overlay_files.txt · Last modified: 2019/10/04 17:14 by shygoo