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
Steam's own data now decides whether Highball offers a game's Mac build, read the way Steam for Mac reads it. A build marked macos64 or macosapplesilicon in appinfo's common.osextended, or a 64-bit macOS launch entry, counts even when the store page leaves macOS out, as for LEGO Jurassic World and other Feral ports (highball#310). A Mac build with neither is 32-bit, which no current macOS runs, so Stacking, LEGO Marvel Super Heroes or Mafia II Classic no longer put Install on Mac first and the Windows version leads (highball#316). A curated row still wins, and a game whose app data isn't in hand falls back to the store page as before. Checked against Steam's data for 15 titles through api.steamcmd.net (Cyberpunk 2077 and Lies of P carry only macosapplesilicon) and against this Mac's real library: Dota 2, Big Walk and WHERE SAFETY ENDS stay Mac builds, Portal, Portal 2 and Team Fortress 2 read as 32-bit, with the same result on their pages as before. New tests.
Gauthier Piarrette65cfa81bf9ff
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex df3021a..aa52405 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -24,6 +24,9 @@ final class AppState {var gamesByBottle: [String: [SteamGame]] = [:]/// The Steam account's games per bottle, installed or not (SteamOwnedLibrary, highball#199).var steamOwnedByBottle: [String: [OwnedSteamGame]] = [:]+ /// What Steam's app data says about each owned game's Mac build (MacAppInfoBuild), by appid.+ /// Built with steamOwnedByBottle, so the library's tiles look it up instead of searching.+ var macAppInfoByAppID: [Int: MacAppInfoBuild] = [:]var gameDB = GameDB(directories: [])// Long-running work@@ -370,13 +373,15 @@ 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)+ MacSteamBuild.leads(entry: gameDB.entry(for: item), installedOnMac: item.installedOnMac,+ appInfo: item.steamAppID.flatMap { macAppInfoByAppID[$0] })}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] },- installedOnMac: item.installedOnMac)+ installedOnMac: item.installedOnMac,+ appInfo: item.steamAppID.flatMap { macAppInfoByAppID[$0] })}/// The verified fix recipe for a library item, if the db has one (db entry id == recipe id).@@ -542,6 +547,8 @@ final class AppState {await MainActor.run {guard let self, owned != self.steamOwnedByBottle else { return }self.steamOwnedByBottle = owned+ self.macAppInfoByAppID = Dictionary(owned.values.joined().map { ($0.appid, $0.macBuild) },+ uniquingKeysWith: { a, _ in a })self.rebuildLibrary()}}diff --git a/Sources/HighballKit/GamePageCopy.swift b/Sources/HighballKit/GamePageCopy.swiftindex e1db7fc..e37475c 100644--- a/Sources/HighballKit/GamePageCopy.swift+++ b/Sources/HighballKit/GamePageCopy.swift@@ -66,6 +66,7 @@ public enum GamePageCopy {let source = switch build {case .installed: "Steam for Mac lists it as installed."case .inDatabase: "From the compatibility database."+ case .inAppInfo: "Steam's own data marks a Mac build that runs on current macOS."case .onStore: "Steam's store page lists macOS for it."}return MacBuild(diff --git a/Sources/HighballKit/MacSteamBuild.swift b/Sources/HighballKit/MacSteamBuild.swiftindex 0e361e0..f6f9304 100644--- a/Sources/HighballKit/MacSteamBuild.swift+++ b/Sources/HighballKit/MacSteamBuild.swift@@ -4,23 +4,28 @@ import Foundation/// Mac Steam app installs and runs without Wine. Only Steam builds count; a native edition sold/// elsewhere (Death Stranding's on the Mac App Store) is a different purchase and isn't marked.///-/// Two sources, curated first:+/// Three sources, curated first:/// - the database row's `nativeMac`, when its `where` names Steam; a row can also say/// `"available": false` for a port that no longer runs;-/// - otherwise the Steam store's `platforms.mac` for the appid. The store page is what Valve and-/// publishers keep current: Steam's own appinfo still lists macOS for Portal, whose 32-bit Mac-/// build stopped running with Catalina, while the store page for 400 no longer does-/// (checked 2026-09-24).+/// - then Steam's own app data, the way Steam for Mac reads it (MacAppInfoBuild): a build marked+/// 64-bit counts even when the store page leaves macOS out (LEGO Jurassic World, highball#310),+/// and a 32-bit one never counts, since macOS stopped running those with Catalina (Stacking,+/// highball#316, and Portal);+/// - otherwise the Steam store's `platforms.mac` for the appid, for a game whose app data isn't+/// in hand.public enum MacSteamBuild: Equatable, Sendable {/// Steam for Mac has it installed (MacSteam): no need to ask anyone.case installed/// The database row says so (and may carry requirements in its note).case inDatabase+ /// Steam's app data marks a Mac build that runs on current macOS.+ case inAppInfo/// Steam's store page lists macOS.case onStore/// Pure. nil: no Mac build on Steam known, or the store hasn't been asked yet.- public static func resolve(entry: GameDBEntry?, storeMac: Bool?, installedOnMac: Bool = false) -> MacSteamBuild? {+ public static func resolve(entry: GameDBEntry?, storeMac: Bool?, installedOnMac: Bool = false,+ appInfo: MacAppInfoBuild? = nil) -> MacSteamBuild? {if installedOnMac { return .installed }if let native = entry?.nativeMac {guard native.available else { return nil }@@ -28,15 +33,50 @@ public enum MacSteamBuild: Equatable, Sendable {let stores = (native.where ?? "Steam").split(separator: ",").map { $0.trimmingCharacters(in: .whitespaces).lowercased() }if stores.contains("steam") { return .inDatabase }}- return storeMac == true ? .onStore : nil+ switch appInfo {+ case .runnable?: return .inAppInfo+ case .only32Bit?: return nil+ case .absent?, nil: 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+ /// Without a row, a Mac build Steam's data says is 32-bit never leads: it can't run.+ public static func leads(entry: GameDBEntry?, installedOnMac: Bool, appInfo: MacAppInfoBuild? = nil) -> Bool {+ guard installedOnMac else { return false }+ if let available = entry?.nativeMac?.available { return available }+ return appInfo != .only32Bit+ }+}++/// What Steam's app data says about a game's Mac build, read the way Steam for Mac reads it.+/// Steam marks a build that runs on current macOS with `macos64` or `macosapplesilicon` in+/// `common.osextended` (Cyberpunk 2077 and Lies of P carry only the second), and a macOS launch+/// entry can say `osarch` 64 on its own (LEGO Jurassic World, whose oslist names Windows only).+/// A Mac build with neither is 32-bit, the case where Steam for Mac says it is "unable to run+/// 32-bit games": Stacking, LEGO Marvel Super Heroes, Portal. Checked against Steam's data+/// through api.steamcmd.net for 15 titles on 2026-10-11.+public enum MacAppInfoBuild: Sendable, Hashable {+ /// No Mac build in the data.+ case absent+ /// A Mac build exists and is 32-bit only.+ case only32Bit+ /// A Mac build that runs on current macOS.+ case runnable++ /// `macLaunchArchs`: the `osarch` of each macOS launch entry, "" for one that names none.+ public init(oslist: String?, osextended: String?, macLaunchArchs: [String]) {+ let marks = (osextended ?? "").lowercased().split(separator: ",").map { $0.trimmingCharacters(in: .whitespaces) }+ if marks.contains("macos64") || marks.contains("macosapplesilicon") || macLaunchArchs.contains("64") {+ self = .runnable+ } else if (oslist ?? "").lowercased().contains("macos") || !macLaunchArchs.isEmpty {+ self = .only32Bit+ } else {+ self = .absent+ }}}diff --git a/Sources/HighballKit/SteamOwnedLibrary.swift b/Sources/HighballKit/SteamOwnedLibrary.swiftindex c4b0a54..fdbef2c 100644--- a/Sources/HighballKit/SteamOwnedLibrary.swift+++ b/Sources/HighballKit/SteamOwnedLibrary.swift@@ -10,10 +10,13 @@ public struct OwnedSteamGame: Sendable, Hashable {/// appinfo's `common.oslist` names macOS. Not proof of a Mac build that still runs (Portal's/// 32-bit one is still listed), only which games are worth asking the store about (MacFlagStore).public var listsMac = false+ /// What appinfo says about the Mac build: 64-bit, 32-bit only, or none (MacAppInfoBuild).+ public var macBuild: MacAppInfoBuild = .absent- public init(appid: Int, name: String, localCapsule: URL? = nil, localHeader: URL? = nil, listsMac: Bool = false) {+ public init(appid: Int, name: String, localCapsule: URL? = nil, localHeader: URL? = nil, listsMac: Bool = false,+ macBuild: MacAppInfoBuild = .absent) {self.appid = appid; self.name = name; self.localCapsule = localCapsule; self.localHeader = localHeader- self.listsMac = listsMac+ self.listsMac = listsMac; self.macBuild = macBuild}/// Local art first: newer apps keep theirs at hashed store paths, so the fixed CDN name@@ -57,7 +60,8 @@ public enum SteamOwnedLibrary {let art = artwork(in: cache.appending(path: String(appid)))return OwnedSteamGame(appid: appid, name: name, localCapsule: art["library_600x900.jpg"],localHeader: art["library_header.jpg"] ?? art["header.jpg"],- listsMac: app.oslist?.lowercased().contains("macos") ?? false)+ listsMac: app.oslist?.lowercased().contains("macos") ?? false,+ macBuild: app.macBuild)}.sorted { $0.name.localizedCaseInsensitiveCompare($1.name) == .orderedAscending }}@@ -95,6 +99,14 @@ public enum SteamAppInfo {public var name: String?public var type: String?public var oslist: String?+ /// `common.osextended`: "macos64", "macosapplesilicon" and "macosnotarized" among others.+ public var osextended: String? = nil+ /// The `osarch` of each macOS launch entry under `config.launch`, "" for one naming none.+ public var macLaunchArchs: [String] = []++ public var macBuild: MacAppInfoBuild {+ MacAppInfoBuild(oslist: oslist, osextended: osextended, macLaunchArchs: macLaunchArchs)+ }}public struct ParseError: Error, CustomStringConvertible {@@ -129,8 +141,14 @@ public enum SteamAppInfo {if let wanted, !wanted.contains(appid) { continue }r.offset += 4 + 4 + 8 + 20 + 4 + 20let root = try r.object(strings)- let common = (root["appinfo"]?.object ?? root)["common"]?.object- apps[appid] = App(name: common?["name"]?.string, type: common?["type"]?.string, oslist: common?["oslist"]?.string)+ let info = root["appinfo"]?.object ?? root+ let common = info["common"]?.object+ let macArchs = (info["config"]?.object?["launch"]?.object ?? [:]).values+ .compactMap { $0.object?["config"]?.object }+ .filter { ($0["oslist"]?.string ?? "").lowercased().contains("macos") }+ .map { $0["osarch"]?.string ?? "" }.sorted()+ apps[appid] = App(name: common?["name"]?.string, type: common?["type"]?.string, oslist: common?["oslist"]?.string,+ osextended: common?["osextended"]?.string, macLaunchArchs: macArchs)}return apps}diff --git a/Tests/HighballKitTests/MacSteamBuildTests.swift b/Tests/HighballKitTests/MacSteamBuildTests.swiftindex 4fc3432..68090e9 100644--- a/Tests/HighballKitTests/MacSteamBuildTests.swift+++ b/Tests/HighballKitTests/MacSteamBuildTests.swift@@ -103,6 +103,46 @@ final class MacSteamBuildTests: XCTestCase {XCTAssertNil(MacSteam.app(among: []))}+ /// Steam's own data, read the way Steam for Mac reads it, decides before the store page.+ /// LEGO Jurassic World's store page leaves macOS out while Steam for Mac installs its 64-bit+ /// build (highball#310), and Stacking's store page lists macOS for a 32-bit build no current+ /// Mac runs, so the Windows version has to lead (highball#316).+ func testSteamsOwnDataDecidesBeforeTheStorePage() throws {+ XCTAssertEqual(MacSteamBuild.resolve(entry: nil, storeMac: false, appInfo: .runnable), .inAppInfo)+ XCTAssertEqual(MacSteamBuild.resolve(entry: nil, storeMac: nil, appInfo: .runnable), .inAppInfo)+ XCTAssertNil(MacSteamBuild.resolve(entry: nil, storeMac: true, appInfo: .only32Bit), "a 32-bit Mac build is no Mac build")+ XCTAssertEqual(MacSteamBuild.resolve(entry: nil, storeMac: true, appInfo: .absent), .onStore, "no Mac data: the store as before")+ XCTAssertEqual(MacSteamBuild.resolve(entry: nil, storeMac: true, appInfo: nil), .onStore, "data not in hand: the store as before")+ XCTAssertNil(MacSteamBuild.resolve(entry: nil, storeMac: false, appInfo: .absent))++ // A curated row still wins both ways.+ let curated = try entry(#"{"id":"x","title":"X","steam_appid":1,"status":"community","nativeMac":{"available":true,"where":"Steam"}}"#)+ XCTAssertEqual(MacSteamBuild.resolve(entry: curated, storeMac: nil, appInfo: .only32Bit), .inDatabase)+ let retired = try entry(#"{"id":"x","title":"X","steam_appid":1,"status":"community","nativeMac":{"available":false}}"#)+ XCTAssertNil(MacSteamBuild.resolve(entry: retired, storeMac: nil, appInfo: .runnable))+ }++ func testAnInstalled32BitMacBuildDoesNotLead() throws {+ XCTAssertEqual(MacSteamBuild.resolve(entry: nil, storeMac: nil, installedOnMac: true, appInfo: .only32Bit), .installed,+ "it is installed, the page says so")+ XCTAssertFalse(MacSteamBuild.leads(entry: nil, installedOnMac: true, appInfo: .only32Bit), "but it can't run, so Play is the Windows one")+ XCTAssertTrue(MacSteamBuild.leads(entry: nil, installedOnMac: true, appInfo: .runnable))+ let curated = try entry(#"{"id":"x","title":"X","steam_appid":1,"status":"community","nativeMac":{"available":true,"where":"Steam"}}"#)+ XCTAssertTrue(MacSteamBuild.leads(entry: curated, installedOnMac: true, appInfo: .only32Bit), "a curated row outranks the data")+ }++ func testReadsSteamsMacMarks() {+ XCTAssertEqual(MacAppInfoBuild(oslist: "windows,macos", osextended: "macos64,macosnotarized", macLaunchArchs: []), .runnable)+ XCTAssertEqual(MacAppInfoBuild(oslist: "windows,macos", osextended: "macosapplesilicon", macLaunchArchs: []), .runnable)+ XCTAssertEqual(MacAppInfoBuild(oslist: "windows", osextended: "", macLaunchArchs: ["64"]), .runnable)+ XCTAssertEqual(MacAppInfoBuild(oslist: "windows,macos,linux", osextended: nil, macLaunchArchs: [""]), .only32Bit)+ XCTAssertEqual(MacAppInfoBuild(oslist: "windows,macos", osextended: "", macLaunchArchs: []), .only32Bit)+ XCTAssertEqual(MacAppInfoBuild(oslist: "windows", osextended: nil, macLaunchArchs: [""]), .only32Bit,+ "a macOS launch entry is a Mac build even when oslist forgets it")+ XCTAssertEqual(MacAppInfoBuild(oslist: "windows,linux", osextended: "", macLaunchArchs: []), .absent)+ XCTAssertEqual(MacAppInfoBuild(oslist: nil, osextended: nil, macLaunchArchs: []), .absent)+ }+func testRowCanRetireAPortTheStoreStillLists() throws {let retired = try entry(#"{"id":"x","title":"X","steam_appid":1,"status":"community","nativeMac":{"available":false,"note":"32-bit, stopped running with Catalina"}}"#)XCTAssertNil(MacSteamBuild.resolve(entry: retired, storeMac: true))@@ -164,6 +204,10 @@ final class MacSteamBuildTests: XCTestCase {XCTAssertNil(fromStore.requirements)XCTAssertEqual(fromStore.source, "Steam's store page lists macOS for it.")+ let fromData = try XCTUnwrap(GamePageCopy.macBuild(.inAppInfo, entry: nil, myChip: "Apple M1 Pro", macOS: "26.6.2"))+ XCTAssertEqual(fromData.headline, "There is a native Mac build on Steam.")+ XCTAssertEqual(fromData.source, "Steam's own data marks a Mac build that runs on current macOS.")+let installed = try XCTUnwrap(GamePageCopy.macBuild(.installed, entry: hades, myChip: "Apple M1 Pro", macOS: "26.6.2"))XCTAssertEqual(installed.headline, "Installed in Steam for Mac.")XCTAssertEqual(installed.requirements, "Native Apple Silicon build, macOS 12 and M1 or later.")diff --git a/Tests/HighballKitTests/SteamOwnedLibraryTests.swift b/Tests/HighballKitTests/SteamOwnedLibraryTests.swiftindex beef174..ee21e1f 100644--- a/Tests/HighballKitTests/SteamOwnedLibraryTests.swift+++ b/Tests/HighballKitTests/SteamOwnedLibraryTests.swift@@ -7,13 +7,18 @@ final class SteamOwnedLibraryTests: XCTestCase {// MARK: A synthetic appinfo.vdf- private struct App { var appid: UInt32; var name: String; var type: String; var oslist: String = "windows" }+ private struct App {+ var appid: UInt32; var name: String; var type: String; var oslist: String = "windows"+ var osextended: String? = nil+ /// Launch entries under config.launch, each with its oslist and optional osarch.+ var launch: [(oslist: String, osarch: String?)] = []+ }private func le<T: FixedWidthInteger>(_ v: T) -> [UInt8] { withUnsafeBytes(of: v.littleEndian) { Array($0) } }/// Builds a v29 file (keys as indexes into a trailing string table) or a v28 one (inline keys).private func appinfo(_ apps: [App], v29: Bool = true) -> Data {- let keys = ["appinfo", "Common", "name", "type", "oslist", "appid"]+ let keys = ["appinfo", "Common", "name", "type", "oslist", "appid", "osextended", "config", "launch", "osarch", "0", "1", "2"]func key(_ k: String) -> [UInt8] { v29 ? le(UInt32(keys.firstIndex(of: k)!)) : Array(k.utf8) + [0] }func str(_ k: String, _ v: String) -> [UInt8] { [0x01] + key(k) + Array(v.utf8) + [0] }func int(_ k: String, _ v: UInt32) -> [UInt8] { [0x02] + key(k) + le(v) }@@ -22,8 +27,16 @@ final class SteamOwnedLibraryTests: XCTestCase {var entries: [UInt8] = []for app in apps {// Key case varies in Valve's data; the reader must not care.- let kv = obj("appinfo", int("appid", app.appid)- + obj("Common", str("name", app.name) + str("type", app.type) + str("oslist", app.oslist))) + [0x08]+ var common = str("name", app.name) + str("type", app.type) + str("oslist", app.oslist)+ if let ext = app.osextended { common += str("osextended", ext) }+ var info = int("appid", app.appid) + obj("Common", common)+ if !app.launch.isEmpty {+ let entries = app.launch.enumerated().flatMap { i, l in+ obj(String(i), obj("config", str("oslist", l.oslist) + (l.osarch.map { str("osarch", $0) } ?? [])))+ }+ info += obj("config", obj("launch", entries))+ }+ let kv = obj("appinfo", info) + [0x08]let header = le(UInt32(2)) + le(UInt32(0)) + le(UInt64(0)) + [UInt8](repeating: 0, count: 20)+ le(UInt32(1)) + [UInt8](repeating: 0, count: 20)entries += le(app.appid) + le(UInt32(header.count + kv.count)) + header + kv@@ -55,6 +68,36 @@ final class SteamOwnedLibraryTests: XCTestCase {XCTAssertEqual(parsed.count, 4)}+ /// Steam for Mac's own reading (highball#310, #316): osextended marks a Mac build that runs,+ /// a 64-bit macOS launch entry does too, and a listed Mac build with neither is 32-bit.+ /// Shaped on the real entries (api.steamcmd.net, 2026-10-11).+ func testReadsTheMacBuildSteamForMacSees() throws {+ let parsed = try SteamAppInfo.parse(appinfo([+ App(appid: 234140, name: "Mad Max", type: "game", oslist: "windows,macos,linux", osextended: "macos64",+ launch: [("windows", nil), ("macos", "64")]),+ App(appid: 1091500, name: "Cyberpunk 2077", type: "game", oslist: "windows,macos", osextended: "macosapplesilicon"),+ App(appid: 352400, name: "LEGO Jurassic World", type: "game", oslist: "windows", osextended: "",+ launch: [("windows", nil), ("macos", "64")]),+ App(appid: 115110, name: "Stacking", type: "game", oslist: "windows,macos,linux", launch: [("macos", nil)]),+ App(appid: 570940, name: "DARK SOULS™: REMASTERED", type: "game"),+ ]))+ XCTAssertEqual(parsed[234140]?.osextended, "macos64")+ XCTAssertEqual(parsed[234140]?.macLaunchArchs, ["64"])+ XCTAssertEqual(parsed[115110]?.macLaunchArchs, [""], "a macOS launch entry naming no osarch")+ XCTAssertEqual(parsed[234140]?.macBuild, .runnable)+ XCTAssertEqual(parsed[1091500]?.macBuild, .runnable, "an Apple Silicon build carries no macos64 mark")+ XCTAssertEqual(parsed[352400]?.macBuild, .runnable, "oslist says Windows, the launch entry says a 64-bit Mac build")+ XCTAssertEqual(parsed[115110]?.macBuild, .only32Bit)+ XCTAssertEqual(parsed[570940]?.macBuild, .absent)++ let root = try steamRoot(owned: [115110, 352400, 570940], appinfo: appinfo([+ App(appid: 352400, name: "LEGO Jurassic World", type: "game", launch: [("macos", "64")]),+ App(appid: 115110, name: "Stacking", type: "game", oslist: "windows,macos,linux"),+ App(appid: 570940, name: "DARK SOULS™: REMASTERED", type: "game"),+ ]))+ XCTAssertEqual(SteamOwnedLibrary.games(steamRoot: root).map(\.macBuild), [.absent, .runnable, .only32Bit])+ }+func testReadsV28InlineKeys() throws {let parsed = try SteamAppInfo.parse(appinfo(apps, v29: false))XCTAssertEqual(parsed[1145361]?.type, "Music")