Add a debug menu for testing Ocarina of Time: the game's flags by name, the game's speed, and a memory search, on F9.

With debug_menu = 1 (off by default; the Game tab has the switch) F9 opens a panel on the left edge in the
performance overlay's look, with the game in view beside it. ui/menu.cpp lays it out in the settings menu's place,
so its input and the game's blocked pad are the menu's own. Typed characters now reach the menu for its text fields.

Flags: the game's 11,292 on/off flags are read from its game data manager, and a click changes one through the
game's own function on the game's thread at its pad read (runtime/debug_tools.c dbg_tick), so the game applies it
at its next update as it does its own changes. The game knows a flag by the hash of its name only; the names shown
are found in the player's own event flow files, hashed and matched when the panel first opens (2,250 of them from
915 files in 0.2 s), and none is kept in the code. World: Link's position, and a speed factor from 0.05 to 8 that
multiplies the step the runtime gives the game each frame (measured 0.50 at 0.5x). Memory: a search of the heap
for a value of 1, 2 or 4 bytes or a float (about 2 s), narrowed by equals, changed, unchanged, went up or went
down, with a value to set at a place or to hold there every frame.

Tested through the window's own messages: F9 opened it, a click on a flag set that flag in the game, text typed
into the filter narrowed the list, and F9 closed it; a scripted run set and held a value and put it back.

Teleporting, a free camera and starting cutscenes are not in it: writing Link's position, or every copy of it in
the heap, moved him back within three frames, so they need the game's own warp, scene-change and event functions.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
epicmeme546
2026-11-11 06:19:47 -05:00
parent 45d0c87423
commit 5a69bdc91f
13 changed files with 930 additions and 8 deletions

View File

@@ -56,6 +56,11 @@ extern "C" int menu_window_msg(HWND h, UINT m, WPARAM w, LPARAM l, LRESULT *res)
*res = 0;
return 1;
}
if (w == VK_F9 && menu_debug_enabled()) { // the debug menu, while its setting is on
if (!(l & (1 << 30))) menu_debug_toggle();
*res = 0;
return 1;
}
if (w == VK_F10) { // also keeps F10 from opening the window menu
if (!(l & (1 << 30))) menu_perf_cycle();
*res = 0;
@@ -69,6 +74,9 @@ extern "C" int menu_window_msg(HWND h, UINT m, WPARAM w, LPARAM l, LRESULT *res)
if (!menu_is_open()) return 0;
if (ImGuiKey k = key_of(w)) menu_event_key(k, m == WM_KEYDOWN || m == WM_SYSKEYDOWN);
return 0; // F11 and the system keys keep working
case WM_CHAR: // typed text, for the debug menu's fields
if (menu_is_open() && w >= 0x20 && w < 0xd800) menu_event_char((unsigned)w);
return 0;
case WM_MOUSEMOVE:
if (menu_is_open()) menu_event_mouse_pos((float)GET_X_LPARAM(l), (float)GET_Y_LPARAM(l));
return 0;