Skip to content

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

A game's recipe can carry a second route on a preview engine. Forza Horizon 6 plays on D3DMetal 4 with its copy protection's hitch and on a native arm64 line without it, at a lower frame rate, and neither is the better one for everybody, so its recipe gets a previewRoute: an environment on the route's line goes by the route, every other by the recipe as before, under one recipe id. Play asks once (the preview ask with the route's own note, then the usual engine ask), the game page's Other route asks again, and a player who stays changes nothing. Recipes gain a framecap step (the environment's cap, set only where the player has none) and ${user} in file paths, variables ${environment}. A route's mode is the environment's own, the page shows the route's verdict and folds a long list of variables into one line.

Gauthier Piarrette8386b6755bcb
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 8ef2503..0fff2ec 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -439,7 +439,7 @@ final class AppState {
/// The verified fix recipe for a library item, if the db has one (db entry id == recipe id).
func fixRecipe(for item: LibraryItem) -> HighballKit.Recipe? {
guard let entry = gameDB.entry(for: item),
- let recipe = Self.recipe(entry.id), recipe.kind == .game else { return nil }
+ let recipe = Self.recipe(entry.id).map({ routed($0, for: item) }), recipe.kind == .game else { return nil }
// A recipe pinned to an engine this install does not see (a line still in preview) is not
// offered: the game page and Play stay as they were before the recipe existed.
let defaults = UserDefaults.standard
@@ -454,11 +454,38 @@ final class AppState {
/// pinned to a hidden engine), for what Play checks before anything else. An opt-in recipe stays the page's
/// business, as everywhere.
func gameRecipe(for item: LibraryItem) -> HighballKit.Recipe? {
- guard let entry = gameDB.entry(for: item), let recipe = Self.recipe(entry.id), recipe.kind == .game, !recipe.isOptIn
+ guard let entry = gameDB.entry(for: item), let recipe = Self.recipe(entry.id).map({ routed($0, for: item) }),
+ recipe.kind == .game, !recipe.isOptIn
else { return nil }
return recipe
}
+ /// The recipe the environment `item` plays in goes by (Recipe.routed).
+ private func routed(_ recipe: HighballKit.Recipe, for item: LibraryItem) -> HighballKit.Recipe {
+ recipe.routed(onEngine: bottles.first { $0.name == item.bottleName }?.settings.engineID)
+ }
+
+ /// The preview route a game's recipe offers (Recipe.previewRoute) where this Mac can run it and the game does not
+ /// play on it already, with the newest revision of its line.
+ func routeOffer(for item: LibraryItem) -> (recipe: HighballKit.Recipe, manifest: EngineManifest)? {
+ guard let entry = gameDB.entry(for: item), let base = Self.recipe(entry.id), base.kind == .game, !base.isOptIn,
+ let route = base.route, let pin = route.engine,
+ !routed(base, for: item).isPreviewRoute else { return nil }
+ let revisions = Self.bundledManifests.filter { EngineManifest.line(of: $0.id) == EngineManifest.line(of: pin) && $0.runs(onMacOS: EngineManifest.currentMacOS) }
+ guard let manifest = revisions.max(by: { (EngineManifest.revision(of: $0.id) ?? 0) < (EngineManifest.revision(of: $1.id) ?? 0) }) else { return nil }
+ return (route, manifest)
+ }
+
+ /// Games Play has asked about their preview route: the ask comes once, the game page can ask again.
+ static let previewRouteAskedKey = "previewRouteAsked"
+ static func firstPreviewRouteAsk(game: String) -> Bool {
+ var asked = UserDefaults.standard.stringArray(forKey: previewRouteAskedKey) ?? []
+ guard !asked.contains(game) else { return false }
+ asked.append(game)
+ UserDefaults.standard.set(asked, forKey: previewRouteAskedKey)
+ return true
+ }
+
/// The preview engine a game's recipe pins while this Mac does not see it (EngineChannels.previewToOffer): Play
/// asks the player before anything changes. An opt-in recipe stays the page's business, as everywhere.
func previewOffer(for item: LibraryItem) -> (recipe: HighballKit.Recipe, manifest: EngineManifest)? {
@@ -496,6 +523,11 @@ final class AppState {
pendingMacOS = (recipe, floor, item, bottle, renderer)
return
}
+ // A game with a second route on a preview engine: the player chooses once, and the answer stands.
+ if let offer = routeOffer(for: item), Self.firstPreviewRouteAsk(game: offer.recipe.id) {
+ pendingPreview = (offer.recipe, bottle, offer.manifest, item, renderer)
+ return
+ }
// A recipe pinned to a preview engine this Mac does not see yet: before 0.10.19 Play launched the game here
// as if the recipe did not exist, which for Microsoft Flight Simulator 2024 was a Rosetta engine it cannot
// start on. An environment already on that engine counts as the player's choice, and so does one on an
@@ -580,7 +612,10 @@ final class AppState {
pendingD3DMetal = (item, bottle, engine)
return
case .notShipped:
- let instead = Renderer.fallback(for: wanted, in: engine)
+ // The mode the game's recipe names comes first: the per-game mode a player chose on another route
+ // follows the game to an engine that lacks it (D3DMetal, on the native arm64 line).
+ let named = fixRecipe(for: item)?.renderer.flatMap { $0.availability(in: engine) == .available ? $0 : nil }
+ let instead = named ?? Renderer.fallback(for: wanted, in: engine)
appendLog("\(item.title): \(wanted.unavailableReason(in: engine) ?? "") Playing with \(GamePageCopy.plainName(instead)).")
renderer = instead
}
@@ -1665,6 +1700,12 @@ final class AppState {
pendingPreview = nil
Self.optInPreview(pending.manifest.id)
appendLog("\(pending.item.title): the \(pending.manifest.id) preview engine is offered on this Mac from now on")
+ // A route lives beside the recipe, so nothing further in Play would ask for its engine.
+ if pending.recipe.isPreviewRoute {
+ pendingEngine = (pending.recipe, pending.bottle, pending.manifest, pending.item,
+ environmentFit(for: pending.recipe, besides: pending.bottle, item: pending.item))
+ return
+ }
play(pending.item, renderer: pending.renderer)
}
@@ -1672,6 +1713,11 @@ final class AppState {
func playWithoutPreview() {
guard let pending = pendingPreview else { return }
pendingPreview = nil
+ if pending.recipe.isPreviewRoute {
+ appendLog("\(pending.item.title): staying on its current route, without the \(pending.manifest.id) preview engine.")
+ play(pending.item, renderer: pending.renderer)
+ return
+ }
appendLog("\(pending.item.title): its fix needs the \(pending.manifest.id) preview engine; playing without it.")
launch(pending.item, in: pending.bottle, renderer: pending.renderer)
}
@@ -1984,7 +2030,8 @@ final class AppState {
}
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
}
diff --git a/Sources/HighballApp/EngineAsk.swift b/Sources/HighballApp/EngineAsk.swift
index e823611..6d75732 100644
--- a/Sources/HighballApp/EngineAsk.swift
+++ b/Sources/HighballApp/EngineAsk.swift
@@ -71,7 +71,8 @@ extension GamePageCopy {
let text = manifest.isNativeARM64
? L("%@ is verified on the %@ engine, which runs natively on Apple silicon and is still in preview: the game plays, with the rough edges its page lists. Highball offers that engine for this game, sets it up in an environment of its own, and leaves this one as it is.")
: L("%@ is verified on the %@ engine, which is still in preview: the game plays, with the rough edges its page lists. Highball offers that engine for this game, sets it up in an environment of its own, and leaves this one as it is.")
- return String(format: text, recipe.title, shortEngineName(manifest)) + memoryNote(recipe: recipe, memoryMB: memoryMB)
+ let route = recipe.previewRouteNote.flatMap { $0.isEmpty ? nil : " " + $0 } ?? ""
+ return String(format: text, recipe.title, shortEngineName(manifest)) + route + memoryNote(recipe: recipe, memoryMB: memoryMB)
}
/// "r5" for arm64-wine11.18-r5, the id itself when it carries no revision.
diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swift
index f25ad0a..b72d5c4 100644
--- a/Sources/HighballApp/GameDetailView.swift
+++ b/Sources/HighballApp/GameDetailView.swift
@@ -26,7 +26,15 @@ struct GameDetailView: View {
@State private var showWhy = false
@State private var showAdvanced = false
- private var entry: GameDBEntry? { state.gameDB.entry(for: item) }
+ private var entry: GameDBEntry? {
+ var row = state.gameDB.entry(for: item)
+ // On a game's preview route the route's mode is the game's, whatever the row verified for its other route.
+ if let recipe = fixRecipe, recipe.isPreviewRoute {
+ row?.renderer = recipe.renderer; row?.rendererMinMacOS = nil
+ if let verified = recipe.previewRouteVerified { row?.verified = verified; row?.lastVerified = recipe.lastVerified?.date }
+ }
+ return row
+ }
private var bottle: Bottle? { item.bottleName.flatMap { name in state.bottles.first { $0.name == name } } }
private var blocked: Bool { entry?.isBlocked == true }
/// Steam already has an appmanifest for it (downloading or updating), as opposed to a game
@@ -47,7 +55,7 @@ struct GameDetailView: View {
private var verdict: GamePageCopy.Verdict { GamePageCopy.verdict(entry, myChip: state.machineChip) }
private var willDo: [GamePageCopy.WillDo] {
GamePageCopy.willDo(entry, recipe: fixRecipe, applied: fixApplied, bottleRenderer: bottle?.settings.renderer ?? .dxvk,
- explicit: bottle?.settings.rendererExplicit ?? false, gameOverride: state.rendererOverride(for: item),
+ explicit: (bottle?.settings.rendererExplicit ?? false) && fixRecipe?.isPreviewRoute != true, gameOverride: state.rendererOverride(for: item),
needsDirect3D12: item.installed && entry?.nativeVulkan != true && state.programNeedsDirect3D12(item))
}
private var engineName: String? { bottle.flatMap { state.engine(for: $0) }?.displayName }
@@ -583,6 +591,15 @@ struct GameDetailView: View {
if item.source == .gog, let game = state.gogInstalled(item, in: bottle) {
gogSettings(game)
}
+ // A second route on a preview engine: Play asks once, and here it can be asked again.
+ if let offer = state.routeOffer(for: item) {
+ HStack(alignment: .top, spacing: 12) {
+ Text(L("Other route")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)
+ Button(String(format: L("Try the %@ engine…"), GamePageCopy.shortEngineName(offer.manifest))) {
+ state.pendingPreview = (offer.recipe, bottle, offer.manifest, item, nil)
+ }.disabled(state.busy)
+ }
+ }
// The engine is the environment's, so the page says so and can change it
// through the same switch page as the environment's settings, which lists
// every program that moves along (highball#262: an engine shown here that
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index 0a09a03..5d74313 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -684,6 +684,8 @@ enum L10n {
"Remove": "Supprimer",
"Engines no environment uses": "Moteurs qu'aucun environnement n'utilise",
"Show older engine revisions": "Afficher les anciennes révisions des moteurs",
+ "Other route": "Autre voie",
+ "Try the %@ engine…": "Essayer le moteur %@…",
"Remove…": "Supprimer…",
"Removing one frees its disk space. If a game asks for it again later, Highball downloads it then.": "En supprimer un libère son espace disque. Si un jeu le demande plus tard, Highball le télécharge à nouveau.",
"Removing engine %@": "Suppression du moteur %@",
diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swift
index 1100219..287c069 100644
--- a/Sources/HighballKit/Bottle.swift
+++ b/Sources/HighballKit/Bottle.swift
@@ -922,8 +922,9 @@ public struct Bottle: Sendable {
let inserted = (env["DYLD_INSERT_LIBRARIES"] ?? "").split(separator: ":").map(String.init)
env["DYLD_INSERT_LIBRARIES"] = ([lib.path] + inserted.filter { $0 != lib.path }).joined(separator: ":")
}
- // A recipe's value can depend on this Mac (a video memory budget from its memory).
- return env.mapValues { MacVariables.expand($0) }
+ // A recipe's value can depend on this Mac (a video memory budget from its memory), and an engine's or a recipe's
+ // on this environment (a driver's shader cache kept inside it, and gone with it).
+ return env.mapValues { MacVariables.expand($0).replacingOccurrences(of: "${environment}", with: url.path) }
}
/// The renderer-specific bridge files that make the DLSS switch actionable in this engine.
diff --git a/Sources/HighballKit/GamePageCopy.swift b/Sources/HighballKit/GamePageCopy.swift
index e22e52c..d48d4ae 100644
--- a/Sources/HighballKit/GamePageCopy.swift
+++ b/Sources/HighballKit/GamePageCopy.swift
@@ -142,7 +142,13 @@ public enum GamePageCopy {
: "Leave the optional \(recipe.title) fix alone; it is under Game settings for when the notes say your Mac needs it",
done: applied))
} else if let recipe {
+ // A route's list of switches says nothing to a reader as 28 lines (Forza Horizon 6's emulator switches).
+ let variables = recipe.steps.filter { if case .environment = $0 { return true } else { return false } }.count
+ if variables > 6 {
+ items.append(WillDo(text: "Set \(variables) emulator and graphics variables for this game", done: applied))
+ }
for step in recipe.steps {
+ if variables > 6, case .environment = step { continue }
guard let text = describe(step) else { continue }
items.append(WillDo(text: text, cost: applied ? nil : step.slowHint, done: applied))
}
@@ -232,6 +238,7 @@ public enum GamePageCopy {
case .pin: return nil
case let .note(text): return text
case let .dllOverride(v): return "Set the Windows library override \(v)"
+ case let .frameCap(n): return "Cap the frame rate at \(n)"
case let .dxvkConfig(exe, _): return "Configure DXVK for \(exe)"
}
}
diff --git a/Sources/HighballKit/Recipe.swift b/Sources/HighballKit/Recipe.swift
index 44a0634..f554857 100644
--- a/Sources/HighballKit/Recipe.swift
+++ b/Sources/HighballKit/Recipe.swift
@@ -45,6 +45,9 @@ public struct Recipe: Codable, Sendable, Identifiable {
/// so it also reaches a game launched by an already-running Steam. This is how a game's
/// need to avoid a vendor library ships as data instead of app code.
case dllOverride(String)
+ /// The environment's frame cap, the same setting as in its Graphics settings, set only where the player has
+ /// none: a game whose even pacing depends on a cap gets it on its first start and keeps the player's choice.
+ case frameCap(Int)
/// Per-app DXVK options ("csgo.exe" → dxvk.enableAsync=False…), stored on the bottle
/// and rendered into its dxvk.conf at every DXVK launch. This is how game-specific
/// DXVK knowledge ships as data instead of app code.
@@ -77,6 +80,7 @@ public struct Recipe: Codable, Sendable, Identifiable {
case "pin": self = .pin(try c.decode(Pin.self, forKey: .pin))
case "note": self = .note(try c.decode(String.self, forKey: .text))
case "dlloverride": self = .dllOverride(try c.decode(String.self, forKey: .value))
+ case "framecap": self = .frameCap(try c.decode(Int.self, forKey: .value))
case "dxvkconfig": self = .dxvkConfig(exe: try c.decode(String.self, forKey: .exe),
options: try c.decode([String: String].self, forKey: .options))
case let other: throw HighballError.invalid("unknown recipe step type '\(other)'")
@@ -108,6 +112,7 @@ public struct Recipe: Codable, Sendable, Identifiable {
case let .pin(p): try c.encode("pin", forKey: .type); try c.encode(p, forKey: .pin)
case let .note(t): try c.encode("note", forKey: .type); try c.encode(t, forKey: .text)
case let .dllOverride(v): try c.encode("dlloverride", forKey: .type); try c.encode(v, forKey: .value)
+ case let .frameCap(n): try c.encode("framecap", forKey: .type); try c.encode(n, forKey: .value)
case let .dxvkConfig(exe, options):
try c.encode("dxvkconfig", forKey: .type); try c.encode(exe, forKey: .exe)
try c.encode(options, forKey: .options)
@@ -120,7 +125,7 @@ public struct Recipe: Codable, Sendable, Identifiable {
case let .installer(_, _, _, label, _, _): return label
case let .winetricks(verbs, _): return verbs.joined(separator: " ")
case .registry: return nil
- case .environment, .renderer, .sync, .winver, .file, .copy, .pin, .note, .dxvkConfig, .dllOverride: return nil
+ case .environment, .renderer, .sync, .winver, .file, .copy, .pin, .note, .dxvkConfig, .dllOverride, .frameCap: return nil
}
}
@@ -156,7 +161,7 @@ public struct Recipe: Codable, Sendable, Identifiable {
/// takes no meaningful time (installer/winetricks can take 20-40 minutes).
public var isAutoApplicable: Bool {
switch self {
- case .file, .copy, .renderer, .sync, .environment, .pin, .note, .dxvkConfig, .dllOverride: return true
+ case .file, .copy, .renderer, .sync, .environment, .pin, .note, .dxvkConfig, .dllOverride, .frameCap: return true
case .installer, .winetricks, .registry, .winver: return false
}
}
@@ -192,6 +197,9 @@ public struct Recipe: Codable, Sendable, Identifiable {
/// behaviour left one behind for every game it missed. Every other path, and every game in
/// the environment's own library, lands where the step says, as before.
public static func target(of path: String, driveC: URL, steamGames: [SteamGame]) -> URL {
+ // ${user} is the Mac's short user name, the name Wine gives the folder under drive_c/users: a game's
+ // settings live in there (Forza Horizon 6's, in AppData/Local).
+ let path = path.replacingOccurrences(of: "${user}", with: NSUserName())
let standard = driveC.appending(path: path)
let steam = "Program Files (x86)/Steam", common = "\(steam)/steamapps/common/"
guard path.hasPrefix(common) else { return standard }
@@ -212,7 +220,7 @@ public struct Recipe: Codable, Sendable, Identifiable {
public var changesLaunchEnvironment: Bool {
steps.contains { step in
switch step {
- case .renderer, .sync, .environment: return true
+ case .renderer, .sync, .environment, .frameCap: return true
default: return false
}
}
@@ -319,6 +327,53 @@ public struct Recipe: Codable, Sendable, Identifiable {
/// for the page's wording and for artifact checks once applied.
public var optIn: Bool?
public var isOptIn: Bool { optIn ?? false }
+
+ /// A second way to run this game, on a preview engine the player takes by choice, beside the recipe's own: Forza
+ /// Horizon 6 plays on D3DMetal 4 with its copy protection's hitch and on the native arm64 line without it, at a
+ /// lower frame rate, and neither is the better one for everybody. An environment on the route's line goes by the
+ /// route (`routed(onEngine:)`), every other by the recipe as before, so nothing changes for a player who stays.
+ public struct PreviewRoute: Codable, Sendable {
+ public var engine: String
+ public var renderer: Renderer?
+ public var minMemoryGB: Int?
+ public var steps: [Step]
+ public var knownIssues: [KnownIssue]?
+ public var lastVerified: Verification?
+ /// What the route changes for the player, added to Play's ask.
+ public var note: String?
+ /// What the game page's verdict says for this route, the row's own fields being its other route's.
+ public var verified: GameDBEntry.VerifiedOn?
+ }
+ public var previewRoute: PreviewRoute?
+ /// Set on the recipe `route` makes: `note` is the route's, and applying it makes the mode the environment's own.
+ public var previewRouteNote: String?
+ public var isPreviewRoute: Bool { previewRouteNote != nil }
+ /// The route's `verified`, on the recipe `route` makes.
+ public var previewRouteVerified: GameDBEntry.VerifiedOn?
+
+ /// This recipe as its preview route: the same game and id, so what an environment records for it (the applied list,
+ /// the variables scoped to the game) stays where everything looks for it, with the route's engine, mode and steps.
+ public var route: Recipe? {
+ guard let r = previewRoute else { return nil }
+ var copy = self
+ copy.engine = r.engine
+ copy.renderer = r.renderer ?? renderer
+ copy.minMemoryGB = r.minMemoryGB
+ copy.steps = r.steps
+ copy.knownIssues = r.knownIssues ?? knownIssues
+ copy.lastVerified = r.lastVerified ?? lastVerified
+ copy.previewRoute = nil
+ copy.previewRouteNote = r.note ?? ""
+ copy.previewRouteVerified = r.verified
+ return copy
+ }
+
+ /// The recipe an environment on `engineID` goes by: the route on the route's line, the recipe itself on any other.
+ public func routed(onEngine engineID: String?) -> Recipe {
+ guard let route, let pin = route.engine, let engineID, let line = EngineManifest.line(of: engineID),
+ line == EngineManifest.line(of: pin) else { return self }
+ return route
+ }
/// What an installed runtime leaves behind, so the Dependencies panel can tell "installed"
/// from "our recipe ran": a file under drive_c, or a registry value in system.reg (exact
/// match or a minimum for dword values). Any one marker satisfied means installed. Data, so
@@ -491,6 +546,9 @@ public struct RecipeRunner: Sendable {
notes.append("Kept this bottle's renderer (\(bottle.settings.renderer.rawValue)); the recipe suggests \(r.rawValue).")
}
}
+ // A route's mode is the environment's own, or the row's mode for the game's other route would replace it at
+ // every launch (D3DMetal, which the native arm64 line does not have).
+ if recipe.isPreviewRoute { bottle.settings.rendererExplicit = true }
// Read once, for the file and copy steps of a game installed in another Steam library.
let steamGames = recipe.steps.contains {
switch $0 { case .file, .copy: return true; default: return false }
@@ -646,7 +704,7 @@ public struct RecipeRunner: Sendable {
let url = Recipe.target(of: path, driveC: bottle.driveC, steamGames: steamGames)
try FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)
try contents.write(to: url, atomically: true, encoding: .utf8)
- if url != bottle.driveC.appending(path: path) { log?("[\(recipe.id)] wrote \(url.path), the game's folder in another Steam library") }
+ if url != Recipe.target(of: path, driveC: bottle.driveC, steamGames: []) { log?("[\(recipe.id)] wrote \(url.path), the game's folder in another Steam library") }
case let .copy(from, to, asNative):
guard let source = Self.copySource(engineRoot: engine.root, from) else {
throw HighballError.invalid("copy step: '\(from)' is not a file inside the engine")
@@ -677,6 +735,8 @@ public struct RecipeRunner: Sendable {
bottle.settings.dllOverrides = parts.joined(separator: ";")
case let .dxvkConfig(exe, options):
bottle.settings.dxvkAppConfig[exe] = options
+ case let .frameCap(n):
+ if bottle.settings.fpsCap == 0 { bottle.settings.fpsCap = n }
}
}
if !bottle.settings.recipes.contains(recipe.id) { bottle.settings.recipes.append(recipe.id) }
diff --git a/Sources/highball/main.swift b/Sources/highball/main.swift
index d6f2c59..74ea1d4 100644
--- a/Sources/highball/main.swift
+++ b/Sources/highball/main.swift
@@ -490,7 +490,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), resolve: { try? loadRecipe($0) }) { print($0) }
+ let notes = try await r.apply(try loadRecipe(recipe).routed(onEngine: b.settings.engineID), resolve: { try? loadRecipe($0) }) { print($0) }
for n in notes { print("note: \(n)") }
}
}
diff --git a/Tests/HighballKitTests/BundledEngineTests.swift b/Tests/HighballKitTests/BundledEngineTests.swift
index d01df59..d066c15 100644
--- a/Tests/HighballKitTests/BundledEngineTests.swift
+++ b/Tests/HighballKitTests/BundledEngineTests.swift
@@ -35,6 +35,8 @@ final class BundledEngineTests: XCTestCase {
XCTAssertFalse(arm64.isEmpty)
for m in arm64 {
XCTAssertFalse(m.runs(onMacOS: "26.4.9"), "\(m.id) says it runs below macOS 26.5")
+ // The KosmicKrisp line asks for more: its driver has only been measured on macOS 27.
+ if EngineManifest.line(of: m.id) == "arm64-kk-wine11.18" { XCTAssertEqual(m.minMacOS, "27.0"); continue }
XCTAssertTrue(m.runs(onMacOS: "26.5"), "\(m.id) refuses macOS 26.5")
}
}
diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swift
index 874e755..2605d6c 100644
--- a/Tests/HighballKitTests/RegressionTests.swift
+++ b/Tests/HighballKitTests/RegressionTests.swift
@@ -1115,6 +1115,48 @@ extension RegressionTests {
XCTAssertEqual(ids(installed: [], current: "x64-gone-r1"), ["x64-b-r3", "x64-a-r11", "x64-a-r10", "x64-gone-r1"])
}
+ // Forza Horizon 6's second route: an environment on the route's line goes by the route, every other by the recipe,
+ // under one id, so what an environment records for the game stays in one place.
+ func testPreviewRouteAppliesOnlyOnItsOwnLine() throws {
+ let json = #"""
+ {"id":"game","kind":"game","title":"Game","renderer":"d3dmetal","engine":"x64-a-r18","minMemoryGB":null,
+ "steps":[{"type":"environment","name":"OLD","value":"1"}],
+ "previewRoute":{"engine":"arm64-b-r1","renderer":"vkd3d","minMemoryGB":32,"note":"Steadier.",
+ "steps":[{"type":"environment","name":"NEW","value":"1"},{"type":"framecap","value":30}]}}
+ """#
+ let recipe = try JSONDecoder().decode(HighballKit.Recipe.self, from: Data(json.utf8))
+ XCTAssertFalse(recipe.isPreviewRoute)
+ XCTAssertEqual(recipe.routed(onEngine: "x64-a-r28").engine, "x64-a-r18")
+ XCTAssertFalse(recipe.routed(onEngine: nil).isPreviewRoute)
+ XCTAssertFalse(recipe.routed(onEngine: "arm64-other-r9").isPreviewRoute, "another arm64 line is not the route")
+ let route = recipe.routed(onEngine: "arm64-b-r7")
+ XCTAssertTrue(route.isPreviewRoute, "a later revision of the line goes by the route")
+ XCTAssertEqual(route.id, "game")
+ XCTAssertEqual(route.engine, "arm64-b-r1")
+ XCTAssertEqual(route.renderer, .vkd3d)
+ XCTAssertEqual(route.minMemoryGB, 32)
+ XCTAssertEqual(route.previewRouteNote, "Steadier.")
+ XCTAssertNil(route.previewRoute)
+ XCTAssertTrue(route.changesLaunchEnvironment)
+ XCTAssertTrue(route.isAutoApplicable)
+ // A long list of switches reads as one line on the page.
+ var long = route
+ long.steps = (0..<7).map { .environment(name: "V\($0)", value: "1") } + [.frameCap(30)]
+ let plan = GamePageCopy.willDo(nil, recipe: long, applied: false, bottleRenderer: .vkd3d).map(\.text)
+ XCTAssertTrue(plan.contains("Set 7 emulator and graphics variables for this game"), "\(plan)")
+ XCTAssertFalse(plan.contains { $0.contains("V3") })
+ // The variables follow whichever route the environment is on.
+ var settings = BottleSettings(name: "b", engineID: "arm64-b-r1")
+ XCTAssertEqual(HighballKit.Recipe.syncScopedEnvironment(of: route, in: &settings), ["NEW"])
+ XCTAssertEqual(settings.gameEnvironment["game"], ["NEW": "1"])
+ }
+
+ func testRecipeFilePathsNameTheMacUser() {
+ let drive = URL(fileURLWithPath: "/tmp/drive_c")
+ XCTAssertEqual(HighballKit.Recipe.target(of: "users/${user}/AppData/x", driveC: drive, steamGames: []).path,
+ "/tmp/drive_c/users/\(NSUserName())/AppData/x")
+ }
+
func testEnginesAboveTheMacOSFloorAreNotOffered() throws {
func manifest(_ id: String, floor: String) throws -> EngineManifest {
let json = #"{"id":"\#(id)","displayName":"e","arch":"x86_64","minMacOS":"\#(floor)","components":{}}"#