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
CLI: create bottles on the newest engine, not the alphabetically first
Gauthier Piarrettebd6010113c55
diff --git a/Sources/HighballKit/EngineStore.swift b/Sources/HighballKit/EngineStore.swiftindex a5ae8d7..257c172 100644--- a/Sources/HighballKit/EngineStore.swift+++ b/Sources/HighballKit/EngineStore.swift@@ -48,10 +48,13 @@ public struct EngineStore: Sendable {}/// The engine to use by default: the one the bundled manifest names when it is installed,- /// else the first installed (alphabetical). After an engine update two engines can coexist- /// briefly, and "first" would be the old one.+ /// else the newest installed. Newest is the highest id under numeric-aware ordering, so+ /// `…-r10` beats `…-r9` and `…-r2`. After an engine update two engines coexist, and the+ /// CLI, which has no bundled manifest, created bottles on the old one while the app used+ /// the new one (found 2026-09-04: a bottle created from the CLI ran r0 next to the app's r1).public static func defaultEngine(installed: [InstalledEngine], bundledID: String?) -> InstalledEngine? {- installed.first { $0.id == bundledID } ?? installed.first+ installed.first { $0.id == bundledID }+ ?? installed.max { $0.id.compare($1.id, options: .numeric) == .orderedAscending }}public func engine(_ id: String) throws -> InstalledEngine {diff --git a/Sources/highball/main.swift b/Sources/highball/main.swiftindex be87be2..f1830ae 100644--- a/Sources/highball/main.swift+++ b/Sources/highball/main.swift@@ -89,13 +89,13 @@ struct Bottle: AsyncParsableCommand {struct Create: AsyncParsableCommand {@Argument var name: String- @Option(help: "Engine id (default: first installed).") var engine: String?+ @Option(help: "Engine id (default: newest installed).") var engine: String?@Option(help: "Renderer: wined3d|dxmt|d3dmetal|dxvk (explicit choice; recipes won't override it)") var renderer: HighballKit.Renderer?@Option(help: "Apply this recipe after creation (id or path).") var recipe: String?func run() async throws {let store = EngineStore()- let eng = try engine.map { try store.engine($0) } ?? store.installedEngines().first+ let eng = try engine.map { try store.engine($0) } ?? EngineStore.defaultEngine(installed: store.installedEngines(), bundledID: nil)guard let eng else { fail("no engine installed") }print("creating bottle '\(name)' with \(eng.id) (wineboot takes ~90 s the first time)…")var bottle = try await BottleStore().create(name: name, engine: eng, renderer: renderer ?? .dxmt)diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swiftindex b3da8b9..77874cd 100644--- a/Tests/HighballKitTests/RegressionTests.swift+++ b/Tests/HighballKitTests/RegressionTests.swift@@ -851,9 +851,12 @@ extension RegressionTests {}let old = try engine("x64-sikarugir10.0_6-r0"), new = try engine("x64-sikarugir10.0_6-r1")XCTAssertEqual(EngineStore.defaultEngine(installed: [old, new], bundledID: new.id)?.id, new.id)- XCTAssertEqual(EngineStore.defaultEngine(installed: [old, new], bundledID: nil)?.id, old.id, "no manifest: first installed")+ XCTAssertEqual(EngineStore.defaultEngine(installed: [old, new], bundledID: nil)?.id, new.id, "no manifest (the CLI): newest installed, not the alphabetically first")+ XCTAssertEqual(EngineStore.defaultEngine(installed: [new, old], bundledID: nil)?.id, new.id, "order of discovery must not matter")XCTAssertEqual(EngineStore.defaultEngine(installed: [old], bundledID: new.id)?.id, old.id, "update not installed yet: keep using the old one")XCTAssertNil(EngineStore.defaultEngine(installed: [], bundledID: new.id))+ let r9 = try engine("x64-sikarugir10.0_6-r9"), r10 = try engine("x64-sikarugir10.0_6-r10")+ XCTAssertEqual(EngineStore.defaultEngine(installed: [r10, r9], bundledID: nil)?.id, r10.id, "numeric-aware: r10 is newer than r9 although it sorts first as a string")}// An engine update only re-runs wineboot on each bottle when the Wine build changed. r1 is