Skip to content

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

Launch options: a changed row is tinted and has its own reset

LNPANDY582dcb9dde01
diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py
index 2464d279..fada0ea7 100644
--- a/frontend-qt/nspb_qt/localization.py
+++ b/frontend-qt/nspb_qt/localization.py
@@ -384,6 +384,7 @@ TABLE: dict[str, tuple[str, str, str, str]] = {
'library.scrollForward': ('向后滚动', 'Scroll forward', 'Rulla framåt', 'Weiterblättern'),
'launch.title': ('启动选项', 'Launch options', 'Startalternativ', 'Startoptionen'),
'launch.reset': ('恢复测试默认值', 'Reset to tested defaults', 'Återställ testade standardvärden', 'Auf getestete Standardwerte zurücksetzen'),
+ 'launch.rowReset': ('恢复此设置的默认值', 'Reset this setting to its default', 'Den här inställningen tillbaka till standardvärdet', 'Diese Einstellung auf den Standard zurücksetzen'),
'launch.done': ('完成', 'Done', 'Klar', 'Fertig'),
'launch.applied': ('已保存到这个游戏应用中,每次启动都会生效。', 'Saved in the game’s app: applies every time it starts.', 'Sparat i spelets app och används vid varje start.', 'In der App des Spiels gesichert: gilt bei jedem Start.'),
'launch.none': ('这个版本没有附带启动选项列表。', 'This build carries no list of launch options.', 'Den här versionen saknar lista över startalternativ.', 'Dieser Build bringt keine Liste mit Startoptionen mit.'),
diff --git a/frontend/Sources/NSPortBuilder/LaunchOptionsView.swift b/frontend/Sources/NSPortBuilder/LaunchOptionsView.swift
index 38cb5f1f..be9b0460 100644
--- a/frontend/Sources/NSPortBuilder/LaunchOptionsView.swift
+++ b/frontend/Sources/NSPortBuilder/LaunchOptionsView.swift
@@ -161,13 +161,18 @@ struct LaunchOptionsView: View {
all.first { $0.env == "DM_OPMODE" }.map { value($0, game) != "0" } ?? true
}
+ /// Whether this row carries a choice of its own: a value that differs from the tested default is what
+ /// "changed" means here, and it is what the tint and the per-row reset go by.
+ private func changed(_ s: LaunchSetting, _ game: LibraryGame) -> Bool { value(s, game) != s.def }
+
@ViewBuilder private func row(_ s: LaunchSetting, _ game: LibraryGame, all: [LaunchSetting]) -> some View {
let value = self.value(s, game)
let isDocked = docked(game, all)
let pixels = s.kind == "range" ? s.pixels(scale: Double(value) ?? 1, docked: isDocked) : nil
+ let changed = changed(s, game)
HStack(alignment: .center, spacing: 16) {
VStack(alignment: .leading, spacing: 3) {
- Text(s.label).font(.manrope(14, .medium))
+ Text(s.label).font(.manrope(14, .medium)).foregroundStyle(changed ? LauncherPalette.cream : .primary)
if let full = s.kind == "range" ? s.pixels(scale: 1, docked: isDocked) : nil {
// The render scale in pixels: the share of the game's own size in the console mode chosen
Text(String(format: m.t(isDocked ? "launch.scaleOfDocked" : "launch.scaleOfHandheld"), Int(((Double(value) ?? 1) * 100).rounded()), full))
@@ -177,6 +182,15 @@ struct LaunchOptionsView: View {
}
}
Spacer(minLength: 12)
+ if changed { // a per-row reset, NX Play's: one tap back to the tested default
+ Button { set(s, s.def) } label: {
+ Image(systemName: "arrow.uturn.backward.circle").font(.system(size: 15))
+ .foregroundStyle(.secondary)
+ }
+ .buttonStyle(.plain)
+ .help(m.t("launch.rowReset"))
+ .accessibilityLabel(m.t("launch.rowReset"))
+ }
control(s, value, pixels: pixels).frame(width: LaunchControl.width, alignment: .trailing)
}
.padding(.horizontal, 18).padding(.vertical, 13)
diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift
index f8bdaf99..d0747dc9 100644
--- a/frontend/Sources/NSPortBuilder/Localization.swift
+++ b/frontend/Sources/NSPortBuilder/Localization.swift
@@ -427,6 +427,7 @@ enum L10n {
"library.scrollForward": ("\u{5411}\u{540e}\u{6eda}\u{52a8}", "Scroll forward"),
"launch.title": ("\u{542f}\u{52a8}\u{9009}\u{9879}", "Launch options"),
"launch.reset": ("\u{6062}\u{590d}\u{6d4b}\u{8bd5}\u{9ed8}\u{8ba4}\u{503c}", "Reset to tested defaults"),
+ "launch.rowReset": ("恢复此设置的默认值", "Reset this setting to its default"),
"launch.done": ("\u{5b8c}\u{6210}", "Done"),
"launch.applied": ("已保存到这个游戏应用中,每次启动都会生效。", "Saved in the game’s app: applies every time it starts."),
"launch.none": ("\u{8fd9}\u{4e2a}\u{7248}\u{672c}\u{6ca1}\u{6709}\u{9644}\u{5e26}\u{542f}\u{52a8}\u{9009}\u{9879}\u{5217}\u{8868}\u{3002}", "This build carries no list of launch options."),
@@ -1322,6 +1323,7 @@ enum L10n {
"library.scrollForward": "Rulla framåt",
"launch.title": "Startalternativ",
"launch.reset": "Återställ testade standardvärden",
+ "launch.rowReset": "Den här inställningen tillbaka till standardvärdet",
"launch.done": "Klar",
"launch.applied": "Sparat i spelets app och används vid varje start.",
"launch.none": "Den här versionen saknar lista över startalternativ.",
@@ -2151,6 +2153,7 @@ enum L10n {
"library.scrollForward": "Weiterblättern",
"launch.title": "Startoptionen",
"launch.reset": "Auf getestete Standardwerte zurücksetzen",
+ "launch.rowReset": "Diese Einstellung auf den Standard zurücksetzen",
"launch.done": "Fertig",
"launch.applied": "In der App des Spiels gesichert: gilt bei jedem Start.",
"launch.none": "Dieser Build bringt keine Liste mit Startoptionen mit.",