feat(nfc): an NFC page for the tag dumps the game's NFC tab lists #49

Open
airdamien wants to merge 1 commit from airdamien/LongshotLauncher:feat/nfc-tags into main
First-time contributor

Why

Longshot is getting an NFC tab that gives the game NFC tags from files in a folder of the player's (MagicBeanDev/Longshot#280). Players need a way to put their tag dumps there without finding a hidden folder: this adds an NFC page to the launcher for it.

What changed

  • Core/NfcTags.cs: the folder (LONGSHOT_NFC_DIR, else %LOCALAPPDATA%\Longshot\nfc on Windows, $XDG_DATA_HOME/longshot/nfc on Linux: the same rule as the game's host/nn_nfp.c), listing, checking a dump (.bin of 532, 540 or 572 bytes; a Flipper Zero .nfc; the two marks of a figure's NTAG215), adding (a name that is taken is never replaced: the same bytes are left, others go in as Name (2).bin), deleting. Written through AtomicFile.
  • Core/NfcReader.cs: reading a tag with a Nintendo Switch 2 Pro Controller over USB (Windows, WinUSB): the reader's commands behind a send-and-answer delegate, so the checks drive them with a pretended controller. Read only: a write command cannot be built.
  • App/ViewModels/NfcViewModel.cs, App/Views/NfcView.axaml, NfcDeleteView.axaml: the page. Add files (many at once), add a folder (with the folders under it), drop files or folders on the page, scan a tag, delete one or several (asked first), open the folder.
  • App/Views/HomeView.axaml, HomeViewModel.cs, MainViewModel.cs: an NFC card under the saves' on the home, and an NFC tags link on the home before any build exists (the folder does not wait for a build).
  • tests/launcher_core/NfcChecks.cs, NfcReaderChecks.cs: 110 checks, on pretended tags built in code. No real dump is in the repository, and CONTRIBUTING.md says none may be.
  • docs/nfc.md, README.

How it was tested

  • dotnet build LongshotLauncher.slnx: 0 errors (Windows 11, .NET SDK 10.0.201).

  • The NFC checks alone: NFC ONLY: 110 checks passed. The whole of tests/test_launcher_core.py has not run green here: on this Windows PC it stops in SelfUpdateChecks before reaching them, and does so on main too (a Linux path in that check); CI on Linux is where the whole suite runs. To run them alone I made Main call only NfcChecks(); NfcReaderChecks(); in a copy that is not committed.

  • On screen (the screenshot below): the page listing three pretended tags and one file that is no dump, from a scratch LONGSHOT_NFC_DIR.

  • By the author, on their own files: adding a folder of folders.

  • Scan a tag, by the author on a real controller (a Nintendo Switch 2 Pro Controller, firmware 1.1.5, over USB, Windows 11): a figure's tag held on the controller was read and saved into the folder as Scanned <ID>.bin.

Not tested: the page on Linux (the scan is Windows only and its button is disabled there); a scan's other ends on real hardware (no tag in time, a tag that is no figure's, the controller held by another program) beyond the checks' pretended controller; drag and drop was built and compiled, and tried by the author only.

Screenshot

The NFC page, this PR:

The NFC page

