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
The game page tells the truth: a verdict sentence, what Play will do, Advanced
Gauthier Piarrette87e47bcbfef5
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex 5843785..ae5f6c9 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -149,9 +149,6 @@ final class AppState {return recipe}- /// A heavy fix waiting on the user's word before Play continues (installer/winetricks- /// class — honest prompt with the time cost instead of a silent 30-minute surprise).- var pendingHeavyFix: (item: LibraryItem, recipe: HighballKit.Recipe)?/// The "never pick a bottle first" guarantee: every Play in the library resolves the/// item's own bottle and dispatches by source. Play also means "make it work the way@@ -183,31 +180,21 @@ final class AppState {}return}- pendingHeavyFix = (item, recipe)- return // Play continues via confirmHeavyFix or skipHeavyFix+ // A heavy fix is a step, not a question (UX plan §3.5): the page listed it with its+ // cost, Play runs it on the strip with Stop available, and the done row offers Play+ // as the next thing rather than firing a launch long after anyone stopped watching.+ applyRecipe(recipe.id, to: bottle, then: DoneState(+ title: String(format: L("%@ installed"), recipe.title),+ ctaTitle: String(format: L("Play %@"), item.title),+ cta: { [weak self] in+ guard let self, let fresh = self.bottles.first(where: { $0.name == bottleName }) else { return }+ self.launch(item, in: fresh)+ }))+ return}launch(item, in: bottle)}- /// User confirmed the heavy fix: apply it (busy sheet shows progress), then launch.- func confirmHeavyFix() {- guard let (item, recipe) = pendingHeavyFix else { return }- pendingHeavyFix = nil- guard let bottleName = item.bottleName,- let bottle = bottles.first(where: { $0.name == bottleName }) else { return }- applyRecipe(recipe.id, to: bottle)- // The user presses Play again after the install — auto-chaining a launch onto a- // 30-minute install would fire it long after they stopped watching.- }-- func skipHeavyFix() {- guard let (item, _) = pendingHeavyFix else { return }- pendingHeavyFix = nil- guard let bottleName = item.bottleName,- let bottle = bottles.first(where: { $0.name == bottleName }) else { return }- launch(item, in: bottle)- }-private func launch(_ item: LibraryItem, in bottle: Bottle) {recordPlay(item)switch item.source {@@ -283,6 +270,8 @@ final class AppState {}let paths = HighballPaths()+ /// This Mac's chip, read once: the game page compares it with the chip a verdict was taken on.+ let machineChip = Machine.chip()var engineStore: EngineStore { EngineStore(paths: paths) }var bottleStore: BottleStore { BottleStore(paths: paths) }@@ -610,10 +599,10 @@ final class AppState {}}- func applyRecipe(_ id: String, to bottle: Bottle) {+ func applyRecipe(_ id: String, to bottle: Bottle, then done: DoneState? = nil) {guard let engine = engine(for: bottle), let recipe = Self.recipe(id) else { return }runBusy("Installing \(recipe.title)",- done: DoneState(title: String(format: L("%@ installed"), recipe.title), ctaTitle: nil, cta: nil),+ 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) } }diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swiftindex f4f1419..a5bdc36 100644--- a/Sources/HighballApp/GameDetailView.swift+++ b/Sources/HighballApp/GameDetailView.swift@@ -1,57 +1,45 @@import SwiftUIimport HighballKit-/// A game's page: wide hero art, verdict chips, then the properties — with the bottle as a-/// property row carrying quick actions, never a prerequisite for Play.+/// A game's page (UX plan §3.5): a verdict written as a sentence, Play as the only button, an+/// honest list of what Play will do, and every identifier behind one Advanced triangle.struct GameDetailView: View {@Environment(AppState.self) private var statelet item: LibraryItem@State private var showBottleSettings = false+ @State private var showWhy = false+ @State private var showAdvanced = falseprivate var entry: GameDBEntry? { item.steamAppID.flatMap { state.gameDB[$0] } }private var bottle: Bottle? { item.bottleName.flatMap { name in state.bottles.first { $0.name == name } } }private var blocked: Bool { entry?.isBlocked == true }- /// Light fixes auto-apply at Play; this button remains the manual (re-)apply path,- /// mostly useful for heavy recipes and repair.private var fixRecipe: HighballKit.Recipe? { state.fixRecipe(for: item) }private var fixApplied: Bool {guard let fixRecipe, let bottle else { return false }return bottle.settings.recipes.contains(fixRecipe.id)}+ private var running: GameSession? {+ if let appid = item.steamAppID, let s = state.session(forAppID: appid) { return s }+ return state.runningSessions.first { $0.title == item.title && $0.bottleName == item.bottleName }+ }+ 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)+ }+ private var engineName: String? { bottle.flatMap { state.engine(for: $0) }?.displayName }var body: some View {ScrollView {- VStack(alignment: .leading, spacing: 20) {+ VStack(alignment: .leading, spacing: 18) {hero- HStack(spacing: 8) {- if let (label, color) = verdictLabel(entry?.status) {- Text(label)- .font(.system(size: 10.5, weight: .semibold).monospaced())- .padding(.horizontal, 8).padding(.vertical, 3)- .background(Capsule().fill(color.opacity(0.22)))- .overlay(Capsule().stroke(color.opacity(0.8), lineWidth: 1))- .foregroundStyle(color)- }- if let r = entry?.effectiveRenderer() {- Text(r.rawValue.uppercased())- .font(.system(size: 10.5, weight: .medium).monospaced())- .foregroundStyle(.secondary)- }- if blocked {- Text(entry?.anticheat?.names.first ?? "anti-cheat")- .font(.system(size: 10.5).monospaced())- .foregroundStyle(HB.bad)- }- SourceBadge(source: item.source)- }- if let notes = entry?.notes {- Text(notes).font(.callout).foregroundStyle(.secondary)- .frame(maxWidth: 620, alignment: .leading)- }- properties+ verdictBlock+ playRow+ if item.installed, !blocked { willDoCard }+ advancedSpacer(minLength: 0)}.padding(.horizontal, 28).padding(.vertical, 20)+ .frame(maxWidth: 680, alignment: .leading).frame(maxWidth: .infinity, alignment: .leading)}.background(BottleBackdrop())@@ -61,6 +49,8 @@ struct GameDetailView: View {}}+ // MARK: Pieces+private var hero: some View {ZStack(alignment: .bottomLeading) {Color.clear@@ -90,76 +80,160 @@ struct GameDetailView: View {.overlay(RoundedRectangle(cornerRadius: 12).stroke(HB.cardStroke))}- private var properties: some View {- VStack(alignment: .leading, spacing: 1) {- // Bottle row: the runtime as a property with quick actions.- HStack(spacing: 10) {- Image(systemName: "cylinder.split.1x2").foregroundStyle(.secondary)- VStack(alignment: .leading, spacing: 1) {- Text(item.bottleName ?? L("Not installed in any bottle")).font(.callout.weight(.semibold))- if let bottle {- Text("\(bottle.settings.renderer.rawValue.uppercased()) · \(bottle.settings.engineID)")- .font(.caption).foregroundStyle(.secondary)- }- if !item.otherBottles.isEmpty {- Text(String(format: L("Also installed in %@"), item.otherBottles.joined(separator: ", ")))- .font(.caption).foregroundStyle(.tertiary)- }+ private var verdictColor: Color {+ switch entry?.status {+ case "verified-local": return HB.good+ case "blocked-anticheat": return HB.bad+ case nil: return .secondary+ default: return HB.amber+ }+ }++ private var verdictBlock: some View {+ HStack(alignment: .top, spacing: 10) {+ Circle().fill(verdictColor).frame(width: 8, height: 8).padding(.top, 7)+ VStack(alignment: .leading, spacing: 3) {+ Text(verdict.headline).font(.title3.weight(.semibold))+ if let detail = verdict.detail {+ Text(detail).font(.callout).foregroundStyle(.secondary)}- Spacer()- if item.installed {- if let fixRecipe, let bottle, !fixApplied {- Button(String(format: L("Apply %@ fix"), item.title)) {- state.applyRecipe(fixRecipe.id, to: bottle)- }- .disabled(state.busy)- .help(L("Sets this game up the way the compatibility database verified it — renderer, settings, dependencies."))- }- if let appid = item.steamAppID, let running = state.session(forAppID: appid) {- Text(L("Running")).font(.caption.bold()).foregroundStyle(HB.good)- Button(L("Stop")) { state.stopSession(running) }.buttonStyle(.bordered)- } else {- Button(L("Play")) { state.play(item) }- .buttonStyle(.borderedProminent).disabled(state.busy || blocked)- }- if bottle != nil, PlayLink.target(for: item) != nil {- Button { state.makeMacApp(for: item) } label: { Image(systemName: "macwindow.badge.plus") }- .help(L("Make a Mac app for this game in ~/Applications/Highball: open it from the Dock, Spotlight or Launchpad to play without opening Highball first."))+ }+ }+ }++ private var playRow: some View {+ HStack(spacing: 14) {+ if let running {+ Button(L("Stop")) { state.stopSession(running) }.buttonStyle(.bordered).controlSize(.large)+ TimelineView(.periodic(from: .now, by: 15)) { ctx in+ Text(ActivityText.minutes(since: running.started, now: ctx.date)+ .map { String(format: L("Running for %d min"), $0) } ?? L("Running"))+ .font(.callout).foregroundStyle(HB.good)+ }+ } else if item.installed {+ Button { state.play(item) } label: {+ Label(L("Play"), systemImage: "play.fill").frame(minWidth: 96)+ }+ .buttonStyle(.borderedProminent).controlSize(.large).tint(HB.amber)+ .disabled(state.busy || blocked)+ Text(blocked ? L("Its anti-cheat does not run on macOS.") : L("Highball will ask how it went when you finish."))+ .font(.callout).foregroundStyle(.secondary)+ } else if item.source == .epic {+ Button(L("Install")) { state.install(item) }.buttonStyle(.borderedProminent).controlSize(.large).tint(HB.amber)+ .disabled(state.busy)+ Text(L("Installs into your Highball environment.")).font(.callout).foregroundStyle(.secondary)+ } else {+ Text(L("Not installed in any environment.")).font(.callout).foregroundStyle(.secondary)+ }+ }+ }++ private var willDoCard: some View {+ VStack(alignment: .leading, spacing: 8) {+ HB.eyebrow(L("When you press Play, Highball will"))+ ForEach(Array(willDo.enumerated()), id: \.offset) { _, line in+ HStack(alignment: .firstTextBaseline, spacing: 8) {+ Image(systemName: line.done ? "checkmark" : (line.cost == nil ? "checkmark" : "hourglass"))+ .font(.caption.weight(.bold))+ .foregroundStyle(line.cost == nil || line.done ? HB.good : HB.amber)+ .frame(width: 14)+ Text(line.text).font(.callout)+ if let cost = line.cost {+ Text(cost).font(.caption.monospacedDigit()).foregroundStyle(.secondary)}- if bottle != nil {- Button { showBottleSettings = true } label: { Image(systemName: "gearshape") }- Button { if let b = bottle { NSWorkspace.shared.open(b.driveC) } } label: {- Image(systemName: "folder")- }+ }+ }+ HStack(spacing: 6) {+ Text(entry == nil ? L("No row in the compatibility database yet.") : L("From the open compatibility database."))+ .font(.caption).foregroundStyle(.secondary)+ if entry != nil {+ Button(L("Why these settings?")) { showWhy.toggle() }+ .buttonStyle(.link).font(.caption)+ .popover(isPresented: $showWhy, arrowEdge: .bottom) { whyPopover }+ }+ }+ }+ .padding(14)+ .frame(maxWidth: .infinity, alignment: .leading)+ .background(RoundedRectangle(cornerRadius: 10).fill(HB.card))+ .overlay(RoundedRectangle(cornerRadius: 10).stroke(HB.cardStroke))+ }++ /// The explanation, and the way out: the environment's own settings are one click away.+ private var whyPopover: some View {+ VStack(alignment: .leading, spacing: 10) {+ Text(L("Why these settings")).font(.headline)+ if let notes = entry?.notes { Text(notes).font(.callout) }+ if let p = entry?.provenance {+ Text(p).font(.caption).foregroundStyle(.secondary)+ }+ if let results = entry?.rendererResults, !results.isEmpty {+ Divider()+ ForEach(results.keys.sorted(), id: \.self) { key in+ if let r = results[key] {+ Text("\(key.uppercased()): \(r.verdict)\(r.detail.map { ", \($0)" } ?? "")")+ .font(.caption).foregroundStyle(.secondary)}- } else if item.source == .epic {- Button(L("Install")) { state.install(item) }.disabled(state.busy)}}- .padding(12)- .background(RoundedRectangle(cornerRadius: 10).fill(HB.card))+ Divider()+ Text(L("To play with the environment's own graphics mode instead, change it under Advanced below; Highball then leaves it alone for every game in that environment."))+ .font(.caption).foregroundStyle(.secondary)+ }+ .padding(16).frame(width: 420)+ }- Group {- row(L("Source"), item.source == .steam- ? "Steam · \(item.steamAppID.map(String.init) ?? "")"- : item.source == .epic ? "Epic · \(item.epicAppName ?? "")" : L("Windows program"))+ private var advanced: some View {+ DisclosureGroup(isExpanded: $showAdvanced) {+ VStack(alignment: .leading, spacing: 8) {+ if let bottle {+ row(L("Environment"), bottle.name + (engineName.map { " · \($0)" } ?? ""))+ row(L("Graphics mode"), GamePageCopy.plainName(bottle.settings.renderer) + (bottle.settings.rendererExplicit ? L(" (set by you)") : ""))+ row(L("Engine"), bottle.settings.engineID)+ if let r = entry?.effectiveRenderer() { row(L("Verified with"), GamePageCopy.plainName(r)) }+ }if item.sizeOnDisk > 0 {row(L("Size on disk"), ByteCountFormatter.string(fromByteCount: item.sizeOnDisk, countStyle: .file))}if let played = item.lastPlayed {row(L("Last played"), played.formatted(date: .abbreviated, time: .shortened))}+ if !item.otherBottles.isEmpty {+ row(L("Also installed in"), item.otherBottles.joined(separator: ", "))+ }+ HStack(spacing: 8) {+ if bottle != nil {+ Button(L("Environment settings…")) { showBottleSettings = true }+ Button(L("Show the Windows drive")) { if let b = bottle { NSWorkspace.shared.open(b.driveC) } }+ if PlayLink.target(for: item) != nil {+ Button(L("Make a Mac app…")) { state.makeMacApp(for: item) }+ .help(L("A small app in ~/Applications/Highball that starts this game without opening Highball first."))+ }+ }+ if let fixRecipe, let bottle, item.installed {+ Button(fixApplied ? String(format: L("Re-apply the %@ fix"), fixRecipe.title) : String(format: L("Apply the %@ fix now"), fixRecipe.title)) {+ state.applyRecipe(fixRecipe.id, to: bottle)+ }+ .disabled(state.busy)+ }+ }+ .controlSize(.small)+ .padding(.top, 4)+ }+ .padding(.top, 8)+ } label: {+ HStack(spacing: 8) {+ Text(L("Advanced")).font(.callout.weight(.medium))+ Text(L("graphics mode · engine · environment · files")).font(.caption.monospaced()).foregroundStyle(.tertiary)}}- .frame(maxWidth: 640)+ .padding(.top, 6)}private func row(_ label: String, _ value: String) -> some View {- HStack {+ HStack(alignment: .firstTextBaseline, spacing: 12) {Text(label).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)- Text(value).font(.caption)- Spacer()+ Text(value).font(.callout).textSelection(.enabled)}- .padding(.horizontal, 12).padding(.vertical, 7)}}diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swiftindex 569c4e1..983a45a 100644--- a/Sources/HighballApp/HighballApp.swift+++ b/Sources/HighballApp/HighballApp.swift@@ -282,21 +282,6 @@ struct ContentView: View {.sheet(isPresented: $state.showLog) { LogSheet() }.sheet(isPresented: $state.showGPTKLicense) { GPTKLicenseSheet() }.sheet(isPresented: $state.showEpicSignIn) { EpicSignInSheet() }- // Heavy fix at Play: installs take real time, so the cost is stated, never silent.- .confirmationDialog(- String(format: L("%@ needs a one-time setup to run the way it was verified."),- state.pendingHeavyFix?.item.title ?? ""),- isPresented: .init(get: { state.pendingHeavyFix != nil },- set: { if !$0 { state.pendingHeavyFix = nil } }),- titleVisibility: .visible- ) {- Button(L("Install the fix first")) { state.confirmHeavyFix() }- Button(L("Play without it")) { state.skipHeavyFix() }- Button(L("Cancel"), role: .cancel) { state.pendingHeavyFix = nil }- } message: {- Text(state.pendingHeavyFix?.recipe.steps.compactMap(\.slowHint).first- ?? L("This installs the dependencies the compatibility database verified."))- }// A partial delete succeeded — the bottle is gone and the name is free — so framing it as// a failure, with an invitation to file a bug, misreads what happened. Same alert, honest// title, and no Report button for something that is not a problem to report.diff --git a/Sources/HighballKit/GamePageCopy.swift b/Sources/HighballKit/GamePageCopy.swiftnew file mode 100644index 0000000..0eeea00--- /dev/null+++ b/Sources/HighballKit/GamePageCopy.swift@@ -0,0 +1,131 @@+import Foundation++/// The sentences on a game's page (UX plan §3.5). Facts stated, gaps named, nothing computed+/// that was not measured: "verified on an M4 Pro" and "your Mac is an M1 Pro", never+/// "verified on a Mac like yours".+public enum GamePageCopy {+ public struct Verdict: Equatable {+ public var headline: String+ public var detail: String?+ }++ /// The verdict sentence for an entry (nil: no row at all), given the reader's chip.+ public static func verdict(_ entry: GameDBEntry?, myChip: String, today: Date = Date()) -> Verdict {+ let mine = shortChip(myChip)+ guard let entry else {+ return Verdict(headline: "Nobody has tested this on an \(mine) yet.",+ detail: "Play, and Highball will ask how it went when you finish.")+ }+ switch entry.status {+ case "blocked-anticheat":+ let name = entry.anticheat?.names.first ?? "its anti-cheat"+ return Verdict(headline: "Can't run: \(name).",+ detail: entry.anticheat?.note ?? "Its anti-cheat does not run on macOS.")+ case "verified-local":+ let chip = entry.verified?.chip.map(shortChip)+ var head = chip.map { "Verified on an \($0)." } ?? "Verified on this project's own Mac."+ if chip == mine { head = "Verified on an \(mine), the same chip as yours." }+ var parts: [String] = []+ if let fps = entry.verified?.fps {+ parts.append(fps.hasSuffix("fps") ? fps : "\(fps) frames per second")+ }+ if let os = entry.verified?.macos { parts.append("on macOS \(os)") }+ var detail = parts.isEmpty ? "" : sentenceCase(parts.joined(separator: " "))+ if let when = freshness(entry.lastVerified, today: today) {+ detail += detail.isEmpty ? "Last confirmed \(when)." : ", last confirmed \(when)."+ } else if !detail.isEmpty { detail += "." }+ if let chip, chip != mine { detail += (detail.isEmpty ? "" : " ") + "Your Mac is an \(mine)." }+ return Verdict(headline: head, detail: detail.isEmpty ? nil : detail)+ case "reported-upstream":+ return Verdict(headline: "Reported working upstream.",+ detail: "Named in the renderer's release notes as working; not verified here yet. Your Mac is an \(mine).")+ default:+ return Verdict(headline: "Reported by players.",+ detail: "Not verified by this project yet. Your Mac is an \(mine).")+ }+ }++ /// One line of "when you press Play, Highball will".+ public struct WillDo: Equatable {+ public var text: String+ public var cost: String?+ public var done: Bool+ public init(text: String, cost: String? = nil, done: Bool = false) { self.text = text; self.cost = cost; self.done = done }+ }++ /// What Play applies, in order, from the row and the fix recipe. `applied` means the recipe+ /// already ran in this environment, so its steps read as done.+ public static func willDo(_ entry: GameDBEntry?, recipe: Recipe?, applied: Bool,+ bottleRenderer: Renderer, osMajor: Int = ProcessInfo.processInfo.operatingSystemVersion.majorVersion) -> [WillDo] {+ var items: [WillDo] = []+ if let wanted = entry?.effectiveRenderer(osMajor: osMajor) {+ items.append(WillDo(text: wanted == bottleRenderer+ ? "Use \(plainName(wanted)), the way it was verified"+ : "Use \(plainName(wanted)) for this game, the way it was verified, instead of the environment's \(wanted == bottleRenderer ? "" : plainName(bottleRenderer))"))+ } else {+ items.append(WillDo(text: "Use \(plainName(bottleRenderer)), the environment's setting; no verdict names a better one"))+ }+ if let args = entry?.effectiveLaunchArgs(osMajor: osMajor), !args.isEmpty {+ items.append(WillDo(text: "Start it with \(args.joined(separator: " "))"))+ }+ if let recipe {+ for step in recipe.steps {+ guard let text = describe(step) else { continue }+ items.append(WillDo(text: text, cost: applied ? nil : step.slowHint, done: applied))+ }+ }+ return items+ }++ // MARK: helpers++ public static func plainName(_ r: Renderer) -> String {+ switch r {+ case .dxmt: return "DXMT (DirectX 11 on Metal)"+ case .d3dmetal: return "Apple's DirectX 12 support"+ case .dxvk: return "DXVK (Vulkan on Metal)"+ case .wined3d: return "Wine's own Direct3D"+ }+ }++ /// "Apple M1 Pro" -> "M1 Pro"; anything else unchanged.+ public static func shortChip(_ chip: String) -> String {+ let t = chip.trimmingCharacters(in: .whitespaces)+ return t.hasPrefix("Apple ") ? String(t.dropFirst(6)) : t+ }++ /// "today", "yesterday", "12 days ago", or "on 2026-08-25" past two months.+ static func freshness(_ ymd: String?, today: Date) -> String? {+ guard let ymd else { return nil }+ let f = DateFormatter(); f.dateFormat = "yyyy-MM-dd"; f.timeZone = TimeZone(identifier: "UTC")+ guard let d = f.date(from: ymd) else { return nil }+ let days = Int(today.timeIntervalSince(d) / 86_400)+ switch days {+ case ..<1: return "today"+ case 1: return "yesterday"+ case 2...60: return "\(days) days ago"+ default: return "on \(ymd)"+ }+ }++ static func sentenceCase(_ s: String) -> String {+ guard let first = s.first else { return s }+ return first.uppercased() + s.dropFirst()+ }++ static func describe(_ step: Recipe.Step) -> String? {+ switch step {+ case let .installer(_, _, _, label, _, _): return "Install \(label)"+ case let .winetricks(verbs, _): return "Install \(verbs.joined(separator: ", "))"+ case let .registry(_, name, _, _): return "Set the Windows registry value \(name)"+ case let .environment(name, _): return "Set \(name) for this game"+ case let .renderer(r): return "Switch the environment's graphics mode to \(plainName(r))"+ case let .sync(m): return "Set the environment's sync mode to \(m.rawValue)"+ case let .winver(v): return "Report Windows \(v.rawValue) to the game"+ case let .file(path, _): return "Write \(URL(fileURLWithPath: path).lastPathComponent)"+ case .pin: return nil+ case let .note(text): return text+ case let .dxvkConfig(exe, _): return "Configure DXVK for \(exe)"+ }+ }+}diff --git a/Sources/HighballKit/SteamLibrary.swift b/Sources/HighballKit/SteamLibrary.swiftindex 09dd8d5..ba0dc9f 100644--- a/Sources/HighballKit/SteamLibrary.swift+++ b/Sources/HighballKit/SteamLibrary.swift@@ -78,6 +78,8 @@ public struct GameDBEntry: Codable, Sendable {public var provenance: String?public var notes: String?public var anticheat: AnticheatInfo?+ /// The date of the last local verification, "YYYY-MM-DD".+ public var lastVerified: String?/// Extra arguments appended to the game's launch (Steam forwards -applaunch trailing args/// to the game). Data, not code: game-specific knowledge stays in the db (issue #21's/// windowed workaround for legacy CS:GO's macOS 26 fullscreen freeze is the first user).@@ -92,6 +94,26 @@ public struct GameDBEntry: Codable, Sendable {/// a black screen. Data, not code: the row decides.public var rendererMinMacOS: String?public var rendererBelow: Renderer?+ /// The machine and build the verdict was taken on, for the game page's sentence: "Verified+ /// on an M1 Pro. About 70 frames per second on macOS 26.6.2". Free-text `provenance` stays+ /// for the site; this is the structured part the app can compare with the reader's Mac.+ public struct VerifiedOn: Codable, Sendable, Equatable {+ public var chip: String? // "Apple M1 Pro"+ public var macos: String? // "26.6.2"+ public var engine: String? // engine id+ public var fps: String? // "about 70", "60 to 82"; words, never a computed number+ public init(chip: String? = nil, macos: String? = nil, engine: String? = nil, fps: String? = nil) {+ self.chip = chip; self.macos = macos; self.engine = engine; self.fps = fps+ }+ }+ public var verified: VerifiedOn?+ /// Per-renderer outcomes ("works", "fails", ...) with a detail sentence, the data nobody+ /// else publishes; the game page shows them under "Why these settings?".+ public struct RendererResult: Codable, Sendable, Equatable {+ public var verdict: String+ public var detail: String?+ }+ public var rendererResults: [String: RendererResult]?public var isBlocked: Bool { status == "blocked-anticheat" }diff --git a/Tests/HighballKitTests/GamePageCopyTests.swift b/Tests/HighballKitTests/GamePageCopyTests.swiftnew file mode 100644index 0000000..b25999b--- /dev/null+++ b/Tests/HighballKitTests/GamePageCopyTests.swift@@ -0,0 +1,61 @@+import XCTest+@testable import HighballKit++final class GamePageCopyTests: XCTestCase {+ private func entry(_ json: String) throws -> GameDBEntry {+ try JSONDecoder().decode(GameDBEntry.self, from: Data(json.utf8))+ }+ private let today = Date(timeIntervalSince1970: 1_788_480_000) // 2026-09-04 UTC-ish++ func testVerifiedOnAnotherChipNamesTheGap() throws {+ let e = try entry(#"{"id":"x","title":"X","steam_appid":1,"status":"verified-local","lastVerified":"2026-08-23","verified":{"chip":"Apple M4 Pro","macos":"26","fps":"60 to 82"}}"#)+ let v = GamePageCopy.verdict(e, myChip: "Apple M1 Pro", today: today)+ XCTAssertEqual(v.headline, "Verified on an M4 Pro.")+ XCTAssertEqual(v.detail, "60 to 82 frames per second on macOS 26, last confirmed 12 days ago. Your Mac is an M1 Pro.")+ }++ func testVerifiedOnTheSameChipSaysSo() throws {+ let e = try entry(#"{"id":"x","title":"X","steam_appid":1,"status":"verified-local","lastVerified":"2026-09-04","verified":{"chip":"Apple M1 Pro","macos":"26.6.2","fps":"about 70"}}"#)+ let v = GamePageCopy.verdict(e, myChip: "Apple M1 Pro", today: today)+ XCTAssertEqual(v.headline, "Verified on an M1 Pro, the same chip as yours.")+ XCTAssertEqual(v.detail, "About 70 frames per second on macOS 26.6.2, last confirmed today.")+ }++ func testVerifiedWithoutStructuredFactsStaysHonest() throws {+ let e = try entry(#"{"id":"x","title":"X","steam_appid":1,"status":"verified-local","lastVerified":"2026-05-01"}"#)+ let v = GamePageCopy.verdict(e, myChip: "Apple M1 Pro", today: today)+ XCTAssertEqual(v.headline, "Verified on this project's own Mac.")+ XCTAssertEqual(v.detail, "Last confirmed on 2026-05-01.")+ }++ func testNoRowIsAnInvitation() {+ let v = GamePageCopy.verdict(nil, myChip: "Apple M2", today: today)+ XCTAssertEqual(v.headline, "Nobody has tested this on an M2 yet.")+ }++ func testBlockedNamesTheAntiCheat() throws {+ let e = try entry(#"{"id":"x","title":"X","steam_appid":1,"status":"blocked-anticheat","anticheat":{"names":["Vanguard"],"macVerdict":"blocked","note":"kernel driver"}}"#)+ XCTAssertEqual(GamePageCopy.verdict(e, myChip: "Apple M1", today: today).headline, "Can't run: Vanguard.")+ }++ func testWillDoListsRendererArgsAndRecipeSteps() throws {+ let e = try entry(#"{"id":"x","title":"X","steam_appid":1,"status":"verified-local","renderer":"dxmt","launchArgs":["-windowed"]}"#)+ let recipe = Recipe(id: "x", kind: .game, title: "X fix", steps: [+ .winetricks(verbs: ["vcrun2022"], slow: "about a minute"),+ .environment(name: "MVK_SHADOW_IMPORT", value: "1"),+ .note("Alt-tab twice if the window stays black"),+ ])+ let items = GamePageCopy.willDo(e, recipe: recipe, applied: false, bottleRenderer: .dxvk, osMajor: 26)+ XCTAssertEqual(items.map(\.text), [+ "Use DXMT (DirectX 11 on Metal) for this game, the way it was verified, instead of the environment's DXVK (Vulkan on Metal)",+ "Start it with -windowed",+ "Install vcrun2022",+ "Set MVK_SHADOW_IMPORT for this game",+ "Alt-tab twice if the window stays black",+ ])+ XCTAssertEqual(items[2].cost, "about a minute")+ let done = GamePageCopy.willDo(e, recipe: recipe, applied: true, bottleRenderer: .dxmt, osMajor: 26)+ XCTAssertEqual(done[0].text, "Use DXMT (DirectX 11 on Metal), the way it was verified")+ XCTAssertTrue(done[2].done); XCTAssertNil(done[2].cost)+ }+}