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
Steam's own window opens with DXMT in an environment set to D3DMetal: its browser helpers cannot present under D3DMetal and the window stays black, so a player who switched the environment for a DirectX 12 game could not sign in or install it (highball#268). On an M4 (Wine 11 r17, D3DMetal environment, signed-out client) the sign-in window was black when started under D3DMetal and drew in full when the app opened it with DXMT. Play is unchanged: a client in another mode is restarted before the game, which still gets D3DMetal. A mode set on the Steam shortcut itself stands, and Steam's uninstall dialog follows the same rule
Gauthier Piarrettef1c47470f9a3
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex 9b9d56e..40b52c6 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -1710,11 +1710,14 @@ final class AppState {let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)let url = Uninstall.steamURL(appID: appID)appendLog("\(item.title): asking Steam to uninstall it (\(url))")+ // Its dialog has to be seen, so the client gets the mode its window draws in.+ let mode = SteamRestart.windowRenderer(shortcut: nil, environment: bottle.settings.renderer,+ dxmtRuns: Renderer.dxmt.availability(in: engine) == .available)Task.detached {// A running client takes the URL and shows its own dialog; with none running the// client starts first, which is what `start` does with a steam:// argument.if (try? await runner.forwardToRunningSteam([url])) == nil {- _ = try? await runner.start(bottle.driveC.appending(path: "Program Files (x86)/Steam/steam.exe"), arguments: [url])+ _ = try? await runner.start(bottle.driveC.appending(path: "Program Files (x86)/Steam/steam.exe"), arguments: [url], renderer: mode)}}case let .epic(appName):@@ -2105,6 +2108,13 @@ final class AppState {extraEnvironment = ["WINEMSYNC": "0", "WINEESYNC": "0"]}let extra = extraEnvironment+ var started = pin+ if isSteamUI(pin), let mode = SteamRestart.windowRenderer(shortcut: pin.renderer, environment: bottle.settings.renderer,+ dxmtRuns: Renderer.dxmt.availability(in: engine) == .available) {+ started.renderer = mode+ await MainActor.run { self.appendLog("Steam's window opens with \(Renderer.displayName(mode)), since it stays black with D3DMetal. Games still start with D3DMetal.") }+ }+ let steamPin = started// The process outlives "starting": busy covers the start only, then the Steam row// (a client) or a session (anything else) carries it, and the app stays free (0.6).let box = LaunchOutcome()@@ -2112,7 +2122,7 @@ final class AppState {let steamUI = isSteamUI(pin)watchedLaunch(box) {if steamUI {- let (r, resumed) = try await runner.startResumingKnownSteamCrash(pin: pin, extraEnvironment: extra) { line in+ let (r, resumed) = try await runner.startResumingKnownSteamCrash(pin: steamPin, extraEnvironment: extra) { line inlog(line)if line.contains("relaunching so it resumes") {Task { @MainActor in self.stage = L("Steam crashed at a known spot — relaunching to resume the update") }diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swiftindex c6213a4..9dfbefc 100644--- a/Sources/HighballApp/HighballApp.swift+++ b/Sources/HighballApp/HighballApp.swift@@ -251,6 +251,14 @@ struct ContentView: View {guard let bottle = state.bottles.first(where: { $0.name == String(spec[..<cut]) }) else { return }state.runDropped(URL(fileURLWithPath: String(spec[spec.index(after: cut)...])), in: bottle, andPin: false)}+ // HB_DEBUG_STEAM="<environment>" opens that environment's Steam as its row's Show does,+ // so a script can see which mode the window starts in (highball#268).+ .task {+ guard let name = ProcessInfo.processInfo.environment["HB_DEBUG_STEAM"] else { return }+ try? await Task.sleep(for: .seconds(4))+ guard let bottle = state.bottles.first(where: { $0.name == name }) else { return }+ state.showSteam(in: bottle)+ }// HB_DEBUG_PLAY="<library item id>" presses Play on that tile, so a script can capture// the questions Play asks (the engine ask, highball-db#318)..task {diff --git a/Sources/HighballKit/SteamRestart.swift b/Sources/HighballKit/SteamRestart.swiftindex 88d4988..30ded1d 100644--- a/Sources/HighballKit/SteamRestart.swift+++ b/Sources/HighballKit/SteamRestart.swift@@ -15,6 +15,18 @@ public enum SteamRestart {static let inherited: [(String, String)] = [("ROSETTA_ADVERTISE_AVX", "AVX advertised"), ("MTL_HUD_ENABLED", "the Metal HUD"),("CX_FWD_COMPAT_GL_CTX", "forward-compatible OpenGL contexts")]+ /// The mode Steam's own window starts in, when it is not the one the shortcut would give it.+ /// Steam's browser helpers cannot present under D3DMetal: its windows exist and stay black+ /// (Wine 11 with D3DMetal 3, 2026-09-13, and with D3DMetal 4 on r18, 2026-10-05, measured), so a+ /// player who set the environment to D3DMetal for a DirectX 12 game could not sign in or install+ /// it (highball#268). DXMT draws the window on both engine lines. A mode set on the Steam+ /// shortcut itself is the player's and stands. Play still gets the game's mode: a client that+ /// differs is restarted before the launch (`restartSteamIfMismatched`).+ public static func windowRenderer(shortcut: Renderer?, environment: Renderer, dxmtRuns: Bool) -> Renderer? {+ guard shortcut == nil, environment == .d3dmetal, dxmtRuns else { return nil }+ return .dxmt+ }+/// What became of the running client before a launch.public enum Outcome: Equatable {/// No client runs; the launch cold-starts one with its own environment.diff --git a/Tests/HighballKitTests/SteamWindowRendererTests.swift b/Tests/HighballKitTests/SteamWindowRendererTests.swiftnew file mode 100644index 0000000..332631e--- /dev/null+++ b/Tests/HighballKitTests/SteamWindowRendererTests.swift@@ -0,0 +1,25 @@+import XCTest+@testable import HighballKit++/// Steam's own window stays black under D3DMetal (highball#268: an environment set to D3DMetal for+/// Forza Horizon 4 on the Wine 11 engine, and Steam could not be signed in to or used).+final class SteamWindowRendererTests: XCTestCase {+ func testAD3DMetalEnvironmentOpensSteamsWindowWithDXMT() {+ XCTAssertEqual(SteamRestart.windowRenderer(shortcut: nil, environment: .d3dmetal, dxmtRuns: true), .dxmt)+ }++ func testEveryOtherModeIsLeftAsItIs() {+ for mode in Renderer.allCases where mode != .d3dmetal {+ XCTAssertNil(SteamRestart.windowRenderer(shortcut: nil, environment: mode, dxmtRuns: true), mode.rawValue)+ }+ }++ func testAModeSetOnTheSteamShortcutStands() {+ XCTAssertNil(SteamRestart.windowRenderer(shortcut: .d3dmetal, environment: .d3dmetal, dxmtRuns: true))+ XCTAssertNil(SteamRestart.windowRenderer(shortcut: .dxvk, environment: .d3dmetal, dxmtRuns: true))+ }++ func testAnEngineWithoutDXMTKeepsTheEnvironmentsMode() {+ XCTAssertNil(SteamRestart.windowRenderer(shortcut: nil, environment: .d3dmetal, dxmtRuns: false))+ }+}