Skip to content

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

Slim IPA by default: the full package was a trap

LNPANDY13d9191f9fbc
diff --git a/README.md b/README.md
index c876b4b2..1457e6d4 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ Measured on Tears of the Kingdom (v1.0.0 + 1.4.3):
| Files | 304,243 | **127** |
| Largest directory | 75,941 entries | 126 shards, none over 200 MiB |
| IPA with the game inside | 16.6 GB (fails to install) | — |
-| IPA without it (`DM_NO_ROMFS=1`) | — | **743 MB, installs** |
+| Slim IPA (the default, no RomFS inside) | — | **743 MB, installs** |
| Copy to the phone | hours | one folder of 127 files |
Path lookup is a binary search over the sorted file table; a directory listing walks one contiguous
@@ -125,15 +125,19 @@ python3 dm/tools/romfs_arc.py verify <base> <RomFS dir> # byte-compares every
python3 dm/tools/romfs_arc.py list <base> [path] # list one directory
```
-### 4. Build the IPA without the RomFS
+### 4. Build the IPA
+
+The main build script packs a **slim IPA by default** (no RomFS inside; the app reads the game
+files from `Documents/romfs`), so step 1 already produced it. To re-pack just the package later:
```bash
-DM_NO_ROMFS=1 GAME=<title id> W=<work dir> PATCHED=<patched dir> \
+GAME=<title id> W=<work dir> PATCHED=<patched dir> \
ROMFS=<RomFS dir> MSL_IOS=<shader dir> \
dm/ios/tools/build_ipa.sh <output.ipa>
```
-Without `DM_NO_ROMFS=1` the script behaves exactly as upstream (the RomFS goes into the package).
+`--full-romfs` (or `DM_FULL_ROMFS=1`) packs the RomFS into the package instead — upstream's
+behaviour, only sensible for small games.
### 5. Copy the archive to the phone
@@ -187,7 +191,7 @@ and the reader looks paths up in that tree. To switch games:
1. Extract the new game's NSPs with `nx_extract` as usual (upstream's script does this).
2. Pack that game's `RomFS` with `romfs_arc.py`.
-3. Rebuild the IPA with `DM_NO_ROMFS=1` and the new `GAME=` profile.
+3. Rebuild the IPA with the new `GAME=` profile (the slim package is the default).
4. Copy the new archive into `Documents/romfs/`.
Three things to watch for:
@@ -225,7 +229,7 @@ past the end would return the next file's bytes).
| `dm/host/hle_fs.c` | mount and route archive-backed paths |
| `dm/host/Makefile` | build `romfs_arc.c` |
| `dm/ios/Sources/main.m` | `romfs_locate` accepts `romfs.idx` |
-| `dm/ios/tools/build_ipa.sh` | `DM_NO_ROMFS=1` |
+| `dm/ios/tools/build_ipa.sh` | slim by default (`DM_FULL_ROMFS=1` = upstream full package) |
The mount is recognised by its **directory**, not its name: titles differ (`rom` for most games,
`content` for Tears of the Kingdom).
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 5e3c2d96..3dc264fb 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -38,7 +38,7 @@ romfs.00 ... .125 126 个分片,每片 200 MiB,源文件字节原样
| 文件数 | 304,243 | **127** |
| 最大的目录 | 75,941 个条目 | 126 个分片,均不超过 200 MiB |
| 含游戏的 IPA | 16.6 GB(装不上) | — |
-| 不含游戏的 IPA(`DM_NO_ROMFS=1`) | — | **743 MB,可安装** |
+| 瘦身 IPA(默认,不含 RomFS) | — | **743 MB,可安装** |
| 拷到手机 | 数小时 | 一个含 127 个文件的文件夹 |
路径查找是对排序后的文件表做二分查找;目录枚举只遍历一段连续的子项区间。索引用 `mmap` 映射,
@@ -115,15 +115,18 @@ python3 dm/tools/romfs_arc.py verify <基路径> <RomFS 目录> # 逐字节比
python3 dm/tools/romfs_arc.py list <基路径> [路径] # 列出某个目录
```
-### 4. 构建不含 RomFS 的 IPA
+### 4. 构建 IPA
+
+主构建脚本**默认打瘦身 IPA**(不含 RomFS;App 从 `Documents/romfs` 读游戏文件),所以第 1 步
+已经产出。以后只想重新打包时:
```bash
-DM_NO_ROMFS=1 GAME=<title id> W=<工作目录> PATCHED=<改写目录> \
+GAME=<title id> W=<工作目录> PATCHED=<改写目录> \
ROMFS=<RomFS 目录> MSL_IOS=<shader 目录> \
dm/ios/tools/build_ipa.sh <输出.ipa>
```
-不设 `DM_NO_ROMFS=1` 时,脚本行为与上游完全一致(RomFS 进包)。
+`--full-romfs`(或 `DM_FULL_ROMFS=1`)把 RomFS 打进包里——上游行为,只对小体量游戏有意义。
### 5. 把归档拷到手机
@@ -174,7 +177,7 @@ DM_OPMODE=0 # 掌机模式:720p 渲染而不是底座的 1080p
1. 用 `nx_extract` 解出新游戏的 NSP(上游脚本会自动做)。
2. 用 `romfs_arc.py` 打包那个游戏的 `RomFS`。
-3. 用新的 `GAME=` profile 加 `DM_NO_ROMFS=1` 重新构建 IPA。
+3. 用新的 `GAME=` profile 重新构建 IPA(默认即瘦身包)。
4. 把新归档拷进 `Documents/romfs/`。
三点需要注意:
@@ -208,7 +211,7 @@ DM_OPMODE=0 # 掌机模式:720p 渲染而不是底座的 1080p
| `dm/host/hle_fs.c` | 挂载并路由归档路径 |
| `dm/host/Makefile` | 编译 `romfs_arc.c` |
| `dm/ios/Sources/main.m` | `romfs_locate` 接受 `romfs.idx` |
-| `dm/ios/tools/build_ipa.sh` | `DM_NO_ROMFS=1` |
+| `dm/ios/tools/build_ipa.sh` | 默认瘦身包(`DM_FULL_ROMFS=1` = 上游完整包) |
挂载点按**目录**识别,而不是按名字:各游戏的挂载名不同(多数是 `rom`,《王国之泪》是 `content`)。
diff --git a/dm/games/0100F2C0115B6000/dmsh_chain.h b/dm/games/0100F2C0115B6000/dmsh_chain.h
index e86b8b99..8cd659de 100644
--- a/dm/games/0100F2C0115B6000/dmsh_chain.h
+++ b/dm/games/0100F2C0115B6000/dmsh_chain.h
@@ -1,2 +1,2 @@
// Generated file (dm/gfx/tools/dmsh_chain.py --header, game 0100F2C0115B6000): the B shader library translation chain version this source tree expects (default options); the host loads only <library dir>/b-<V>/
-#define DMSH_CHAIN "e7245308050d"
+#define DMSH_CHAIN "4d019a31c6c4"
diff --git a/dm/ios/tools/build_ipa.sh b/dm/ios/tools/build_ipa.sh
index ab2b032d..113b6bfe 100755
--- a/dm/ios/tools/build_ipa.sh
+++ b/dm/ios/tools/build_ipa.sh
@@ -95,16 +95,16 @@ codesign -d --entitlements :- "$APP" | grep -q increased-memory-limit \
|| die "entitlements did not make it into the placeholder signature"
t "entitlements: increased-memory-limit embedded in the placeholder signature"
if [ -n "$AOC" ] && [ -d "$AOC" ]; then MAPS+=("$P/aoc=$AOC"); t "add-on content: $(ls "$AOC" | tr '\n' ' ')"; fi
-# DM_NO_ROMFS=1: leave the RomFS out of the package. The app then reads it from Documents/romfs
-# (a directory tree, or a ROMFSARC archive: romfs.idx + romfs.NN shards, see dm/host/romfs_arc.h).
-# This is how a game whose RomFS is too large for the iOS installer is shipped: the package stays
-# small and the game files are copied once through the Files app / Finder.
-if [ -n "${DM_NO_ROMFS:-}" ]; then
- t "pack IPA without RomFS (game files come from Documents/romfs)"
+# DM_FULL_ROMFS=1: pack the RomFS into the package (upstream behaviour; only sensible for small
+# games — a full package of a large game is many GB and iOS refuses to install it). The default is
+# the slim package: the app reads the game files from Documents/romfs (a directory tree, or a
+# ROMFSARC archive: romfs.idx + romfs.NN shards, see dm/host/romfs_arc.h and docs/ROMFS_ARCHIVE.md).
+if [ -z "${DM_FULL_ROMFS:-}" ]; then
+ t "pack slim IPA without RomFS (game files come from Documents/romfs; DM_FULL_ROMFS=1 packs them)"
python3 tools/pack_ipa.py "$OUT_IPA" --store "$(gp zip_store)" --skip $P/_CodeSignature --skip $P/embedded.mobileprovision --skip $P/msl --skip $P/aoc --skip $P/romfs "${MAPS[@]}" || die "pack_ipa"
else
MAPS+=("$P/romfs=$ROMFS")
- t "pack IPA (already-compressed game files stored, everything else deflated)"
+ t "pack full IPA with RomFS (already-compressed game files stored, everything else deflated)"
python3 tools/pack_ipa.py "$OUT_IPA" --store "$(gp zip_store)" --skip $P/_CodeSignature --skip $P/embedded.mobileprovision --skip $P/msl --skip $P/aoc --skip $P/romfs "${MAPS[@]}" || die "pack_ipa"
fi
t "done: $OUT_IPA ($(du -h "$OUT_IPA" | cut -f1))"
diff --git a/scripts/build_ipa_from_nsp.py b/scripts/build_ipa_from_nsp.py
index 516f914d..99812450 100755
--- a/scripts/build_ipa_from_nsp.py
+++ b/scripts/build_ipa_from_nsp.py
@@ -1076,6 +1076,8 @@ def parse_args(argv):
ap.add_argument('--app-name', help='app name on the home screen (default: the game name in the base NSP)')
ap.add_argument('--bundle-id', help='the app\'s bundle ID (default: org.nxnative.<base game title ID in lowercase>)')
ap.add_argument('--keep-extracted', action=argparse.BooleanOptionalAction, help='keep the extracted game files after the IPA is built, for the next build (default: the KEEP_EXTRACTED setting, on)')
+ ap.add_argument('--slim', action=argparse.BooleanOptionalAction, default=True, help='pack the IPA without the RomFS: the app reads the game files from Documents/romfs (a directory tree or a ROMFSARC archive, see docs/ROMFS_ARCHIVE.md). Default on — a full package of a large game is many GB and iOS refuses to install it (PackageExtractionFailed)')
+ ap.add_argument('--full-romfs', dest='slim', action='store_false', help='pack the RomFS into the IPA (upstream behaviour; only sensible for small games)')
ap.add_argument('--env-file', help='environment switches for a diagnostic build (one KEY=VALUE per line)')
ap.add_argument('--survey-only', action='store_true', help='a game with no profile: only the survey, no provisional profile and no IPA')
ap.add_argument('--allow-damaged', action='store_true', help='a damaged NSP (files failing the NCA hash check): write them as read and go on instead of stopping')
@@ -1198,6 +1200,9 @@ def main(args=None):
else: say('[RED] no game icon in the extraction (an older extraction did not save it: delete extract/ and run again); the home-screen icon will be blank')
env_file = args.env_file or DM_ENV_FILE
if env_file: ipa_env['DM_ENV_FILE'] = str(Path(os.path.expanduser(env_file)).resolve())
+ if args.slim:
+ ipa_env['DM_NO_ROMFS'] = '1'
+ say('slim IPA: the RomFS stays out of the package (pack the archive with dm/tools/romfs_arc.py and copy it to the app\'s Documents/romfs; --full-romfs packs it instead)')
watch = IpaWatch(repo, work / 'ipa', out_ipa)
PROG.stage('app build', poll=watch.poll, step='starting') # build_ipa.sh's "pack IPA" line starts the stage "IPA pack"
run(['bash', repo / 'dm/ios/tools/build_ipa.sh', out_ipa], logs / 'build_ipa.log', env=ipa_env, on_line=watch.line)