Skip to content

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

Merge pull request #590 from gabeperez/fix/component-installing

Gauthier Piarrette848f64992529
diff --cc Sources/HighballApp/AppState.swift
index 0fff2ec,411c89b..3d54f63
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@@ -2029,9 -1983,30 +2029,31 @@@ final class AppState
}
}
+ /// The recipe being applied now, and where, from its first step to its last. A component's
+ /// Installed check can pass long before the run ends: winetricks puts .NET Framework 4.8's
+ /// clr.dll in place early, then runs Microsoft's compiler services for many minutes.
+ var applyingRecipe: (id: String, bottle: String)?
+
+ /// Whether `component` is being installed in `bottle` now: applied itself, or pulled in by the
+ /// recipe being applied (a game's fix that requires .NET Framework 4.8) and not yet done. A new
+ /// environment's setup runs its recipes without this, so it is not covered.
+ func isApplying(_ component: HighballKit.Recipe, in bottle: Bottle) -> Bool {
+ guard let applying = applyingRecipe, applying.bottle == bottle.name else { return false }
+ if applying.id == component.id { return true }
+ guard !bottle.settings.recipes.contains(component.id) else { return false }
+ // Through `requires` at any depth, as RecipeRunner applies them.
+ var pending = [applying.id], seen = Set<String>()
+ while let id = pending.popLast() {
+ guard seen.insert(id).inserted, let requires = Self.recipe(id)?.requires else { continue }
+ if requires.contains(component.id) { return true }
+ pending += requires
+ }
+ return false
+ }
+
func applyRecipe(_ id: String, to bottle: Bottle, then done: DoneState? = nil) {
- guard let engine = engine(for: bottle), let recipe = Self.recipe(id) else { return }
+ guard let engine = engine(for: bottle),
+ let recipe = Self.recipe(id)?.routed(onEngine: bottle.settings.engineID) else { return }
if let wanted = recipe.engineToOffer(current: engine.manifest, known: Self.knownManifests) {
pendingEngine = (recipe, bottle, wanted, nil, nil); return
}