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
Renderers: every renderer reaches DXVK's D3D9, and reports carry the right log (#21, #29)
Gauthier Piarrettedb3a5432432d
diff --git a/Scripts/render-smoke.sh b/Scripts/render-smoke.shindex 042933a..442a1dc 100755--- a/Scripts/render-smoke.sh+++ b/Scripts/render-smoke.sh@@ -1,7 +1,8 @@#!/bin/bash# On-demand renderer smoke (the release gate's evidence). Runs Unigine Heaven in a# scratch bottle across the renderer matrix that issue #21 taught us to cover:-# dxmt/D3D11, dxvk/D3D11, dxvk/D3D9 with async on, dxvk/D3D9 with async off.+# dxmt/D3D11, dxvk/D3D11, dxvk/D3D9 with async on, dxvk/D3D9 with async off,+# and dxmt/D3D9 — the combination that shipped broken from 0.7.9 to 0.7.16.# Pass criterion is liveness (still rendering at T+45 s, no dyld/library failure,# expected DXVK banner state) — a headless script cannot judge pixels; real-game# verification stays a human job. Result lands in private/render-smoke/latest.json,@@ -62,8 +63,12 @@ run_case() { # name renderer video_app async(0|1|-)dxvk:1) grep -q 'async compiler threads' "$log" || { echo "FAIL: async expected but absent"; pass=0; } ;;dxvk:0) grep -q 'async compiler threads' "$log" && { echo "FAIL: async present despite toggle off"; pass=0; } ;;esac- if [ "$renderer" = dxvk ]; then- grep -q 'DXVK' "$log" || { echo "FAIL: no DXVK banner"; pass=0; }+ # Any D3D9 case must show a DXVK banner. That is the issue #21 tripwire: the dxmt and+ # d3dmetal overlays ship no d3d9, so without the d9vk overlay attached D3D9 silently drops+ # to wined3d, whose missing shadow-depth formats fail Source's CSM check and kept legacy+ # CS:GO from starting on the DEFAULT renderer from 0.7.9 to 0.7.16.+ if [ "$renderer" = dxvk ] || [ "$vapp" = direct3d9 ]; then+ grep -q 'DXVK' "$log" || { echo "FAIL: no DXVK banner (D3D9 fell back to wined3d?)"; pass=0; }fielseecho "FAIL: no run log found"; pass=0@@ -79,6 +84,7 @@ run_case "dxmt-d3d11" dxmt direct3d11 "-"run_case "dxvk-d3d11" dxvk direct3d11 "1"run_case "dxvk-d3d9-async" dxvk direct3d9 "1"run_case "dxvk-d3d9-sync" dxvk direct3d9 "0"+run_case "dxmt-d3d9" dxmt direct3d9 "-""$HB" bottle kill "$BOTTLE" >/dev/null 2>&1 || true"$HB" bottle delete "$BOTTLE" || truediff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex 72a9f16..cc1cd07 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -45,6 +45,9 @@ final class AppState {struct CrashSuggestion: Identifiable {let id = UUID()let program: String+ /// The bottle that was actually launched. The alert used to edit `selectedBottle`, which+ /// `launchGame` never sets — so accepting could rewrite an unrelated bottle, or none.+ let bottleName: Stringlet renderer: Rendererlet logPath: String}@@ -385,9 +388,10 @@ final class AppState {}if result.crashedEarly {let current = pin.renderer ?? bottle.settings.renderer- let next: Renderer = current == .dxmt ? .d3dmetal : (current == .d3dmetal ? .dxvk : .dxmt)await MainActor.run {- self.crashSuggestion = CrashSuggestion(program: pin.name, renderer: next, logPath: result.log.path)+ self.crashSuggestion = CrashSuggestion(program: pin.name, bottleName: bottle.name,+ renderer: Renderer.suggestion(after: current),+ logPath: result.log.path)}}}@@ -465,9 +469,10 @@ final class AppState {}if result.crashedEarly {let current = renderer ?? bottle.settings.renderer- let next: Renderer = current == .dxmt ? .d3dmetal : (current == .d3dmetal ? .dxvk : .dxmt)await MainActor.run {- self.crashSuggestion = CrashSuggestion(program: game.name, renderer: next, logPath: result.log.path)+ self.crashSuggestion = CrashSuggestion(program: game.name, bottleName: bottle.name,+ renderer: Renderer.suggestion(after: current),+ logPath: result.log.path)}}}@@ -597,10 +602,11 @@ final class AppState {Task { @MainActor in self.appendLog(line) }}if result.crashedEarly {+ let current = renderer ?? bottle.settings.rendererawait MainActor.run {- self.crashSuggestion = CrashSuggestion(program: game.app_title,- renderer: renderer == .dxvk ? .d3dmetal : .dxvk,- logPath: result.log.path)+ self.crashSuggestion = CrashSuggestion(program: game.app_title, bottleName: bottle.name,+ renderer: Renderer.suggestion(after: current),+ logPath: result.log.path)}}}diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swiftindex ddb9939..57c51c6 100644--- a/Sources/HighballApp/HighballApp.swift+++ b/Sources/HighballApp/HighballApp.swift@@ -278,8 +278,9 @@ struct ContentView: View {Alert(title: Text("\(s.program) exited right away"),message: Text("That usually means the graphics backend doesn't suit it. Try \(s.renderer.rawValue.uppercased())? The log is at \(s.logPath)."),primaryButton: .default(Text("Use \(s.renderer.rawValue.uppercased())")) {- if let name = state.selectedBottle, var bottle = state.bottles.first(where: { $0.name == name }) {+ if var bottle = state.bottles.first(where: { $0.name == s.bottleName }) {bottle.settings.renderer = s.renderer+ bottle.settings.rendererExplicit = true // the user picked it; recipes must not clobber it (#29)state.update(bottle)}},diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swiftindex e248e4e..17cdbf5 100644--- a/Sources/HighballKit/Bottle.swift+++ b/Sources/HighballKit/Bottle.swift@@ -19,11 +19,11 @@ public enum Renderer: String, Codable, CaseIterable, Sendable {return envcase .dxmt:guard let dir = engine.rendererDir("dxmt") else { throw HighballError.missing("dxmt renderer in engine \(engine.id)") }- env["WINEDLLPATH_PREPEND"] = dir.appending(path: "wine").path+ env["WINEDLLPATH_PREPEND"] = Self.withD9VK(dir.appending(path: "wine").path, engine: engine)case .d3dmetal:guard let dir = engine.rendererDir("d3dmetal") else { throw HighballError.missing("d3dmetal renderer in engine \(engine.id) (optional component not installed?)") }let external = dir.appending(path: "external").path- env["WINEDLLPATH_PREPEND"] = dir.appending(path: "wine").path+ env["WINEDLLPATH_PREPEND"] = Self.withD9VK(dir.appending(path: "wine").path, engine: engine)env["CX_D3DMETALPATH"] = externalenv["DYLD_FALLBACK_LIBRARY_PATH+"] = externalenv["DYLD_FALLBACK_FRAMEWORK_PATH+"] = external@@ -41,6 +41,39 @@ public enum Renderer: String, Codable, CaseIterable, Sendable {}return env}++ /// Appends the d9vk overlay (DXVK's D3D9) to a Metal backend's DLL search path.+ ///+ /// The renderer setting chooses the D3D10/11/12 backend; D3D9 must not be collateral damage.+ /// Neither the dxmt nor the d3dmetal overlay ships a d3d9 for either architecture (d3dmetal's+ /// i386 directory is a symlink to cnc-ddraw's and holds only ddraw.dll), so without this a+ /// D3D9 title silently gets Wine's own wined3d, whose D3D9 lacks the DF16/DF24 shadow-depth+ /// formats Source's CSM check probes. Legacy CS:GO then refuses to start with "graphics+ /// hardware does not support all features (CSM)".+ ///+ /// 0.7.9 fixed this for the dxvk renderer only, leaving it live on dxmt — the DEFAULT — and+ /// on d3dmetal. Reproduced on a dxmt bottle 2026-08-30 with that exact dialog (issue #21).+ /// Appended, not prepended, so the chosen backend keeps priority for everything it does ship;+ /// d9vk contributes only d3d9.dll, so the two never collide.+ ///+ /// Degrades to the backend alone if the engine has no d9vk, rather than throwing: this is the+ /// default renderer's path, and an engine missing d9vk should still run D3D11 titles. The+ /// dxvk case keeps its hard failure, because there D3D9 is the whole point.+ private static func withD9VK(_ path: String, engine: InstalledEngine) -> String {+ guard let d9vk = engine.rendererDir("d9vk") else { return path }+ return [path, d9vk.appending(path: "wine").path].joined(separator: ":")+ }++ /// The backend to offer after `current` failed on launch, cycling through the Metal-backed+ /// options. Direct3D 9 no longer constrains this: `withD9VK` attaches DXVK's d3d9 to every+ /// renderer, so switching backend can't drop D3D9 support the way it could before 0.7.17.+ public static func suggestion(after current: Renderer) -> Renderer {+ switch current {+ case .dxmt: return .d3dmetal+ case .d3dmetal: return .dxvk+ case .dxvk, .wined3d: return .dxmt+ }+ }}public enum WindowsVersion: String, Codable, CaseIterable, Sendable {@@ -264,7 +297,17 @@ public struct Bottle: Sendable {// the async fork reads `env == "1" || config.enableAsync`, so an env 1 can never be// overridden for a single game, while the conf's [csgo.exe] section can (issue #21).// WineRunner writes the file before each dxvk launch.- if r == .dxvk { env["DXVK_CONFIG_FILE"] = Self.dxvkConfigWindowsPath }+ // Every renderer but wined3d now reaches DXVK's d3d9 (see withD9VK), so the config and+ // the per-process log must follow it. Gating these on `== .dxvk` left D3D9 titles on a+ // dxmt or d3dmetal bottle running DXVK with no per-game profile and no log at all.+ if r != .wined3d {+ env["DXVK_CONFIG_FILE"] = Self.dxvkConfigWindowsPath+ // DXVK also writes a per-process <exe>_d3d9.log naming the backend, the config it+ // read and the device it got. Pointing it inside the bottle gives Highball the one+ // artifact that survives a game started by a launcher client Highball did not spawn —+ // the case where the game has no wine log of its own at all (issue #21).+ env["DXVK_LOG_PATH"] = Self.dxvkLogWindowsPath+ }if settings.fpsCap > 0 {switch r {case .dxvk: env["DXVK_FRAME_RATE"] = String(settings.fpsCap)@@ -283,6 +326,9 @@ public struct Bottle: Sendable {public static let dxvkConfigWindowsPath = #"C:\highball\dxvk.conf"#/// Unix location of the same file.public var dxvkConfigURL: URL { driveC.appending(path: "highball/dxvk.conf") }+ /// Windows path DXVK writes its per-process logs to, and its Unix location.+ public static let dxvkLogWindowsPath = #"C:\highball\logs"#+ public var dxvkLogURL: URL { driveC.appending(path: "highball/logs") }/// Contents of the per-bottle dxvk.conf. The global line carries the bottle's async/// toggle. The [csgo.exe] section is the issue #21 profile: legacy CS:GO (32-bit D3D9)@@ -294,10 +340,15 @@ public struct Bottle: Sendable {/// already forces, so the game's dxsupport.cfg picks a concrete GPU profile instead/// of unknown-device failsafe. Later lines win, so the section must follow the global.public static func dxvkConfig(async: Bool, appConfig: [String: [String: String]] = [:]) -> String {- // FALLBACK, kept deliberately (do not delete yet): legacy CS:GO froze at map load- // with async on (issue #21), and legacy CS:GO can ONLY launch via Steam's own- // chooser (CEG DRM) — it never passes the app's Play-gate, so bottles without the- // counter-strike-2 recipe still need this. The same knowledge now ships as data+ // FALLBACK, kept deliberately (do not delete yet): legacy CS:GO can only be started+ // from Steam's own launch-option chooser, so it never passes the app's Play-gate and a+ // bottle without the counter-strike-2 recipe still needs these values. Re-confirmed+ // 2026-08-30: even with the csgo_legacy beta branch selected, `steam -applaunch 730`+ // starts cs2.exe, because -applaunch cannot answer the chooser ("LaunchApp waiting for+ // user response" in Steam's own log) and takes the default option.+ // NOTE: async is NOT the cause of the #21 map-load freeze. The logs show this config+ // reaching csgo.exe exactly as designed and the game froze anyway. These values stay+ // because each is individually sound, not because they fixed it. The same knowledge// (recipe dxvkconfig step); recipe-set values OVERRIDE this fallback. Remove after// a deprecation window once recipe coverage is the norm.let csgoFallback = ["dxvk.enableAsync": "False", "d3d9.maxAvailableMemory": "2048",@@ -325,6 +376,8 @@ public struct Bottle: Sendable {public func writeDxvkConfig() throws {let dir = dxvkConfigURL.deletingLastPathComponent()try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)+ // DXVK only writes its per-process log if the directory exists.+ try FileManager.default.createDirectory(at: dxvkLogURL, withIntermediateDirectories: true)let content = Self.dxvkConfig(async: settings.dxvkAsync, appConfig: settings.dxvkAppConfig)if (try? String(contentsOf: dxvkConfigURL, encoding: .utf8)) != content {try content.write(to: dxvkConfigURL, atomically: true, encoding: .utf8)diff --git a/Sources/HighballKit/Paths.swift b/Sources/HighballKit/Paths.swiftindex c6c6a3a..0b1c43a 100644--- a/Sources/HighballKit/Paths.swift+++ b/Sources/HighballKit/Paths.swift@@ -39,45 +39,261 @@ public struct HighballPaths: Sendable {}}-/// Builds a pre-filled GitHub bug-report URL: system info and the newest log's tail land in-/// the issue form (field ids: what/chip/version/log in .github/ISSUE_TEMPLATE/bug.yml), so-/// every report arrives with the context that triage always needs.+/// Builds a pre-filled GitHub bug-report URL: system info and a digest of the most relevant+/// log land in the issue form (field ids: what/chip/version/log in .github/ISSUE_TEMPLATE/bug.yml),+/// so every report arrives with the context that triage always needs.public enum BugReport {+ /// Strings that prove a log recorded a real graphics-stack launch. Backend names only —+ /// never a game or exe name, so this keeps working for titles nobody has heard of.+ ///+ /// Picking the log by CONTENT rather than by filename is the whole point. A game that can+ /// only be started from a launcher's own UI (legacy CS:GO's CEG chooser) never gets a wine+ /// log of its own: Wine hands the entire process tree one pipe, so the game's DXVK output+ /// lands in the LAUNCHER's log. The previous picker skipped launcher logs by name and so+ /// attached the one file guaranteed not to mention the game — in issue #21 that was a+ /// wineboot log, and it cost four rounds of guessing.+ static let backendMarkers = [+ "info: Game:", // DXVK/d9vk banner: names the exe that created the device+ "DXVK-Kegworks",+ "DXVK:",+ "Found config file:",+ "Effective configuration:",+ "winemetal", // DXMT+ "D3DMetal",+ "wined3d_adapter_create",+ ]++ /// Kept in the digest for context, but deliberately NOT used to choose a log: every wine+ /// process emits `init_peb starting`, so treating it as a backend signal would make almost+ /// any log "informative" and collapse selection back to newest-wins.+ static let contextMarkers = ["init_peb starting"]++ static let errorMarkers = ["err:", "[mvk-error]", "Assertion Failed", "Backtrace:"]+ /// Wine shouts these on every single launch and they have never explained a failure. Left in+ /// the budget they crowd the real errors out: one issue #21 log carries 24 HID lines and 740+ /// identical font-handle lines before anything diagnostic.+ static let benignMarkers = [+ "handle_DeviceMatchingCallback",+ "kerberos_LsaApInitializePackage",+ "ntlm_check_version",+ "ntlm_LsaApInitializePackage",+ "process_run_key Error running cmd",+ "RoGetActivationFactory",+ ]+ static let maxErrorLines = 40+ static let tailLines = 40+ static let maxDigestCharacters = 8000+ /// How many of the newest logs to open. The directory accumulates hundreds of files.+ static let maxLogsExamined = 15+ /// GitHub answers a request URI over roughly 8 KB with 414, and percent-encoding a log can+ /// several-fold its length (every newline becomes %0A), so the ENCODED url is what must be+ /// budgeted — not the digest's character count.+ static let maxURLCharacters = 7000+ /// A single launch here has produced a 167 MB log, so never read one whole. The banner and+ /// the effective configuration are written when the game creates its device, early in its+ /// output; the runaway repetition that makes a log enormous always comes later. Kept modest+ /// because `url()` scans up to `maxLogsExamined` of these on the calling thread.+ static let maxHeadBytes = 1 << 20+ static let maxTailBytes = 256 << 10++ /// Where a launch can leave a log: Highball's own directory, plus the per-process files DXVK+ /// writes inside each bottle (DXVK_LOG_PATH, set in `Bottle.environment`). The DXVK files+ /// matter because they survive the one case Highball cannot otherwise observe — a game+ /// started by a launcher client that Highball did not spawn.+ static func logDirectories(_ paths: HighballPaths) -> [URL] {+ var dirs = [paths.logs]+ let bottles = (try? FileManager.default.contentsOfDirectory(at: paths.bottles, includingPropertiesForKeys: nil)) ?? []+ dirs += bottles.map { $0.appending(path: "drive_c/highball/logs") }+ return dirs.filter { FileManager.default.fileExists(atPath: $0.path) }+ }++ /// Head and tail of a log, bounded. A gap marker records what was skipped so nobody reads+ /// the result as complete.+ static func boundedText(of url: URL) -> String? {+ guard let handle = try? FileHandle(forReadingFrom: url) else { return nil }+ defer { try? handle.close() }+ let size = (try? handle.seekToEnd()) ?? 0+ try? handle.seek(toOffset: 0)+ guard size > UInt64(maxHeadBytes + maxTailBytes) else {+ return (try? handle.readToEnd()).map { String(decoding: $0, as: UTF8.self) }+ }+ let head = (try? handle.read(upToCount: maxHeadBytes)) ?? Data()+ try? handle.seek(toOffset: size - UInt64(maxTailBytes))+ let tail = (try? handle.readToEnd()) ?? Data()+ let skipped = size - UInt64(maxHeadBytes) - UInt64(maxTailBytes)+ return String(decoding: head, as: UTF8.self)+ + "\n… \(skipped) bytes not scanned …\n"+ + String(decoding: tail, as: UTF8.self)+ }++ /// Condenses a wine log to the lines triage actually reads: the launch header and exit+ /// footer, the first sighting of each graphics-backend marker (with the indented block that+ /// follows a configuration dump), the errors, and the tail. Runs of an identical line+ /// collapse to one `(xN)`.+ ///+ /// A blind `suffix(30)` — what this replaced — is structurally useless on a wine log: the+ /// end is always MoltenVK warning spam, while the block naming the backend sits thousands of+ /// lines earlier (line 6547 of 8185 in the issue #21 logs).+ public static func digest(_ text: String) -> String {+ let lines = text.split(separator: "\n", omittingEmptySubsequences: false).map(String.init)+ guard !lines.isEmpty else { return "" }+ var keep = Set<Int>()+ var note: [Int: String] = [:]+ // The "# …" launch header and the "# exit=" footer.+ for (i, line) in lines.enumerated() where line.hasPrefix("#") { keep.insert(i) }+ for marker in backendMarkers + contextMarkers {+ guard let i = lines.firstIndex(where: { $0.contains(marker) }) else { continue }+ keep.insert(i)+ // The indented report that follows a configuration dump.+ var j = i + 1+ while j < lines.count, lines[j].hasPrefix("info: ") { keep.insert(j); j += 1 }+ }+ // Errors: benign startup noise dropped, the rest deduplicated across the whole log so a+ // failure repeated 740 times costs one line and still reports its true count.+ var firstIndex: [String: Int] = [:]+ var occurrences: [String: Int] = [:]+ var order: [String] = []+ var errorKey: [Int: String] = [:]+ for (i, line) in lines.enumerated()+ where errorMarkers.contains(where: line.contains) && !benignMarkers.contains(where: line.contains) {+ let key = normalizedError(line)+ errorKey[i] = key+ if firstIndex[key] == nil { firstIndex[key] = i; order.append(key) }+ occurrences[key, default: 0] += 1+ }+ for key in order.prefix(maxErrorLines) {+ guard let i = firstIndex[key] else { continue }+ keep.insert(i)+ if let n = occurrences[key], n > 1 { note[i] = "(x\(n))" }+ }+ // The tail: where a crash lands, and where a freeze simply stops. An error already+ // represented above is skipped here, so one failure can never appear twice carrying two+ // different counts.+ for i in max(0, lines.count - tailLines)..<lines.count {+ if let key = errorKey[i], firstIndex[key] != i { continue }+ keep.insert(i)+ }++ var out: [String] = []+ var previous = -1+ var repeats = 0+ func collapse() {+ if repeats > 1, !out.isEmpty { out[out.count - 1] += " (x\(repeats))" }+ repeats = 0+ }+ for i in keep.sorted() {+ let rendered = note[i].map { "\(clip(lines[i])) \($0)" } ?? clip(lines[i])+ if i == previous + 1, repeats > 0, rendered == out.last { repeats += 1; previous = i; continue }+ collapse()+ if previous >= 0, i > previous + 1 { out.append("… \(i - previous - 1) lines …") }+ out.append(rendered)+ repeats = 1+ previous = i+ }+ collapse()+ return redactHome(trim(out))+ }++ /// Longest single line kept. Bounds the digest and, not incidentally, stops a very long opaque+ /// value — a launcher URL carrying an auth token, which real Epic logs here do contain — from+ /// being pasted whole into a public GitHub issue.+ static let maxLineCharacters = 300+ static func clip(_ line: String) -> String {+ guard line.count > maxLineCharacters else { return line }+ return line.prefix(maxLineCharacters) + "… (+\(line.count - maxLineCharacters) chars)"+ }++ /// Joins the kept lines, and if they exceed the budget keeps BOTH ENDS: the head carries the+ /// launch header, the backend banner and the effective configuration; the tail carries how the+ /// run ended. A plain `suffix` would drop exactly the head — the content this function exists+ /// to preserve — and keep the MoltenVK spam, reinstating the failure it was written to fix.+ static func trim(_ lines: [String]) -> String {+ let whole = lines.joined(separator: "\n")+ guard whole.count > maxDigestCharacters else { return whole }+ let headBudget = maxDigestCharacters * 2 / 3+ var head: [String] = [], used = 0+ for line in lines {+ if used + line.count + 1 > headBudget, !head.isEmpty { break }+ head.append(line); used += line.count + 1+ }+ var tail: [String] = [], tailUsed = 0+ for line in lines[head.count...].reversed() {+ if used + tailUsed + line.count + 1 > maxDigestCharacters { break }+ tail.append(line); tailUsed += line.count + 1+ }+ let dropped = lines.count - head.count - tail.count+ guard dropped > 0 else { return whole }+ return (head + ["… \(dropped) digest lines dropped …"] + tail.reversed()).joined(separator: "\n")+ }++ /// Replaces the user's home directory with `~`. Wine command lines and DLL search paths are+ /// absolute, so they carry the account name into a public issue for no diagnostic gain.+ static func redactHome(_ text: String) -> String {+ let home = NSHomeDirectory()+ return home.count > 1 ? text.replacingOccurrences(of: home, with: "~") : text+ }++ /// An error line stripped of what varies between otherwise identical occurrences: Wine's+ /// per-thread id prefix and any hex addresses. Without this, the same failure on eight+ /// threads reads as eight different problems.+ static func normalizedError(_ line: String) -> String {+ var text = line+ if let colon = text.firstIndex(of: ":"), text.distance(from: text.startIndex, to: colon) == 4,+ text[text.startIndex..<colon].allSatisfy(\.isHexDigit) {+ text = String(text[text.index(after: colon)...])+ }+ return text.replacingOccurrences(of: "0x[0-9a-fA-F]+", with: "0x…", options: .regularExpression)+ }++ /// The log most likely to explain what went wrong: the newest one that actually recorded a+ /// graphics backend, falling back to the newest of all.+ static func mostInformativeLog(in directories: [URL]) -> (url: URL, text: String)? {+ let key: Set<URLResourceKey> = [.contentModificationDateKey]+ var logs: [URL] = []+ for dir in directories {+ let files = (try? FileManager.default.contentsOfDirectory(at: dir, includingPropertiesForKeys: Array(key))) ?? []+ logs += files.filter { $0.pathExtension == "log" }+ }+ let modified: (URL) -> Date = {+ (try? $0.resourceValues(forKeys: key))?.contentModificationDate ?? .distantPast+ }+ let newestFirst = logs.sorted { modified($0) > modified($1) }.prefix(maxLogsExamined)+ var fallback: (url: URL, text: String)?+ for url in newestFirst {+ guard let text = boundedText(of: url) else { continue }+ if backendMarkers.contains(where: text.contains) { return (url, text) }+ if fallback == nil { fallback = (url, text) }+ }+ return fallback+ }+public static func url(version: String, paths: HighballPaths = HighballPaths()) -> URL {let chip = (try? Shell.capture("/usr/sbin/sysctl", ["-n", "machdep.cpu.brand_string"]))?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "unknown chip"let macos = (try? Shell.capture("/usr/bin/sw_vers", ["-productVersion"]))?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "?"- var logTail = ""- if let files = try? FileManager.default.contentsOfDirectory(at: paths.logs, includingPropertiesForKeys: [.contentModificationDateKey]) {- let logs = files.filter { $0.pathExtension == "log" }- let byNewest: (URL, URL) -> Bool = { a, b in- let da = (try? a.resourceValues(forKeys: [.contentModificationDateKey]))?.contentModificationDate ?? .distantPast- let db = (try? b.resourceValues(forKeys: [.contentModificationDateKey]))?.contentModificationDate ?? .distantPast- return da < db- }- // Prefer the newest program log over a launcher's own log. When a game is- // started through Steam/Epic/etc the launcher process usually writes last,- // so the plain newest log is the launcher's, not the game's (issue #22).- let launcherMarkers = ["steam.exe", "epicgameslauncher", "ubisoftconnect", "galaxyclient", "battle.net", "launcher.exe", "rockstarservice"]- let isLauncher: (URL) -> Bool = { url in- let name = url.lastPathComponent.lowercased()- return launcherMarkers.contains { name.contains($0) }- }- let newest = logs.filter { !isLauncher($0) }.max(by: byNewest) ?? logs.max(by: byNewest)- if let newest, let text = try? String(contentsOf: newest, encoding: .utf8) {- var tail = text.split(separator: "\n").suffix(30).joined(separator: "\n")- if tail.count > 3000 { tail = String(tail.suffix(3000)) }- logTail = "\(newest.lastPathComponent):\n\(tail)"- }- }- var comps = URLComponents(string: "https://github.com/gauthierpiarrette/highball/issues/new")!- comps.queryItems = [- URLQueryItem(name: "template", value: "bug.yml"),- URLQueryItem(name: "chip", value: "\(chip), macOS \(macos)"),- URLQueryItem(name: "version", value: version),- URLQueryItem(name: "log", value: logTail),- ]- return comps.url!+ var logDigest = ""+ if let found = mostInformativeLog(in: logDirectories(paths)) {+ // Name the full file too: the digest is a summary, and triage may want the original.+ logDigest = "\(redactHome(found.url.path)):\n\(digest(found.text))"+ }+ func url(log: String) -> URL {+ var comps = URLComponents(string: "https://github.com/gauthierpiarrette/highball/issues/new")!+ comps.queryItems = [+ URLQueryItem(name: "template", value: "bug.yml"),+ URLQueryItem(name: "chip", value: "\(chip), macOS \(macos)"),+ URLQueryItem(name: "version", value: version),+ URLQueryItem(name: "log", value: log),+ ]+ return comps.url!+ }+ // Shrink from the tail until the encoded URL fits: the head holds the launch header, the+ // backend banner and the effective configuration, which are what triage reads first.+ var result = url(log: logDigest)+ while result.absoluteString.count > maxURLCharacters, logDigest.count > 400 {+ logDigest = String(logDigest.prefix(logDigest.count * 3 / 4))+ result = url(log: logDigest)+ }+ return result}}diff --git a/Sources/HighballKit/WineRunner.swift b/Sources/HighballKit/WineRunner.swiftindex 6522a48..ebbbc49 100644--- a/Sources/HighballKit/WineRunner.swift+++ b/Sources/HighballKit/WineRunner.swift@@ -32,6 +32,60 @@ public struct WineRunner: Sendable {}}+ /// A log URL that cannot overwrite an existing one. The ISO 8601 stamp is second-resolution+ /// and `createFile` truncates, so two launches inside the same second used to destroy one+ /// another's log — routine during Repair, which fires reg, reg and wineboot back to back.+ /// The name is also flattened: `label` falls back to `args.first`, which can be a full path.+ static func uniqueLogURL(in directory: URL, named name: String) -> URL {+ let flat = name.replacingOccurrences(of: "/", with: "_")+ let base = directory.appending(path: "\(flat).log")+ guard FileManager.default.fileExists(atPath: base.path) else { return base }+ for n in 2...99 {+ let candidate = directory.appending(path: "\(flat)-\(n).log")+ if !FileManager.default.fileExists(atPath: candidate.path) { return candidate }+ }+ return base+ }++ /// What the process will really synchronize with, which is not always the bottle's setting:+ /// a pin's own environment is merged LAST and wins, and Steam's pin persists+ /// WINEMSYNC=0/WINEESYNC=0 so its interface stays responsive. Every game launched from that+ /// Steam window therefore inherits sync-off whatever the bottle says — the reason "try+ /// sync=none" was a no-op in issue #21 and the reporter's negative result meant nothing.+ static func effectiveSync(env: [String: String], settings: BottleSettings) -> String {+ let actual: SyncMode+ if env["WINEMSYNC"] == "1" { actual = .msync }+ else if env["WINEESYNC"] == "1" { actual = .esync }+ else { actual = SyncMode.none }+ return actual == settings.sync ? actual.rawValue : "\(actual.rawValue) (bottle asks \(settings.sync.rawValue))"+ }++ /// The log's opening block. Beyond the command line it records the few settings that decide+ /// which graphics and synchronization stack the process actually got.+ ///+ /// Allowlisted on purpose, never the whole environment: this text is pre-filled into a public+ /// GitHub issue, and a bottle's env can hold personal paths or tokens. Without it a report+ /// cannot separate "the config was never delivered" from "the config was delivered and did+ /// not help", which is exactly where issue #21 stalled for two rounds.+ static func launchHeader(engine: InstalledEngine, bottle: Bottle, renderer: Renderer,+ env: [String: String], args: [String]) -> String {+ var out = "# gin \(engine.id) bottle=\(bottle.name) renderer=\(renderer)\n"+ out += "# wine \(args.joined(separator: " "))\n"+ out += "# sync=\(Self.effectiveSync(env: env, settings: bottle.settings))"+ out += " winver=\(bottle.settings.windowsVersion.rawValue) dpi=\(bottle.settings.dpiScale)"+ out += " dxvkAsync=\(bottle.settings.dxvkAsync)\n"+ for key in ["WINEDLLPATH_PREPEND", "WINEDLLOVERRIDES", "DXVK_CONFIG_FILE", "DXVK_LOG_PATH"] {+ if let value = env[key] { out += "# \(key)=\(value)\n" }+ }+ // The generated dxvk.conf decides per-game behaviour, so quote it rather than making the+ // reader ask for a second file that Repair may already have rewritten.+ if env["DXVK_CONFIG_FILE"] != nil,+ let conf = try? String(contentsOf: bottle.dxvkConfigURL, encoding: .utf8) {+ out += conf.split(separator: "\n").map { "# \($0)\n" }.joined()+ }+ return out+ }+/// Runs `wine <args>` and waits. `onOutput` receives each line of combined stdout/stderr.@discardableResultpublic func run(@@ -43,15 +97,17 @@ public struct WineRunner: Sendable {onOutput: (@Sendable (String) -> Void)? = nil) async throws -> LaunchResult {try paths.ensure()- // The dxvk renderer reads its options from the generated conf (async toggle +- // per-game profiles like [csgo.exe], issue #21) — refresh it before the spawn.- if (renderer ?? bottle.settings.renderer) == .dxvk { try? bottle.writeDxvkConfig() }+ // DXVK reads its options from the generated conf (async toggle + per-game profiles like+ // [csgo.exe], issue #21) — refresh it before the spawn. Every renderer but wined3d gets+ // DXVK's d3d9 attached, so every one of them needs the conf, not just .dxvk.+ if (renderer ?? bottle.settings.renderer) != .wined3d { try? bottle.writeDxvkConfig() }let env = try bottle.environment(engine: engine, renderer: renderer, extra: extraEnvironment)let stamp = ISO8601DateFormatter().string(from: Date()).replacingOccurrences(of: ":", with: "")- let logURL = paths.logs.appending(path: "\(stamp)-\(bottle.name)-\(label ?? args.first ?? "wine").log")+ let logURL = Self.uniqueLogURL(in: paths.logs, named: "\(stamp)-\(bottle.name)-\(label ?? args.first ?? "wine")")FileManager.default.createFile(atPath: logURL.path, contents: nil)let logHandle = try FileHandle(forWritingTo: logURL)- let header = "# gin \(engine.id) bottle=\(bottle.name) renderer=\(renderer ?? bottle.settings.renderer)\n# wine \(args.joined(separator: " "))\n"+ let header = Self.launchHeader(engine: engine, bottle: bottle,+ renderer: renderer ?? bottle.settings.renderer, env: env, args: args)logHandle.write(Data(header.utf8))let process = Process()diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swiftindex dc70e68..73e8e2e 100644--- a/Tests/HighballKitTests/RegressionTests.swift+++ b/Tests/HighballKitTests/RegressionTests.swift@@ -151,23 +151,222 @@ extension RegressionTests {}extension RegressionTests {- // The report button used to attach the single newest log; when a game is launched- // through Steam the launcher's log is newest, so triage got Steam's log, not the- // game's (#22). Confirm the launcher-marker filter is exhaustive for known launchers.- func testReportLogPrefersGameOverLauncher() {- // These are the launcher log basenames the picker must skip when a game log exists.- let launcherLogs = [- "2026-08-26T104357Z-Steam for cyberpunk-steam.exe.log",- "2026-08-26T000000Z-b-EpicGamesLauncher.exe.log",- "2026-08-26T000000Z-b-UbisoftConnect.exe.log",- "2026-08-26T000000Z-b-Launcher.exe.log",- ]- let markers = ["steam.exe", "epicgameslauncher", "ubisoftconnect", "galaxyclient", "battle.net", "launcher.exe", "rockstarservice"]- for name in launcherLogs {- XCTAssertTrue(markers.contains { name.lowercased().contains($0) }, "'\(name)' should be recognized as a launcher log")+ // The report button used to skip any log whose NAME looked like a launcher's, on the theory+ // that a game started through Steam writes its own log last (#22). For a game that can only+ // be started from the launcher's own UI — legacy CS:GO's CEG chooser — that is exactly+ // backwards: Wine gives the whole process tree one pipe, so the game's DXVK output lands in+ // the steam.exe log, and skipping it left a wineboot log with nothing in it. That is the+ // file issue #21's reporter sent, and it cost four rounds. Selection is now by content.+ func testReportPicksTheLogThatNamesTheBackendEvenWhenItIsALaunchers() throws {+ let dir = FileManager.default.temporaryDirectory.appending(path: "hb-report-\(UUID().uuidString)")+ try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)+ defer { try? FileManager.default.removeItem(at: dir) }++ let steamLog = dir.appending(path: "2026-08-28T111314Z-play-steam.exe.log")+ try """+ # gin x64-sikarugir10.0_6-r0 bottle=play renderer=dxvk+ # wine steam.exe -silent -applaunch 730+ info: Game: csgo.exe+ info: DXVK-Kegworks: v1.10.4-async+ info: Found config file: C:\\highball\\dxvk.conf+ info: Effective configuration:+ info: d3d9.customVendorId = 1002+ info: dxvk.enableAsync = False+ """.write(to: steamLog, atomically: true, encoding: .utf8)++ // Written LAST, so the old newest-non-launcher rule would have picked exactly this.+ let winebootLog = dir.appending(path: "2026-08-28T111500Z-play-wineboot.log")+ try """+ # gin x64-sikarugir10.0_6-r0 bottle=play renderer=wined3d+ # wine wineboot -u+ err:kerberos:kerberos_LsaApInitializePackage no Kerberos support, expect problems+ """.write(to: winebootLog, atomically: true, encoding: .utf8)+ // Make the wineboot log unambiguously the newest.+ try FileManager.default.setAttributes([.modificationDate: Date()], ofItemAtPath: winebootLog.path)+ try FileManager.default.setAttributes([.modificationDate: Date().addingTimeInterval(-60)],+ ofItemAtPath: steamLog.path)++ let found = BugReport.mostInformativeLog(in: [dir])+ XCTAssertEqual(found?.url.lastPathComponent, steamLog.lastPathComponent,+ "must pick the log that actually recorded a graphics backend")+ let digest = BugReport.digest(found?.text ?? "")+ XCTAssertTrue(digest.contains("Game: csgo.exe"), "the banner naming the exe must survive")+ XCTAssertTrue(digest.contains("dxvk.enableAsync = False"), "the effective config block must survive")+ }++ // A blind suffix(30) is useless on a wine log: the end is MoltenVK warning spam while the+ // block that identifies the backend sits thousands of lines earlier (6547 of 8185 in #21).+ func testReportDigestKeepsTheBackendBlockBuriedMidLogAndCollapsesSpam() {+ var lines = ["# gin e bottle=b renderer=dxvk", "# wine steam.exe"]+ lines += (0..<3000).map { "info: chatter \($0)" }+ lines += ["info: Game: csgo.exe", "info: Effective configuration:", "info: dxvk.enableAsync = False"]+ lines += (0..<200).map { _ in "[mvk-warn] Metal does not support disabling primitive restart." }+ let digest = BugReport.digest(lines.joined(separator: "\n"))++ XCTAssertTrue(digest.contains("Game: csgo.exe"))+ XCTAssertTrue(digest.contains("dxvk.enableAsync = False"))+ XCTAssertTrue(digest.contains("# wine steam.exe"), "the launch header must survive")+ XCTAssertTrue(digest.contains("(x"), "identical repeated lines must collapse")+ XCTAssertLessThan(digest.count, BugReport.maxDigestCharacters + 1)+ XCTAssertFalse(digest.contains("chatter 1500"), "unremarkable middle must be dropped")+ }+}++extension RegressionTests {+ // The first cut of the digest capped itself with suffix(), which discards the FRONT — the+ // launch header, the backend banner and the effective-configuration block it exists to keep —+ // and preserves the MoltenVK tail spam, i.e. exactly the failure it was written to fix.+ // Measured on this machine's real logs: 15 of 411 crossed the cap and 14 lost their header.+ func testOversizedDigestKeepsTheHeadNotJustTheTail() {+ var lines = ["# gin ENGINE bottle=b renderer=dxvk", "# wine steam.exe -applaunch 730",+ "info: Game: csgo.exe", "info: Effective configuration:",+ "info: dxvk.enableAsync = False"]+ // Distinct long error lines: the real shape that overflows the budget.+ lines += (0..<400).map { "0\($0 % 10)a\($0 % 10):err:module:import_dll Library FOO\($0).dll not found in \(String(repeating: "path/", count: 20))" }+ lines += (0..<60).map { "[mvk-warn] Metal does not support disabling primitive restart \($0)." }+ let digest = BugReport.digest(lines.joined(separator: "\n"))++ XCTAssertGreaterThan(lines.joined(separator: "\n").count, BugReport.maxDigestCharacters,+ "fixture must actually overflow, or this test is vacuous")+ XCTAssertLessThanOrEqual(digest.count, BugReport.maxDigestCharacters + 200)+ XCTAssertTrue(digest.contains("# gin ENGINE bottle=b renderer=dxvk"), "launch header must survive truncation")+ XCTAssertTrue(digest.contains("Game: csgo.exe"), "backend banner must survive truncation")+ XCTAssertTrue(digest.contains("dxvk.enableAsync = False"), "effective config must survive truncation")+ XCTAssertTrue(digest.contains("digest lines dropped"), "truncation must be visible, never silent")+ }++ // No single line may be long enough to paste a launcher's auth token into a public issue,+ // and the user's home directory must not carry their account name there either.+ func testDigestClipsLongLinesAndRedactsHome() {+ let token = String(repeating: "eyJhbGciOiJIUzI1NiJ9.", count: 60)+ let digest = BugReport.digest("# wine x\nerr: LogHttp: GET \(NSHomeDirectory())/x?auth=\(token)")+ XCTAssertFalse(digest.contains(token), "a long opaque value must be clipped")+ XCTAssertFalse(digest.contains(NSHomeDirectory()), "home path must be redacted to ~")+ XCTAssertTrue(digest.contains("~"))+ }++ // The digest cap is not a URL cap: percent-encoding a log several-folds it, and GitHub+ // answers a request URI over ~8 KB with 414 — the report button would silently fail.+ func testReportURLStaysUnderGitHubsRequestLimit() throws {+ let home = FileManager.default.temporaryDirectory.appending(path: "hb-url-\(UUID().uuidString)")+ let paths = HighballPaths(home: home)+ try paths.ensure()+ defer { try? FileManager.default.removeItem(at: home) }+ let noisy = (0..<3000).map { "0a0b:err:module:import_dll Library FOO\($0).dll not found" }+ try (["# gin E bottle=b renderer=dxvk", "info: Game: csgo.exe"] + noisy)+ .joined(separator: "\n")+ .write(to: paths.logs.appending(path: "2026-08-30T000000Z-b-steam.exe.log"),+ atomically: true, encoding: .utf8)++ let url = BugReport.url(version: "0.7.17", paths: paths)+ XCTAssertLessThanOrEqual(url.absoluteString.count, BugReport.maxURLCharacters)+ XCTAssertTrue(url.absoluteString.contains("template=bug.yml"))+ }+}++extension RegressionTests {+ // D3D9 now reaches DXVK on every renderer, so the config that carries the per-game profiles+ // and the per-process log path must follow it. Gating these on `== .dxvk` left a D3D9 title+ // on a dxmt or d3dmetal bottle running DXVK with no profile and no log at all.+ func testDxvkConfigAndLogPathReachEveryNonWineD3DRenderer() throws {+ var manifest = try EngineManifest.load(from: URL(fileURLWithPath: #filePath)+ .deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()+ .appending(path: "spike/engine-manifest.json"))+ manifest.acceptedLicenses = Array(EngineManifest.gatedRenderers.values)+ let root = FileManager.default.temporaryDirectory.appending(path: "hb-cfg-\(UUID().uuidString)")+ for r in ["dxmt", "d3dmetal", "dxvk", "d9vk"] {+ try FileManager.default.createDirectory(+ at: root.appending(path: "frameworks/renderer/\(r)/wine"), withIntermediateDirectories: true)}- // A real game log must NOT match any launcher marker.- XCTAssertFalse(markers.contains { "2026-08-26T104400Z-cyberpunk-Cyberpunk2077.exe.log".lowercased().contains($0) })+ defer { try? FileManager.default.removeItem(at: root) }+ let engine = InstalledEngine(manifest: manifest, root: root)+ let bottle = Bottle(url: FileManager.default.temporaryDirectory.appending(path: "hb-cfg-bottle"),+ settings: BottleSettings(name: "t", engineID: manifest.id))++ for renderer in [Renderer.dxmt, .d3dmetal, .dxvk] {+ let env = try bottle.environment(engine: engine, renderer: renderer)+ XCTAssertEqual(env["DXVK_CONFIG_FILE"], Bottle.dxvkConfigWindowsPath, "\(renderer.rawValue)")+ XCTAssertEqual(env["DXVK_LOG_PATH"], Bottle.dxvkLogWindowsPath, "\(renderer.rawValue)")+ }+ let plain = try bottle.environment(engine: engine, renderer: .wined3d)+ XCTAssertNil(plain["DXVK_CONFIG_FILE"], "wined3d uses no DXVK")+ XCTAssertNil(plain["DXVK_LOG_PATH"])+ }+}++extension RegressionTests {+ // Reproduced on this machine 2026-08-30: legacy CS:GO on a bottle using the DEFAULT renderer+ // (dxmt) died with "Your graphics hardware does not support all features (CSM)". Neither the+ // dxmt nor the d3dmetal overlay ships a d3d9 for either architecture, so D3D9 fell through to+ // Wine's wined3d, whose D3D9 lacks the shadow-depth formats Source probes. 0.7.9 fixed this+ // for the dxvk renderer ONLY, leaving the default broken. Every renderer must now reach+ // DXVK's d3d9 (issue #21).+ func testEveryRendererReachesDXVKsD3D9() throws {+ let manifestURL = URL(fileURLWithPath: #filePath)+ .deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()+ .appending(path: "spike/engine-manifest.json")+ var manifest = try EngineManifest.load(from: manifestURL)+ // d3dmetal is licence-gated (Apple GPTK); accept it so the gate isn't what's under test.+ manifest.acceptedLicenses = Array(EngineManifest.gatedRenderers.values)+ let root = FileManager.default.temporaryDirectory.appending(path: "hb-d9vk-\(UUID().uuidString)")+ // rendererDir only returns a directory that exists, so lay out the overlays it looks for.+ for r in ["dxmt", "d3dmetal", "dxvk", "d9vk"] {+ try FileManager.default.createDirectory(+ at: root.appending(path: "frameworks/renderer/\(r)/wine"), withIntermediateDirectories: true)+ }+ defer { try? FileManager.default.removeItem(at: root) }+ let engine = InstalledEngine(manifest: manifest, root: root)+ guard let d9vk = engine.rendererDir("d9vk") else { return XCTFail("fixture missing d9vk") }+ let d9vkPath = d9vk.appending(path: "wine").path++ for renderer in [Renderer.dxmt, .d3dmetal, .dxvk] {+ let env = try renderer.environment(engine: engine)+ let search = env["WINEDLLPATH_PREPEND"] ?? ""+ XCTAssertTrue(search.split(separator: ":").contains { $0 == d9vkPath },+ "\(renderer.rawValue) must reach DXVK's d3d9 or D3D9 titles fall back to wined3d (CSM gate, #21)")+ }+ // wined3d is Wine's own stack by definition and contributes no overlay.+ XCTAssertNil(try Renderer.wined3d.environment(engine: engine)["WINEDLLPATH_PREPEND"])+ }++ // The alert used to edit `selectedBottle`, which launchGame never sets, so accepting a+ // suggestion could rewrite an unrelated bottle. The cycle itself must stay total.+ func testRendererSuggestionCyclesAndNeverSuggestsItself() {+ for r in Renderer.allCases {+ XCTAssertNotEqual(Renderer.suggestion(after: r), r)+ }+ XCTAssertEqual(Renderer.suggestion(after: .dxmt), .d3dmetal)+ XCTAssertEqual(Renderer.suggestion(after: .d3dmetal), .dxvk)+ }+}++extension RegressionTests {+ // The ISO 8601 stamp is second-resolution and createFile truncates, so two launches inside+ // one second destroyed each other's log. Repair fires reg, reg and wineboot back to back.+ func testLogNamesDoNotCollideWithinASecond() throws {+ let dir = FileManager.default.temporaryDirectory.appending(path: "hb-logname-\(UUID().uuidString)")+ try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)+ defer { try? FileManager.default.removeItem(at: dir) }+ let first = WineRunner.uniqueLogURL(in: dir, named: "2026-08-28T111314Z-play-reg")+ FileManager.default.createFile(atPath: first.path, contents: nil)+ let second = WineRunner.uniqueLogURL(in: dir, named: "2026-08-28T111314Z-play-reg")+ XCTAssertNotEqual(first, second)+ // label falls back to args.first, which can be a full path — never make subdirectories.+ let flattened = WineRunner.uniqueLogURL(in: dir, named: "stamp-b-/Users/x/Program Files/a.exe")+ XCTAssertEqual(flattened.deletingLastPathComponent().path, dir.path)+ }++ // A pin's own environment is merged LAST, so Steam's persisted WINEMSYNC=0/WINEESYNC=0 wins+ // over the bottle's setting for everything launched from its window. The header must record+ // what the process really got, or a report cannot tell "sync was applied" from "sync was+ // silently overridden" — the ambiguity that made "try sync=none" a no-op in issue #21.+ func testEffectiveSyncReportsTheOverrideNotTheSetting() {+ var settings = BottleSettings(name: "t", engineID: "e")+ settings.sync = .msync+ let overridden = WineRunner.effectiveSync(env: ["WINEMSYNC": "0", "WINEESYNC": "0"], settings: settings)+ XCTAssertTrue(overridden.hasPrefix("none"))+ XCTAssertTrue(overridden.contains("bottle asks msync"))+ XCTAssertEqual(WineRunner.effectiveSync(env: ["WINEMSYNC": "1", "WINEESYNC": "0"], settings: settings), "msync")}}