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
The shell settings page gets its entry, and three rc7 test reports
LNPANDYd711ac08b117
diff --git a/frontend-ios/Sources/ShellUI/LibraryView.swift b/frontend-ios/Sources/ShellUI/LibraryView.swiftindex a24ba691..280410df 100644--- a/frontend-ios/Sources/ShellUI/LibraryView.swift+++ b/frontend-ios/Sources/ShellUI/LibraryView.swift@@ -35,6 +35,7 @@ public struct LibraryView: View {public var input: ShellInput?@State private var selectedID: String?@State private var settingsOpen: Bool+ @State private var shellSettingsOpen = false@State private var controllersOpen: Bool/// The game whose How to fix or How to update explanation is open.@State private var helpGameID: String?@@ -91,7 +92,12 @@ public struct LibraryView: View {if games.isEmpty {EmptyLibraryView().overlay(alignment: .topTrailing) {- ControllerChip(count: controllers.count, action: openControllers).padding(.top, 6).padding(.trailing, 16)+ HStack(spacing: 10) {+ Button { shellSettingsOpen = true } label: {+ Image(systemName: "gearshape")+ }.buttonStyle(ChipButtonStyle()).accessibilityLabel(ShellStrings.text("Settings"))+ ControllerChip(count: controllers.count, action: openControllers)+ }.padding(.top, 6).padding(.trailing, 16)}} else if let selected {library(selected, layout: layout, size: geometry.size, insets: insets)@@ -211,6 +217,11 @@ public struct LibraryView: View {.onChange(of: games.map(\.id)) { _, ids inif !ids.contains(selectedID ?? "") { selectedID = ids.first; settingsOpen = false }}+ .sheet(isPresented: $shellSettingsOpen) {+ ShellSettingsView(store: ShellSettingsStore()) { key in+ if key == "data" { actions.onPickShellData() } else { actions.onPickShellCloud() }+ }+ }}@ViewBuilder private func library(_ selected: GameDetail, layout: ShellLayout, size: CGSize, insets: EdgeInsets) -> some View {diff --git a/frontend-ios/Sources/ShellUI/ShellInputs.swift b/frontend-ios/Sources/ShellUI/ShellInputs.swiftindex 555d878d..8acfc0e2 100644--- a/frontend-ios/Sources/ShellUI/ShellInputs.swift+++ b/frontend-ios/Sources/ShellUI/ShellInputs.swift@@ -157,12 +157,15 @@ public struct ShellActions {public var onShowLog: (String) -> Voidpublic var onAppUpdate: () -> Voidpublic var onBack: () -> Void+ public var onPickShellData: () -> Void+ public var onPickShellCloud: () -> Voidpublic init(onSelect: @escaping (String) -> Void = { _ in }, onPlay: @escaping (String) -> Void = { _ in },onChange: @escaping (String, String, String) -> Void = { _, _, _ in },onPickGameData: @escaping (String) -> Void = { _ in }, onUseAppData: @escaping (String) -> Void = { _ in },onPickCloudSaves: @escaping (String) -> Void = { _ in }, onDisableCloudSaves: @escaping (String) -> Void = { _ in },onResetDefaults: @escaping (String) -> Void = { _ in }, onShowLog: @escaping (String) -> Void = { _ in },- onAppUpdate: @escaping () -> Void = {}, onBack: @escaping () -> Void = {}) {+ onAppUpdate: @escaping () -> Void = {}, onBack: @escaping () -> Void = {},+ onPickShellData: @escaping () -> Void = {}, onPickShellCloud: @escaping () -> Void = {}) {self.onSelect = onSelectself.onPlay = onPlayself.onChange = onChange@@ -174,5 +177,7 @@ public struct ShellActions {self.onShowLog = onShowLogself.onAppUpdate = onAppUpdateself.onBack = onBack+ self.onPickShellData = onPickShellData+ self.onPickShellCloud = onPickShellCloud}}diff --git a/frontend/Sources/NSPortBuilder/BuildNotifications.swift b/frontend/Sources/NSPortBuilder/BuildNotifications.swiftindex 8c5e240b..a2448a31 100644--- a/frontend/Sources/NSPortBuilder/BuildNotifications.swift+++ b/frontend/Sources/NSPortBuilder/BuildNotifications.swift@@ -72,24 +72,16 @@ final class BuildNotifier: NSObject, ObservableObject, UNUserNotificationCenterDfunc watch(_ m: BuildModel, library: GameLibrary) {guard watching == nil, BuildNotice.hasBundleID else { return }UNUserNotificationCenter.current().delegate = self- watching = m.$running.removeDuplicates().dropFirst().sink { [weak self, weak m, weak library] running in+ watching = m.$done.removeDuplicates().dropFirst().sink { [weak self, weak m, weak library] done inguard let self, let m, let library else { return }- if running {- // The first build is when someone has a reason to say yes; the system asks only once.- if BuildNotice.enabled { UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { _, _ in } }- return- }- // Published before the change lands: Stop is still visible now, the outcome only once the handler that- // ended the build has finished (it sets done and its note after running).+ if m.running { return } // a reset between builds: done flips false while nothing has ended yet+ // `done` is the chain's own verdict: the Mac target sets it when the .app exists, the iPhone target+ // when the pack-install chain finished (its script ends earlier, with `running` false while work goes+ // on — a `running`-based notice read that window as a failure, and a done-based one missed nothing).let stopped = m.stoppingDispatchQueue.main.async {- // The iPhone target's build ends its script and then packs the image and installs- // into the shell: `running` flips false while `done` is still false, and the real- // outcome lands when that chain finishes. No failed stage means the build is between- // its phases, not over — stay quiet and let the chain's own end decide.- if !stopped && !m.done && !m.stages.contains(where: { $0.state == .failed }) { return }let outcome: BuildNotice.Outcome = stopped ? .stopped- : m.done ? .finished : .failed(reason: BuildNotice.failureReason(note: m.doneNote, stages: m.stages))+ : done ? .finished : .failed(reason: BuildNotice.failureReason(note: m.doneNote, stages: m.stages))guard BuildNotice.shouldNotify(outcome, enabled: BuildNotice.enabled, appActive: NSApp.isActive, hasBundleID: true) else { return }self.post(outcome, m: m, library: library)}diff --git a/frontend/Sources/NSPortBuilder/ContentView.swift b/frontend/Sources/NSPortBuilder/ContentView.swiftindex 3e8a87ee..6a467ef0 100644--- a/frontend/Sources/NSPortBuilder/ContentView.swift+++ b/frontend/Sources/NSPortBuilder/ContentView.swift@@ -3104,7 +3104,7 @@ struct BuilderView: View {/// One line of a card: a status dot (its place kept when there is none, so every title starts on one line),/// the title (with a disclosure chevron beside it when `open` is given), a secondary detail, and its controls./// Its buttons and dropdowns are all LauncherControl.width wide, so they line up in one column across the cards.- private func row<Trailing: View>(_ title: String, detail: String = "", dot: Color? = nil, help: String = "", open: Bool? = nil,+ private func row<Trailing: View>(_ title: String, detail: String = "", detail2: String = "", dot: Color? = nil, help: String = "", open: Bool? = nil,@ViewBuilder trailing: () -> Trailing) -> some View {HStack(spacing: 12) {Circle().fill(dot ?? .clear).frame(width: 7, height: 7)@@ -3127,6 +3127,10 @@ struct BuilderView: View {.fixedSize(horizontal: false, vertical: true).help(help.isEmpty ? detail : help)}}+ if !detail2.isEmpty {+ Text(detail2).font(.mono(12)).foregroundStyle(.secondary)+ .lineLimit(1).truncationMode(.middle).help(detail2)+ }}Spacer(minLength: 12)trailing().launcherRowControls()@@ -3714,7 +3718,7 @@ struct BuilderView: View {Text(m.confirmingChannel.flatMap { m.engineSelection.channel.switchWarningKey(to: $0) }.map { m.t($0) } ?? "")}divider- row(m.t("shellCache.row"), detail: m.t("shellCache.note") + "\n" + m.shellCachePath) {+ row(m.t("shellCache.row"), detail: m.t("shellCache.note"), detail2: m.shellCachePath) {Button(m.t("shellCache.open")) { m.revealFolder(URL(fileURLWithPath: m.shellCachePath)) }.buttonStyle(LauncherSecondaryButtonStyle())}diff --git a/frontend/Sources/NSPortBuilder/LauncherDropdown.swift b/frontend/Sources/NSPortBuilder/LauncherDropdown.swiftindex e7af1653..31b11980 100644--- a/frontend/Sources/NSPortBuilder/LauncherDropdown.swift+++ b/frontend/Sources/NSPortBuilder/LauncherDropdown.swift@@ -243,13 +243,13 @@ struct LauncherDropdown: View {let shape = RoundedRectangle(cornerRadius: rounded ? 9 : 99)let width = fill ? nil : rowWidthreturn HStack(spacing: 8) {- if fill || width != nil { Spacer(minLength: 0) } // a fixed-width dropdown centres its words- Text(current).font(.manrope(rounded ? 13 : 12.5, .semibold)).lineLimit(1)- .minimumScaleFactor(width == nil ? 1 : 0.85)+ if fill || width != nil { Spacer(minLength: 0) } // the words centre in the space beside the chevron:+ Text(current).font(.manrope(rounded ? 13 : 12.5, .semibold)).lineLimit(1) // an equal leading spacer keeps+ .minimumScaleFactor(width == nil ? 1 : 0.85) // their centre on the button's.fixedSize(horizontal: !fill && width == nil, vertical: false)if fill || width != nil { Spacer(minLength: 0) }Image(systemName: "chevron.down").font(.system(size: 9, weight: .bold)).foregroundStyle(.secondary)- .rotationEffect(.degrees(open ? 180 : 0))+ .rotationEffect(.degrees(open ? 180 : 0)).frame(width: 14) // chevron reserves its width, so both spacers match}.padding(.horizontal, rounded ? 15 : 14).padding(.vertical, rounded ? 9 : 7).frame(width: width, height: width == nil ? nil : LauncherControl.height)diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swiftindex 81666826..851ef017 100644--- a/frontend/Sources/NSPortBuilder/Localization.swift+++ b/frontend/Sources/NSPortBuilder/Localization.swift@@ -256,7 +256,8 @@ enum L10n {"settings.heading": ("\u{8bbe}\u{7f6e}", "Settings"),"settings.note": ("\u{6e38}\u{620f}\u{6587}\u{4ef6}\u{5939}\u{3001}\u{6784}\u{5efa}\u{5de5}\u{5177}\u{548c}\u{5e94}\u{7528}\u{66f4}\u{65b0}\u{ff0c}\u{90fd}\u{5728}\u{8fd9}\u{91cc}\u{3002}", "Library location, build tools and updates."),"shellCache.row": ("缓存文件", "Cache files"),- "shellCache.note": ("壳的 framework 镜像、游戏库清单(shell.json)和横幅缓存。删掉它意味着每个游戏在下次安装时需要重新从构建文件夹提供 framework;构建文件夹也已删除的游戏需要重新构建。", "The shell's mirrored frameworks, its library file (shell.json) and the banner cache. Deleting it means every game's framework must come from its build folder again at the next install; a game whose build folder is also gone must be rebuilt."),+ "shellCache.open": ("打开目录", "Open folder"),+ "shellCache.note": ("壳的 framework 镜像、shell.json 和横幅缓存。删除后:下次安装时每个游戏要从构建文件夹重新提供 framework;构建文件夹也删了的游戏需要重新构建。", "The shell's mirrored frameworks, its library file (shell.json) and the banner cache. Deleting it means every game's framework must come from its build folder again at the next install; a game whose build folder is also gone must be rebuilt."),"settings.appNote": ("\u{4e3a} Apple \u{8bbe}\u{5907}\u{6784}\u{5efa}\u{6e38}\u{620f}", "Build your games for Apple devices"),"build.compatibility": ("\u{517c}\u{5bb9}\u{6027}\u{9009}\u{9879}", "Older iPhone support"),"build.macNote": ("\u{5728}\u{8fd9}\u{53f0} Mac \u{4e0a}\u{76f4}\u{63a5}\u{8fd0}\u{884c}\u{3002}", "Play directly on this Mac."),@@ -1255,7 +1256,8 @@ enum L10n {"settings.language.fr": "Français","settings.heading": "Inställningar","shellCache.row": "Cachefiler",- "shellCache.note": "Skalns speglade frameworks, dess biblioteksfil (shell.json) och banner-cachen. Raderar du dem måste varje spels framework åter levereras från dess byggmapp vid nästa installation; ett spel vars byggmapp också är borta måste byggas om.",+ "shellCache.open": "Öppna mapp",+ "shellCache.note": "Skalns speglade frameworks, shell.json och banner-cachen. Radering betyder: varje spels framework kommer igen från dess byggmapp vid nästa installation; är den också borta måste spelet byggas om.","onboarding.welcome.title": "Välkommen.","onboarding.welcome.note": "Spela dina Switch-spel direkt på din Mac på ungefär 15 minuter.","onboarding.platform.title": "Var vill du spela?",@@ -2321,7 +2323,8 @@ enum L10n {"library.clearSearch": "Suche löschen","settings.heading": "Einstellungen","shellCache.row": "Cachedateien",- "shellCache.note": "Die gespiegelten Frameworks der Shell, ihre Bibliotheksdatei (shell.json) und der Banner-Cache. Wer sie löscht, muss bei der nächsten Installation das Framework jedes Spiels wieder aus dessen Build-Ordner liefern. Ein Spiel, dessen Build-Ordner auch weg ist, muss neu gebaut werden.",+ "shellCache.open": "Ordner öffnen",+ "shellCache.note": "Gespiegelte Frameworks, shell.json und der Banner-Cache. Löschen bedeutet: das Framework jedes Spiels kommt bei der nächsten Installation wieder aus dessen Build-Ordner; ist der auch weg, muss das Spiel neu gebaut werden.","settings.note": "Speicherort der Bibliothek, Build-Werkzeuge und Updates.","settings.appNote": "Baue deine Spiele für Apple-Geräte","build.compatibility": "Unterstützung für ältere iPhones",@@ -3372,7 +3375,8 @@ enum L10n {"library.clearSearch": "Effacer la recherche","settings.heading": "Réglages","shellCache.row": "Fichiers de cache",- "shellCache.note": "Les frameworks en miroir de la coque, son fichier de bibliothèque (shell.json) et le cache des bannières. Les supprimer signifie que le framework de chaque jeu doit à nouveau venir de son dossier de compilation à la prochaine installation ; un jeu dont le dossier de compilation a aussi disparu doit être recompilé.",+ "shellCache.open": "Ouvrir le dossier",+ "shellCache.note": "Les frameworks en miroir de la coque, shell.json et le cache des bannières. Les supprimer signifie que le framework de chaque jeu reviendra de son dossier de compilation à la prochaine installation ; un jeu dont le dossier a aussi disparu doit être recompilé.","settings.note": "Emplacement de la bibliothèque, outils de compilation et mises à jour.","settings.appNote": "Compilez vos jeux pour les appareils Apple","build.compatibility": "Prise en charge des anciens iPhone",