Skip to content

amiibo Part A: Games find your amiibo on Peanuts' own stand, no keys needed - #711

Open
davdxpx wants to merge 1 commit into
igawa6:mainfrom
davdxpx:amiibo-stand
Open

davdxpx wants to merge 1 commit into
igawa6:mainfrom
davdxpx:amiibo-stand

Conversation

@davdxpx

@davdxpx davdxpx commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Games that read amiibo find none today. The host answers that the game is searching but never finds a tag, so Breath of the Wild's daily chests, Super Mario Odyssey's costumes and Smash's figure players stay closed. This PR gives the host a stand of its own, and the app places the player's amiibo on it. Issue #582, also asked in #647. #668 discusses a reader built on the player's own key_retail.bin; this stand needs no keys at all.

Builds directly on main 0.1.8, with nothing else under it. Part B (#712) adds the game page's amiibo area. Part C (#713) adds the quick menu's tab, the card over the game and the show.

What players get

  • Games find an amiibo. One placed on Peanuts' stand is found at the game's search and read and written as on a Switch. Each game keeps its own data on it. A second after the game is done with it, it leaves the stand on its own, as a lifted figure does. One placed before the game looks is found at its next search.
  • No amiibo keys, no figure dumps. The stand sits above the figures' encryption: games get the tag, the model, the owner and their own data as plain values. Peanuts never asks for, reads or ships keys, and an amiibo from the built-in list works without a dump.
  • Owner and nickname. The owner is the player's Mii from Peanuts' users, and the nickname is the character's name.
  • Every amiibo is known. AmiiboAPI's table ships with the app: 932 amiibo, which of 54 Switch games use each one, and what for. It is MIT licensed and credited in Settings › About.
  • Your own amiibo. .bin files, folders and ZIP packs are read for the amiibo's ID and UID only. Nothing else of a dump is kept.
  • What a game once wrote on the real figure stays in the dump. That part of a dump is encrypted with the figure's keys, so a game starts on a Peanuts amiibo as on a new one and keeps its data in Peanuts from then on.
  • For testing: the adb control's game do=amiibo value=status|off|<id>|own:<key>.

How it is built

  • dm/peanuts/peanuts_amiibo.c takes over nn::nfc and nn::nfp in the Android host in place of hle_sdk16.c's block: one marked pair of lines (#ifndef PN_AMIIBO), with the same registrations (the test compares the lists), and CMake defines PN_AMIIBO for both host kinds.
    • States, events and results follow the SDK's (module 115).
    • Each game's area is kept per access ID and written by a helper thread to files/amiibo/own/<id>-<uid>/.
    • The app talks to it through Bridge.amiiboStatus, amiiboPlace and amiiboRemove.
  • dev.peanuts.amiibo holds the app side:
    • AmiiboDb: the table, made by peanuts/scripts/amiibo-db.py from AmiiboAPI commit 6115745c.
    • AmiiboStore, AmiiboImport and AmiiboBin: the player's own amiibo and the imports.
    • AmiiboStand: places and lifts, and reads the stand's state.
    • AmiiboPictures: pictures from AmiiboAPI's images, fetched only when a page shows them and cached.
  • PEANUTS.md, peanuts/UPSTREAM-EDITS.md (Round 65) and peanuts/docs/AMIIBO.md list the hook and the new files.
  • upstream-update.sh --check counts Peanuts' own JVM tests (android/app/src/jvmtest/java/dev/peanuts/) as Peanuts-owned, as Cheats that check the game's code before they write and keep working after an update #677 does.

Tested

  • peanuts/tests/test_amiibo_host.py runs the stand in C with made-up IDs, under ASan and UBSan (TSan clean). It covers the game's calls as a game makes them: search, placed while searching, read, an area created and written, unmount and the lift a second later, and placed in advance.
  • peanuts/tests/test_amiibo.py (with AmiiboJvmTest) covers the table, the store, and imports of generated .bin files, folders and ZIP packs. Also run: test_ctl.py.
  • upstream-update.sh --check, check-publish.sh, and check-min-api.py on the APK.
  • A run on the Thor with a game (Breath of the Wild) follows.

…eded

Games that read amiibo (Breath of the Wild's daily rewards, Super Mario
Odyssey's costumes, Smash's fighters) now find one: a virtual stand in
the host that the app places the player's amiibo on. GitHub issue igawa6#582.

- dm/peanuts/peanuts_amiibo.c takes over nn::nfc and nn::nfp in the
  Android host in place of hle_sdk16.c's block (PN_AMIIBO, one marked
  pair of lines). It sits above the figures' encryption: TagInfo,
  ModelInfo, CommonInfo, RegisterInfo and the application areas are
  plain, so no amiibo keys are asked for, read or shipped.
- The activate and deactivate events are signalled; mount, read,
  write, flush and create or recreate of an area answer as the SDK's;
  each game keeps an area of its own on an amiibo; a second after the
  game unmounts it the amiibo leaves the stand on its own. One placed
  in advance is found at the game's next search.
- The owner is the player's Mii, the nickname the character's name.
- dev.peanuts.amiibo: AmiiboAPI's table offline (MIT,
  peanuts/scripts/amiibo-db.py), the player's own amiibo, imports of
  .bin files, folders and ZIP packs (ID and UID only), pictures loaded
  on demand, and the adb control's game do=amiibo.

Tests: test_amiibo_host.py (the stand in C, made-up IDs),
test_amiibo.py (AmiiboJvmTest), test_ctl.py. Round 65.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant