From CloudModding OoT Wiki

Game States are the top level states of the Zelda 64 engine.

Types of Game States

Ocarina of Time has six normally usable game states:

Core Game States
Code File Description
n/a Initial Game State
ovl_title Displays the Nintendo Logo
ovl_opening Initializes the Title Screen cutscene
n/a Main Game
ovl_file_choose File Select menu
ovl_select Map Select menu

Game State Table

code (File)
Game State
VersionOffsetVRomVRam
Debug1029D000B969D000B96AF08011F8308011F950
NTSC 1.00E02A000B672A000B673C0800F1340800F1460
PAL MQ0DD29000B6529000B653B0800EE190800EE2B0

This table defines the top-level states the game can execute in (Map Select, Boot Logo, the playable game itself, etc.), and reserves variable space for each state

Format

/* 0x00 */ uint RamStart; //location of overlay in ram, or 0 in rom
/* 0x04 */ int VRomStart; //if applicable
/* 0x08 */ int VRomEnd;   //if applicable
/* 0x0C */ int VRamStart; //if applicable

/* 0x10 */ int VRamEnd;   //if applicable
/* 0x14 */ uint unknown2;
/* 0x18 */ ptr VRamInitialization; //initializes and executes the given context
/* 0x1C */ ptr VRamDeconstructor; //"deconstructs" the context, and sets the next context to load

/* 0x20-0x2B */ //unknown

/* 0x2C */ int AllocateSize; //Size of initialized instance of the overlay

Debug Rom

VRom Start VRom End VRam Start VRam End VRam
Initialization
VRam
Deconstructor
Instance
Variables
File Description
00000000 00000000 00000000 00000000 800C4104 800C40FC 000000A4 N/A
00BCFAC0 00BD2B20 80800B90 80803BF0 80801E44 80801E0C 00000240 ovl_select Map Select
00BCEF30 00BCFAC0 80800000 80800B90 80800878 80800858 000001E8 ovl_title Nintendo Logo (on Boot)
00000000 00000000 00000000 00000000 800BCA64 800BC8EC 00012518 game_play Main Game
00BD2B20 00BD2C70 80803BF0 80803D40 80803CAC 80803CA4 000001D0 ovl_opening Initializes the game into the title screen
00BD2C70 00BE2730 80803D40 80813820 80811A20 80811A18 0001CAE0 ovl_file_choose File Select

NTSC 1.0

VRom Start VRom End VRam Start VRam End VRam
Initialization
VRam
Deconstructor
Instance
Variables
File Description
00000000 00000000 00000000 00000000 800A0748 800A073C 000000A4 N/A
00B9E400 00BA1160 808009C0 80803720 80801C14 80801C08 00000240 ovl_select Map Select
00B9DA40 00B9E400 80800000 808009C0 808007B0 80800750 000001E8 ovl_title Nintendo Logo (on Boot)
00000000 00000000 00000000 00000000 8009A750 8009A5C0 00012518 game_play Main Game
00BA1160 00BA12C0 80803720 80803880 808037E8 808037DC 000001D0 ovl_opening Initializes the game into the title screen
00BA12C0 00BB11E0 80803880 808137C0 80812394 80812388 0001CAD0 ovl_file_choose File Select

PAL MQ

VRom Start VRom End VRam Start VRam End VRam
Initialization
VRam
Deconstructor
Instance
Variables
File Description
00000000 00000000 00000000 00000000 800A02D8 800A02CC 000000A4 N/A
00B8AA80 00B8D700 80800850 808034D0 80801A40 80801A34 00000240 ovl_select Map Select
00B8A230 00B8AA80 80800000 80800850 808006C0 808006A0 000001E8 ovl_title Nintendo Logo (on Boot)
00000000 00000000 00000000 00000000 8009A4CC 8009A360 00012518 game_play Main Game
00B8D700 00B8D860 808034D0 80803630 80803598 8080358C 000001D0 ovl_opening Initializes the game into the title screen
00B8D860 00B9C470 80803630 80812260 80810C54 80810C48 0001CAE0 ovl_file_choose File Select


prenmi State

The prenmi game state is an otherwise unusable game state that does not appear on the game state overlay table. In the Debug Rom, it is invoked by having a controller plugged into port two during boot-up, then resetting the game at any time. This will force a swap to the prenmi state, but the state will not be invoked due to it not having a record on the on the overlay table; instead the graph thread will silently end execution.

The prenmi game state has a working draw function. It runs at 60 fps, and draws for a few frames before exiting. It draws a horizontal line across the screen that moves upwards vertically, as well as the normal input display in the bottom right corner.

Notes

//Variables
8012DBC0 s32 //set to 1 on boot if a controller is plugged into port 2
//Functions
80092330 //prenmi_move
80092384 //prenmi_draw
800924B0 //prenmi_destructor
800924B8 //prenmi_init