Skip to content

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

engine install: inherit licences the owner already accepted (#61)

Gauthier Piarrette2075fee013ab
diff --git a/Sources/HighballKit/EngineStore.swift b/Sources/HighballKit/EngineStore.swift
index 6913a53..970dda9 100644
--- a/Sources/HighballKit/EngineStore.swift
+++ b/Sources/HighballKit/EngineStore.swift
@@ -74,6 +74,16 @@ public struct EngineStore: Sendable {
installed.filter { $0.id != defaultID && !referencedIDs.contains($0.id) && !keep.contains($0.id) }
}
+ /// Which licences a newly installed engine records as accepted: the ones asked for, plus any
+ /// already accepted on an engine installed here. Same id means the same licence text, so a
+ /// second engine carrying the same D3DMetal does not ask again. Not carrying them left an
+ /// engine that has D3DMetal but will not serve it, so a bottle set to Apple's DirectX 12
+ /// silently fell back on every launch with nothing obviously wrong (highball#61, reproduced
+ /// here 2026-09-09 when a fresh install of r5 dropped the acceptance made on r4).
+ public static func acceptances(requested: Set<String>, installed: [InstalledEngine]) -> [String] {
+ Array(requested.union(installed.flatMap { $0.manifest.acceptedLicenses ?? [] })).sorted()
+ }
+
/// Whether an engine update may move a bottle onto `fresh` without re-running the Windows
/// first boot. The question is about the bottle's OWN engine: comparing the previous default
/// instead walked bottles across Wine builds whenever the default's own step was
@@ -162,8 +172,14 @@ public struct EngineStore: Sendable {
try extract(archive, component: component, name: name, into: staging)
}
+ // A licence the owner already accepted on another installed engine carries over. It is the
+ // same licence text under the same id, and not carrying it leaves an engine that has
+ // D3DMetal but will not serve it, so a bottle set to Apple's DirectX 12 silently falls back
+ // on every launch with nothing obviously wrong (highball#61, and again here 2026-09-09 when
+ // a fresh install of r5 dropped the acceptance made on r4). updateEngine() already gathered
+ // acceptances this way; doing it here covers every path, including first run and the CLI.
var saved = manifest
- saved.acceptedLicenses = Array(accepted).sorted()
+ saved.acceptedLicenses = Self.acceptances(requested: accepted, installed: (try? installedEngines()) ?? [])
try saved.save(to: staging.appending(path: "manifest.json"))
try linkRuntime(staging)
try? FileManager.default.removeItem(at: root)
diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swift
index 6409cc3..cd50efe 100644
--- a/Tests/HighballKitTests/RegressionTests.swift
+++ b/Tests/HighballKitTests/RegressionTests.swift
@@ -862,6 +862,28 @@ extension RegressionTests {
"an engine the app still offers (bundled manifest) is kept for rollback even with no bottle on it")
}
+ // highball#61: an engine can carry D3DMetal while recording no acceptance for its licence, so a
+ // bottle set to Apple's DirectX 12 falls back on every launch and the engine looks broken.
+ // Reproduced here 2026-09-09: a fresh install of r5 dropped the acceptance made on r4.
+ func testFreshEngineInheritsLicencesAlreadyAccepted() throws {
+ func engine(_ id: String, accepted: [String]) throws -> InstalledEngine {
+ let json = #"{"id":"\#(id)","displayName":"e","arch":"x86_64","minMacOS":"14.0","components":{},"acceptedLicenses":\#(String(data: try JSONEncoder().encode(accepted), encoding: .utf8)!)}"#
+ return InstalledEngine(manifest: try JSONDecoder().decode(EngineManifest.self, from: Data(json.utf8)),
+ root: URL(fileURLWithPath: "/tmp/\(id)"))
+ }
+ let gptk = "apple-gptk-license-2023-08-17"
+ let r4 = try engine("x64-crossover26.3-r4", accepted: [gptk])
+ let plain = try engine("x64-sikarugir10.0_6-r2", accepted: [])
+
+ XCTAssertEqual(EngineStore.acceptances(requested: [], installed: [r4, plain]), [gptk],
+ "THE BUG: a new engine must inherit the licence the owner already accepted")
+ XCTAssertEqual(EngineStore.acceptances(requested: [], installed: [plain]), [],
+ "nothing accepted anywhere: the new engine asks, as it should")
+ XCTAssertEqual(EngineStore.acceptances(requested: ["other-licence"], installed: [r4]),
+ ["apple-gptk-license-2023-08-17", "other-licence"],
+ "what the caller asks for is kept alongside what carries over")
+ }
+
// 2026-09-09, found on the maintainer's own machine: an older Highball started, updated to its
// bundled default, and walked EVERY bottle onto it, including two on a different Wine build
// whose prefixes are a different format. It then deleted the engine it did not recognise, so a