From 2a8fd84c5043add854a2092e6fe084982ff962c6 Mon Sep 17 00:00:00 2001 From: Michael Schienbein <7663497+mooki000@users.noreply.github.com> Date: Mon, 9 Nov 2026 18:11:28 -0600 Subject: [PATCH] Let the menu test hook put the cursor on a setting's row. The menu test hook's shot of the Screen tab shows only its first screenful of rows, so rows further down (Upscaling, Frame generation) could not be pictured without input, and a hidden test window takes none. NX2NAVI_MENU_TEST_SET now accepts FOCUS=, which calls opt_focus_key for that setting's row: the cursor goes to it and the page scrolls it into view when it is next drawn. It does not switch tabs. Co-Authored-By: Claude Sonnet 5.5 --- runtime/ui/menu.cpp | 15 ++++++++++++--- runtime/ui/menu.h | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 20f15acd..ff4ab868 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -502,7 +502,9 @@ extern "C" void menu_vk_release(void) { // working directory) as menu-test--.png; after the last tab the menu closes. // NX2NAVI_MENU_TEST_SET=:=[,=...][;:...]: cfg_set of each key (NX2NAVI_ prefix // optional) at that presented frame; changes live settings with no input, menu open or not. nx2navi.ini is written only by -// the pseudo-key SAVE=1 (cfg_save, as a row change does; a failed write shows the menu's save note). +// the pseudo-key SAVE=1 (cfg_save, as a row change does; a failed write shows the menu's save note). FOCUS= (the +// NX2NAVI_ prefix optional) puts the cursor on that setting's row and scrolls it into view when the row is next drawn +// (opt_focus_key), so a page's shot shows a row below the first screenful; it does not switch tabs. enum { TAB_SCREEN, TAB_GAME, TAB_SOUND, TAB_CONTROLS, TAB_COUNT }; // Ocarina of Time: the options this port has enum { TEST_PAGE_FRAMES = 30, TEST_SETS = 16 }; struct TestSet { uint64_t frame; char key[64], value[64]; }; @@ -555,8 +557,15 @@ static void test_apply_sets(uint64_t frame) { for (; g_test.next_set < g_test.n_sets && g_test.sets[g_test.next_set].frame <= frame; g_test.next_set++) { const TestSet &t = g_test.sets[g_test.next_set]; rt_log("menu: test hook: frame %llu: %s=%s", (unsigned long long)frame, t.key, t.value); - if (!strcmp(t.key, "NX2NAVI_SAVE")) rt_log("menu: test hook: cfg_save %s", cfg_save() ? "wrote" : "failed"); - else cfg_set(t.key, t.value); + if (!strcmp(t.key, "NX2NAVI_SAVE")) { + rt_log("menu: test hook: cfg_save %s", cfg_save() ? "wrote" : "failed"); + } else if (!strcmp(t.key, "NX2NAVI_FOCUS")) { + char row[80]; + snprintf(row, sizeof row, "%s%s", strncmp(t.value, "NX2NAVI_", strlen("NX2NAVI_")) ? "NX2NAVI_" : "", t.value); + opt_focus_key(row); + } else { + cfg_set(t.key, t.value); + } } } diff --git a/runtime/ui/menu.h b/runtime/ui/menu.h index 82d6b1c3..bcf2fd89 100644 --- a/runtime/ui/menu.h +++ b/runtime/ui/menu.h @@ -10,7 +10,7 @@ // "Continue" and "Quit game". // Test hooks (ui/menu.cpp): NX2NAVI_MENU_TEST=[:] opens the menu at that presented frame and saves // one swapchain shot per tab into NX2NAVI_MENU_TEST_DIR; NX2NAVI_MENU_TEST_SET=:=[,...][;...] sets settings -// at given frames without input (SAVE=1 writes nx2navi.ini). +// at given frames without input (SAVE=1 writes nx2navi.ini, FOCUS= puts the cursor on that setting's row). // // Threads: the event functions are called by the window thread, menu_toggle by whichever thread polls the pad, the // overlay functions by the present path under its lock. ImGui itself runs on the present path only.