Notes for the reviewer

  • This is only useful once Longshot has the NFC tab (its pull request: MagicBeanDev/Longshot#280). It does nothing to a build without it.
  • The folder is a new place under the player's data (...\Longshot\nfc), beside the save backups' ...\Longshot\oot-save-backups.
  • AI assistance: written with Claude Code (the commit's trailers say so).

🤖 Generated with Claude Code

## Why Longshot is getting an NFC tab that gives the game NFC tags from files in a folder of the player's (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/280). Players need a way to put their tag dumps there without finding a hidden folder: this adds an **NFC** page to the launcher for it. ## What changed - `Core/NfcTags.cs`: the folder (`LONGSHOT_NFC_DIR`, else `%LOCALAPPDATA%\Longshot\nfc` on Windows, `$XDG_DATA_HOME/longshot/nfc` on Linux: the same rule as the game's `host/nn_nfp.c`), listing, checking a dump (`.bin` of 532, 540 or 572 bytes; a Flipper Zero `.nfc`; the two marks of a figure's NTAG215), adding (a name that is taken is never replaced: the same bytes are left, others go in as `Name (2).bin`), deleting. Written through `AtomicFile`. - `Core/NfcReader.cs`: reading a tag with a Nintendo Switch 2 Pro Controller over USB (Windows, WinUSB): the reader's commands behind a send-and-answer delegate, so the checks drive them with a pretended controller. Read only: a write command cannot be built. - `App/ViewModels/NfcViewModel.cs`, `App/Views/NfcView.axaml`, `NfcDeleteView.axaml`: the page. Add files (many at once), add a folder (with the folders under it), drop files or folders on the page, scan a tag, delete one or several (asked first), open the folder. - `App/Views/HomeView.axaml`, `HomeViewModel.cs`, `MainViewModel.cs`: an NFC card under the saves' on the home, and an *NFC tags* link on the home before any build exists (the folder does not wait for a build). - `tests/launcher_core/NfcChecks.cs`, `NfcReaderChecks.cs`: 110 checks, on pretended tags built in code. **No real dump is in the repository**, and CONTRIBUTING.md says none may be. - `docs/nfc.md`, README. ## How it was tested - `dotnet build LongshotLauncher.slnx`: 0 errors (Windows 11, .NET SDK 10.0.201). - The NFC checks alone: `NFC ONLY: 110 checks passed`. **The whole of `tests/test_launcher_core.py` has not run green here**: on this Windows PC it stops in `SelfUpdateChecks` before reaching them, and does so on `main` too (a Linux path in that check); CI on Linux is where the whole suite runs. To run them alone I made `Main` call only `NfcChecks(); NfcReaderChecks();` in a copy that is not committed. - On screen (the screenshot below): the page listing three pretended tags and one file that is no dump, from a scratch `LONGSHOT_NFC_DIR`. - By the author, on their own files: adding a folder of folders. - Scan a tag, by the author on a real controller (a Nintendo Switch 2 Pro Controller, firmware 1.1.5, over USB, Windows 11): a figure's tag held on the controller was read and saved into the folder as `Scanned <ID>.bin`. **Not tested:** the page on Linux (the scan is Windows only and its button is disabled there); a scan's other ends on real hardware (no tag in time, a tag that is no figure's, the controller held by another program) beyond the checks' pretended controller; drag and drop was built and compiled, and tried by the author only. ## Screenshot The NFC page, this PR: ![The NFC page](https://git.magicbean.dev/attachments/8da4ab15-95aa-4e76-baaa-7d56c3721402) ## Notes for the reviewer - This is only useful once Longshot has the NFC tab (its pull request: https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/280). It does nothing to a build without it. - The folder is a new place under the player's data (`...\Longshot\nfc`), beside the save backups' `...\Longshot\oot-save-backups`. - AI assistance: written with Claude Code (the commit's trailers say so). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(nfc): an NFC page for the tag dumps the game's NFC tab lists
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Compile and test (pull_request) Blocked by required conditions
5c1c036655
Add one file, many, or a folder with the folders under it; drop files on the page; delete one or several; open the folder;
scan a tag with a Nintendo Switch 2 Pro Controller over USB (Windows). The dumps stay on the PC, in the folder every
Longshot build shares.

Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.2 <[email protected]>
airdamien changed title from WIP: feat(nfc): an NFC page for the tag dumps the game's NFC tab lists to feat(nfc): an NFC page for the tag dumps the game's NFC tab lists 2026-11-13 19:25:17 +00:00
Author
First-time contributor

Scan a tag was run by the author on a real Switch 2 Pro Controller over USB: a figure's tag was read and saved into the folder. With that, the page's functions have all been used on real files and hardware; the title's WIP is off. Still for CI: the whole core suite (it does not run on the author's Windows PC, nor does main's).

Scan a tag was run by the author on a real Switch 2 Pro Controller over USB: a figure's tag was read and saved into the folder. With that, the page's functions have all been used on real files and hardware; the title's WIP is off. Still for CI: the whole core suite (it does not run on the author's Windows PC, nor does main's).
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Compile and test (pull_request) Blocked by required conditions
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/nfc-tags:airdamien-feat/nfc-tags'
git switch 'airdamien-feat/nfc-tags'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!49
No description provided.