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
a recipe naming an engine this build does not ship asks for an update (Check for Updates, or play without the fix) instead of launching on the old engine as if it had never asked; the database can now move ahead of the app
Gauthier Piarrette0c8dccec256e
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex a1582d4..5b06793 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -288,6 +288,10 @@ final class AppState {pendingEngine = (recipe, bottle, wanted)return}+ if let missing = recipe.engineUnknown(current: engine.manifest, known: Self.knownManifests) {+ pendingUpdate = (recipe, missing, (item, bottle, renderer))+ return+ }if recipe.isAutoApplicable {Task { @MainActor invar runner = RecipeRunner(paths: paths, engine: engine, bottle: bottle)@@ -943,6 +947,12 @@ final class AppState {/// engine (other programs untouched) or moving this one.var pendingEngine: (recipe: HighballKit.Recipe, bottle: Bottle, manifest: EngineManifest)?+ /// A recipe naming an engine this build does not ship: the database moved ahead of the+ /// app (The Last Flame's fix needs r11, which 0.9.33 was the first to carry). The ask+ /// points at Check for Updates; `play` is the game Play was launching, so the owner can+ /// still run it without the fix, or nil when the page's own button asked for the fix.+ var pendingUpdate: (recipe: HighballKit.Recipe, engineID: String, play: (item: LibraryItem, bottle: Bottle, renderer: Renderer?)?)?+/// The ask's first way out: a new environment on the engine the recipe names, the recipe/// applied; the engine downloads first when it is not installed.func createEnvironment(for recipe: HighballKit.Recipe, on manifest: EngineManifest) {@@ -972,6 +982,16 @@ final class AppState {}}+ /// The update ask's way out that keeps playing: the game launches as it would have before+ /// the recipe existed, on the current engine, and the log says which fix it went without.+ func playWithoutTheFix() {+ guard let pending = pendingUpdate else { return }+ pendingUpdate = nil+ guard let play = pending.play else { return }+ appendLog("\(play.item.title): its fix needs the \(pending.engineID) engine, which this Highball does not ship; playing without it.")+ launch(play.item, in: play.bottle, renderer: play.renderer)+ }+/// The ask's second way out: move the environment itself (the Windows setup re-runs, nothing/// installed is lost), then the done row offers the install.func moveEnvironment(for recipe: HighballKit.Recipe, bottle: Bottle, to manifest: EngineManifest) {@@ -1031,6 +1051,9 @@ final class AppState {if let wanted = recipe.engineToOffer(current: engine.manifest, known: Self.knownManifests) {pendingEngine = (recipe, bottle, wanted); return}+ if let missing = recipe.engineUnknown(current: engine.manifest, known: Self.knownManifests) {+ pendingUpdate = (recipe, missing, nil); return+ }runBusy("Installing \(recipe.title)",done: done ?? DoneState(title: String(format: L("%@ installed"), recipe.title), ctaTitle: nil, cta: nil),stop: .killBottleThenRepair(bottle, label: L("Stop and repair"))) { [self] indiff --git a/Sources/HighballApp/EngineAsk.swift b/Sources/HighballApp/EngineAsk.swiftindex f54eb0b..880bfd0 100644--- a/Sources/HighballApp/EngineAsk.swift+++ b/Sources/HighballApp/EngineAsk.swift@@ -13,6 +13,13 @@ extension GamePageCopy {ByteCountFormatter.string(fromByteCount: Int64(m.components.values.compactMap(\.size).reduce(0, +)), countStyle: .file)}+ /// The fix names an engine this build does not ship: the database moved ahead of the app.+ static func updateAsk(recipe: HighballKit.Recipe, engineID: String, canPlay: Bool) -> String {+ let play = canPlay ? " " + L("You can also play without the fix, as before.") : ""+ return String(format: L("%@'s fix runs on the %@ engine, and this version of Highball does not ship it yet. Check for Updates gets the version that does.%@"),+ recipe.title, engineID, play)+ }+static func engineAsk(recipe: HighballKit.Recipe, manifest: EngineManifest, installed: Bool) -> String {let download = installed ? "" : String(format: L(", after a download of about %@"), downloadSize(manifest))return String(format: L("%@ is verified on the %@ engine, and this environment is not on it. Moving this environment switches it there%@ and keeps everything installed; the Windows setup re-runs when needed, a minute or two. A new environment keeps your other programs where they are and starts empty, so the game has to be installed again."),diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swiftindex 48e01ed..6d3571d 100644--- a/Sources/HighballApp/HighballApp.swift+++ b/Sources/HighballApp/HighballApp.swift@@ -202,6 +202,7 @@ struct ContentView: View {.sheet(isPresented: $state.showGPTKLicense) { GPTKLicenseSheet() }.d3dMetalAsk(state).engineAsk(state)+ .updateAsk(state).rendererTrialAsk(state).homeMoveAsk(state).sheet(isPresented: $state.showEpicSignIn) { EpicSignInSheet() }@@ -320,6 +321,22 @@ private extension View {Text(GamePageCopy.engineAsk(recipe: pending.recipe, manifest: pending.manifest, installed: state.engines.contains { $0.id == pending.manifest.id }))}}+ @MainActor func updateAsk(_ state: AppState) -> some View {+ self.alert(state.pendingUpdate.map { String(format: L("%@ needs a newer Highball"), $0.recipe.title) } ?? "",+ isPresented: .init(get: { state.pendingUpdate != nil }, set: { if !$0 { state.pendingUpdate = nil } }),+ presenting: state.pendingUpdate) { pending in+ Button(L("Check for Updates…")) {+ state.pendingUpdate = nil+ (NSApp.delegate as? AppDelegate)?.updaterController.updater.checkForUpdates()+ }+ if pending.play != nil {+ Button(L("Play without the fix")) { state.playWithoutTheFix() }+ }+ Button(L("Not now"), role: .cancel) { state.pendingUpdate = nil }+ } message: { pending in+ Text(GamePageCopy.updateAsk(recipe: pending.recipe, engineID: pending.engineID, canPlay: pending.play != nil))+ }+ }@MainActor func rendererTrialAsk(_ state: AppState) -> some View {self.alert(state.rendererTrial.map { String(format: L("Try %@ for %@ next time?"), GamePageCopy.plainName($0.next), $0.title) } ?? "",isPresented: .init(get: { state.rendererTrial != nil }, set: { if !$0 { state.rendererTrial = nil } }),diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swiftindex 43e7ff3..1b1e217 100644--- a/Sources/HighballApp/L10n.swift+++ b/Sources/HighballApp/L10n.swift@@ -175,6 +175,10 @@ enum L10n {"It ran with %@. Another mode often suits a game better on this Mac, and old DirectX 9 games in particular do badly on Wine's own Direct3D. This changes the mode for this game only; the environment keeps its own. Undo it any time under Advanced on the game's page.": "Il a tourné avec %@. Un autre mode convient souvent mieux à un jeu sur ce Mac, et les vieux jeux DirectX 9 en particulier tournent mal avec le Direct3D de Wine. Cela change le mode pour ce jeu seulement, l'environnement garde le sien. Annulable à tout moment dans Avancé sur la page du jeu.","Does not apply: this game draws with Vulkan directly, not through any Direct3D layer.": "Sans effet : ce jeu dessine directement avec Vulkan, sans couche Direct3D.","%@ needs the %@ engine": "%@ a besoin du moteur %@",+ "%@ needs a newer Highball": "%@ a besoin d'un Highball plus récent",+ "Play without the fix": "Jouer sans le correctif",+ "You can also play without the fix, as before.": "Vous pouvez aussi jouer sans le correctif, comme avant.",+ "%@'s fix runs on the %@ engine, and this version of Highball does not ship it yet. Check for Updates gets the version that does.%@": "Le correctif de %@ tourne sur le moteur %@, que cette version de Highball ne fournit pas encore. Rechercher les mises à jour donne la version qui le fournit.%@","New environment for %@": "Nouvel environnement pour %@","Move this environment": "Déplacer cet environnement","Creating the %@ environment on %@": "Création de l'environnement %@ sur %@",diff --git a/Sources/HighballKit/Recipe.swift b/Sources/HighballKit/Recipe.swiftindex eb03d88..384d7ea 100644--- a/Sources/HighballKit/Recipe.swift+++ b/Sources/HighballKit/Recipe.swift@@ -571,4 +571,14 @@ public extension Recipe {guard let id = engine, let wanted = known.first(where: { $0.id == id }) else { return nil }return EngineManifest.satisfies(current: current, wanted: wanted) ? nil : wanted}++ /// The engine this recipe names when no manifest this build ships carries it and the+ /// environment is not already on it: the fix reached the database before the Highball+ /// that ships its engine (The Last Flame's r11 pin, highball#99, landed while 0.9.32 was+ /// the stable). Play tells the owner to update instead of launching on the current engine+ /// as if the recipe had never asked. Nil when the recipe names no engine.+ func engineUnknown(current: EngineManifest, known: [EngineManifest]) -> String? {+ guard let id = engine, current.id != id, !known.contains(where: { $0.id == id }) else { return nil }+ return id+ }}diff --git a/Tests/HighballKitTests/RecipeEngineTests.swift b/Tests/HighballKitTests/RecipeEngineTests.swiftindex e9b15bc..2030e86 100644--- a/Tests/HighballKitTests/RecipeEngineTests.swift+++ b/Tests/HighballKitTests/RecipeEngineTests.swift@@ -36,6 +36,22 @@ final class RecipeEngineTests: XCTestCase {XCTAssertNil(try recipe(engine: nil).engineToOffer(current: wine10, known: [wine10, wine11]))}+ /// A recipe can reach the database before the Highball that ships its engine (The Last+ /// Flame's r11 pin landed while 0.9.32 was the stable, highball#99). Play then must say+ /// "update" rather than launch on the old engine as if the recipe had never asked, and must+ /// stay quiet when the environment is already on that engine, whoever installed it.+ func testAnEngineThisBuildDoesNotShipAsksForAnUpdate() throws {+ let wine10 = try manifest(id: "x64-sikarugir10.0_6-r5", wine: "aaa")+ let r10 = try manifest(id: "x64-crossover26.3-r10", wine: "bbb")+ let r11 = try manifest(id: "x64-crossover26.3-r11", wine: "ccc")+ let r = try recipe(engine: "x64-crossover26.3-r11")+ XCTAssertNil(r.engineToOffer(current: wine10, known: [wine10, r10]), "nothing to offer: the build has no r11")+ XCTAssertEqual(r.engineUnknown(current: wine10, known: [wine10, r10]), "x64-crossover26.3-r11")+ XCTAssertNil(r.engineUnknown(current: wine10, known: [wine10, r10, r11]), "the build ships it: the engine ask handles it")+ XCTAssertNil(r.engineUnknown(current: r11, known: [wine10, r10]), "already on it (a newer Highball installed it)")+ XCTAssertNil(try recipe(engine: nil).engineUnknown(current: wine10, known: [wine10]))+ }+/// r6 and r7 are the same Wine as r5, and a bottle on r5 still needs them: r6 changes/// MoltenVK (Red Dead), r7 adds a builtin DLL (CS:GO). Same Wine never meant "has it".func testALaterRevisionOfTheSameWineIsOffered() throws {