Skip to content

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

BC compatibility as an app switch, and both new capabilities in the README

LNPANDYee6b799111df
diff --git a/README.md b/README.md
index 253661ab..2fa3882c 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,16 @@
<img src="frontend/screenshots/hero-features-en.png" width="100%" alt="NX2Apple — Switch games on your iPhone">
+> **New in v0.4.4** — two changes worth knowing before you start:
+>
+> - 🖥️ **A Mac app as an output.** The same build can produce a double-clickable `.app` for this
+> Mac instead of an iPhone IPA — pick it in the footer. Same extraction, rewrite and shaders;
+> the RomFS goes inside the app.
+> - 📱 **Older iPhones and iPads.** A build can now decode BC textures on the CPU, which brings
+> **A15 / A16 and earlier** devices into range (iPhone 13 and older, A16 iPads). It is a switch
+> in the app, off by default — newer devices keep the faster GPU path.
+
+
A macOS app takes your own game dumps and does the whole thing with a few clicks — unpack, rewrite
the game's code for Apple silicon, translate its shaders to Metal, pack a slim IPA plus a sharded
RomFS archive that a phone can actually install (even a 16 GB game), and then tells you the three
@@ -198,6 +208,8 @@ Newest first. The fork follows upstream daily, so its game list and host fixes a
| Date | Version | What changed |
|---|---|---|
+| 2026-10-26 | unreleased | **Mac app output** (a double-clickable .app from the same build); **A15/A16 and earlier devices** via CPU BC decode, as an app switch; per-game data folders (`Documents/games/<id>/`) so an external drive works; NRO header no longer scanned as code; the nightly sync can no longer fail silently |
+| 2026-10-26 | v0.4.4 | **Fixes a build failure that hit every app build in v0.4.3** (`work` read before it was assigned); 72 games (+3) |
| 2026-10-26 | v0.4.3 | NSZ/XCZ dumps work out of the box; a fresh Xcode now reports its missing iOS SDK; three environment traps closed |
| 2026-10-25 | v0.4.2 | The app downloads and updates the repository itself, and updates itself; 58 games (+10); save-loading deadlock fixed; NuGet failures self-heal |
| 2026-10-24 | v0.4.1 | Animal Crossing: New Horizons verified on an iPhone (103,645 files → 72 shards); archive packing reuses unchanged work |
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 2692603f..7fdec78f 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -18,6 +18,15 @@
<img src="frontend/screenshots/hero-features.png" width="100%" alt="NX2Apple — Switch 游戏装进 iPhone">
+> **v0.4.4 新增** —— 开始之前值得知道的两件事:
+>
+> - 🖥️ **可以输出 Mac App。** 同一次构建能产出可双击运行的 `.app`,而不是 iPhone 的 IPA ——
+> 在底栏切换。解包、重写、shader 完全相同,RomFS 打包进 App 内部。
+> - 📱 **支持更老的 iPhone 和 iPad。** 构建时可以选择在 CPU 上解压 BC 纹理,从而支持
+> **A15 / A16 及更早**的设备(iPhone 13 及更早、A16 的 iPad)。App 里有开关,默认关闭 ——
+> 新设备继续走更快的 GPU 路径。
+
+
一个 macOS App 拿你自己导出的游戏文件,点几下就把整件事做完——解包、为 Apple 芯片重写游戏代码、把
shader 翻译成 Metal、打包出装得进手机的瘦身 IPA 和分片 RomFS 归档(16 GB 的大作也装得上),最后告诉
你装上设备的三步。
@@ -200,6 +209,8 @@ cd frontend && swift run # 或直接双击 frontend/NS Port Builder.app
| 日期 | 版本 | 变更 |
|---|---|---|
+| 2026-10-26 | 未发布 | **可输出 Mac App**(同一次构建产出可双击运行的 .app);**支持 A15 / A16 及更早设备**(CPU 解压 BC 纹理,App 内开关);每游戏独立数据目录(`Documents/games/<id>/`),外置硬盘可用;NRO 头不再被当作代码扫描;每日同步不会再静默失败 |
+| 2026-10-26 | v0.4.4 | **修复了 v0.4.3 里每个 App 构建都会失败的问题**(`work` 在赋值前被读取);72 款游戏(+3) |
| 2026-10-26 | v0.4.3 | NSZ/XCZ 压缩格式开箱可用;全新 Xcode 会明说缺 iOS SDK;三个环境陷阱关掉 |
| 2026-10-25 | v0.4.2 | App 自己下载并更新仓库、也能更新自己;58 款游戏(+10);读档死锁修复;NuGet 报错自动恢复 |
| 2026-10-24 | v0.4.1 | 集合啦!动物森友会在 iPhone 上验证通过(103,645 文件 → 72 片);归档打包复用未变的成果 |
diff --git a/dm/gfx/nvn/nvn_mtl.m b/dm/gfx/nvn/nvn_mtl.m
index 9be2f6df..eaf47f7b 100644
--- a/dm/gfx/nvn/nvn_mtl.m
+++ b/dm/gfx/nvn/nvn_mtl.m
@@ -351,8 +351,13 @@ void mtl_init(void) {
if (!g_dev) MDIE("no Metal device");
if (!g_dev.hasUnifiedMemory) MDIE("needs a unified-memory device (zero-copy memory pools)");
g_bc_gpu = [g_dev supportsBCTextureCompression];
- g_bc_cpu = !g_bc_gpu && DM_GAME_TEX_BC_CPU;
- if (g_bc_cpu) MLOG("BC textures: this GPU has no BC support, decoding them on the CPU (profile tex_bc_cpu)");
+ // DM_TEX_BC_CPU overrides the profile at run time, which is what lets the app offer a switch
+ // without rebuilding: 1 turns it on, 0 off, unset keeps the profile's tex_bc_cpu. It only ever
+ // applies to a GPU without BC support — on hardware that has it the GPU path is always better.
+ const char *bc_env = getenv("DM_TEX_BC_CPU");
+ int bc_want = bc_env ? atoi(bc_env) : DM_GAME_TEX_BC_CPU;
+ g_bc_cpu = !g_bc_gpu && bc_want;
+ if (g_bc_cpu) MLOG("BC textures: this GPU has no BC support, decoding them on the CPU (%s)", bc_env ? "DM_TEX_BC_CPU" : "profile tex_bc_cpu");
g_q = [g_dev newCommandQueue];
// A device without Metal 4 (the paravirtualized GPU of a virtual Mac, such as GitHub's macos-26 runner: no residency set, no MTL4CommandQueue) cannot run the NVN layer. The GL and
// Vulkan layers draw on classic queues of their own and need only the device (mtl_device_classic): there the classic part starts and presents are dropped, which is all a
diff --git a/frontend/Sources/NSPortBuilder/ContentView.swift b/frontend/Sources/NSPortBuilder/ContentView.swift
index f9ebb438..b1c3f2df 100644
--- a/frontend/Sources/NSPortBuilder/ContentView.swift
+++ b/frontend/Sources/NSPortBuilder/ContentView.swift
@@ -86,6 +86,13 @@ final class BuildModel: ObservableObject {
@Published var target = (UserDefaults.standard.string(forKey: "buildTarget") ?? "ios") {
didSet { UserDefaults.standard.set(target, forKey: "buildTarget") }
}
+ /// Decode BC-compressed textures on the CPU. Only relevant for GPUs without BC support
+ /// (A15/A16 and older): on a device that has it the GPU path is always better, so the switch
+ /// is a compatibility option and defaults off. Passed as DM_TEX_BC_CPU through --env-file,
+ /// which the host reads at start-up — no rebuild of the host needed.
+ @Published var bcOnCPU = UserDefaults.standard.bool(forKey: "bcOnCPU") {
+ didSet { UserDefaults.standard.set(bcOnCPU, forKey: "bcOnCPU") }
+ }
@Published var archivePath = "" // the romfs folder the pack wrote
/// Where this build's folder actually is: --work-dir when the checkout has it, else the script's
/// default under the input folder (issue #5 — an upstream checkout has no --work-dir).
@@ -584,6 +591,19 @@ final class BuildModel: ObservableObject {
}
var args = [repoPath + "/scripts/build_ipa_from_nsp.py", inputDir, "-k", keysPath,
"--progress", "lines"]
+ // A compatibility switch the player turned on: written to a small env file the pipeline
+ // copies into the app bundle (main.m sets one variable per line at boot). Only for an IPA;
+ // a Mac app runs on this Mac's GPU, which always has BC support.
+ if bcOnCPU && target != "mac-app" {
+ let envPath = NSTemporaryDirectory() + "nspb-env-\(UUID().uuidString.prefix(8)).txt"
+ do {
+ try "DM_TEX_BC_CPU=1\n".write(toFile: envPath, atomically: true, encoding: .utf8)
+ args += ["--env-file", envPath]
+ say(t("msg.bcOn"))
+ } catch {
+ say(String(format: t("msg.bcEnvFailed"), error.localizedDescription))
+ }
+ }
if hasWorkDir { args += ["--work-dir", workDir] }
let macApp = target == "mac-app"
if macApp {
@@ -1237,6 +1257,7 @@ struct ContentView: View {
header
repository
inputs
+ buildOptions
dependencies
if m.done { installGuide }
stagesView
@@ -1364,6 +1385,32 @@ struct ContentView: View {
// ---- 游戏数据 ----
+ // ---- build options ----
+
+ /// Output-specific switches. A Mac app runs on this Mac's GPU (which always has BC support),
+ /// so the compatibility option is only shown for an iPhone build.
+ @ViewBuilder private var buildOptions: some View {
+ GroupBox {
+ VStack(alignment: .leading, spacing: 10) {
+ sectionHeader("slider.horizontal.3", m.t("opt.title"), note: m.t("opt.note"))
+ if m.target == "mac-app" {
+ Text(m.t("opt.macNoBc"))
+ .font(.system(size: 11.5)).foregroundStyle(.secondary)
+ } else {
+ Toggle(isOn: $m.bcOnCPU) {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(m.t("opt.bc")).font(.system(size: 13))
+ Text(m.t("opt.bc.note"))
+ .font(.system(size: 11)).foregroundStyle(.secondary)
+ }
+ }
+ .toggleStyle(.switch)
+ .disabled(m.running)
+ }
+ }.padding(8)
+ }
+ }
+
private var inputs: some View {
GroupBox {
VStack(alignment: .leading, spacing: 10) {
diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift
index b741fe27..bb57c935 100644
--- a/frontend/Sources/NSPortBuilder/Localization.swift
+++ b/frontend/Sources/NSPortBuilder/Localization.swift
@@ -120,6 +120,15 @@ enum L10n {
"msg.macAppDone": ("Mac App 已生成,可在访达里双击运行", "Mac app ready — double-click it in the Finder"),
"msg.macAppMissing": ("构建结束但没有找到 .app(仓库里缺 dm/mac/pack_app.py?)",
"Build finished but no .app was produced (is dm/mac/pack_app.py in the checkout?)"),
+ "opt.title": ("构建选项", "Build options"),
+ "opt.note": ("按输出类型", "per output"),
+ "opt.bc": ("兼容老设备(A15 / A16 及更早)", "Older devices (A15 / A16 and earlier)"),
+ "opt.bc.note": ("在不支持 BC 纹理压缩的 GPU 上于 CPU 解压:iPhone 13 及更早、A16 的 iPad。新设备请保持关闭——GPU 路径更快",
+ "Decode BC textures on the CPU for GPUs without BC support: iPhone 13 and earlier, A16 iPads. Leave off on newer devices — the GPU path is faster"),
+ "opt.macNoBc": ("Mac App 用这台 Mac 的 GPU,不需要兼容选项", "A Mac app uses this Mac's GPU; no compatibility option needed"),
+ "msg.bcOn": ("兼容老设备:BC 纹理将在 CPU 上解压", "Older-device mode: BC textures will be decoded on the CPU"),
+ "msg.bcEnvFailed": ("无法写入环境文件:%@——继续构建,但兼容模式未启用",
+ "Could not write the environment file: %@ — building without the compatibility mode"),
"target.ios": ("输出:iPhone IPA", "Output: iPhone IPA"),
"target.mac": ("输出:Mac App", "Output: Mac app"),
"target.tip": ("点一下切换(Mac App 可直接双击运行,不需要 iPhone)",