Skip to content

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

perf: msync for games (+42% fps), sync=none only for the Steam UI's cold start

Gauthier Piarrette2d3fd64f0526
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 0edfb1a..f253b66 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -138,11 +138,24 @@ final class AppState {
}
}
+ /// Steam's own UI (CEF) hangs under msync/esync, and Wine's sync mode is fixed when the
+ /// prefix's wineserver starts. So the Steam window gets a cold start with sync forced off,
+ /// while games keep the bottle's (faster) sync. See recipes/launchers/steam.json.
+ private func isSteamUI(_ pin: Pin) -> Bool {
+ pin.path.lowercased().hasSuffix("steam/steam.exe")
+ }
+
func launch(pin: Pin, in bottle: Bottle) {
guard let engine = engine(for: bottle) else { return }
runBusy("Running \(pin.name)", showLogSheet: false) { [self] in
let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)
- let result = try await runner.start(pin: pin) { line in Task { @MainActor in self.appendLog(line) } }
+ var extra = [String: String]()
+ if isSteamUI(pin), bottle.settings.sync != SyncMode.none {
+ try? runner.kill() // restart the wineserver so sync=none takes effect
+ try? await Task.sleep(for: .seconds(2))
+ extra = ["WINEMSYNC": "0", "WINEESYNC": "0"]
+ }
+ let result = try await runner.start(pin: pin, extraEnvironment: extra) { line in Task { @MainActor in self.appendLog(line) } }
if result.crashedEarly {
let current = pin.renderer ?? bottle.settings.renderer
let next: Renderer = current == .dxmt ? .d3dmetal : (current == .d3dmetal ? .dxvk : .dxmt)
diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swift
index 26badb0..edc118b 100644
--- a/Sources/HighballApp/BottleView.swift
+++ b/Sources/HighballApp/BottleView.swift
@@ -146,6 +146,15 @@ struct BottleView: View {
}
Toggle(L("Metal performance HUD"), isOn: binding(\.metalHUD))
Toggle(L("Advertise AVX to games (Rosetta)"), isOn: binding(\.advertiseAVX))
+ Toggle(L("DXVK async shader compilation (less stutter)"), isOn: binding(\.dxvkAsync))
+ Picker(L("Frame rate cap"), selection: binding(\.fpsCap)) {
+ Text(L("Uncapped")).tag(0)
+ Text("30 fps").tag(30)
+ Text("60 fps").tag(60)
+ Text("120 fps").tag(120)
+ }
+ Text(L("Games run with the bottle’s sync (msync is fastest). Opening the Steam window restarts Windows processes with sync off — its interface needs it."))
+ .font(.caption).foregroundStyle(.secondary)
}
private func binding<T>(_ keyPath: WritableKeyPath<BottleSettings, T>) -> Binding<T> {
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index 3aeb374..563202c 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -78,6 +78,12 @@ enum L10n {
"Install engine": "Installer le moteur",
"Installing…": "Installation…",
+ "DXVK async shader compilation (less stutter)": "Compilation asynchrone des shaders DXVK (moins de saccades)",
+ "Frame rate cap": "Limite d’images par seconde",
+ "Uncapped": "Illimité",
+ "Games run with the bottle’s sync (msync is fastest). Opening the Steam window restarts Windows processes with sync off — its interface needs it.":
+ "Les jeux utilisent la synchronisation de la bouteille (msync est la plus rapide). Ouvrir la fenêtre Steam redémarre les processus Windows sans synchronisation — son interface l’exige.",
+
// Status pills
"Verified": "Vérifié",
"Reported": "Signalé",
diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swift
index a9d717b..61b5729 100644
--- a/Sources/HighballKit/Bottle.swift
+++ b/Sources/HighballKit/Bottle.swift
@@ -69,6 +69,10 @@ public struct BottleSettings: Codable, Sendable {
public var sync: SyncMode = .msync
public var metalHUD: Bool = false
public var advertiseAVX: Bool = false
+ /// DXVK async pipeline compilation — big shader-stutter relief, minor risk of artifacts.
+ public var dxvkAsync: Bool = true
+ /// Cap the frame rate (0 = uncapped). Applied per renderer (DXVK_FRAME_RATE / DXMT_CONFIG).
+ public var fpsCap: Int = 0
public var environment: [String: String] = [:]
public var pins: [Pin] = []
public var recipes: [String] = []
@@ -78,6 +82,24 @@ public struct BottleSettings: Codable, Sendable {
self.name = name
self.engineID = engineID
}
+
+ public init(from decoder: Decoder) throws {
+ let c = try decoder.container(keyedBy: CodingKeys.self)
+ formatVersion = try c.decodeIfPresent(Int.self, forKey: .formatVersion) ?? 1
+ name = try c.decode(String.self, forKey: .name)
+ engineID = try c.decode(String.self, forKey: .engineID)
+ renderer = try c.decodeIfPresent(Renderer.self, forKey: .renderer) ?? .dxmt
+ windowsVersion = try c.decodeIfPresent(WindowsVersion.self, forKey: .windowsVersion) ?? .win10
+ sync = try c.decodeIfPresent(SyncMode.self, forKey: .sync) ?? .msync
+ metalHUD = try c.decodeIfPresent(Bool.self, forKey: .metalHUD) ?? false
+ advertiseAVX = try c.decodeIfPresent(Bool.self, forKey: .advertiseAVX) ?? false
+ dxvkAsync = try c.decodeIfPresent(Bool.self, forKey: .dxvkAsync) ?? true
+ fpsCap = try c.decodeIfPresent(Int.self, forKey: .fpsCap) ?? 0
+ environment = try c.decodeIfPresent([String: String].self, forKey: .environment) ?? [:]
+ pins = try c.decodeIfPresent([Pin].self, forKey: .pins) ?? []
+ recipes = try c.decodeIfPresent([String].self, forKey: .recipes) ?? []
+ created = try c.decodeIfPresent(Date.self, forKey: .created) ?? Date()
+ }
}
public struct Bottle: Sendable {
@@ -120,6 +142,15 @@ public struct Bottle: Sendable {
}
if settings.metalHUD { env["MTL_HUD_ENABLED"] = "1" }
if settings.advertiseAVX { env["ROSETTA_ADVERTISE_AVX"] = "1" }
+ let r = renderer ?? settings.renderer
+ if r == .dxvk, settings.dxvkAsync { env["DXVK_ASYNC"] = "1" }
+ if settings.fpsCap > 0 {
+ switch r {
+ case .dxvk: env["DXVK_FRAME_RATE"] = String(settings.fpsCap)
+ case .dxmt: env["DXMT_CONFIG"] = "d3d11.preferredMaxFrameRate=\(settings.fpsCap);"
+ default: break
+ }
+ }
merge(&env, settings.environment)
merge(&env, try (renderer ?? settings.renderer).environment(engine: engine))
merge(&env, extra)
diff --git a/Sources/HighballKit/WineRunner.swift b/Sources/HighballKit/WineRunner.swift
index 7750af4..ded35df 100644
--- a/Sources/HighballKit/WineRunner.swift
+++ b/Sources/HighballKit/WineRunner.swift
@@ -83,9 +83,10 @@ public struct WineRunner: Sendable {
/// Runs the pinned program, honouring its own renderer/env/args.
@discardableResult
- public func start(pin: Pin, onOutput: (@Sendable (String) -> Void)? = nil) async throws -> LaunchResult {
+ public func start(pin: Pin, extraEnvironment: [String: String] = [:], onOutput: (@Sendable (String) -> Void)? = nil) async throws -> LaunchResult {
let exe = bottle.driveC.appending(path: pin.path)
- return try await start(exe, arguments: pin.arguments, renderer: pin.renderer, extraEnvironment: pin.environment, onOutput: onOutput)
+ let env = pin.environment.merging(extraEnvironment) { $1 }
+ return try await start(exe, arguments: pin.arguments, renderer: pin.renderer, extraEnvironment: env, onOutput: onOutput)
}
public func wineboot() async throws -> LaunchResult {