Skip to content

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

Verifier: attribute runs by the overlays' per-process logs; DXMT gets one

Gauthier Piarrette965c85c3e54f
diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swift
index 9cc2e49..bec7ecc 100644
--- a/Sources/HighballKit/Bottle.swift
+++ b/Sources/HighballKit/Bottle.swift
@@ -377,6 +377,10 @@ public struct Bottle: Sendable {
// 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
+ // DXMT writes the same kind of per-process file when asked; it is the one artifact
+ // that says which Direct3D implementation actually served a process (Wine's load
+ // trace names overlay builtins by their Windows path, so it cannot tell).
+ env["DXMT_LOG_PATH"] = Self.dxvkLogWindowsPath
}
if settings.fpsCap > 0 {
switch r {
diff --git a/Sources/HighballKit/Verifier.swift b/Sources/HighballKit/Verifier.swift
index a1d65b7..5b3b996 100644
--- a/Sources/HighballKit/Verifier.swift
+++ b/Sources/HighballKit/Verifier.swift
@@ -17,9 +17,10 @@ public struct VerifyOutcome: Codable, Sendable {
public var chip: String
public var macos: String
public var log: String
- /// Which Direct3D implementation actually served the game, from Wine's DLL-load trace:
- /// "dxmt", "dxvk", "d3dmetal", "wined3d" (Wine's own, i.e. no overlay applied), or "none"
- /// when the game loaded no Direct3D at all. Optional so older result lines still decode.
+ /// Which Direct3D implementation actually served the game, from the per-process logs the
+ /// overlays write: "dxmt", "dxvk", or "wined3d" when neither wrote one during the run
+ /// (Wine's own Direct3D, or a game drawing with Vulkan or OpenGL directly). Optional so
+ /// older result lines still decode.
public var served: String?
/// False when a renderer overlay was asked for and Wine's own Direct3D served instead: the
/// engine ignored the overlay (2026-09-04: a tree without WINEDLLPATH_PREPEND support passed
@@ -59,12 +60,12 @@ public struct Verifier {
let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)
let steam = bottle.driveC.appending(path: "Program Files (x86)/Steam/steam.exe")
log?("[\(game.name)] launching via silent Steam (\(renderer.rawValue))…")
- // +loaddll is what makes the verdict attributable: the game's Wine output lands in this
- // log (children inherit stderr), and each Direct3D DLL's load line names the file that
- // served it, overlay or Wine's own.
+ // DXMT at info level writes its per-process log like DXVK does; those files, and when
+ // they were written, are what attributes the verdict.
+ let runStart = Date()
let launch = Task {
try await runner.start(steam, arguments: ["-silent", "-applaunch", String(game.appid)], renderer: renderer,
- extraEnvironment: ["WINEDEBUG": "fixme-all,+loaddll"])
+ extraEnvironment: ["DXMT_LOG_LEVEL": "info"])
}
// Wait up to 6 minutes for the game process (cold silent Steam needs ~2 min first).
@@ -84,19 +85,10 @@ public struct Verifier {
// Tear down.
try? WineRunner(paths: paths, engine: engine, bottle: bottle).kill()
launch.cancel()
- // The launch task returns when steam.exe exits, which kill() just arranged; bound the
- // wait anyway so a client that lingers cannot hold the verifier.
- let launchLog: URL? = await withTaskGroup(of: URL?.self) { group in
- group.addTask { (try? await launch.value)?.log }
- group.addTask { try? await Task.sleep(for: .seconds(30)); return nil }
- let first = await group.next() ?? nil
- group.cancelAll()
- return first
- }
- let served = launchLog.flatMap { try? String(contentsOf: $0, encoding: .utf8) }.map(Self.servedImplementation(fromLog:)) ?? "unknown"
+ let served = Self.servedImplementation(logsDirectory: bottle.driveC.appending(path: "highball/logs"), since: runStart)
// Every renderer but wined3d routes Direct3D 9 through the d9vk overlay, so "dxvk" under a
// dxmt run is still an overlay; only Wine's own implementation means the ask was ignored.
- let overlayApplied: Bool? = (renderer == .wined3d || served == "unknown" || served == "none") ? nil : served != "wined3d"
+ let overlayApplied: Bool? = renderer == .wined3d ? nil : served != "wined3d"
let meanLum = luminances.isEmpty ? 0 : luminances.reduce(0, +) / Double(luminances.count)
let verdict: VerifyOutcome.Verdict =
@@ -117,26 +109,26 @@ public struct Verifier {
return outcome
}
- /// Reads Wine's +loaddll trace for the Direct3D DLLs a process loaded and names the
- /// implementation behind them by the file's location: Highball's overlay directories
- /// (renderers/<name>/wine or the Template's renderer/<name>/wine) or Wine's own system32.
- /// d3d9 through the d9vk overlay counts as dxvk. The first Direct3D load wins the name;
- /// "none" when no Direct3D DLL loaded at all.
- public static func servedImplementation(fromLog log: String) -> String {
- for line in log.split(separator: "\n") {
- guard line.contains("loaddll"), line.contains("Loaded L\""),
- let range = line.range(of: #"Loaded L"([^"]+\\+(d3d11|d3d9|d3d10core|d3d12|dxgi)\.dll)""#, options: .regularExpression)
- else { continue }
- // Wine's debugstr doubles backslashes ("C:\\windows\\system32\\d3d11.dll"); fold them
- // so one set of patterns matches real output (a first version matched only the
- // hand-written fixture and never attributed a real run).
- let path = line[range].lowercased().replacingOccurrences(of: "\\\\", with: "\\")
- if path.contains("\\dxmt\\") { return "dxmt" }
- if path.contains("\\dxvk\\") || path.contains("\\d9vk\\") { return "dxvk" }
- if path.contains("\\d3dmetal\\") { return "d3dmetal" }
- if path.contains("\\windows\\system32\\") || path.contains("\\windows\\syswow64\\") { return "wined3d" }
+ /// Names the Direct3D implementation that served the run from the per-process logs the
+ /// overlays write into the bottle (DXVK and DXMT both do, under `highball/logs`), ignoring
+ /// Steam's own helpers. A file written during the run whose header names DXVK means dxvk,
+ /// one naming DXMT means dxmt; no such file means Wine's own Direct3D served (or the game
+ /// drew with Vulkan or OpenGL directly), which is reported as wined3d. Wine's load trace
+ /// cannot do this job: it names overlay builtins by their Windows path.
+ public static func servedImplementation(logsDirectory: URL, since: Date) -> String {
+ let fm = FileManager.default
+ guard let files = try? fm.contentsOfDirectory(at: logsDirectory, includingPropertiesForKeys: [.contentModificationDateKey]) else { return "wined3d" }
+ var found: [String] = []
+ for f in files where f.pathExtension == "log" {
+ let name = f.lastPathComponent.lowercased()
+ guard name.contains("_d3d"), !name.hasPrefix("steam"), !name.hasPrefix("gameoverlayui") else { continue }
+ guard let modified = try? f.resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate, modified >= since else { continue }
+ guard let head = try? String(contentsOf: f, encoding: .utf8).prefix(2000).lowercased() else { continue }
+ if head.contains("dxmt") { found.append("dxmt") } else if head.contains("dxvk") { found.append("dxvk") }
}
- return "none"
+ if found.contains("dxmt") { return "dxmt" }
+ if found.contains("dxvk") { return "dxvk" }
+ return "wined3d"
}
func append(_ o: VerifyOutcome) throws {
diff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swift
index 1782c60..bafca71 100644
--- a/Tests/HighballKitTests/RegressionTests.swift
+++ b/Tests/HighballKitTests/RegressionTests.swift
@@ -919,17 +919,21 @@ extension RegressionTests {
XCTAssertFalse(current.needsSave)
}
- // The verifier names the Direct3D implementation from Wine's +loaddll trace. The 2026-09-04
- // engine that ignored every overlay would have shown "wined3d" on a dxmt run.
- func testVerifierNamesTheDirect3DImplementationFromTheLoadTrace() {
- let dxmt = #"0024:trace:loaddll:build_module Loaded L"Z:\Users\me\Library\Application Support\Highball\engines\x64-a-r1\renderers\dxmt\wine\x86_64-windows\d3d11.dll" at 000000006FC00000: builtin"#
- let d9vk = #"0024:trace:loaddll:build_module Loaded L"Z:\Users\me\Library\Application Support\Highball\engines\x64-a-r1\frameworks\renderer\d9vk\wine\x86_64-windows\d3d9.dll" at 000000006FC00000: builtin"#
- let own = #"0024:trace:loaddll:build_module Loaded L"C:\windows\system32\d3d11.dll" at 000000006FC00000: builtin"#
- let other = #"0024:trace:loaddll:build_module Loaded L"C:\windows\system32\kernel32.dll" at 000000006FC00000: builtin"#
- XCTAssertEqual(Verifier.servedImplementation(fromLog: [other, dxmt, own].joined(separator: "\n")), "dxmt", "the first Direct3D load names it")
- XCTAssertEqual(Verifier.servedImplementation(fromLog: [other, d9vk].joined(separator: "\n")), "dxvk", "d9vk is DXVK's d3d9")
- XCTAssertEqual(Verifier.servedImplementation(fromLog: [other, own].joined(separator: "\n")), "wined3d")
- XCTAssertEqual(Verifier.servedImplementation(fromLog: other), "none")
+ // The verifier names the Direct3D implementation from the overlays' per-process logs written
+ // during the run; Steam's helpers do not count, and nothing written means Wine's own.
+ func testVerifierNamesTheDirect3DImplementationFromOverlayLogs() throws {
+ let dir = FileManager.default.temporaryDirectory.appending(path: "hb-served-\(UUID().uuidString)")
+ try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
+ let since = Date().addingTimeInterval(-5)
+ XCTAssertEqual(Verifier.servedImplementation(logsDirectory: dir, since: since), "wined3d", "no overlay log at all")
+ try "info: Game: steamwebhelper.exe\ninfo: DXVK-Kegworks: v1.10.4".write(to: dir.appending(path: "steamwebhelper_d3d11.log"), atomically: true, encoding: .utf8)
+ XCTAssertEqual(Verifier.servedImplementation(logsDirectory: dir, since: since), "wined3d", "Steam's own helper is not the game")
+ try "info: Game: portal2.exe\ninfo: DXVK-Kegworks: v1.10.4-async".write(to: dir.appending(path: "portal2_d3d9.log"), atomically: true, encoding: .utf8)
+ XCTAssertEqual(Verifier.servedImplementation(logsDirectory: dir, since: since), "dxvk")
+ try "info: dxmt v0.80\n".write(to: dir.appending(path: "game_d3d11.log"), atomically: true, encoding: .utf8)
+ XCTAssertEqual(Verifier.servedImplementation(logsDirectory: dir, since: since), "dxmt", "a DXMT file outranks d9vk's d3d9 file for the same run")
+ XCTAssertEqual(Verifier.servedImplementation(logsDirectory: dir, since: Date().addingTimeInterval(60)), "wined3d", "files older than the run do not count")
+ try? FileManager.default.removeItem(at: dir)
}
// Log pruning: age beyond the newest N, then size, never the verifier's results.