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
Merge branch 'main' into feat/launcher-roundup
v0lumehi77dace8a774c
diff --cc frontend/Sources/NSPortBuilder/LaunchOptionsView.swiftindex be9b0460,6d83bc4d..0f67f35d--- a/frontend/Sources/NSPortBuilder/LaunchOptionsView.swift+++ b/frontend/Sources/NSPortBuilder/LaunchOptionsView.swift@@@ -182,16 -177,7 +182,16 @@@ 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)+ control(s, value, pixels: pixels).launcherRowControls().frame(width: LaunchControl.width, alignment: .trailing)}.padding(.horizontal, 18).padding(.vertical, 13).frame(minHeight: 52)diff --cc frontend/Sources/NSPortBuilder/LauncherView.swiftindex cca0367c,bbef2460..8ac2465b--- a/frontend/Sources/NSPortBuilder/LauncherView.swift+++ b/frontend/Sources/NSPortBuilder/LauncherView.swift@@@ -253,42 -218,25 +256,42 @@@ struct ContentView: View)) {Button(m.t("library.ok")) { launchError = nil; library.error = nil }} message: { Text(launchError ?? library.error ?? "") }- .confirmationDialog(m.t("library.removeQuestion"), isPresented: Binding(- get: { removing != nil }, set: { if !$0 { removing = nil } }- ), titleVisibility: .visible) {- Button(m.t("library.remove"), role: .destructive) {- if let game = removing { library.remove(game.id) }- removing = nil- }- } message: { Text(m.t("library.removeNote")) }+ .typeToConfirm(+ isPresented: Binding(get: { removing != nil }, set: { if !$0 { removing = nil } }),+ phrase: removing?.name ?? "",+ title: m.t("library.removeQuestion"), message: m.t("library.removeNote"),+ buttonTitle: m.t("library.remove")) {+ if let game = removing { library.remove(game.id) }+ removing = nil+ }.sheet(isPresented: Binding(get: { optionsFor != nil }, set: { if !$0 { optionsFor = nil } })) {- if let id = optionsFor { LaunchOptionsView(m: m, library: library, gameID: id).environmentObject(padFocus) }+ if let id = optionsFor { LaunchOptionsView(m: m, library: library, gameID: id).environmentObject(padFocus).launcherDropdownHost() }}- .sheet(isPresented: $controlsOpen) { ControlsView(m: m, layout: controls).environmentObject(padFocus) }+ .sheet(isPresented: $controlsOpen) { ControlsView(m: m, layout: controls).environmentObject(padFocus).launcherDropdownHost() }.sheet(isPresented: Binding(get: { freeSpaceFor != nil }, set: { if !$0 { freeSpaceFor = nil } })) {if let game = library.games.first(where: { $0.id == freeSpaceFor }) { FreeSpaceView(m: m, game: game).environmentObject(padFocus) }}.onChange(of: freeSpaceFor) { id in padFocus.scope = id != nil ? "free" : currentPadScope }.sheet(isPresented: $m.showUpdateSheet) { UpdateSheet(m: m) }+ .sheet(isPresented: $m.showConvertSheet) { ConvertView(m: m) }+ .typeToConfirm(+ isPresented: Binding(get: { m.uninstallPlan != nil }, set: { if !$0 { m.uninstallPlan = nil } }),+ phrase: "NX2Apple",+ title: m.t("uninstall.title"),+ message: m.t("uninstall.confirm"),+ buttonTitle: m.t("uninstall.button")) {+ if let plan = m.uninstallPlan {+ let result = Uninstall.run(plan)+ m.uninstallPlan = nil+ if result.failures.isEmpty {+ m.appStatus = String(format: m.t("uninstall.done"), result.removed.count)+ } else {+ m.appStatus = m.t("uninstall.failed") + "\n" + result.failures.joined(separator: "\n")+ }+ }+ }.sheet(isPresented: Binding(get: { savesFor != nil }, set: { if !$0 { savesFor = nil } })) {- if let id = savesFor { SavesView(m: m, library: library, gameID: id).environmentObject(padFocus) }+ if let id = savesFor { SavesView(m: m, library: library, gameID: id).environmentObject(padFocus).launcherDropdownHost() }}.onChange(of: savesFor) { id in padFocus.scope = id != nil ? "saves" : currentPadScope }.cheatsSheet(for: $cheatsFor, m: m, library: library, pad: padFocus) { currentPadScope }@@@ -507,20 -433,12 +510,17 @@@Text(game.name).font(.manrope(min(68, width * 0.052), .heavy)).tracking(-1.6).lineLimit(2).shadow(color: .black.opacity(0.25), radius: 12)HStack(spacing: 18) {+ if unowned {+ Text(m.t("library.notOwnedHint"))+ .font(.manrope(14)).foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true).frame(maxWidth: 460, alignment: .leading)+ } else {Button { primaryAction(game) } label: {- Label(game.primary == .play ? m.t("library.play")+ LauncherHeroActionLabel(+ title: game.primary == .play ? m.t("library.play"): (game.primary == .openOnDevice ? String(format: m.t("dev.open"), m.deviceName(game.installedDevice)): m.t("library.newBuild")),- systemImage: game.primary == .play ? "play.fill" : (game.primary == .openOnDevice ? "iphone" : "hammer.fill"))- .font(.manrope(18, .bold))- .foregroundStyle(.black).padding(.horizontal, 30).padding(.vertical, 14)- .frame(minWidth: 164)- .background(LauncherPalette.cream, in: Capsule())+ symbol: game.primary == .play ? "play.fill" : (game.primary == .openOnDevice ? "iphone" : "hammer.fill"))}.buttonStyle(.plain).disabled(launching || (m.running && !game.isReady)).keyboardShortcut(.return, modifiers: [])@@@ -618,10 -507,8 +618,11 @@@ScrollView(.horizontal, showsIndicators: false) {HStack(alignment: .top, spacing: 14) {ForEach(filteredGames) { game in+ let _ = LauncherWork.count(.card)- Button { library.selectedID = game.id } label: {+ let unowned = isUnowned(game)+ Button {+ if unowned { selectedUnowned = game.titleID } else { selectedUnowned = nil; library.selectedID = game.id }+ } label: {VStack(alignment: .leading, spacing: 8) {ZStack {if let image = artwork[game.id] {diff --cc frontend/Sources/NSPortBuilder/Library.swiftindex 290e62af,36e4e826..d8e6148e--- a/frontend/Sources/NSPortBuilder/Library.swift+++ b/frontend/Sources/NSPortBuilder/Library.swift@@@ -23,12 -23,10 +23,13 @@@ struct LibraryGame: Codable, Identifiabvar installedDevice = ""/// The repository checkout's commit the last finished build used (ToolsAge); empty for a build from before it was recorded.var toolsCommit = ""+ /// "Keep this build": the player says this build plays well, so engine updates stop marking it older and+ /// nagging a rebuild. A rebuild stays one click away, and this game's profile changes keep being shown.+ var pinned = false+ /// An empty path means there is no Mac build. It is not read, because URL(fileURLWithPath:) would make it the current folder.var isReady: Bool {- guard let app = try? MacGameBundle.read(URL(fileURLWithPath: appPath)) else { return false }+ guard !appPath.isEmpty, let app = try? MacGameBundle.read(URL(fileURLWithPath: appPath)) else { return false }return app.titleID == titleID}