Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.
Swift apple-silicond3dmetaldxmtdxvkfexgame-porting-toolkitgamingmac-gamingmacosmetalmoltenvksteamswiftuivkd3d-protonwhisky-alternativewindows-gameswinewine-wrapper
feat: stop Wine processes on quit (ask), plus a Stop All menu command
Gauthier Piarrette0df60dcb05eb
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex f253b66..4b7fd29 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -239,6 +239,18 @@ final class AppState {try? WineRunner(paths: paths, engine: engine, bottle: bottle).kill()}+ /// True while any Wine process from any bottle is alive. Every Wine process (wineserver,+ /// preloaders, services) runs from the engines directory, so its path in `ps` is the marker.+ func wineProcessesRunning() -> Bool {+ guard let ps = try? Shell.capture("/bin/ps", ["axww"]) else { return false }+ return ps.contains(paths.engines.path)+ }++ /// Stop every bottle's wineserver (and with it all Windows processes).+ func killAllBottles() {+ for bottle in bottles { killBottle(bottle) }+ }+func loadGPTKLicense() {for candidate in [Self.repoRoot?.appending(path: "spike/d3dmetal-license.txt"),Bundle.main.url(forResource: "d3dmetal-license", withExtension: "txt")].compactMap({ $0 }) {diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swiftindex 290d68b..2a6b866 100644--- a/Sources/HighballApp/HighballApp.swift+++ b/Sources/HighballApp/HighballApp.swift@@ -15,12 +15,14 @@ struct HighballApp: App {.tint(HB.amber).preferredColorScheme(.dark).frame(minWidth: 820, minHeight: 560)- .onAppear { state.refresh() }+ .onAppear { state.refresh(); delegate.appState = state }}.windowResizability(.contentSize).commands {CommandGroup(after: .appInfo) {CheckForUpdatesView(updater: delegate.updaterController.updater)+ // Cleanup after a crash or a "leave running" quit — no Activity Monitor needed.+ Button(L("Stop All Windows Processes")) { state.killAllBottles() }}}}@@ -52,6 +54,29 @@ final class CheckForUpdatesViewModel: ObservableObject {final class AppDelegate: NSObject, NSApplicationDelegate {/// Sparkle: reads SUFeedURL and SUPublicEDKey from Info.plist; no-ops in bare dev builds without them.let updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)+ /// Set from the App's onAppear so quit-time can reach the bottles.+ weak var appState: AppState?++ /// Wine processes survive the app (they're not children of its lifetime), so quitting while a+ /// game or Steam runs would strand them with no UI attached. Ask instead of leaking.+ func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {+ guard let state = appState, state.wineProcessesRunning() else { return .terminateNow }+ let alert = NSAlert()+ alert.messageText = L("Windows programs are still running")+ alert.informativeText = L("Stop them and quit, or leave them running? A game left running keeps playing without Highball — quit it from inside the game when you're done.")+ alert.addButton(withTitle: L("Stop Everything & Quit"))+ alert.addButton(withTitle: L("Leave Running & Quit"))+ alert.addButton(withTitle: L("Cancel"))+ switch alert.runModal() {+ case .alertFirstButtonReturn:+ state.killAllBottles()+ return .terminateNow+ case .alertSecondButtonReturn:+ return .terminateNow+ default:+ return .terminateCancel+ }+ }func applicationDidFinishLaunching(_ notification: Notification) {// Works as a bare SwiftPM executable during development: give it a real UI presence.diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swiftindex 185313c..e239ac2 100644--- a/Sources/HighballApp/L10n.swift+++ b/Sources/HighballApp/L10n.swift@@ -27,6 +27,12 @@ enum L10n {"A bottle name can't start with a dot.": "Un nom de bouteille ne peut pas commencer par un point.","A bottle name can't end with a dot.": "Un nom de bouteille ne peut pas se terminer par un point.","The bottle name is too long (64 characters max).": "Le nom de la bouteille est trop long (64 caractères max).",+ "Windows programs are still running": "Des programmes Windows sont encore en cours d'exécution",+ "Stop them and quit, or leave them running? A game left running keeps playing without Highball — quit it from inside the game when you're done.":+ "Les arrêter et quitter, ou les laisser tourner ? Un jeu laissé ouvert continue sans Highball — quittez-le depuis le jeu quand vous avez terminé.",+ "Stop Everything & Quit": "Tout arrêter et quitter",+ "Leave Running & Quit": "Laisser tourner et quitter",+ "Stop All Windows Processes": "Arrêter tous les processus Windows",// Bottle view"Programs": "Programmes",