Skip to content

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

feat: blocked recipes — honest disabled tiles instead of a hanging installer

Gauthier Piarrettecc5b3f905470
diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swift
index 36c1e96..a29e654 100644
--- a/Sources/HighballApp/BottleView.swift
+++ b/Sources/HighballApp/BottleView.swift
@@ -219,10 +219,11 @@ struct BottleView: View {
HB.eyebrow(L("Launchers"))
LazyVGrid(columns: [GridItem(.adaptive(minimum: 108, maximum: 140), spacing: 12)], spacing: 12) {
ForEach(Self.launcherMeta, id: \.id) { meta in
- if AppState.recipe(meta.id) != nil {
+ if let recipe = AppState.recipe(meta.id) {
let installed = bottle.settings.recipes.contains(meta.id)
let pin = bottle.settings.pins.first { $0.name.lowercased().hasPrefix(meta.short.lowercased().prefix(5)) }
- LauncherTile(title: meta.short, symbol: meta.symbol, installed: installed, busy: state.busy) {
+ LauncherTile(title: meta.short, symbol: meta.symbol, installed: installed, busy: state.busy,
+ blockedReason: recipe.blocked?.reason) {
if installed, let pin { state.launch(pin: pin, in: bottle) }
else { state.applyRecipe(meta.id, to: bottle) }
}
@@ -433,9 +434,12 @@ struct LauncherTile: View {
let symbol: String
let installed: Bool
let busy: Bool
+ var blockedReason: String? = nil
let action: () -> Void
@State private var hovering = false
+ private var blocked: Bool { blockedReason != nil && !installed }
+
var body: some View {
Button(action: action) {
VStack(spacing: 8) {
@@ -461,17 +465,19 @@ struct LauncherTile: View {
}
}
Text(title).font(.system(size: 11.5, weight: .medium)).lineLimit(1)
- Text(installed ? L("Open") : L("Install"))
+ Text(installed ? L("Open") : (blocked ? L("Blocked") : L("Install")))
.font(.system(size: 9.5).monospaced())
- .foregroundStyle(installed ? AnyShapeStyle(HB.good) : AnyShapeStyle(.tertiary))
+ .foregroundStyle(installed ? AnyShapeStyle(HB.good) : (blocked ? AnyShapeStyle(HB.bad.opacity(0.85)) : AnyShapeStyle(.tertiary)))
}
.frame(maxWidth: .infinity)
.padding(.vertical, 12)
- .background(RoundedRectangle(cornerRadius: 11).fill(hovering ? Color.white.opacity(0.09) : HB.card))
- .overlay(RoundedRectangle(cornerRadius: 11).stroke(hovering ? HB.amber.opacity(0.4) : HB.cardStroke))
+ .background(RoundedRectangle(cornerRadius: 11).fill(hovering && !blocked ? Color.white.opacity(0.09) : HB.card))
+ .overlay(RoundedRectangle(cornerRadius: 11).stroke(hovering && !blocked ? HB.amber.opacity(0.4) : HB.cardStroke))
+ .opacity(blocked ? 0.55 : 1)
}
.buttonStyle(.plain)
- .disabled(busy)
+ .disabled(busy || blocked)
+ .help(blockedReason.map { L("Blocked on the current engine: ") + $0 } ?? "")
.animation(.easeOut(duration: 0.12), value: hovering)
.onHover { hovering = $0 }
}
diff --git a/Sources/HighballKit/Recipe.swift b/Sources/HighballKit/Recipe.swift
index 6aeaa29..d0d0af9 100644
--- a/Sources/HighballKit/Recipe.swift
+++ b/Sources/HighballKit/Recipe.swift
@@ -75,6 +75,14 @@ public struct Recipe: Codable, Sendable, Identifiable {
public var fix: String?
}
+ /// A recipe the current engine cannot deliver: shown but not runnable, with the reason
+ /// and an upstream tracking link. Better one honest disabled tile than an installer
+ /// that hangs forever (the Rockstar case).
+ public struct Blocked: Codable, Sendable {
+ public var reason: String
+ public var tracking: String?
+ }
+
public struct Verification: Codable, Sendable {
public var date: String
public var engine: String
@@ -91,6 +99,7 @@ public struct Recipe: Codable, Sendable, Identifiable {
public var steps: [Step]
public var knownIssues: [KnownIssue]?
public var lastVerified: Verification?
+ public var blocked: Blocked?
public static func load(from url: URL) throws -> Recipe {
try JSONDecoder.highball.decode(Recipe.self, from: Data(contentsOf: url))
@@ -110,6 +119,11 @@ 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] {
+ 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] = []
if let r = recipe.renderer { bottle.settings.renderer = r }
for (i, step) in recipe.steps.enumerated() {
diff --git a/Tests/HighballKitTests/RecipeDBTests.swift b/Tests/HighballKitTests/RecipeDBTests.swift
index b391c3d..ab1dcaf 100644
--- a/Tests/HighballKitTests/RecipeDBTests.swift
+++ b/Tests/HighballKitTests/RecipeDBTests.swift
@@ -59,6 +59,41 @@ final class RecipeDBTests: XCTestCase {
XCTAssertGreaterThan(checked, 0)
}
+ // A blocked recipe must refuse to run before touching the bottle — the Rockstar
+ // installer would otherwise hang a user's install forever (Sikarugir#258).
+ func testBlockedRecipeRefusesToApply() async throws {
+ let json = """
+ {"id":"b","kind":"launcher","title":"Blocked Thing","steps":[{"type":"note","text":"x"}],
+ "blocked":{"reason":"engine cannot run it","tracking":"https://example.com/1"}}
+ """
+ let r = try JSONDecoder.highball.decode(Recipe.self, from: Data(json.utf8))
+ XCTAssertEqual(r.blocked?.reason, "engine cannot run it")
+ let manifestURL = URL(fileURLWithPath: #filePath)
+ .deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()
+ .appending(path: "spike/engine-manifest.json")
+ let engine = InstalledEngine(manifest: try EngineManifest.load(from: manifestURL),
+ root: FileManager.default.temporaryDirectory.appending(path: "hb-blocked-\(UUID().uuidString)"))
+ let bottle = Bottle(url: URL(fileURLWithPath: "/tmp/hb-blocked-bottle"),
+ settings: BottleSettings(name: "b", engineID: engine.id))
+ var runner = RecipeRunner(engine: engine, bottle: bottle)
+ do {
+ _ = try await runner.apply(r)
+ XCTFail("blocked recipe must throw")
+ } catch {
+ XCTAssertTrue("\(error)".contains("blocked"), "error should explain the block: \(error)")
+ }
+ }
+
+ // The Rockstar db entry must stay blocked until the engine fix lands.
+ func testRockstarRecipeIsBlocked() throws {
+ let f = dbRoot.appending(path: "recipes/launchers/rockstar.json")
+ guard FileManager.default.fileExists(atPath: f.path) else {
+ throw XCTSkip("highball-db checkout not found next to the repo")
+ }
+ let r = try JSONDecoder.highball.decode(Recipe.self, from: Data(contentsOf: f))
+ XCTAssertNotNil(r.blocked, "unblock only after verifying the launcher actually runs (Sikarugir#258)")
+ }
+
// The GOG recipe regression: the web installer trips its service-pack check under
// Wine's win10 profile. The recipe must keep pointing at the offline installer.
func testGogRecipeUsesOfflineInstaller() throws {