Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.
Swift apple-siliconcustom-formathomebrewiosipaipadipadosiphonemetalnative-portnintendo-switchnxnativeromfsswitch-games
A Brewfile installs the build tools, and the README keeps Python packages in a venv
v0lumehibf77967ab618
diff --git a/.gitignore b/.gitignoreindex 90dabfb4..a1326177 100644--- a/.gitignore+++ b/.gitignore@@ -32,3 +32,6 @@ layout_*.tsv# in the tree, and it stayed until 2026-10-27)frontend/*.zipfrontend/NX2Apple.app/++# the virtual environment the README creates for the Python packages+.venv/diff --git a/Brewfile b/Brewfilenew file mode 100644index 00000000..0f9c9db0--- /dev/null+++ b/Brewfile@@ -0,0 +1,7 @@+# System tools for building NX2Apple from source: brew bundle --file=Brewfile+# The Mac launcher's setup screen offers the same tools (frontend/Tests/NSPortBuilderTests/BrewfileTests.swift keeps them equal).+brew "xcodegen" # generates the Xcode project+brew "zstd" # decompression+brew "spirv-cross" # shader translation+brew "glslang" # only for OpenGL (LÖVE) games+cask "dotnet-sdk" # the .NET SDK (10) the extractor and the shader translator run ondiff --git a/README.md b/README.mdindex 6d10c528..5aa6956d 100644--- a/README.md+++ b/README.md@@ -265,9 +265,10 @@ packages, then pack an IPA.```bashgit clone https://github.com/<you>/NX2Apple.gitcd NX2Apple-brew install xcodegen zstd spirv-cross glslang # glslang: OpenGL (LÖVE) games only-brew install --cask dotnet-sdk-python3 -m pip install lz4 capstone fonttools backports.zstd+brew bundle --file=Brewfile # xcodegen, zstd, spirv-cross, glslang (OpenGL games only), .NET SDK+python3 -m venv .venv # Homebrew's Python refuses global pip installs (PEP 668)+.venv/bin/python -m pip install lz4 capstone fonttools nsz "backports.zstd; python_version < '3.14'"+source .venv/bin/activate # so that python3 below is the venv's (in each new terminal)```### 2. What you need on diskdiff --git a/README.zh-CN.md b/README.zh-CN.mdindex 5e58ba62..9661f25d 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -261,9 +261,10 @@ Homebrew 工具和 Python 包,然后打 IPA。```bashgit clone https://github.com/<you>/NX2Apple.gitcd NX2Apple-brew install xcodegen zstd spirv-cross glslang # glslang: OpenGL (LÖVE) games only-brew install --cask dotnet-sdk-python3 -m pip install lz4 capstone fonttools backports.zstd+brew bundle --file=Brewfile # xcodegen, zstd, spirv-cross, glslang(仅 OpenGL 游戏), .NET SDK+python3 -m venv .venv # Homebrew 的 Python 不允许全局 pip 安装(PEP 668)+.venv/bin/python -m pip install lz4 capstone fonttools nsz "backports.zstd; python_version < '3.14'"+source .venv/bin/activate # 之后的 python3 即 venv 的(每个新终端都要执行)````backports.zstd` 是《王国之泪》的 zstd 字典需要的;其他游戏用不到。diff --git a/frontend/Sources/NSPortBuilder/ContentView.swift b/frontend/Sources/NSPortBuilder/ContentView.swiftindex d15f735d..5557afa5 100644--- a/frontend/Sources/NSPortBuilder/ContentView.swift+++ b/frontend/Sources/NSPortBuilder/ContentView.swift@@ -1870,6 +1870,14 @@ final class BuildModel: ObservableObject {/// the script with a message the user could not act on (issue #53).nonisolated static let minPython = (3, 12)+ /// The Homebrew formulae the dependency check offers, with the localization key of each row. The repo-root+ /// Brewfile lists the same formulae (BrewfileTests keeps the two equal).+ nonisolated static let brewDeps: [(formula: String, key: String)] =+ [("xcodegen", "dep.xcodegen"), ("zstd", "dep.zstd"), ("spirv-cross", "dep.spirv")]++ /// Formulae the Brewfile also installs that the check does not ask for: glslang is only for OpenGL (LÖVE) games.+ nonisolated static let optionalBrewFormulae = ["glslang"]+/// The interpreter probe: lz4 / capstone / fontTools always, and zstd from either source —/// `compression.zstd` is built in from Python 3.14 and `backports.zstd` (which declares/// Python < 3.14) is the only option before that. Requiring the backport unconditionally@@ -2093,7 +2101,7 @@ final class BuildModel: ObservableObject {out.append(Dep(id: "brew", name: "dep.brew", hint: "dep.brew.hint", present: brew != nil,installCmd: ["/bin/bash", "-c","NONINTERACTIVE=1 /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""]))- for (pkg, key) in [("xcodegen", "dep.xcodegen"), ("zstd", "dep.zstd"), ("spirv-cross", "dep.spirv")] {+ for (pkg, key) in brewDeps {let path = firstExisting(["/opt/homebrew/bin/\(pkg)", "/usr/local/bin/\(pkg)"])out.append(Dep(id: "brew:" + pkg, name: key, hint: key + ".hint", present: path != nil,detail: path ?? "",diff --git a/frontend/Tests/NSPortBuilderTests/BrewfileTests.swift b/frontend/Tests/NSPortBuilderTests/BrewfileTests.swiftnew file mode 100644index 00000000..31a6d8fb--- /dev/null+++ b/frontend/Tests/NSPortBuilderTests/BrewfileTests.swift@@ -0,0 +1,35 @@+import XCTest+@testable import NSPortBuilder++/// #111: the repo-root Brewfile is the one list of Homebrew tools, and the launcher's dependency check offers the same.+final class BrewfileTests: XCTestCase {+ private func brewfileLines() throws -> [String] {+ // frontend/Tests/NSPortBuilderTests/BrewfileTests.swift -> the repository root+ var url = URL(fileURLWithPath: #filePath)+ for _ in 0..<4 { url.deleteLastPathComponent() }+ let text = try String(contentsOf: url.appendingPathComponent("Brewfile"), encoding: .utf8)+ return text.split(separator: "\n").map { line in+ String(line.split(separator: "#", maxSplits: 1, omittingEmptySubsequences: false).first ?? "")+ .trimmingCharacters(in: .whitespaces)+ }.filter { !$0.isEmpty }+ }++ private func entries(_ kind: String) throws -> [String] {+ try brewfileLines().compactMap { line in+ guard line.hasPrefix(kind + " \""), let a = line.firstIndex(of: "\""),+ let b = line[line.index(after: a)...].firstIndex(of: "\"") else { return nil }+ return String(line[line.index(after: a)..<b])+ }+ }++ func testBrewfileFormulaeAreTheLaunchersDependencies() throws {+ let launcher = Set(BuildModel.brewDeps.map { $0.formula } + BuildModel.optionalBrewFormulae)+ XCTAssertEqual(Set(try entries("brew")), launcher)+ XCTAssertEqual(try entries("brew").count, launcher.count, "a formula is listed twice")+ }++ func testBrewfileCaskIsTheDotnetSdkTheLauncherNeeds() throws {+ // The launcher checks for an SDK (`dotnet --list-sdks`) and installs channel 10.0; the cask is Homebrew's SDK.+ XCTAssertEqual(try entries("cask"), ["dotnet-sdk"])+ }+}