Skip to content

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

Graphics modes follow what an engine ships. A new environment starts on the first mode in the fallback order its engine can run: DXMT on every Intel engine, as before, and DXVK on an engine without DXMT, instead of a DXMT setting that would degrade at every launch. The DXVK mode on an engine that ships no d9vk and declares Direct3D 9 on Wine's own serves Direct3D 10 and 11 alone; every other engine still refuses DXVK without d9vk, as #21 requires. A recipe suggesting a mode the engine does not have at all (Steam's DXMT on such an engine) now leaves a neutral note instead of advice to switch engines. For the native arm64 line, which has neither DXMT nor DXVK's d3d9. 526 tests pass on the M4.

Gauthier Piarrette2360ff7af334
diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swift
index dee7303..ff53ca6 100644
--- a/Sources/HighballKit/Bottle.swift
+++ b/Sources/HighballKit/Bottle.swift
@@ -68,9 +68,17 @@ public enum Renderer: String, Codable, CaseIterable, Sendable {
// support all features (CSM)" (#21). d9vk is required for .dxvk: a missing overlay
// must fail loudly, never silently regress D3D9 back to wined3d.
guard let dxvk = engine.rendererDir("dxvk") else { throw HighballError.missing("dxvk renderer in engine \(engine.id)") }
- guard let d9vk = engine.rendererDir("d9vk") else { throw HighballError.missing("d9vk (DXVK D3D9) renderer in engine \(engine.id)") }
- env["WINEDLLPATH_PREPEND"] = [d9vk.appending(path: "wine").path, dxvk.appending(path: "wine").path].joined(separator: ":")
- env["WINEDLLOVERRIDES+"] = "dxgi,d3d9,d3d10core,d3d11=n,b"
+ if let d9vk = engine.rendererDir("d9vk") {
+ env["WINEDLLPATH_PREPEND"] = [d9vk.appending(path: "wine").path, dxvk.appending(path: "wine").path].joined(separator: ":")
+ env["WINEDLLOVERRIDES+"] = "dxgi,d3d9,d3d10core,d3d11=n,b"
+ } else if engine.manifest.direct3D9 == "wined3d" {
+ // An engine that keeps Direct3D 9 on Wine's own and ships no d9vk at all (the
+ // arm64 line, whose DXVK is built without its d3d9): DXVK serves 10 and 11 only.
+ env["WINEDLLPATH_PREPEND"] = dxvk.appending(path: "wine").path
+ env["WINEDLLOVERRIDES+"] = "dxgi,d3d10core,d3d11=n,b"
+ } else {
+ throw HighballError.missing("d9vk (DXVK D3D9) renderer in engine \(engine.id)")
+ }
}
return env
}
@@ -200,6 +208,13 @@ public enum Renderer: String, Codable, CaseIterable, Sendable {
fallbackOrder.first { $0 != wanted && $0.availability(in: engine) == .available } ?? .wined3d
}
+ /// The mode a new environment starts on: the first in `fallbackOrder` this engine can run.
+ /// DXMT on every Intel engine, as before; DXVK on an engine without DXMT (the arm64 line),
+ /// rather than a DXMT setting that would degrade at every launch.
+ public static func defaultMode(for engine: InstalledEngine) -> Renderer {
+ fallbackOrder.first { $0.availability(in: engine) == .available } ?? .wined3d
+ }
+
public static func displayName(_ r: Renderer) -> String {
switch r {
case .wined3d: return "WineD3D"
diff --git a/Sources/HighballKit/BottleStore.swift b/Sources/HighballKit/BottleStore.swift
index 09541d6..8c08a81 100644
--- a/Sources/HighballKit/BottleStore.swift
+++ b/Sources/HighballKit/BottleStore.swift
@@ -59,7 +59,8 @@ public struct BottleStore: Sendable {
}
/// Creates the directory + bottle.json, then runs `wineboot -u` to populate the prefix.
- public func create(name rawName: String, engine: InstalledEngine, renderer: Renderer = .dxmt, windowsVersion: WindowsVersion = .win10) async throws -> Bottle {
+ /// `renderer` nil starts the environment on the engine's default mode (Renderer.defaultMode).
+ public func create(name rawName: String, engine: InstalledEngine, renderer: Renderer? = nil, windowsVersion: WindowsVersion = .win10) async throws -> Bottle {
let name = rawName.trimmingCharacters(in: .whitespaces)
if let problem = Self.nameProblem(name) { throw HighballError.invalid(problem) }
try paths.ensure()
@@ -71,7 +72,7 @@ public struct BottleStore: Sendable {
guard lstat(url.path, &existing) != 0 else { throw HighballError.invalid("bottle '\(name)' already exists") }
try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)
var settings = BottleSettings(name: name, engineID: engine.id)
- settings.renderer = renderer
+ settings.renderer = renderer ?? Renderer.defaultMode(for: engine)
settings.windowsVersion = windowsVersion
let bottle = Bottle(url: url, settings: settings)
try bottle.save()
diff --git a/Sources/HighballKit/Recipe.swift b/Sources/HighballKit/Recipe.swift
index 6f81ff6..3e75961 100644
--- a/Sources/HighballKit/Recipe.swift
+++ b/Sources/HighballKit/Recipe.swift
@@ -435,6 +435,10 @@ public struct RecipeRunner: Sendable {
let why = r.unavailableReason(in: engine)
if let applied = Self.rendererToApply(recipeRenderer: r, settings: bottle.settings, available: why == nil) {
bottle.settings.renderer = applied
+ } else if r.availability(in: engine) == .notShipped {
+ // A recipe written for every engine (Steam's suggests DXMT) on an engine that has
+ // no such mode at all (the arm64 line): nothing to fix, so no advice to switch engines.
+ notes.append("Kept this bottle's renderer (\(bottle.settings.renderer.rawValue)); the recipe suggests \(r.rawValue), which engine \(engine.id) does not have.")
} else if let why {
notes.append("Kept this bottle's renderer (\(bottle.settings.renderer.rawValue)); the recipe suggests \(r.rawValue): \(why)")
} else {
diff --git a/Sources/highball/main.swift b/Sources/highball/main.swift
index 55333eb..39c71a3 100644
--- a/Sources/highball/main.swift
+++ b/Sources/highball/main.swift
@@ -108,7 +108,7 @@ struct Bottle: AsyncParsableCommand {
let eng = try engine.map { try store.engine($0) } ?? EngineStore.defaultEngine(installed: store.installedEngines(), bundledID: nil)
guard let eng else { fail("no engine installed") }
print("creating bottle '\(name)' with \(eng.id) (wineboot takes ~90 s the first time)…")
- var bottle = try await BottleStore().create(name: name, engine: eng, renderer: renderer ?? .dxmt)
+ var bottle = try await BottleStore().create(name: name, engine: eng, renderer: renderer)
if renderer != nil { // a flag the user typed is an explicit choice (#29)
bottle.settings.rendererExplicit = true
try bottle.save()
diff --git a/Tests/HighballKitTests/EnvironmentTests.swift b/Tests/HighballKitTests/EnvironmentTests.swift
index 3d35ecb..9272b65 100644
--- a/Tests/HighballKitTests/EnvironmentTests.swift
+++ b/Tests/HighballKitTests/EnvironmentTests.swift
@@ -230,6 +230,22 @@ final class EnvironmentTests: XCTestCase {
"dxvk present but d9vk missing must throw, not fall back to wined3d")
}
+ /// The arm64 line's DXVK is built without its d3d9 and the engine says Direct3D 9 stays on
+ /// Wine's own: there the DXVK mode serves Direct3D 10 and 11 alone instead of refusing to start.
+ func testDxvkWithoutD9vkOnAnEngineThatKeepsDirect3D9OnWine() throws {
+ let (base, bottle) = try fixtures()
+ var manifest = base.manifest
+ manifest.direct3D9 = "wined3d"
+ let engine = InstalledEngine(manifest: manifest, root: base.root)
+ let dxvk = engine.renderersDir.appending(path: "dxvk/wine")
+ try FileManager.default.createDirectory(at: dxvk, withIntermediateDirectories: true)
+ defer { try? FileManager.default.removeItem(at: engine.root) }
+ let env = try bottle.environment(engine: engine, renderer: .dxvk)
+ XCTAssertEqual(env["WINEDLLPATH_PREPEND"], dxvk.path, "the dxvk overlay alone, no d9vk")
+ XCTAssertFalse(env["WINEDLLOVERRIDES"]?.contains("d3d9") ?? false, "d3d9 stays Wine's own")
+ XCTAssertTrue(env["WINEDLLOVERRIDES"]?.contains("d3d11=n,b") ?? false)
+ }
+
/// OpenGL games asking for a 3.2+ core context without the forward-compatible bit crash on
/// macOS unless Wine adds it; the engine's Mac driver reads this switch (highball#136).
func testForwardCompatibleGLContextsAreOnForEveryLaunch() throws {
diff --git a/Tests/HighballKitTests/RendererAvailabilityTests.swift b/Tests/HighballKitTests/RendererAvailabilityTests.swift
index 67308c5..ec00b62 100644
--- a/Tests/HighballKitTests/RendererAvailabilityTests.swift
+++ b/Tests/HighballKitTests/RendererAvailabilityTests.swift
@@ -46,6 +46,15 @@ final class RendererAvailabilityTests: XCTestCase {
return b
}
+ // MARK: A new environment's mode
+
+ func testANewEnvironmentStartsOnTheFirstModeItsEngineRuns() throws {
+ XCTAssertEqual(Renderer.defaultMode(for: try engine(accepted: false)), .dxmt, "every Intel engine keeps DXMT")
+ XCTAssertEqual(Renderer.defaultMode(for: try engine(ships: ["dxvk", "vkd3d"], accepted: false)), .dxvk,
+ "no DXMT (the arm64 line): DXVK, not a DXMT setting that degrades at every launch")
+ XCTAssertEqual(Renderer.defaultMode(for: try engine(ships: [], accepted: false)), .wined3d)
+ }
+
// MARK: Direct3D 12-only programs (highball#139)
func testADirect3D12OnlyProgramGetsAModeThatHasIt() throws {