Skip to content

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

Two notices the last build cycle asked for, then some

LNPANDY2359762c6250
diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py
index 503e365d..ed71e172 100644
--- a/frontend-qt/nspb_qt/localization.py
+++ b/frontend-qt/nspb_qt/localization.py
@@ -153,6 +153,8 @@ TABLE: dict[str, tuple[str, str]] = {
'dep.install.fail': ('安装失败:%@(详情见日志)', 'Install failed: %@ (see the log)'),
'dep.python.old': ('Python %@ 太旧(需要 3.9 或更新);这个解释器没有构建需要的包', 'Python %@ is too old (need 3.9 or newer); it lacks the packages the build needs'),
'dep.python.none': ('没找到可用的 Python(%@ 不行)——点右侧「安装」,App 会下载 3.12 并静默装到自己的目录', 'No usable Python found (%@ will not run) — press Install and the app fetches 3.12 into its own folder'),
+ 'msg.workdirHint': ('提示:「输出目录」同时是构建缓存的位置(输出目录/<ID>_build)。已有构建资源时,把它选回上次的同一位置即可复用(解包、shader 不重跑);换新位置会从头再来。', 'Tip: the output folder is also where the build cache lives (<output>/<ID>_build). To reuse an existing build, point it back at the same folder; a new folder starts over.'),
+ 'msg.chainChanged': ('上游代码更新了 shader 翻译链,之前构建的 shader 库无法复用——本次构建用新翻译器重建(每个版本一次,之后的构建恢复复用)。', 'An upstream update changed the shader translator, so previously built shader libraries cannot be reused — this build rebuilds them with the new one (once per update; later builds reuse as before).'),
'dep.python.downloading': ('正在下载并安装 Python 3.12…(约 26 MB,装到 App 自己的目录)', "Downloading and installing Python 3.12… (about 26 MB, into the app's own folder)"),
'dep.python.done': ('Python 已安装:%@', 'Python installed: %@'),
'prog.title': ('构建进度', 'Build progress'),
diff --git a/frontend-qt/nspb_qt/ui.py b/frontend-qt/nspb_qt/ui.py
index 5c442484..a00d684e 100644
--- a/frontend-qt/nspb_qt/ui.py
+++ b/frontend-qt/nspb_qt/ui.py
@@ -265,8 +265,11 @@ class MainWindow(QMainWindow):
def _build_footer(self) -> None:
wrap = QWidget()
- row = QHBoxLayout(wrap)
- row.setContentsMargins(12, 6, 12, 8)
+ outer = QVBoxLayout(wrap)
+ outer.setContentsMargins(0, 0, 0, 0)
+ outer.setSpacing(2)
+ row = QHBoxLayout()
+ row.setContentsMargins(12, 6, 12, 4)
row.setSpacing(10)
self.build_btn = QPushButton(self.m.t('build.start'))
self.build_btn.setObjectName('primary')
@@ -287,6 +290,14 @@ class MainWindow(QMainWindow):
self._translatable.append((self.out_btn, 'build.outDir'))
self.out_btn.clicked.connect(self._choose_out)
row.addWidget(self.out_btn)
+ # the output folder silently decides where the build cache lives — the report changed it
+ # and lost a finished build; say it here, all the time
+ hint = QLabel(self.m.t('msg.workdirHint'))
+ hint.setObjectName('note')
+ hint.setWordWrap(True)
+ outer.addLayout(row)
+ outer.addWidget(hint)
+ self._translatable.append((hint, 'msg.workdirHint'))
self.centralWidget().layout().addWidget(wrap)
@staticmethod
@@ -478,6 +489,14 @@ class MainWindow(QMainWindow):
self.log.moveCursor(self.log.textCursor().MoveOperation.End)
self.log.insertPlainText(s)
self.log.moveCursor(self.log.textCursor().MoveOperation.End)
+ # The script marks a shader-chain bump with this tag: the cached libraries cannot be
+ # reused and this build recompiles them. A popup, not a log line — the report's question
+ # ("why is it building shaders again, the artifacts are on the drive") came from exactly
+ # this moment passing unnoticed. Once per build: the log chunks arrive in pieces.
+ if '[NOTE] chain-changed' in s and not getattr(self, '_chain_note_shown', False):
+ self._chain_note_shown = True
+ from PySide6.QtWidgets import QMessageBox
+ QMessageBox.information(self, 'NS Port Builder', self.m.t('msg.chainChanged'))
def _on_finished(self, ok: bool, note: str) -> None:
if ok:
diff --git a/frontend/Sources/NSPortBuilder/ContentView.swift b/frontend/Sources/NSPortBuilder/ContentView.swift
index f89d22d8..36db836b 100644
--- a/frontend/Sources/NSPortBuilder/ContentView.swift
+++ b/frontend/Sources/NSPortBuilder/ContentView.swift
@@ -74,6 +74,7 @@ final class BuildModel: ObservableObject {
]
@Published var outDir = ""
@Published var stages: [Stage] = []
+ private var chainNoteShown = false // the shader-chain notice shows once per build
@Published var running = false
@Published var logTail = ""
@Published var done = false
@@ -752,6 +753,18 @@ final class BuildModel: ObservableObject {
private func handle(_ line: String) {
append(line + "\n")
+ // The script marks a shader-chain bump with this tag: the cached libraries cannot be
+ // reused and this build recompiles them. An alert, not a log line — the report's question
+ // ("why is it building shaders again, the artifacts are on the drive") came from exactly
+ // this moment passing unnoticed. Once per build: the pipe delivers arbitrary chunks.
+ if line.contains("[NOTE] chain-changed") && !chainNoteShown {
+ chainNoteShown = true
+ let a = NSAlert()
+ a.messageText = t("msg.chainChanged")
+ a.alertStyle = .informational
+ a.addButton(withTitle: "OK")
+ a.runModal()
+ }
guard let s = Self.parseStage(line) else { return }
if let i = stages.firstIndex(where: { $0.id == s.k }) {
if !s.name.isEmpty { stages[i].name = s.name }
@@ -1662,6 +1675,7 @@ struct ContentView: View {
// ---- 底部(固定) ----
private var footer: some View {
+ VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 14) {
Button(m.running ? m.t("btn.stop") : (m.done ? m.t("btn.rebuild") : m.t("btn.build"))) {
m.running ? m.stop() : m.startBuild()
@@ -1689,8 +1703,18 @@ struct ContentView: View {
if d.runModal() == .OK, let u = d.url { m.outDir = u.path }
}
}
+ // The report's own mistake, and a reasonable one: the output folder silently decides where
+ // the build cache lives, so changing it threw away a finished build. Say it where the
+ // folder buttons are, all the time.
+ Text(m.t("msg.workdirHint"))
+ .font(.system(size: 10.5))
+ .foregroundStyle(.secondary)
+ .lineLimit(2)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
.padding(.horizontal, 22)
- .padding(.vertical, 12)
+ .padding(.top, 12)
+ .padding(.bottom, 6)
}
@ViewBuilder private var statusText: some View {
diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift
index 379afee7..8aca688f 100644
--- a/frontend/Sources/NSPortBuilder/Localization.swift
+++ b/frontend/Sources/NSPortBuilder/Localization.swift
@@ -224,6 +224,10 @@ enum L10n {
"Python %@ is too old (need 3.9 or newer); it lacks the packages the build needs"),
"dep.python.none": ("没找到可用的 Python(%@ 不行)——点右侧「安装」,App 会下载 3.12 并静默装到自己的目录",
"No usable Python found (%@ will not run) — press Install and the app fetches 3.12 into its own folder"),
+ "msg.workdirHint": ("提示:「输出目录」同时是构建缓存的位置(输出目录/<ID>_build)。已有构建资源时,把它选回上次的同一位置即可复用(解包、shader 不重跑);换新位置会从头再来。",
+ "Tip: the output folder is also where the build cache lives (<output>/<ID>_build). To reuse an existing build, point it back at the same folder; a new folder starts over."),
+ "msg.chainChanged": ("上游代码更新了 shader 翻译链,之前构建的 shader 库无法复用——本次构建用新翻译器重建(每个版本一次,之后的构建恢复复用)。",
+ "An upstream update changed the shader translator, so previously built shader libraries cannot be reused — this build rebuilds them with the new one (once per update; later builds reuse as before)."),
"dep.python.downloading": ("正在下载并安装 Python 3.12…(约 26 MB,装到 App 自己的目录)",
"Downloading and installing Python 3.12… (about 26 MB, into the app's own folder)"),
"dep.python.done": ("Python 已安装:%@", "Python installed: %@"),
diff --git a/scripts/build_ipa_from_nsp.py b/scripts/build_ipa_from_nsp.py
index 8aa11cc2..3d49d419 100755
--- a/scripts/build_ipa_from_nsp.py
+++ b/scripts/build_ipa_from_nsp.py
@@ -1454,6 +1454,11 @@ def build_shaders(py, repo, sh, xlate, env, logs, g, pkg_key=None, mac=False):
ios, log = sh / 'ios', logs / 'dmsh_build.log'
PROG.stage('Mac shaders' if mac else 'iOS shaders')
chain = chain_of(repo)
+ stale = sorted(d.name for d in (sh / 'cache').glob('b-*') if d.name != f'b-{chain}' and any(d.glob('*_b.metallib'))
+ ) + sorted(d.name for d in ios.glob('b-*') if d.name != f'b-{chain}' and any(d.glob('*_b.metallib')))
+ if stale: say(f'[NOTE] chain-changed: {", ".join(stale)} -> b-{chain}: the upstream update changed the shader '
+ 'translator, so the cached libraries cannot be reused and this build rebuilds them with it '
+ '(once per update; later builds reuse as before)')
out = sh / 'cache' if mac else ios
libs, kf, kmac = out / f'b-{chain}', ios / f'b-{chain}.key', sh / f'mac-b-{chain}.key'
if pkg_key:
diff --git a/scripts/sync_upstream.py b/scripts/sync_upstream.py
index 2f42551f..d2964262 100644
--- a/scripts/sync_upstream.py
+++ b/scripts/sync_upstream.py
@@ -542,6 +542,20 @@ def rmtree(p):
if p.is_symlink() or p.is_file(): p.unlink()
elif p.exists(): shutil.rmtree(p, onerror=_rmtree_enoent)
if p.exists(): shutil.rmtree(p, onerror=_rmtree_enoent) # the caller needs it gone (copytree follows)""")]))
+ # A shader-chain bump (an upstream translator update) silently invalidates every cached
+ # library: the row stayed green, the build "worked", and hours of Metal compile looked like a
+ # mystery re-run (the report: "why is it building shaders again, the artifacts are on the
+ # drive"). Say it loudly, with a marker both front ends turn into a user-facing notice.
+ P.append(('chain-change note', "[NOTE] chain-changed", [(
+ """ chain = chain_of(repo)
+ out = sh / 'cache' if mac else ios""",
+ """ chain = chain_of(repo)
+ stale = sorted(d.name for d in (sh / 'cache').glob('b-*') if d.name != f'b-{chain}' and any(d.glob('*_b.metallib'))
+ ) + sorted(d.name for d in ios.glob('b-*') if d.name != f'b-{chain}' and any(d.glob('*_b.metallib')))
+ if stale: say(f'[NOTE] chain-changed: {", ".join(stale)} -> b-{chain}: the upstream update changed the shader '
+ 'translator, so the cached libraries cannot be reused and this build rebuilds them with it '
+ '(once per update; later builds reuse as before)')
+ out = sh / 'cache' if mac else ios""")]))
# Xcode 15 and later download the iOS platform separately: xcodebuild and the Metal compiler can
# both be present with no iOS SDK, and the failure then surfaced deep inside xcodebuild. Naming
# the SDK makes the error actionable (found while auditing environment assumptions, 2026-10-26).