fix(nfc): return the amiibo model number in native byte order #1747
No reviewers
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1747
Loading…
Reference in a new issue
No description provided.
Delete branch "Svartskogen/Longshot:fix/nfc-model-byte-order"
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?
Type: fix · Risk: low · Tested on: CachyOS Linux, Radeon RX 9070 · Needs: Windows NFC smoke test
TL;DR
Amiibo scans could succeed but return ordinary random items instead of their model-specific rewards. This fixes the model number passed to the game; the player rebuilt locally and confirmed receiving both Young Link and Young Zelda masks in Hyrule Castle Town. A regression test reproduces the wrong model numbers on main and passes with the fix.
Breakdown
Why
The NFC implementation added in #280 reads and mounts the tags successfully, but their model numbers can fail the game's reward lookup. The player reported that both new OoT tags gave ordinary random items, and confirmed both special masks after applying this fix.
Prior-work search covered open, merged and closed issues/PRs for NFC, GetModelInfo, amiibo, endianness, model number and byte order, plus recent team-room claims. No competing fix was found.
How to reproduce
Seen on: CachyOS Linux, Radeon RX 9070, RADV Mesa 26.2.6-arch3.1.
Settings and switches: existing game settings; no NFC debug switches.
Steps: in Hyrule Castle Town, enter the game's amiibo scan flow, select an owned tag in Insert > NFC and tap it; repeat with the other model.
Expected: Young Link and Young Zelda each give their special mask.
Actual: the original nightly returned ordinary random items, although its log showed that both tags were read.
The game-free reproduction is
python -I -B tests/test_nfc_model_info.pywith the new test applied to main: four unequal-byte synthetic model numbers are reversed.What changed
The SDK result now contains the numeric model number expected by the game. The conversion changes only those two output bytes; the original tag and all other returned fields retain their existing values.
host/nn_nfp.c, GetModelInfo: retain the existing field copy and explicitly reverse only the two bytes of the model-number field for the SDK result. The tag itself is untouched.tests/test_nfc_model_info.py: compile the actual function viatests/srccut.pyand verify six synthetic model blocks, other fields, zeroed reserved bytes, output bounds, unchanged tag memory, five unmounted states and a null output pointer. No dumps or keys are used.docs/tested/2026-11-19-nfc-model-number-svartskogen-run01.md: record the player's in-game acceptance run.Measurements
Verdict: four synthetic model-number mismatches become zero; the player confirms both masks after rebuilding with the identical function.
Hardware: CachyOS Linux; Radeon RX 9070, RADV Mesa 26.2.6-arch3.1; Ryzen 7 5700X3D, 32 GB RAM.
Scene: Hyrule Castle Town; 2560x1440 output. Performance was not measured: this is a conversion when a tag is queried, with no per-frame, rendering, loading or cache changes.
Method: compile the extracted main/fixed function with GCC and Clang; run two interleaved pairs per compiler. Each pair returns four wrong model numbers on main and zero with the fix (median 4 -> 0).
How to reproduce: run the new regression against main and this branch;
CC=gccandCC=clangselect the compilers.8b0ea7869ecf2ee1The repeated fixture measurements were first taken against
a0868c6dand b816917f. Rebases ontod30b9479and8b0ea786leave both the baseline and patched GetModelInfo functions byte-identical, so the conversion results remain applicable. The latest rebase also passed the NFC regression with GCC and Clang, the existing NFC list tests, and the tested-configuration checks.In-game baseline: nightly-486-09a20cd6, source 41f3919f, ordinary rewards. In-game fixed build: the same nightly rebuilt locally, source fingerprint baa617b0; the player confirmed both masks in Hyrule Castle Town and supplied screenshots wearing each. The installed and PR GetModelInfo functions were compared byte for byte and match. This is not a claim that a full game built from the new main was played.
Flags and settings
None.
Testing
Tested:
a0868c6dbase plus this fix: 718 passed, 35 failed, 99 skipped (--jobs 8 --timeout 180). Three Tooling-location failures were resolved by settingMAGICBEAN_TOOLING; all three reruns passed. The remaining 31 deterministic failures were reproduced on unmodifieda0868c6dandd30b9479.test_vbytes.pyhit the imposed 180-second limit on both the PR run and unmodifiedd30b9479. The main comparison finished with 3 passes, the same 31 deterministic failures, and that timeout. No new failure was isolated to this NFC change.d30b9479: 112 passed, 12 failed, 2 skipped; one is the resolved Tooling-location failure, and the other eleven are in main's failure set. The new NFC regression passes.31 pre-existing deterministic failures (reproduced on unmodified main)
tests/test_bug_report_defaults.pytests/test_capture_read_once.pytests/test_crt_options.pytests/test_damage_debug_menu.pytests/test_dev_packs.pytests/test_display_startup_failure.pytests/test_dlss_feature_size.pytests/test_failed_compile_keeps_objects.pytests/test_guest_imported.pytests/test_high_fps_fixes.pytests/test_host_guest_writes.pytests/test_hud_layout_row.pytests/test_libc_hooks.pytests/test_linux_preflight.pytests/test_linux_pressure.pytests/test_linux_update.pytests/test_log_open_failure.pytests/test_missing_nup.pytests/test_mods_size_table.pytests/test_pending_guest_import.pytests/test_pipeline_play_cache.pytests/test_prepare_cache_save.pytests/test_present_thread.pytests/test_profiling_mode.pytests/test_psychov35_fsr3_fg.pytests/test_readback_timeout_source.pytests/test_slow_frames.pytests/test_song_note_cue.pytests/test_upscaler_rows.pytests/test_vcore_escape.pytests/test_walk_key.pyNot tested: a full current-main game rebuild, Windows compilation/runtime, physical NFC reader, and multi-session application-area persistence. The change does not touch the reader or persistence paths. Windows compilation/runtime have not been verified and will not be performed by this contributor. The author has requested review with this limitation documented; Windows validation is deferred to reviewers and is not a contributor readiness condition.
Must be tested:
Screenshots
After applying the fix to nightly-486-09a20cd6 (source fingerprint baa617b0), Hyrule Castle Town. Screenshots supplied by the player; they show both rewards equipped. No before screenshot was supplied; the before/after numeric evidence is the compiled regression above.
Risks
What could break: reward recognition for tags whose model-number bytes differ; tests cover both byte orders, zero and equal bytes as well as preservation of all other returned fields.
Turning it off: revert the fix commit.
Compatibility: no new setting, save format, NFC dump format, shader cache change or MKWVK_API_VERSION bump. Existing dumps need no edits or conversion.
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md).mainand passing here.Tested in game: Player-tested on CachyOS Linux, Radeon RX 9070, RADV Mesa 26.2.6-arch3.1: Hyrule Castle Town, both Young Link and Young Zelda masks received after rebuilding nightly-486-09a20cd6 with this exact GetModelInfo function. The player supplied screenshots wearing both masks. Full current-main game rebuild not claimed.
Added the player-supplied screenshots of both masks and the confirmed Hyrule Castle Town run. The new regression fails on main and passes with GCC and Clang; complete host compilation adds no warnings. Compared the unrelated suite failures against unmodified main: the same 31 deterministic failures and test_vbytes timeout reproduce there; the three Tooling-location failures pass after setting MAGICBEAN_TOOLING. Kept WIP because Windows host compilation remains untested.
Ready for review at the author’s request. Windows compilation/runtime remain explicitly unverified and will not be performed by this contributor; that checklist item is left unticked. Linux in-game confirmation, screenshots and regression-test evidence are unchanged.
WIP: fix(nfc): return the amiibo model number in native byte orderto fix(nfc): return the amiibo model number in native byte order9917b32e049ecf2ee11aRebased the two NFC commits onto current main (
8b0ea786). The NFC regression passes with GCC and Clang; existing NFC list and tested-configuration checks pass. Per the author’s decision, Windows validation is deferred to reviewers rather than used as a contributor readiness condition; it remains explicitly unverified in Testing. Removed the unticked Windows readiness item without claiming a Windows test was run. Workflow approval and the required independent review still need a maintainer.mooki referenced this pull request2026-11-19 20:00:51 +00:00
mooki referenced this pull request2026-11-19 20:01:00 +00:00
TrashPanda referenced this pull request2026-11-19 23:10:48 +00:00