Skip to content

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

Qt front end: the language toggle re-translates everything, and the venv finds the app interpreter

LNPANDY7286e5d15eaf
diff --git a/dm/ios/probe/DmProbe.xcodeproj/project.pbxproj b/dm/ios/probe/DmProbe.xcodeproj/project.pbxproj
index 4ed3bdef..bdc31f0c 100644
--- a/dm/ios/probe/DmProbe.xcodeproj/project.pbxproj
+++ b/dm/ios/probe/DmProbe.xcodeproj/project.pbxproj
@@ -38,7 +38,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
- 43150F93F9204EF615D94F11 /* DmProbe.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = DmProbe.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 43150F93F9204EF615D94F11 /* DmProbe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DmProbe.app; sourceTree = BUILT_PRODUCTS_DIR; };
9D35A9F8119FFBEE2C503AAD /* probe.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = probe.c; sourceTree = "<group>"; };
FB06C46F0E8AB6B859924E6A /* probe_main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = probe_main.m; sourceTree = "<group>"; };
FE4AE6108123D746C5393ED7 /* Probe.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Probe.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -129,9 +129,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
- LastUpgradeCheck = 1430;
- TargetAttributes = {
- };
+ LastUpgradeCheck = 2710;
};
buildConfigurationList = 9ED6CC584E2C401AB7102CFC /* Build configuration list for PBXProject "DmProbe" */;
developmentRegion = en;
@@ -218,6 +216,7 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@@ -238,6 +237,7 @@
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
+ STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
@@ -249,6 +249,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
+ DEVELOPMENT_TEAM = MG2FF22535;
INFOPLIST_FILE = "probe-Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -266,6 +267,8 @@
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = NO;
+ "DEVELOPMENT_TEAM[sdk=iphoneos*]" = MG2FF22535;
+ "DEVELOPMENT_TEAM[sdk=macosx*]" = MG2FF22535;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -320,6 +323,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -333,6 +337,7 @@
MTL_FAST_MATH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
+ STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
@@ -345,6 +350,8 @@
CODE_SIGN_IDENTITY = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = NO;
+ "DEVELOPMENT_TEAM[sdk=iphoneos*]" = MG2FF22535;
+ "DEVELOPMENT_TEAM[sdk=macosx*]" = MG2FF22535;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -367,6 +374,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
+ DEVELOPMENT_TEAM = MG2FF22535;
INFOPLIST_FILE = "probe-Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
diff --git a/dm/ios/probe/DmProbe.xcodeproj/xcshareddata/xcschemes/DmProbe.xcscheme b/dm/ios/probe/DmProbe.xcodeproj/xcshareddata/xcschemes/DmProbe.xcscheme
index 8747bc5e..ee38f971 100644
--- a/dm/ios/probe/DmProbe.xcodeproj/xcshareddata/xcschemes/DmProbe.xcscheme
+++ b/dm/ios/probe/DmProbe.xcodeproj/xcshareddata/xcschemes/DmProbe.xcscheme
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
- LastUpgradeVersion = "1430"
- version = "1.7">
+ LastUpgradeVersion = "2710"
+ version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
- buildImplicitDependencies = "YES"
- runPostActionsOnFailure = "NO">
+ buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
@@ -41,8 +40,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- shouldUseLaunchSchemeArgsEnv = "YES"
- onlyGenerateCoverageForSpecifiedTargets = "NO">
+ shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py
index 6165b0ec..503e365d 100644
--- a/frontend-qt/nspb_qt/localization.py
+++ b/frontend-qt/nspb_qt/localization.py
@@ -135,7 +135,7 @@ TABLE: dict[str, tuple[str, str]] = {
'dep.spirv.hint.win': ('仅 OpenGL 游戏需要——<a href="https://vulkan.lunarg.com/sdk/home">Vulkan SDK</a> 自带(装完在 toolchain.json 里指一下 Bin 目录)', 'only OpenGL games need it — the <a href="https://vulkan.lunarg.com/sdk/home">Vulkan SDK</a> ships it (point "spirv_cross_dir" in toolchain.json at its Bin folder)'),
'dep.zstd.win': ('zstd', 'zstd'),
'dep.zstd.hint.win': ('解压——点「安装」由 App 下载(facebook/zstd 官方 Windows 版)', "decompression — press Install and the app fetches it (facebook/zstd's official Windows build)"),
- 'dep.metal.hint.win': ('需要 <a href="https://developer.apple.com/download/all/">Apple 开发者下载页</a> 的「Metal Developer Tools for Windows」(免登录不行,需免费 Apple ID;搜索该名称),约 840 MB', 'from the <a href="https://developer.apple.com/download/all/">Apple developer downloads</a>: "Metal Developer Tools for Windows" (an Apple ID sign-in is required; search that name), about 840 MB'),
+ 'dep.metal.hint.win': ('需要 <a href="https://developer.apple.com/download/all/">Apple 开发者下载页</a> 的「Metal Developer Tools for Windows」(需 Apple ID)', 'needs <a href="https://developer.apple.com/download/all/">Apple developer downloads</a>: "Metal Developer Tools for Windows" (Apple ID required)'),
'dep.zstd.hint': ('解压', 'decompression'),
'dep.spirv': ('brew: spirv-cross', 'brew: spirv-cross'),
'dep.spirv.hint': ('shader 转换', 'shader translation'),
diff --git a/frontend-qt/nspb_qt/model.py b/frontend-qt/nspb_qt/model.py
index efe6c297..79d4833d 100644
--- a/frontend-qt/nspb_qt/model.py
+++ b/frontend-qt/nspb_qt/model.py
@@ -269,10 +269,13 @@ class Model(QObject):
d.installing = True
self.deps = deps
- self.python_path, self.python_ok, self.python_ver = py, py_ok, py_ver
if not pu.IS_WIN:
- # On Windows `_windows_deps` already set these from the toolchain probe, which is
- # where the app-installed SDK is visible; this branch is the macOS one.
+ # On Windows `_windows_deps` already set python_path (the interpreter the app
+ # installed, which find_python without its candidates cannot see) and dotnet_path
+ # from the toolchain probes; assigning the plain find_python result here overwrote
+ # the interpreter with the bare fallback "python", and the venv step then ran
+ # "python -m venv" — which is exactly how it failed on the report's machine.
+ self.python_path, self.python_ok, self.python_ver = py, py_ok, py_ver
self.dotnet_path, self.dotnet_ok = dn, dn_ok
self.deps_checked = True
self.depsChanged.emit()
diff --git a/frontend-qt/nspb_qt/ui.py b/frontend-qt/nspb_qt/ui.py
index 60d3e28d..5c442484 100644
--- a/frontend-qt/nspb_qt/ui.py
+++ b/frontend-qt/nspb_qt/ui.py
@@ -49,6 +49,9 @@ class MainWindow(QMainWindow):
body = QWidget()
body.setObjectName('body')
self.body = QVBoxLayout(body)
+ # (widget, string key) pairs re-set on every refresh: anything built once here would
+ # otherwise keep its start-up language after the toggle (the half-Chinese report)
+ self._translatable: list[tuple[QLabel, str]] = []
self.body.setContentsMargins(12, 10, 12, 10)
self.body.setSpacing(8)
scroll.setWidget(body)
@@ -100,7 +103,10 @@ class MainWindow(QMainWindow):
# ---------------------------------------------------------------- cards
- def _card(self, title: str, note: str = '') -> tuple[QFrame, QVBoxLayout]:
+ def _card(self, title_key: str, note_key: str = '') -> tuple[QFrame, QVBoxLayout]:
+ # title/note are registered for re-translation: the language toggle rebuilds nothing, it
+ # re-sets text — and a card title built once at start-up stayed English after the toggle
+ # (the report's half-Chinese interface).
box = QFrame()
box.setObjectName('card')
lay = QVBoxLayout(box)
@@ -108,24 +114,28 @@ class MainWindow(QMainWindow):
lay.setSpacing(6)
head = QHBoxLayout()
head.setSpacing(6)
- t = QLabel(title)
+ t = QLabel(self.m.t(title_key))
t.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
f = t.font()
f.setBold(True)
f.setPointSize(13)
t.setFont(f)
head.addWidget(t)
- if note:
- n = QLabel(note)
+ n = None
+ if note_key:
+ n = QLabel(self.m.t(note_key))
n.setObjectName('note')
head.addWidget(n)
head.addStretch(1)
lay.addLayout(head)
+ self._translatable.append((t, title_key))
+ if n is not None:
+ self._translatable.append((n, note_key))
self.body.addWidget(box)
return box, lay
def _build_repository(self) -> None:
- box, lay = self._card(self.m.t('repo.title'), self.m.t('repo.note'))
+ box, lay = self._card('repo.title', 'repo.note')
self.repo_box = box
row = QHBoxLayout()
self.repo_dot = QLabel('●')
@@ -138,6 +148,7 @@ class MainWindow(QMainWindow):
self.repo_path_label.setMinimumWidth(60)
row.addWidget(self.repo_path_label, 1)
self.choose_btn = QPushButton(self.m.t('repo.choose'))
+ self._translatable.append((self.choose_btn, 'repo.choose'))
self.choose_btn.clicked.connect(self._choose_repo)
row.addWidget(self.choose_btn)
lay.addLayout(row)
@@ -146,8 +157,10 @@ class MainWindow(QMainWindow):
actions = QHBoxLayout()
actions.setSpacing(8)
self.download_btn = QPushButton(self.m.t('repo.download'))
+ self._translatable.append((self.download_btn, 'repo.download'))
self.download_btn.clicked.connect(lambda: self.m.clone_repo())
self.update_btn = QPushButton(self.m.t('repo.update'))
+ self._translatable.append((self.update_btn, 'repo.update'))
self.update_btn.clicked.connect(self.m.update_repo)
for b in (self.download_btn, self.update_btn):
actions.addWidget(b)
@@ -158,7 +171,7 @@ class MainWindow(QMainWindow):
lay.addWidget(self.repo_status)
def _build_inputs(self) -> None:
- box, lay = self._card(self.m.t('data.title'), self.m.t('data.note'))
+ box, lay = self._card('data.title', 'data.note')
self.data_box = box
self.folder_label = QLabel(self.m.t('data.folderHint'))
self.folder_label.setObjectName('mono')
@@ -175,11 +188,13 @@ class MainWindow(QMainWindow):
dot.setFixedWidth(14)
name = QLabel(self.m.t(l10n))
name.setFixedWidth(110)
+ self._translatable.append((name, l10n))
val = QLabel('—')
val.setObjectName('mono')
val.setTextInteractionFlags(Qt.TextSelectableByMouse)
val.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) # filenames are long; the Choose button must stay visible
btn = QPushButton(self.m.t('data.choose'))
+ self._translatable.append((btn, 'data.choose'))
btn.setFixedWidth(72)
btn.clicked.connect(lambda _=False, k=key: self._choose_input(k))
grid.addWidget(dot, i, 0)
@@ -191,21 +206,24 @@ class MainWindow(QMainWindow):
row = QHBoxLayout()
row.addStretch(1)
pick = QPushButton(self.m.t('data.pickFolder'))
+ self._translatable.append((pick, 'data.pickFolder'))
pick.clicked.connect(self._pick_folder)
row.addWidget(pick)
lay.addLayout(row)
def _build_deps(self) -> None:
- box, lay = self._card(self.m.t('dep.title'))
+ box, lay = self._card('dep.title')
self.deps_box = box
head = QHBoxLayout()
self.deps_summary = QLabel('')
head.addWidget(self.deps_summary)
head.addStretch(1)
self.install_all_btn = QPushButton(self.m.t('dep.installAll'))
+ self._translatable.append((self.install_all_btn, 'dep.installAll'))
self.install_all_btn.clicked.connect(self.m.install_all_missing)
head.addWidget(self.install_all_btn)
recheck = QPushButton(self.m.t('dep.recheck'))
+ self._translatable.append((recheck, 'dep.recheck'))
recheck.clicked.connect(self.m.check_deps)
head.addWidget(recheck)
lay.addLayout(head)
@@ -214,7 +232,7 @@ class MainWindow(QMainWindow):
lay.addLayout(self.deps_container)
def _build_progress(self) -> None:
- box, lay = self._card(self.m.t('prog.title'))
+ box, lay = self._card('prog.title')
self.progress_box = box
self.progress_box.setVisible(False)
self.overall = QProgressBar()
@@ -233,6 +251,7 @@ class MainWindow(QMainWindow):
self.log_path_label.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)
head.addWidget(self.log_path_label, 1)
self.export_btn = QPushButton(self.m.t('log.export'))
+ self._translatable.append((self.export_btn, 'log.export'))
self.export_btn.clicked.connect(self._export_log)
head.addWidget(self.export_btn)
self.body.addLayout(head)
@@ -265,6 +284,7 @@ class MainWindow(QMainWindow):
self.target_btn.clicked.connect(self._toggle_target)
row.addWidget(self.target_btn)
self.out_btn = QPushButton(self.m.t('build.outDir'))
+ self._translatable.append((self.out_btn, 'build.outDir'))
self.out_btn.clicked.connect(self._choose_out)
row.addWidget(self.out_btn)
self.centralWidget().layout().addWidget(wrap)
@@ -281,6 +301,11 @@ class MainWindow(QMainWindow):
def _refresh_all(self) -> None:
self.subtitle.setText(self.m.t('app.subtitle'))
self.lang_btn.setText(self.m.lang.toggle_label)
+ # everything built once at start-up re-reads its string here: the language toggle emits
+ # repoChanged, and without this the card titles, the notes and the buttons kept their
+ # start-up language — the report's half-Chinese interface
+ for w, key in self._translatable:
+ w.setText(self.m.t(key))
full = (pu.short_path(self.m.repo_path) if self.m.repo_ok
else (self.m.repo_path or self.m.t('repo.notFound')))
self.repo_path_label.setText(full)
@@ -436,11 +461,18 @@ class MainWindow(QMainWindow):
self.build_btn.style().unpolish(self.build_btn)
self.build_btn.style().polish(self.build_btn)
self.build_btn.setEnabled(running or self.m.can_build)
- if not running and not self.footer.text():
- if not self.m.base_path:
- self.footer.setText(self.m.t('status.needInputs'))
- elif not self.m.repo_ok:
- self.footer.setText(self.m.t('status.chooseRepo'))
+ # Re-set on every refresh, and clear when a build runs (the build's own progress text
+ # takes the footer). "only when empty" wrote the start-up language once and never
+ # updated it — the footer was English after the toggle.
+ if running:
+ self.footer.setText('')
+ elif not self.m.base_path:
+ self.footer.setText(self.m.t('status.needInputs'))
+ elif not self.m.repo_ok:
+ self.footer.setText(self.m.t('status.chooseRepo'))
+ elif not self.footer.text() or self.footer.text() in (
+ self.m.t('status.needInputs'), self.m.t('status.chooseRepo')):
+ self.footer.setText('')
def _append_log(self, s: str) -> None:
self.log.moveCursor(self.log.textCursor().MoveOperation.End)
diff --git a/frontend-qt/nspb_qt/win/fetch.py b/frontend-qt/nspb_qt/win/fetch.py
index 8ca2cc44..3014969b 100644
--- a/frontend-qt/nspb_qt/win/fetch.py
+++ b/frontend-qt/nspb_qt/win/fetch.py
@@ -417,7 +417,8 @@ def install_python(dest: Path | None = None,
def install_zstd(dest: Path | None = None,
log: Callable[[str], None] | None = None,
- progress: Callable[[int, int], None] | None = None) -> Path:
+ progress: Callable[[int, int], None] | None = None,
+ unpack_progress: Callable[[int, int], None] | None = None) -> Path:
"""Download facebook/zstd's Windows release and unpack the CLI into the tools folder.
The dependency row for zstd used to have no fix at all on Windows — the hint named Homebrew,
diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift
index 839db072..379afee7 100644
--- a/frontend/Sources/NSPortBuilder/Localization.swift
+++ b/frontend/Sources/NSPortBuilder/Localization.swift
@@ -203,8 +203,8 @@ enum L10n {
"only OpenGL games need it — the <a href=\"https://vulkan.lunarg.com/sdk/home\">Vulkan SDK</a> ships it (point \"spirv_cross_dir\" in toolchain.json at its Bin folder)"),
"dep.zstd.win": ("zstd", "zstd"),
"dep.zstd.hint.win": ("解压——点「安装」由 App 下载(facebook/zstd 官方 Windows 版)", "decompression — press Install and the app fetches it (facebook/zstd's official Windows build)"),
- "dep.metal.hint.win": ("需要 <a href=\"https://developer.apple.com/download/all/\">Apple 开发者下载页</a> 的「Metal Developer Tools for Windows」(免登录不行,需免费 Apple ID;搜索该名称),约 840 MB",
- "from the <a href=\"https://developer.apple.com/download/all/\">Apple developer downloads</a>: \"Metal Developer Tools for Windows\" (an Apple ID sign-in is required; search that name), about 840 MB"),
+ "dep.metal.hint.win": ("需要 <a href=\"https://developer.apple.com/download/all/\">Apple 开发者下载页</a> 的「Metal Developer Tools for Windows」(需 Apple ID)",
+ "needs <a href=\"https://developer.apple.com/download/all/\">Apple developer downloads</a>: \"Metal Developer Tools for Windows\" (Apple ID required)"),
"dep.zstd.hint": ("解压", "decompression"),
"dep.spirv": ("brew: spirv-cross", "brew: spirv-cross"),
"dep.spirv.hint": ("shader 转换", "shader translation"),