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
recipes: actually install the dependencies they declare
Gauthier Piarrette7dfb10dbf577
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex a15886d..34a0fad 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -254,7 +254,7 @@ final class AppState {if recipe.isAutoApplicable {Task { @MainActor invar runner = RecipeRunner(paths: paths, engine: engine, bottle: bottle)- if let notes = try? await runner.apply(recipe) {+ if let notes = try? await runner.apply(recipe, resolve: { Self.recipe($0) }) {logLines.append("applied the \(recipe.title) fix")for n in notes { logLines.append("note: \(n)") }}@@ -869,7 +869,7 @@ final class AppState {let bottle = try await bottleStore.create(name: name, engine: engine)await MainActor.run { self.appendLog("bottle '\(name)' created on \(engine.id)"); self.refresh() }var runner = RecipeRunner(paths: paths, engine: engine, bottle: bottle)- let notes = try await runner.apply(recipe) { line in Task { @MainActor in self.appendLog(line) } }+ let notes = try await runner.apply(recipe, resolve: { Self.recipe($0) }) { line in Task { @MainActor in self.appendLog(line) } }for n in notes { await MainActor.run { self.appendLog("note: \(n)") } }await MainActor.run { self.selectedBottle = name }}@@ -922,7 +922,7 @@ final class AppState {await MainActor.run { self.appendLog("bottle created") }if let recipeID, let recipe = Self.recipe(recipeID) {var runner = RecipeRunner(paths: paths, engine: engine, bottle: bottle)- let notes = try await runner.apply(recipe) { line in Task { @MainActor in self.appendLog(line) } }+ let notes = try await runner.apply(recipe, resolve: { Self.recipe($0) }) { line in Task { @MainActor in self.appendLog(line) } }for n in notes { await MainActor.run { self.appendLog("note: \(n)") } }}await MainActor.run { self.selectedBottle = name }@@ -938,7 +938,7 @@ final class AppState {done: done ?? DoneState(title: String(format: L("%@ installed"), recipe.title), ctaTitle: nil, cta: nil),stop: .killBottleThenRepair(bottle, label: L("Stop and repair"))) { [self] invar runner = RecipeRunner(paths: paths, engine: engine, bottle: bottle)- let notes = try await runner.apply(recipe) { line in Task { @MainActor in self.appendLog(line) } }+ let notes = try await runner.apply(recipe, resolve: { Self.recipe($0) }) { line in Task { @MainActor in self.appendLog(line) } }for n in notes { await MainActor.run { self.appendLog("note: \(n)") } }}}@@ -1654,7 +1654,7 @@ final class AppState {// MARK: Resource lookup (repo checkout or app bundle)- static var repoRoot: URL? {+ nonisolated static var repoRoot: URL? {var dir = URL(fileURLWithPath: CommandLine.arguments[0]).deletingLastPathComponent()for _ in 0..<6 {if FileManager.default.fileExists(atPath: dir.appending(path: "spike/engine-manifest.json").path) { return dir }@@ -1738,7 +1738,9 @@ final class AppState {return out.values.sorted { $0.title < $1.title }}- static func recipe(_ id: String) -> HighballKit.Recipe? {+ /// Reads a recipe from the bundle or a sibling checkout. Nonisolated because recipe+ /// application resolves dependencies off the main actor: it touches no app state.+ nonisolated static func recipe(_ id: String) -> HighballKit.Recipe? {if let url = Bundle.main.url(forResource: id, withExtension: "json"),let r = try? HighballKit.Recipe.load(from: url) { return r }guard let root = repoRoot else { return nil }diff --git a/Sources/HighballKit/Recipe.swift b/Sources/HighballKit/Recipe.swiftindex 0619023..218ada5 100644--- a/Sources/HighballKit/Recipe.swift+++ b/Sources/HighballKit/Recipe.swift@@ -268,13 +268,26 @@ public struct RecipeRunner: Sendable {}/// Runs every step. Returns the notes the UI should show afterwards.- public mutating func apply(_ recipe: Recipe, log: (@Sendable (String) -> Void)? = nil) async throws -> [String] {+ public mutating func apply(_ recipe: Recipe,+ resolve: (@Sendable (String) -> Recipe?)? = nil,+ log: (@Sendable (String) -> Void)? = nil) async throws -> [String] {if let b = recipe.blocked {var msg = "'\(recipe.title)' is blocked on this engine: \(b.reason)"if let t = b.tracking { msg += " Tracked at \(t)" }throw HighballError.invalid(msg)}var notes: [String] = []+ // Dependencies first. A recipe that declares requires: ["steam", "dotnet48"] means the game+ // does not work without .NET, and until 2026-09-10 that field was read by nothing: pressing+ // Play launched Assetto Corsa without .NET and it died with "Configuration system failed to+ // initialize", while the recipe's only mention of it was a note telling the owner to go and+ // install it themselves. Only tweaks are applied here; a launcher in `requires` is a+ // statement about where the game comes from, not something to install on its behalf.+ for id in recipe.requires ?? [] where !bottle.settings.recipes.contains(id) {+ guard let dep = resolve?(id), dep.kind == .tweak else { continue }+ log?("[\(recipe.id)] needs \(dep.id) first")+ notes += try await apply(dep, resolve: resolve, log: log)+ }// A recipe's renderer is a default, never an override: an explicit user choice wins// (issue #29 — the Steam recipe silently reset a d3dmetal bottle to dxmt).if let r = recipe.renderer {diff --git a/Sources/highball/main.swift b/Sources/highball/main.swiftindex 58890aa..0a1d698 100644--- a/Sources/highball/main.swift+++ b/Sources/highball/main.swift@@ -112,7 +112,7 @@ struct Bottle: AsyncParsableCommand {print("created \(bottle.url.path)")if let recipe {var r = RecipeRunner(engine: eng, bottle: bottle)- let notes = try await r.apply(try loadRecipe(recipe)) { print($0) }+ let notes = try await r.apply(try loadRecipe(recipe), resolve: { try? loadRecipe($0) }) { print($0) }for n in notes { print("note: \(n)") }}}@@ -382,7 +382,7 @@ struct Recipe: AsyncParsableCommand {let b = try BottleStore().get(bottle)let eng = try EngineStore().engine(b.settings.engineID)var r = RecipeRunner(engine: eng, bottle: b)- let notes = try await r.apply(try loadRecipe(recipe)) { print($0) }+ let notes = try await r.apply(try loadRecipe(recipe), resolve: { try? loadRecipe($0) }) { print($0) }for n in notes { print("note: \(n)") }}}diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swiftindex cd50efe..1a97965 100644--- a/Tests/HighballKitTests/RegressionTests.swift+++ b/Tests/HighballKitTests/RegressionTests.swift@@ -884,6 +884,25 @@ extension RegressionTests {"what the caller asks for is kept alongside what carries over")}+ // A recipe that declares requires: ["steam", "dotnet48"] means the game does not work without+ // .NET. Until 2026-09-10 that field was read by nothing, so pressing Play launched Assetto Corsa+ // without .NET and it died with "Configuration system failed to initialize" while the recipe's+ // only mention of the dependency was a note telling the owner to install it themselves.+ func testRecipeDependenciesAreDeclaredAndResolvable() throws {+ let dep = #"{"id":"dotnet48","kind":"tweak","title":"NET","steps":[{"type":"note","text":"n"}]}"#+ let game = #"{"id":"ac","kind":"game","title":"AC","requires":["steam","dotnet48"],"steps":[{"type":"note","text":"g"}]}"#+ let d = try JSONDecoder.highball.decode(Recipe.self, from: Data(dep.utf8))+ let g = try JSONDecoder.highball.decode(Recipe.self, from: Data(game.utf8))+ XCTAssertEqual(g.requires, ["steam", "dotnet48"], "the dependency must survive decoding")+ XCTAssertEqual(d.kind, .tweak, "only tweaks are applied on a game's behalf")++ // The resolver picks tweaks and ignores launchers: a launcher in `requires` says where the+ // game comes from, it is not something to install for it.+ let catalog = ["dotnet48": d]+ let applied = (g.requires ?? []).compactMap { catalog[$0] }.filter { $0.kind == .tweak }.map(\.id)+ XCTAssertEqual(applied, ["dotnet48"])+ }+// 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