Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

A game's row can put the Windows build first over an installed Mac one

Gauthier Piarrette3f89f59721dc
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 35f3e3f..c3c5f83 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -304,6 +304,11 @@ final class AppState {
}
}
+ /// Play on Mac leads for this item (see MacSteamBuild.leads).
+ func prefersMacBuild(_ item: LibraryItem) -> Bool {
+ MacSteamBuild.leads(entry: gameDB.entry(for: item), installedOnMac: item.installedOnMac)
+ }
+
func macSteamBuild(for item: LibraryItem) -> MacSteamBuild? {
guard item.source == .steam else { return nil }
return MacSteamBuild.resolve(entry: gameDB.entry(for: item), storeMac: item.steamAppID.flatMap { macFlags[$0] },
@@ -328,7 +333,7 @@ final class AppState {
/// `windowsBuild` plays the bottle's copy of a game Steam for Mac also has installed; without
/// it the native build goes first.
func play(_ item: LibraryItem, renderer: Renderer? = nil, windowsBuild: Bool = false) {
- if item.installedOnMac, renderer == nil, !windowsBuild { playOnMac(item); return }
+ if prefersMacBuild(item), renderer == nil, !windowsBuild { playOnMac(item); return }
guard let bottleName = item.bottleName,
let found = bottles.first(where: { $0.name == bottleName }) else { return }
var bottle = found
diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swift
index bc4654b..bc998f8 100644
--- a/Sources/HighballApp/GameDetailView.swift
+++ b/Sources/HighballApp/GameDetailView.swift
@@ -173,7 +173,7 @@ struct GameDetailView: View {
.map { String(format: L("Running for %d min"), $0) } ?? L("Running"))
.font(.callout).foregroundStyle(HB.good)
}
- } else if item.installedOnMac {
+ } else if state.prefersMacBuild(item) {
// The native build first; a Windows copy in a bottle stays one click away.
Button { state.playOnMac(item) } label: {
Label(L("Play on Mac"), systemImage: "play.fill").frame(minWidth: 96)
@@ -191,8 +191,13 @@ struct GameDetailView: View {
}
.buttonStyle(.borderedProminent).controlSize(.large).tint(HB.amber)
.disabled(state.busy || blocked)
- Text(blocked ? L("Its anti-cheat does not run on macOS.") : L("Highball will ask how it went when you finish."))
- .font(.callout).foregroundStyle(.secondary)
+ if item.installedOnMac {
+ // The row put the Windows build first (a Mac build missing content); the Mac one stays a click away.
+ Button(L("Play on Mac")) { state.playOnMac(item) }.controlSize(.large)
+ } else {
+ Text(blocked ? L("Its anti-cheat does not run on macOS.") : L("Highball will ask how it went when you finish."))
+ .font(.callout).foregroundStyle(.secondary)
+ }
} else if item.source == .epic {
Button(L("Install")) { state.install(item) }.buttonStyle(.borderedProminent).controlSize(.large).tint(HB.amber)
.disabled(state.busy)
@@ -231,7 +236,7 @@ struct GameDetailView: View {
private var willDoCard: some View {
VStack(alignment: .leading, spacing: 8) {
// Next to Play on Mac, "Play" alone would read as the Mac build's.
- HB.eyebrow(item.installedOnMac ? L("When you play the Windows version, Highball will") : L("When you press Play, Highball will"))
+ HB.eyebrow(state.prefersMacBuild(item) ? L("When you play the Windows version, Highball will") : L("When you press Play, Highball will"))
ForEach(Array(willDo.enumerated()), id: \.offset) { _, line in
HStack(alignment: .firstTextBaseline, spacing: 8) {
Image(systemName: line.done ? "checkmark" : (line.cost == nil ? "checkmark" : "hourglass"))
diff --git a/Sources/HighballApp/LibraryView.swift b/Sources/HighballApp/LibraryView.swift
index eb8485a..6de010f 100644
--- a/Sources/HighballApp/LibraryView.swift
+++ b/Sources/HighballApp/LibraryView.swift
@@ -214,7 +214,7 @@ struct LibraryTile: View {
private var blocked: Bool { entry?.isBlocked == true }
/// Anti-cheat blocks the Windows build only: a native Mac one plays.
- private var playable: Bool { (item.installedOnMac || (item.installed && !blocked)) && !state.busy }
+ private var playable: Bool { (state.prefersMacBuild(item) || (item.installed && !blocked)) && !state.busy }
var body: some View {
NavigationLink(value: item) {
diff --git a/Sources/HighballKit/MacSteamBuild.swift b/Sources/HighballKit/MacSteamBuild.swift
index 1a5d19e..6feaec2 100644
--- a/Sources/HighballKit/MacSteamBuild.swift
+++ b/Sources/HighballKit/MacSteamBuild.swift
@@ -30,6 +30,14 @@ public enum MacSteamBuild: Equatable, Sendable {
}
return storeMac == true ? .onStore : nil
}
+
+ /// Whether Play starts the native build: Steam for Mac has it installed, and the row does not
+ /// say the Mac build is the wrong one to play. The Binding of Isaac's Mac build stops at
+ /// Afterbirth+, so a player who owns the Windows-only Repentance got the old game (highball#223);
+ /// its row says `"available": false` and the Windows build leads, with the Mac one a click away.
+ public static func leads(entry: GameDBEntry?, installedOnMac: Bool) -> Bool {
+ installedOnMac && entry?.nativeMac?.available != false
+ }
}
/// The row field: `"nativeMac": {"available": true, "where": "Steam", "note": "…", "url": "…"}`.
diff --git a/Tests/HighballKitTests/MacSteamBuildTests.swift b/Tests/HighballKitTests/MacSteamBuildTests.swift
index 2188d3c..49fb563 100644
--- a/Tests/HighballKitTests/MacSteamBuildTests.swift
+++ b/Tests/HighballKitTests/MacSteamBuildTests.swift
@@ -29,6 +29,18 @@ final class MacSteamBuildTests: XCTestCase {
"it's installed and the player has it: that outranks any row")
}
+ /// The Binding of Isaac's Mac build stops at Afterbirth+; Repentance is Windows only, so a player
+ /// who owns it was sent to the old game (highball#223). A row saying the Mac build is not the one
+ /// to play puts the Windows build first even with the Mac one installed; nothing else changes.
+ func testARowCanPutTheWindowsBuildFirstOverAnInstalledMacOne() throws {
+ let isaac = try entry(#"{"id":"the-binding-of-isaac-rebirth","title":"Isaac","steam_appid":250900,"status":"community","nativeMac":{"available":false,"where":"Steam"}}"#)
+ let hades = try entry(#"{"id":"hades-ii","title":"Hades II","steam_appid":1145350,"status":"community","nativeMac":{"available":true,"where":"Steam"}}"#)
+ XCTAssertFalse(MacSteamBuild.leads(entry: isaac, installedOnMac: true), "the Windows build leads")
+ XCTAssertTrue(MacSteamBuild.leads(entry: hades, installedOnMac: true))
+ XCTAssertTrue(MacSteamBuild.leads(entry: nil, installedOnMac: true), "no row: an installed Mac build leads as before")
+ XCTAssertFalse(MacSteamBuild.leads(entry: hades, installedOnMac: false), "nothing installed on the Mac side")
+ }
+
// MARK: Steam for Mac's installs
private func macSteam(_ manifests: [String: [(Int, String, Int)]], extraLibrary: URL? = nil) throws -> URL {