amiibo: GetModelInfo puts the series byte in the wrong place, so only Link/Zelda/Ganondorf amiibo are accepted #2489
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#2489
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Longshot version
v3.1.1-dirty (source cdc9b8f7), built with LongshotBuilder nightly-672-e6196f0f. GetModelInfo in host/nn_nfp.c is unchanged in nightly-801-9046a8d7
Channel
Nightly
What kind of problem
Something else
What happened
With amiibo support on, Link, Zelda and Ganondorf amiibo (all variants, including the Smash Bros. ones) work. Every other Zelda-series amiibo shown as supported in the official overview trailer is rejected in game with "This amiibo is not supported": Wolf Link, the four Champions, Riju, Sidon, Tulin, Yunobo, Mineru's Construct, Guardian and Bokoblin.
The dumps load fine. The log shows the same path for working and rejected tags:
Cause
host/nn_nfp.c,GetModelInfo, copies tag bytes 0x54..0x5A in tag order: character (2), variant, figure type, model number, series.nn::nfp::ModelInfois laid out ascharacterId[3],seriesId,numberingId(u16),nfpType. Ryujinx uses the same layout. So the game reads the figure type (00) as the series, and the series (09) as the type.romfs/Game/AmiiboSettinghas per-character entries plus a series-wide entry (SeriesIDType, no specific character). The per-character entries still match, which is why Link/Zelda/Ganondorf work. The series-wide entry never matches, so every other character is rejected.Confirmed
Swapping bytes 0x57 and 0x5A in the dump (so the straight copy comes out in the right order) makes the rejected amiibo work in game. Tested on nightly-672;
GetModelInfois unchanged in nightly-801.Suggested fix
Where in the game
Any amiibo scan (after the Great Deku Tree)
How often
Every time
Graphics card and driver version
NVIDIA GeForce RTX 5070, NVIDIA 621.24
CPU, RAM and operating system
AMD Ryzen 9 5950X, 64 GB, Windows 11 Pro
Changes from the defaults
No response
longshot_log.txt
Relevant lines only (not GPU-related).
Before, original dumps, rejected with "This amiibo is not supported":
Working for comparison:
After, same dumps with bytes 0x57 and 0x5A swapped, accepted in game:
Screenshots or video
No response
Before you send it
Possibly related, for context:
Claiming this one. Branch
dazemc/Longshot:fix/nfp-model-info-field-orderat1a4a65065, onmain9046a8d75; no pull request yet.Fix:
host/nn_nfp.cGetModelInfonow returns the SDK layoutcharacterId[3], seriesId, numberingId (native u16), nfpTypefrom the tag's[character 2][variant][type][number 2 BE][series]:memcpy(m, tag + 0x54, 3),m[3] = tag[0x5a],m[4] = tag[0x59],m[5] = tag[0x58],m[6] = tag[0x57]. The big-endian-to-native number conversion from #1747 is unchanged.Tests, game-free: the existing
tests/test_nfc_model_info.pyasserted the wrong order (out[3]= tag 0x57,out[6]= tag 0x5a); it now asserts the SDK's order and fails on main. Newtests/test_nfc_model_info_fields.pycuts the real HLE function and reads three synthetic tag blocks whose type and series differ, in the tag's order and out in the SDK's. On main8aa5ab87it fails withFAIL case 0: ModelInfo[3] series id is 0x00 (tag[0x57], the figure type), expected 0x09 (tag[0x5a], the series)andFAIL case 0: ModelInfo[6] nfp type is 0x09 (tag[0x5a], the series), expected 0x00 (tag[0x57], the figure type)(6 failed checks, exit 1); at the fix it passes.tests/test_nfc_list_cap.py,tests/test_nfc_scan_hint.pyandtests/test_host_guest_writes.pyalso pass; the last needed itsALLOWEDtext for the 7-byte copy changed to the 3-byte one.In game, no amiibo figure or reader: a 540-byte synthetic tag (
01 0c 00 00 a6 04 09at 0x54, i.e. Yunobo: type 0x00, number 0xa604, series 0x09; NTAG215 containerF1 10 FF EE) was placed in a temporary NFC folder and tapped from the Insert menu's NFC tab. Windowed run of the fix runtime at1a4a65065's tree, Hyrule Field save, amiibo enabled in Options, Items tab's amiibo icon, ZR:nfp: the game waits for an NFC tag: one is at the reader→nfp: the game reads the NFC tag "Yunobo synthetic", then the read completed and handy items appeared around Link. The same tag, save and steps on themainruntime at8aa5ab87showThis amiibo is not supported.No dump, key or game file is part of the branch or this comment.