Skip to content

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

A database row saying the Mac build is not the one to play keeps Play on GOG's Windows build too, as MacSteamBuild.leads does for Steam, and the page's Mac section stays for an installed Mac build the row turns down.

Gabed467f79da2dc
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 01bd226..9656117 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -545,9 +545,9 @@ final class AppState {
/// Play on Mac leads for this item (see MacSteamBuild.leads).
func prefersMacBuild(_ item: LibraryItem) -> Bool {
- // A GOG Mac build leads once installed, unless it is one macOS no longer runs.
if item.source == .gog {
- return item.installedOnMac && item.gogID.flatMap { gogMacInstalled[$0] }?.arch != .only32Bit
+ return StoreMacBuild.leads(entry: gameDB.entry(for: item), installedOnMac: item.installedOnMac,
+ arch: item.gogID.flatMap { gogMacInstalled[$0] }?.arch)
}
return MacSteamBuild.leads(entry: gameDB.entry(for: item), installedOnMac: item.installedOnMac,
appInfo: item.steamAppID.flatMap { macAppInfoByAppID[$0] })
diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swift
index c67be78..1b65b2c 100644
--- a/Sources/HighballApp/GameDetailView.swift
+++ b/Sources/HighballApp/GameDetailView.swift
@@ -216,7 +216,7 @@ struct GameDetailView: View {
.textSelection(.enabled)
if let macBuild {
macBlock(macBuild)
- } else if state.macListed(item), item.source == .gog || item.source == .epic {
+ } else if state.macListed(item) || item.installedOnMac, item.source == .gog || item.source == .epic {
storeMacBlock
} else if let outdated = GamePageCopy.outdatedMacBuild(appInfo: item.steamAppID.flatMap { state.macAppInfoByAppID[$0] }, entry: entry) {
Label(L(outdated), systemImage: "apple.logo").font(.callout).foregroundStyle(.secondary)
@@ -714,7 +714,7 @@ struct GameDetailView: View {
: L("Its anti-cheat does not run on macOS."))
.font(.callout).foregroundStyle(.secondary)
}
- } else if item.source == .gog, item.macListed, !item.installedOnMac {
+ } else if item.source == .gog, state.macListed(item), !item.installedOnMac {
// A Mac version is listed: that's the install on offer, the Windows one a click away.
VStack(alignment: .leading, spacing: 6) {
VStack(alignment: .leading, spacing: 10) {
diff --git a/Sources/HighballKit/MacSteamBuild.swift b/Sources/HighballKit/MacSteamBuild.swift
index 048cb40..e6170da 100644
--- a/Sources/HighballKit/MacSteamBuild.swift
+++ b/Sources/HighballKit/MacSteamBuild.swift
@@ -54,12 +54,20 @@ public enum MacSteamBuild: Equatable, Sendable {
/// A Mac build GOG's or Epic's catalog lists (LibraryItem.macListed), weighed the way MacSteamBuild
/// weighs Steam's: the database row first, so one saying `"available": false` (a Mac port that no
-/// longer runs, or one missing content, highball#223) keeps the badge and the page on the Windows build.
+/// longer runs, or one missing content, highball#223) keeps the badge, the page and Play on the
+/// Windows build.
public enum StoreMacBuild {
/// Whether the store's listing counts.
public static func listed(_ storeLists: Bool, entry: GameDBEntry?) -> Bool {
storeLists && entry?.nativeMac?.available != false
}
+
+ /// Whether Play starts the installed Mac build, as MacSteamBuild.leads decides for Steam: not
+ /// when the row says the Mac build is the wrong one to play, nor when its executable is 32-bit,
+ /// which macOS no longer runs.
+ public static func leads(entry: GameDBEntry?, installedOnMac: Bool, arch: MacBinaryArch?) -> Bool {
+ installedOnMac && entry?.nativeMac?.available != false && arch != .only32Bit
+ }
}
/// What Steam's app data says about a game's Mac build, read the way Steam for Mac reads it.
diff --git a/Tests/HighballKitTests/MacSteamBuildTests.swift b/Tests/HighballKitTests/MacSteamBuildTests.swift
index fe18e07..f4d2bf5 100644
--- a/Tests/HighballKitTests/MacSteamBuildTests.swift
+++ b/Tests/HighballKitTests/MacSteamBuildTests.swift
@@ -235,4 +235,13 @@ final class MacSteamBuildTests: XCTestCase {
XCTAssertTrue(StoreMacBuild.listed(true, entry: nil))
XCTAssertFalse(StoreMacBuild.listed(false, entry: cyberpunk), "a row does not make a listing")
}
+
+ func testInstalledStoreMacBuildLeadsUnlessTheRowOrItsExecutableSaysNo() throws {
+ let isaac = try entry(#"{"id":"the-binding-of-isaac-rebirth","title":"Isaac","steam_appid":250900,"status":"community","nativeMac":{"available":false,"where":"Steam"}}"#)
+ XCTAssertTrue(StoreMacBuild.leads(entry: nil, installedOnMac: true, arch: .native))
+ XCTAssertTrue(StoreMacBuild.leads(entry: nil, installedOnMac: true, arch: nil))
+ XCTAssertFalse(StoreMacBuild.leads(entry: isaac, installedOnMac: true, arch: .native), "the row outranks the install")
+ XCTAssertFalse(StoreMacBuild.leads(entry: nil, installedOnMac: true, arch: .only32Bit))
+ XCTAssertFalse(StoreMacBuild.leads(entry: nil, installedOnMac: false, arch: .native))
+ }
}