Merge pull request #235: Add Amiibo support via nfp:user IPC emulation and ImGui picker (leonelalej)

The Amiibo page reads its text from the catalog (UI_MENU_AMIIBO_*, in all four menu languages)
instead of English literals, and its status line keeps an id and the file name so it follows a
menu language change. Folders show as name/ in the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-01 12:18:45 +03:00
commit 97e666ce2f
13 files changed
+1253 -27

No files matched your search

+8 -3
View File
@@ -30,10 +30,12 @@ static int g_font_bad;
#pragma clang diagnostic ignored "-Wunused-function"
#include "imstb_truetype.h"
#pragma clang diagnostic pop
#include "ui/amiibo_page.h"
#include "ui/binds_page.h"
#include "ui/option_rows.h"
extern "C" {
#include "amiibo.h"
#include "cfg.h"
#include "fs.h"
#include "input.h"
@@ -368,7 +370,7 @@ extern "C" void menu_vk_release(void) {
// TOTK_MENU_TEST_SET=<frame>:<key>=<value>[,<key>=<value>...][;<frame>:...]: cfg_set of each key (TOTK_ prefix
// optional) at that presented frame; changes live settings with no input, menu open or not. totk.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).
enum { TAB_SCREEN, TAB_GAME, TAB_SOUND, TAB_CONTROLS, TAB_MENU, TAB_ADVANCED, TAB_COUNT };
enum { TAB_SCREEN, TAB_GAME, TAB_SOUND, TAB_CONTROLS, TAB_AMIIBO, TAB_MENU, TAB_ADVANCED, TAB_COUNT };
enum { TEST_PAGE_FRAMES = 30, TEST_SETS = 16 };
struct TestSet { uint64_t frame; char key[64], value[64]; };
static struct {
@@ -978,8 +980,9 @@ static void tab_advanced(float scale) {
}
}
static const UiTextId kTabNames[TAB_COUNT] = {UI_MENU_TAB_SCREEN, UI_MENU_TAB_GAME, UI_MENU_TAB_SOUND,
UI_MENU_TAB_CONTROLS, UI_MENU_TAB_MENU, UI_MENU_TAB_ADVANCED};
static const UiTextId kTabNames[TAB_COUNT] = {UI_MENU_TAB_SCREEN, UI_MENU_TAB_GAME, UI_MENU_TAB_SOUND,
UI_MENU_TAB_CONTROLS, UI_MENU_TAB_AMIIBO, UI_MENU_TAB_MENU,
UI_MENU_TAB_ADVANCED};
static int g_tab; // the tab shown
static int g_tab_request = -1; // select this tab at the next layout; -1 none
static int g_focus_page = -1; // this tab's first row takes the cursor once it is shown; -1 none
@@ -1030,6 +1033,7 @@ static void layout_menu(uint32_t w, uint32_t h, float scale) {
case TAB_GAME: tab_game(scale); break;
case TAB_SOUND: tab_sound(scale); break;
case TAB_CONTROLS: tab_controls(scale); break;
case TAB_AMIIBO: tab_amiibo(scale); break;
case TAB_MENU: tab_menu(scale); break;
case TAB_ADVANCED: tab_advanced(scale); break;
}
@@ -1315,6 +1319,7 @@ extern "C" int menu_overlay_frame(uint64_t frame, const MenuTarget *t, const cha
if (g_test.next_set < g_test.n_sets && frame >= g_test.sets[g_test.next_set].frame) test_apply_sets(frame);
if (g_perf_save.exchange(0)) cfg_save();
perf_tick(plat_now_ns(), t);
amiibo_tick();
bool open = g_open.load(std::memory_order_relaxed);
if (!open) {
if (g_save_pending) g_save_pending = opt_save_tick(1); // closed: the last change goes to totk.ini now