Skip to content

Give every game its own work folder when the title ID is not found - #386

Merged
v0lumehi merged 4 commits into
mainfrom
fix/title-id-fallback
Nov 1, 2026
Merged

v0lumehi merged 4 commits into
mainfrom
fix/title-id-fallback

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Fix or feature

  • Fix
  • Feature

What and why

Fixes #382. The launcher fell back to the fixed text "game" when it found no title ID. Every such game got the folder game_build and game.app. A second game then hit the shader cache of the first one and the engine refused with "holds the shader libraries of game ..., give each game its own output directory".

The reporter's files are named like 01007EF00011E000/01007EF00011E000_v0_420d1c5034ab.nsp, with the ID bare (no brackets) at the start of the name. The bare-ID rule needs the start of the name or a delimiter before the ID. The launcher passed the full path, so the ID after a / never matched and these files fell back to "game". titleID now looks at the file name only. A folder named with an ID never stands in for the file, so the update (...E800_v1048576_...) and the DLC (...F001_...) beside the base keep their own IDs. The tests use these names as full paths.

For names that really have no ID, I put the naming in one function, BuildModel.buildKey. All three call sites use it (work folder and app, the iOS games folder, the shell install). With an ID nothing changes: <ID>_build and <ID>.app. Without one the key is the file name stem, cut to letters, digits, - and _, plus an 8-digit FNV-1a hash of the stem. Different names give different folders. The same name gives the same folder, so a rebuild keeps its cache. The hash is stable across launches.

I did not read the title ID from inside the NSP, because the launcher has no NSP reader and I did not want to add a parser. The library and Free space look up <titleID>_build, so they will not find the <name>-<hash>_build folder of such a game. That was also true for game_build.

The Qt front end had the same fallback. I fixed it the same way with inputs.build_key, which gives the same key as the Mac launcher.

Checked

  • Tests: cd frontend && swift build && swift test (670 tests, 0 failures, 16 skipped). python3 -m unittest discover -s frontend-qt/tests and python3 -m unittest discover tools/tests pass. New tests: BuildKeyTests.swift and BuildKeyTests in test_inputs.py.
  • Visual QA: not needed.
  • Run on a device or Mac: not run. I did not build two real games.

Screenshots

None, no visible change.

Scope

  • No engine file (dm/, scripts/, docs/, ref/) is added to the repository: a change there is a patch in patches/ (a commit in engine/, then tools/engine.py export, and tools/engine.py check passes), with its Upstream-Status
  • A fix to the engine or a game profile also goes to seedds/nxnative as a PR in parallel: this PR's patch says forwarded seedds/nxnative#..., or pending until that PR is open
  • A change to a launcher view has before and after screenshots above
  • No keys, game files or data extracted from a game in the change or the attachments

@github-actions github-actions Bot added launcher The NX2Apple launcher app windows Windows (the Qt front end) labels Nov 1, 2026
@v0lumehi
v0lumehi merged commit f443c31 into main Nov 1, 2026
12 checks passed
@v0lumehi
v0lumehi deleted the fix/title-id-fallback branch November 1, 2026 05:09
zynilver pushed a commit to zynilver/NX2Apple that referenced this pull request Nov 1, 2026
…rts are repaired

The launcher's Controls page (PR LNPANDY#39) writes DM_KEYMAP / DM_PAD_MAP at Play, but nothing on
this side read them: the page moved the fields and every game kept its default keys. This
brings seedds/nxnative#386's engine side here — dm/host/input_map.h (the key and button maps,
pure so a test runs without a keyboard) and front_mac.m using it in place of the fixed
key_bit() switch — so the page does what it says. LNPANDY#386 is still open upstream, so
front_mac.m and input_map.h are carriers here (OURS for the two new files, patch_front_mac()
for the changed one), and the day LNPANDY#386 merges, a sync finds every anchor applied already.

Two more things surfaced while checking the suites:

* patch_nso.py had lost the NRO header skip (issue LNPANDY#14). It was fixed in 4b86323 and then
  silently reverted by a sync, because the file was not a carrier: an NRO's text starts at
  0x80, and scanning from 0 read the header's build ID as instructions and skipped the last
  128 bytes of text. Restored, and patch_nso.py is a carrier now (patch_patch_nso).
* patch_tests_makefile() opened with `if 'romfs_arc.c' in t: return skip(...)`, which made the
  touch-pad test block that follows dead code ever after. Its first addition skips on its own
  now, so the new t_input_map rule is not skipped as well.

docs/env_switches.tsv gains the rows the tool asks for (DM_KEYMAP, DM_PAD_MAP), the two it
listed with no meaning (DM_FULL_ROMFS, DM_PROFILE), and the mode change PR LNPANDY#41 needed.

Checked: t_input_map 22/22; the full host suite (make -C dm/host/tests run) exits 0; dmhost
builds; the Python suite is 350 passed, 17 skipped, 0 failed (test_env_switches and
test_nro_header were both failing before this); the sync reports every patcher agreeing with
the tree.
zynilver pushed a commit to zynilver/NX2Apple that referenced this pull request Nov 1, 2026
…who carries them

The section said a build without the engine change ignores DM_KEYMAP / DM_PAD_MAP and plays
with the default keys. That was true when PR LNPANDY#39 was written — seedds/nxnative#386 was open
and nothing here read them — but 9f7d421 carried LNPANDY#386's engine side into this fork, so it
reads them now. It also points at docs/env_switches.tsv, where both names are listed.
lucaszhongsj pushed a commit to lucaszhongsj/nxnative that referenced this pull request Nov 19, 2026
input_map.h parses the maps; front_mac.m applies them to keys and controller buttons.

Upstream-Status: forwarded seedds#386
Reason: The launcher's Controls page: DM_KEYMAP and DM_PAD_MAP move buttons to other keys and controller buttons (open upstream, seedds#386)
Issue: LNPANDY/NX2Apple#386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

launcher The NX2Apple launcher app windows Windows (the Qt front end)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build conflict: Output always named game.app, causes shader cache mismatch when building a second game

1 participant