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
App: a manual download route for flaky networks, and ZIP copies are understood
LNPANDY3e0f72195169
diff --git a/frontend/Sources/NSPortBuilder/ContentView.swift b/frontend/Sources/NSPortBuilder/ContentView.swiftindex c0d1a568..7480960c 100644--- a/frontend/Sources/NSPortBuilder/ContentView.swift+++ b/frontend/Sources/NSPortBuilder/ContentView.swift@@ -210,8 +210,9 @@ final class BuildModel: ObservableObject {/// Compare the checkout with origin/main. `silent` is the launch-time check: no status text, no/// error noise when offline — it only fills repoBehind when it can.func checkRepoUpdates(silent: Bool = false) {- guard !running, !repoBusy, repoOK, let git = Self.gitBinary() else {- if !silent, repoOK, Self.gitBinary() == nil { repoStatus = t("repo.gitMissing") }+ guard repoOK, repoIsGit else { return }+ guard !running, !repoBusy, let git = Self.gitBinary() else {+ if !silent, Self.gitBinary() == nil { repoStatus = t("repo.gitMissing") }return}repoBusy = true@@ -239,7 +240,7 @@ final class BuildModel: ObservableObject {/// Fast-forward the checkout to origin/main. The build keeps everything it needs under/// <id>_build/ outside the repository, so a pull never disturbs a previous build's files.func pullRepo() {- guard !running, !repoBusy, repoOK, let git = Self.gitBinary() else { return }+ guard !running, !repoBusy, repoOK, repoIsGit, let git = Self.gitBinary() else { return }repoBusy = true; repoStatus = t("repo.pulling")let dir = repoPathDispatchQueue.global().async {@@ -362,6 +363,9 @@ final class BuildModel: ObservableObject {}var repoOK: Bool { Self.isRepo(repoPath) }+ /// A clone has .git; a GitHub "Download ZIP" copy does not (everything builds, but there is+ /// nothing to fetch or pull — the update buttons hide and the note says to re-download instead).+ var repoIsGit: Bool { FileManager.default.fileExists(atPath: repoPath + "/.git") }var canBuild: Bool { repoOK && !basePath.isEmpty && !keysPath.isEmpty && allDepsPresent && !running }// MARK: Build@@ -1048,12 +1052,14 @@ struct ContentView: View {sectionHeader("shippingbox", m.t("repo.title"), note: m.t("repo.note"))Spacer(minLength: 8)if m.repoOK {- if let n = m.repoBehind, n > 0 {+ if let n = m.repoBehind, n > 0, m.repoIsGit {Button(m.t("repo.pull")) { m.pullRepo() }.disabled(m.repoBusy || m.running)}- Button(m.t("repo.check")) { m.checkRepoUpdates() }- .disabled(m.repoBusy || m.running)+ if m.repoIsGit {+ Button(m.t("repo.check")) { m.checkRepoUpdates() }+ .disabled(m.repoBusy || m.running)+ }} else {Button(m.t("repo.download")) { m.cloneRepo() }.disabled(m.repoBusy || m.running)@@ -1082,6 +1088,19 @@ struct ContentView: View {} else if !m.repoOK {Text(m.t("repo.firstHint")).font(.system(size: 11.5)).foregroundStyle(.secondary)}+ if !m.repoOK {+ // GitHub does not load everywhere: the manual route (Code → Download ZIP → unzip →+ // Choose repository) needs no git at all, and the note says which folder to pick.+ HStack(spacing: 4) {+ Text(m.t("repo.manualHint")).font(.system(size: 11.5)).foregroundStyle(.secondary)+ Link("github.com/LNPANDY/NX2Apple", destination: URL(string: BuildModel.repoURL.replacingOccurrences(of: ".git", with: ""))!)+ .font(.system(size: 11.5))+ Text(m.t("repo.manualHint2")).font(.system(size: 11.5)).foregroundStyle(.secondary)+ }+ }+ if m.repoOK, !m.repoIsGit {+ Text(m.t("repo.noGit")).font(.system(size: 11.5)).foregroundStyle(.secondary)+ }}.padding(8)}}diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swiftindex 9265ceac..c84c046d 100644--- a/frontend/Sources/NSPortBuilder/Localization.swift+++ b/frontend/Sources/NSPortBuilder/Localization.swift@@ -49,8 +49,13 @@ enum L10n {"repo.downloading": ("正在下载到 ~/NX2Apple…(进度见下方日志,约一分钟)","Downloading to ~/NX2Apple… (progress in the log below, about a minute)"),"repo.downloadDone": ("仓库已下载到 %@", "Repository downloaded to %@"),- "repo.downloadFail": ("下载失败——详情见日志(网络或 git 的问题)",- "Download failed — see the log (network or git)"),+ "repo.downloadFail": ("下载失败——网络不顺?用下面的手动方法",+ "Download failed — flaky network? Use the manual route below"),+ "repo.manualHint": ("网络不顺也可以手动:打开", "Flaky network? Do it by hand: open"),+ "repo.manualHint2": ("→ 点绿色 Code 按钮 → Download ZIP,解压后点「选择仓库…」选中解压出的文件夹",+ "→ the green Code button → Download ZIP, unzip, then pick the unzipped folder with Choose repository…"),+ "repo.noGit": ("这是 ZIP 下载的副本(无 git 历史),构建不受影响;要更新就重新下载 ZIP 解压覆盖",+ "This is a ZIP copy (no git history); builds work fine — to update, download the ZIP again and replace the folder"),"repo.destBusy": ("%@ 已存在且不是本项目——换个位置,或点「选择仓库…」","%@ already exists and is not this project — use another place, or Choose repository…"),"repo.firstHint": ("第一次用?点「下载仓库」自动获取项目(约一分钟,需要网络)",