Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Docs: route C M1 and M2 run on a device, and how M2 was built

v0lumehicda0bb0a39c7
diff --git a/patches/0015-fork-docs.patch b/patches/0015-fork-docs.patch
index 359d62b3..d0fe02d5 100644
--- a/patches/0015-fork-docs.patch
+++ b/patches/0015-fork-docs.patch
@@ -15,7 +15,7 @@ Issue: LNPANDY/NX2Apple#123
docs/ROADMAP.md | 139 +++++++++++++++
docs/WORK-IN-PROGRESS.md | 88 ++++++++++
docs/launcher-c-design.md | 339 ++++++++++++++++++++++++++++++++++++
- docs/launcher-c-plan.md | 213 ++++++++++++++++++++++
+ docs/launcher-c-plan.md | 232 ++++++++++++++++++++++++
docs/probe-dlopen.md | 64 +++++--
8 files changed, 1149 insertions(+), 15 deletions(-)
create mode 100644 docs/MULTIPLAYER.md
@@ -951,18 +951,23 @@ index 0000000..476a1c1
+> **Update (merged):** the dlopen probe now exists — `dm/ios/probe/` with `build_probe.sh`, committed alongside this document, and `probe-out/DmProbe.ipa` is built. W1 step 1 is done. What remains is running it on an iOS 26 device and reading `Documents/probe-log.txt`.
diff --git a/docs/launcher-c-plan.md b/docs/launcher-c-plan.md
new file mode 100644
-index 0000000..e6e253c
+index 00000000..34bb84f1
--- /dev/null
+++ b/docs/launcher-c-plan.md
-@@ -0,0 +1,213 @@
+@@ -0,0 +1,232 @@
+# Route C implementation plan — shell app + per-game framework
+
-+Status: **the dlopen gate is open** (device run on iOS 27.0.1, [probe-dlopen.md](probe-dlopen.md)),
-+design in [launcher-c-design.md](launcher-c-design.md). This plan turns the design into
-+milestones with a testable artifact each. The probe proved a one-function framework loads and
-+runs, but **the real payload is still unproven** (a framework with the game's ~100 MB of `__DM*W`
-+sections / up to 255 sections, `vm_remap` of its signed `__TEXT` with copy=FALSE,
-+`getsectiondata` on a dylib header). M1 exists to prove exactly that.
++Status (2026-10-30): **M1 and M2 run on a device.** The shell app (`dm/ios/tools/build_shell.sh`,
++`dm/ios/project-shell.yml`, `dm/ios/Shell/`) with Breath of the Wild's `DmGame01007EF00011E000.framework`
++(`build_ipa.sh DM_FRAMEWORK_ONLY`, the NSP script's `--shell-framework`) was installed by the Mac launcher's
++one-app target on an iPhone 17 Pro Max (iOS 27.0.1): the library lists the game from the embedded framework,
++its data sits in `Documents/games/01007EF00011E000/`, and Play loads the framework (`boot: game framework …`,
++the module bases of main, subsdk0 and sdk from its sections), mounts the RomFS image and both DLC and reaches
++the game's frame loop. What M2 built and why is in the section below. Open: M3 needs the host to stop reading
++the compiled `game_profile.h` macros (a shell holds one game profile until then, `build_shell.sh` refuses a
++second), M4 (external drive, per-game DLC beyond `aoc/`), M5 (incremental frameworks, broken-framework
++tolerance on a device, re-sign timing). The dlopen gate: [probe-dlopen.md](probe-dlopen.md), the design:
++[launcher-c-design.md](launcher-c-design.md).
+
+## Milestones
+
@@ -1025,6 +1030,20 @@ index 0000000..e6e253c
+
+## M2 — shell + one framework
+
++**As built (2026-10-30).** The project lives in `dm/ios/project-shell.yml` beside `build_ipa.sh`, because
++the host is compiled from `dm/host`'s Makefile per build (`gen_build.py`) and the glue in `dm/ios/Shell/`
++calls the engine's internals. The views have no engine dependency and stay the Swift package `frontend-ios/`
++(ShellUI, ShellHost, ShellControllers), linked into the app as a local package by its absolute path, so the
++demo and the package tests build without the engine. `GameCatalogue` reads `Frameworks/*.framework` with a
++manifest, `EngineLaunchPlan` (ShellHost) computes the environment of the table below from the game, its data
++folder and the player's per-game settings (the per-game app's `launcher.<VAR>` keys), and `ShellMain.m` sets it,
++dlopens the framework, calls `dm_set_game_image_header` and `dm_host_preload_start` with
++`argv = [dmhost, <framework>/dm, <manifest modules>]`, then front_ios.m's unchanged game view takes the window.
++Each framework is self-contained: code, tables, `profile.tsv`, `dm/launcher.json`, `msl/`, `pso/`, icon and
++banner. The game data stays in Documents. The plan's separate `GameManifest.swift`, `GameLibrary.swift`,
++`GameData.m`, `GameLauncher.m` and `BootState.m` became ShellHost types and `ShellMain.m`, and `main.m`,
++`Launcher.swift` and `LauncherSettings.swift` are not changed (the default path is untouched).
++
+`DmShell.app` lists one game. Play sets the environment, `dlopen`s the framework, calls
+`dm_set_game_image_header` + `dm_host_preload_start`, then shows the existing game view.
+