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 PR #56: a controller drives the launcher, so a Mac on a TV needs no keyboard (v0lumehi)
LNP8ccce0714525
diff --cc frontend/Sources/NSPortBuilder/LauncherView.swiftindex ec04d44e,b2c7aeb8..d514f7b3--- a/frontend/Sources/NSPortBuilder/LauncherView.swift+++ b/frontend/Sources/NSPortBuilder/LauncherView.swift@@@ -76,8 -80,9 +80,9 @@@ struct ContentView: View.font(.manrope(13)) // the default for text without a font of its own.frame(minWidth: 900, idealWidth: 1280, minHeight: 680, idealHeight: 900).onAppear {+ gamepad.perform = padActionrefreshArtwork()- if performStartupChecks { library.discover(); fetchArtwork() }+ if performStartupChecks { library.discover(); fetchArtwork(); m.refreshDevices() }if performStartupChecks {m.checkDeps()if m.repoOK && m.repoIsGit { m.checkRepoUpdates(silent: true) }@@@ -464,15 -502,42 +504,50 @@@page = .builds}+ /// A controller's button (LauncherGamepad): the first press shows the focus (on the selected game's card in the library),+ /// then the D-pad moves it (PadFocus), A activates, B closes a sheet or goes back to the library, X opens the selected+ /// game's launch options, L and R switch the pages.+ private func padAction(_ action: LauncherGamepad.Action) {+ let sheetOpen = optionsFor != nil || controlsOpen+ if action == .b {+ if optionsFor != nil { optionsFor = nil } else if controlsOpen { controlsOpen = false }+ else if searching { searching = false; search = "" } else if page != .library { page = .library }+ return+ }+ if removing != nil { return } // the remove dialog is AppKit's; it takes the mouse or the keyboard+ if !padFocus.visible {+ padFocus.show(default: !sheetOpen && page == .library ? library.selectedID.map { "card." + $0.uuidString } : nil)+ if [.up, .down, .left, .right].contains(action) { return } // the first press only shows where the focus is+ }+ switch action {+ case .up: padFocus.move(dx: 0, dy: -1)+ case .down: padFocus.move(dx: 0, dy: 1)+ case .left: padFocus.horizontal(-1)+ case .right: padFocus.horizontal(1)+ case .a: padFocus.activate()+ case .x:+ if !sheetOpen, let game = library.selected, game.isReady { optionsFor = game.id }+ case .l, .r:+ guard !sheetOpen, let at = LauncherPage.allCases.firstIndex(of: page) else { return }+ let pages = LauncherPage.allCases+ page = pages[(at + (action == .l ? pages.count - 1 : 1)) % pages.count]+ case .b, .y:+ return+ }+ }++ /// The space the collection row keeps around its cards for the focus ring (PadFocus draws it 4 pt outside a target).+ static let ringRoom: CGFloat = 6+private func primaryAction(_ game: LibraryGame) {+ if !game.isReady && game.onDevice { // installed on a device: start it there+ launching = true+ m.openOnDevice(udid: game.installedDevice, app: game.iosAppPath) { error in+ launching = false+ if let error { launchError = error }+ }+ return+ }if !game.isReady && game.hasIOSBuild {NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: game.ipaPath)])return