Skip to content

nxnative for Mac: install an iPhone build on a paired device - #28

Merged
LNPANDY merged 3 commits into
LNPANDY:mainfrom
v0lumehi:device-install
Oct 27, 2026
Merged

LNPANDY merged 3 commits into
LNPANDY:mainfrom
v0lumehi:device-install

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Install an iPhone build on a paired device

Rebased on current main (#27 is merged). Rebased again onto 4e37642 (game data as one romfs.img). There are three commits: the install itself, the switch to the sideloading route for the game data, and the move to romfs.img with aoc/.

Today an iPhone build ends with an unsigned IPA and three manual steps (sideload it, copy the RomFS shards into the app's Documents, start it). For people who have Xcode and a development certificate, the launcher can now do this itself:

  • Install on lists the iPhones and iPads paired with this Mac (xcrun devicectl list devices: physical, paired, reachable ones first); Signing team lists the development identities in the keychain (security find-identity), each with its team read from the certificate's organizational unit (not the code in the certificate's name, which is the personal ID).

  • With both chosen, the script prepares the game's Xcode project (--prepare-xcode --keep-extracted --team-id, the developer route it already has) instead of packing an IPA. The launcher then signs it for the device, xcodebuild … -destination id=<UDID> -allowProvisioningUpdates DEVELOPMENT_TEAM=<team> build (Xcode creates the provisioning profile), and installs it, xcrun devicectl device install app. Both show as steps of the build, with Stop ending them as it ends the script.

  • The game files take the standard route, as for sideloading:

    • the game data is packed, or reused, as <out>/games/<title ID>/romfs.img, with the DLC in aoc/ beside it;
    • the app is signed without the game files (DM_COPY_ROMFS=NO);
    • after the install, xcrun devicectl device copy to puts that folder into the app's Documents/games/<title ID>/, where main.m looks first.

    devicectl skips files that did not change, so a reinstall sends the code and shaders, not the game again.

  • The game then appears in the library, and its button opens it on the device (devicectl device process launch).

  • Don't install, export the IPA (the default) keeps the unsigned IPA exactly as before; without Xcode, a certificate or a paired device nothing changes.

The first install needs Developer Mode on the device and trusting the developer (Settings → General → VPN & Device Management); with a free Apple ID the profile expires after seven days. Both are said under the card. frontend/README.md has a section on it.

Tests

swift test --package-path frontend (20 tests): parsing devicectl's device list and security's identities and certificate subjects, and a whole build with stand-ins for the script, xcodebuild and devicectl that checks:

  • the arguments of each step: team, device, derived data, -allowProvisioningUpdates, DM_COPY_ROMFS=NO, the install path, the copy of the game's folder;
  • their order: pack, sign, install, copy;
  • that the library then opens the game on the device. Nothing is signed or installed by the tests.

Not tested on a device yet: signing and installing for real is the next step, done by hand.

Screenshot

The Install card for an iPhone build, as the visual QA test renders it. The device and the team are the test's stand-ins, not real ones.

LNPANDY added a commit that referenced this pull request Oct 27, 2026
…ssue #29)

v0lumehi read the sync script while working on #27/#28 and found a real structural gap: a fix
merged here into a vendored file that is neither OURS nor PATCHED is silently reverted the next
time upstream touches that file. The concrete instance was PR #26 itself — hle_time.c and its test
carry the adjustable-clock entry, neither was protected, and seedds has no such function.

Both parts of the suggestion are taken:

- hle_time.c and t_time.c join OURS (with a comment saying why, and that they leave if upstream
  takes the PR). Found by the issue, verified by the code: neither file was in either list.
- A new pr-scope workflow fails a PR that edits a vendored file outside OURS/PATCHED and outside
  the fork-only paths (frontend/, frontend-qt/, .github/workflows/), with the at-risk list and the
  two ways out. It reads OURS and PATCHED from sync_upstream.py itself, so the check cannot drift
  from the lists it enforces.
@LNPANDY

LNPANDY commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Read, and the shape is right — I want this in once #27's landing is settled on your side. Two things worth saying, one question, and a request that will make review fast.

On the design: routing through --prepare-xcode --keep-extracted --team-id (the developer route the script already has) instead of signing the unsigned IPA is the correct call, for three reasons this project has already learned the hard way:

Why it cannot merge today: it builds on #27, which landed an hour ago — GitHub shows UNKNOWN because the base moved. The launcher's ContentView.swift grew the Windows-facing dependency work and this week's notices, and your branch carries the pre-merge state of several files. A rebase of device-install onto current main is mechanical (I test-merged it: ContentView.swift auto-merges; the rest is your new files) but it is yours to run so the commits stay honest.

My question: the game files live inside the app on this route, so no RomFS archive is packed. That is the simple mental model, and for a first version it is right. But it means an iPad mini holds the whole game twice if the user also keeps the archive for a sideloaded copy, and the archive was built to make 16 GB titles installable at all. Is the plan that the developer route is for "Mac and a cable" users while sideloading + archive stays the mainstream route, or do you see the archive following the developer route too (the app reads it from its own Documents the same way it does today)? I ask because it decides whether the launcher's card should offer the choice rather than assume it.

What I verified already: the test additions parse devicectl's real output shapes and the fixture asserts every argument that matters (-allowProvisioningUpdates, the team, the install path, no archive) — that is the part that makes review fast, so keep that discipline in the rebase. And mergeable aside, nothing in the 8 files touches a sync carrier, so the patchers do not care.

Rebase and it gets a full review the same hour; the tests here all run.

@v0lumehi

Copy link
Copy Markdown
Collaborator Author

@LNPANDY, thanks. Both are done:

Rebased onto current main (92b91c0), and ContentView.swift merged cleanly. swift test: 20 tests, 0 failures. The Qt suite passes too (117 tests).

On the archive question: you were right that the first version opened a second route, with the game files inside the app. I'd rather have one standard, so the developer route now uses the archive like sideloading (commit e31d519):

  1. The script prepares the Xcode project as before. Then the RomFS archive is packed, or reused through its stamp, in the same place as for an IPA (<out>/games/<title ID>/romfs).
  2. xcodebuild signs the app with DM_COPY_ROMFS=NO, so the game files stay out of it.
  3. devicectl device install app, then devicectl device copy to … --destination Documents/games/<title ID>/romfs --domain-type appDataContainer --domain-identifier <bundle ID>. That is where main.m looks first.

This way:

  • a 16 GB title installs the same way on both routes;
  • the iPad mini never holds the game twice;
  • a reinstall only sends the code and shaders, because devicectl skips files that did not change.

The card needs no choice: the cable route is the sideload route with the signing and copying done for you. The fixture test checks the order (archive → sign → install → copy) and every argument, including DM_COPY_ROMFS=NO and the copy's destination.

Still open: a run on a real device. That is next, done by hand.

With Xcode, a development certificate and a paired iPhone or iPad, the
launcher can send an iPhone build straight to the device: choose it under
Install on, with the signing team. The script prepares the game's Xcode
project (--prepare-xcode --team-id) instead of an IPA, xcodebuild
-allowProvisioningUpdates signs it for the device (Xcode makes the profile),
and devicectl installs it; the game files are inside the app, so no RomFS
copy follows. The game then shows in the library, and its button opens it
on the device. Without a device or a team the build stays an unsigned IPA.

Devices come from devicectl list devices (physical, paired; reachable
first), teams from security find-identity, each team read from its
certificate's organizational unit. xcodebuild and devicectl run as stages
of the build in its process group, so Stop ends them too.
…ading

The first version put the game files inside the app (the Xcode project
copies the RomFS). That made a second route next to the standard one,
and the archive is what makes large games installable at all. The
install now takes the standard route:

- The NSP script still prepares the Xcode project; then the RomFS
  archive is packed (or reused) exactly as for an IPA, in
  <out>/games/<title ID>/romfs.
- xcodebuild signs the app for the device with DM_COPY_ROMFS=NO, so the
  game files stay out of it.
- devicectl installs the app, then copies the archive into the app's
  Documents/games/<title ID>/romfs, where main.m looks first. devicectl
  skips files that did not change, so a reinstall sends the code and
  shaders, not the game again.

The fixture test checks the order (archive, sign, install, copy), the
DM_COPY_ROMFS=NO build, the copy's arguments and the archive path the
library records. The card's note, the README and the Qt strings say the
same.
… game data is one image

Main now packs games/<title ID>/romfs.img with the DLC in aoc/ beside it,
in place of the ROMFSARC shards. The device route copies that folder
into the app's Documents/games/<title ID>/, the shape main.m reads, so
the DLC goes along too. The fixture's packer stand-in is romfs_image.py.
@LNPANDY
LNPANDY merged commit 7c4a1e0 into LNPANDY:main Oct 27, 2026
LNPANDY added a commit that referenced this pull request Oct 27, 2026
The update machinery was already here — checkAppUpdate finds the newest release, performAppUpdate
downloads it, swaps the bundle and relaunches — but the only signal was a status line naming a
tag. A user whose app worked had no way to judge whether the new version mattered, so "Update to
v0.4.8" was a leap of faith, and most people took the leap only when something broke.

Now a found update opens a sheet: the version they have, the one on offer, the release notes for
their interface language, Open the release page, Later, and Update now. It opens from the launch
check and from Check for updates, so an old install learns what changed without visiting GitHub.

The notes are the release body, which this project writes in both languages
(docs/RELEASE-NOTES-GUIDE.md). UpdateSheet.lines splits them by the `**中文**` / `**English**`
markers rather than by looking for Han characters — the first version did the latter and handed an
English reader the Chinese paragraph, because that line contains both. A body with no markers is
shown whole instead of being split in half.

Six tests cover the split, including the two cases that failed on the first attempt (a monolingual
body, and inline **bold** inside a marked paragraph). Checked against the real v0.4.7 body: 19 lines
each way, aligned.

appVersion 0.4.7 → 0.4.8: today's merges (#28, #48, #54–#57, #59, #60 and the #52/#53 fixes) were
shipping under a version number that also names the 0.4.7 release, so a bug report could not say
which one it came from.
v0lumehi added a commit to v0lumehi/NX2Apple that referenced this pull request Oct 27, 2026
…alled on (LNPANDY#66)

A save lived in ~/Library/Application Support/nxnative/<title ID>/save on the Mac
(dm/mac/launcher.c) and in Documents/games/<title ID>/save in the iPhone app's
container (dm/ios/Sources/main.m, the per-game folder a launcher install uses), and
the two never met. Manage > Saves... (a controller's Y) opens a sheet with both
saves' newest file dates, the newer one marked, and a copy either way over LNPANDY#28's
route: devicectl with the installed app's data container, on the device the game
was installed on.

The save being replaced is backed up first, beside the Mac save in
save-backups/<date> mac or <date> device. A copy from the device lands beside the
Mac save before the old one moves into the backup, so a failed copy changes
nothing; a copy to the device first fetches the device's save to the Mac and stops
if that fails. save_device (hle_fs.c, a game that mounts device save data beside
its account save) goes along. The copy is refused while a build of the game runs
on the Mac, and the question says to close the game on the device. The question is
asked in the sheet, so a controller can answer it.

All devicectl calls go through one replaceable function (DeviceControl). The tests
serve a temporary folder as the device's container through a stand-in and never
run devicectl: reading both sides, both copies with their backups, a failed or
unreachable device replacing nothing, the copy-to destination being the save
folder and never the game folder that holds romfs.img (a mutation of it fails
three tests), a copy nested in its destination, the listing's dates, the newer
side, and finding a running build by its title ID. swift build -c release is
clean, swift test passes (56, 3 skipped), and the visual QA renders the sheet and
its question with the controller's focus on it.

Not checked on a real device: devicectl's JSON (the dates are read from
CoreDevice's modificationDate key wherever it nests) and whether copy from puts
the folder at or inside --destination (both are handled).
v0lumehi added a commit to v0lumehi/NX2Apple that referenced this pull request Oct 27, 2026
…alled on (LNPANDY#66)

A save lived in ~/Library/Application Support/nxnative/<title ID>/save on the Mac
(dm/mac/launcher.c) and in Documents/games/<title ID>/save in the iPhone app's
container (dm/ios/Sources/main.m, the per-game folder a launcher install uses), and
the two never met. Manage > Saves... (a controller's Y) opens a sheet with both
saves' newest file dates, the newer one marked, and a copy either way over LNPANDY#28's
route: devicectl with the installed app's data container, on the device the game
was installed on.

The save being replaced is backed up first, beside the Mac save in
save-backups/<date> mac or <date> device. A copy from the device lands beside the
Mac save before the old one moves into the backup, so a failed copy changes
nothing; a copy to the device first fetches the device's save to the Mac and stops
if that fails. save_device (hle_fs.c, a game that mounts device save data beside
its account save) goes along. The copy is refused while a build of the game runs
on the Mac, and the question says to close the game on the device. The question is
asked in the sheet, so a controller can answer it.

All devicectl calls go through one replaceable function (DeviceControl). The tests
serve a temporary folder as the device's container through a stand-in and never
run devicectl: reading both sides, both copies with their backups, a failed or
unreachable device replacing nothing, the copy-to destination being the save
folder and never the game folder that holds romfs.img (a mutation of it fails
three tests), a copy nested in its destination, the listing's dates, the newer
side, and finding a running build by its title ID. swift build -c release is
clean, swift test passes (56, 3 skipped), and the visual QA renders the sheet and
its question with the controller's focus on it.

Not checked on a real device: devicectl's JSON (the dates are read from
CoreDevice's modificationDate key wherever it nests) and whether copy from puts
the folder at or inside --destination (both are handled).
v0lumehi added a commit to v0lumehi/NX2Apple that referenced this pull request Oct 27, 2026
…alled on (LNPANDY#66)

A save lived in ~/Library/Application Support/nxnative/<title ID>/save on the Mac
(dm/mac/launcher.c) and in Documents/games/<title ID>/save in the iPhone app's
container (dm/ios/Sources/main.m, the per-game folder a launcher install uses), and
the two never met. Manage > Saves... (a controller's Y) opens a sheet with both
saves' newest file dates, the newer one marked, and a copy either way over LNPANDY#28's
route: devicectl with the installed app's data container, on the device the game
was installed on.

The save being replaced is backed up first, beside the Mac save in
save-backups/<date> mac or <date> device. A copy from the device lands beside the
Mac save before the old one moves into the backup, so a failed copy changes
nothing; a copy to the device first fetches the device's save to the Mac and stops
if that fails. save_device (hle_fs.c, a game that mounts device save data beside
its account save) goes along. The copy is refused while a build of the game runs
on the Mac, and the question says to close the game on the device. The question is
asked in the sheet, so a controller can answer it.

All devicectl calls go through one replaceable function (DeviceControl). The tests
serve a temporary folder as the device's container through a stand-in and never
run devicectl: reading both sides, both copies with their backups, a failed or
unreachable device replacing nothing, the copy-to destination being the save
folder and never the game folder that holds romfs.img (a mutation of it fails
three tests), a copy nested in its destination, the listing's dates, the newer
side, and finding a running build by its title ID. swift build -c release is
clean, swift test passes (56, 3 skipped), and the visual QA renders the sheet and
its question with the controller's focus on it.

Not checked on a real device: devicectl's JSON (the dates are read from
CoreDevice's modificationDate key wherever it nests) and whether copy from puts
the folder at or inside --destination (both are handled).
@v0lumehi
v0lumehi deleted the device-install branch November 1, 2026 05:10
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.

2 participants