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
open a Windows program from Finder: double-click or Open With hands .exe, .msi and .bat to the run dialog (#90)
Gauthier Piarrette38af0df72283
diff --git a/Scripts/make-app.sh b/Scripts/make-app.shindex dc5b760..0a501df 100755--- a/Scripts/make-app.sh+++ b/Scripts/make-app.sh@@ -69,6 +69,21 @@ cat > "$APP/Contents/Info.plist" <<PLIST<key>CFBundleURLName</key><string>Highball play link</string><key>CFBundleURLSchemes</key><array><string>highball</string></array></dict></array>+ <key>CFBundleDocumentTypes</key>+ <array>+ <dict>+ <key>CFBundleTypeName</key><string>Windows program</string>+ <key>CFBundleTypeRole</key><string>Viewer</string>+ <key>LSHandlerRank</key><string>Default</string>+ <key>LSItemContentTypes</key><array><string>com.microsoft.windows-executable</string></array>+ </dict>+ <dict>+ <key>CFBundleTypeName</key><string>Windows installer or batch file</string>+ <key>CFBundleTypeRole</key><string>Viewer</string>+ <key>LSHandlerRank</key><string>Alternate</string>+ <key>CFBundleTypeExtensions</key><array><string>msi</string><string>bat</string></array>+ </dict>+ </array><key>NSLocalNetworkUsageDescription</key><string>Steam and some games look for other players and devices on your network. macOS asks the first time one does.</string><key>NSMicrophoneUsageDescription</key><string>Windows games and apps running in a bottle need the microphone for voice chat and recording. macOS asks the first time one uses it.</string></dict></plist>diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex 76e36a5..0d8e9d8 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -360,6 +360,21 @@ final class AppState {/// The environment a dropped program runs in: the page it was dropped on, else the default.var pendingRunBottle: String?+ /// A Windows program double-clicked in Finder, or opened with Highball from Open With+ /// (issue #90). Same dialog as a dropped or chosen file: run it in the default environment,+ /// or run and keep it in Programs. Anything that is not a program says so instead of doing nothing.+ func openFile(_ url: URL) {+ guard ["exe", "msi", "bat"].contains(url.pathExtension.lowercased()) else {+ fail(HighballError.failed(String(format: L("'%@' isn't a Windows program. Highball opens .exe, .msi and .bat files."), url.lastPathComponent)))+ return+ }+ if pendingRun == url { return } // macOS can deliver the same open twice+ refresh()+ pendingRunBottle = nil+ pendingRun = url+ NSApp.activate(ignoringOtherApps: true)+ }+func chooseProgramToRun(in bottle: String? = nil) {let panel = NSOpenPanel()panel.title = L("Choose a Windows program")@@ -972,6 +987,7 @@ final class AppState {@ObservationIgnored private var deferredPlayLink: (request: PlayLink.Request, at: Date)?func open(url: URL) {+ if url.isFileURL { openFile(url); return }guard let request = PlayLink.parse(url) else { return }refresh()if case let .launcher(id) = request.target {diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swiftindex 7462590..7302025 100644--- a/Sources/HighballApp/HighballApp.swift+++ b/Sources/HighballApp/HighballApp.swift@@ -94,7 +94,22 @@ final class AppDelegate: NSObject, NSApplicationDelegate {super.init()}/// Set from the App's onAppear so quit-time can reach the bottles.- weak var appState: AppState?+ weak var appState: AppState? { didSet { flushPendingOpens() } }+ /// Files Finder asked us to open before the window existed (a double-click that launched the app).+ private var pendingOpens: [URL] = []++ /// Finder's double-click and Open With land here (issue #90); the app declares .exe, .msi and+ /// .bat in its Info.plist. A cold launch delivers them before the state is wired, so they wait.+ func application(_ application: NSApplication, open urls: [URL]) {+ pendingOpens += urls+ flushPendingOpens()+ }++ private func flushPendingOpens() {+ guard let state = appState, !pendingOpens.isEmpty else { return }+ let urls = pendingOpens; pendingOpens = []+ Task { @MainActor in for url in urls { state.open(url: url) } }+ }/// 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.