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
Opening Steam restarts a client a game started with D3DMetal whatever the environment's mode. The restart only looked at the environment: set to DXMT, with a game whose own mode or database row is D3DMetal, Play left Steam on D3DMetal and Open Steam showed that client again, where Steam's browser cannot draw and Steam answers "steamwebhelper is not responding" (highball#565 on Wine 10 r28, M1, and highball#529 on Wine 11 r26, M5 Pro). The window's mode is now the DXMT escape, else the shortcut's mode, else the environment's, and the client restarts when that is not D3DMetal and no game runs. 622 tests pass on the M4.
Gauthier Piarrette1f5d46e10057
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex 2f2e528..5bf789b 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -2693,10 +2693,10 @@ final class AppState {// a game may still be running under it.await BottleStore.preflight(runner: runner, bottle: bottle) { line in Task { @MainActor in self.appendLog(line) } }// A client a game's Play started under D3DMetal shows a black window; with no game- // running it is restarted so the window gets the mode it draws with (highball#416).+ // running it is restarted so the window gets the mode it draws with (highball#416, #565).+ let window = SteamRestart.windowMode(shortcut: pin.renderer, environment: bottle.settings.renderer,+ dxmtRuns: Renderer.dxmt.availability(in: engine) == .available)if isSteamUI(pin),- let window = SteamRestart.windowRenderer(shortcut: pin.renderer, environment: bottle.settings.renderer,- dxmtRuns: Renderer.dxmt.availability(in: engine) == .available),let live = runner.runningSteamEnvironment(), SteamRestart.windowNeedsRestart(live: live, window: window),!runner.steamGameIsRunning() {await MainActor.run { self.appendLog("Steam was running with D3DMetal, which leaves its window black, so it restarts with \(Renderer.displayName(window))") }diff --git a/Sources/HighballKit/SteamRestart.swift b/Sources/HighballKit/SteamRestart.swiftindex 76d37bb..65ef1aa 100644--- a/Sources/HighballKit/SteamRestart.swift+++ b/Sources/HighballKit/SteamRestart.swift@@ -27,13 +27,21 @@ public enum SteamRestart {return .dxmt}+ /// The mode Steam's window opens with: DXMT in place of D3DMetal when `windowRenderer` says so,+ /// otherwise the shortcut's own mode, otherwise the environment's.+ public static func windowMode(shortcut: Renderer?, environment: Renderer, dxmtRuns: Bool) -> Renderer {+ windowRenderer(shortcut: shortcut, environment: environment, dxmtRuns: dxmtRuns) ?? shortcut ?? environment+ }+/// Whether opening Steam's window should restart the running client first: a game's Play started- /// it in a D3DMetal environment, so it runs with D3DMetal and its window is black, while the window- /// wants `window`. Show then brought back a black square that only deleting the environment- /// cleared (highball#416, Wine 11 on an M5 Pro). The caller checks that no game is running.- public static func windowNeedsRestart(live: [String: String], window: Renderer?) -> Bool {- guard let window, window != .d3dmetal else { return false }- return rendererName(ofLive: live) == Renderer.d3dmetal.rawValue+ /// it with D3DMetal, so its window is black, while the window opens with `window`. Show then+ /// brought back a black square that only deleting the environment cleared (highball#416, Wine 11+ /// on an M5 Pro). The game's mode can come from its own settings or its database row in an+ /// environment set to DXMT, so the environment's mode says nothing here: Steam's browser then+ /// answered "steamwebhelper is not responding" at every Show (highball#529, #565). The caller+ /// checks that no game is running.+ public static func windowNeedsRestart(live: [String: String], window: Renderer) -> Bool {+ window != .d3dmetal && rendererName(ofLive: live) == Renderer.d3dmetal.rawValue}/// What became of the running client before a launch.diff --git a/Tests/HighballKitTests/LaunchChecksTests.swift b/Tests/HighballKitTests/LaunchChecksTests.swiftindex 1321633..9073e7b 100644--- a/Tests/HighballKitTests/LaunchChecksTests.swift+++ b/Tests/HighballKitTests/LaunchChecksTests.swift@@ -49,7 +49,22 @@ final class LaunchChecksTests: XCTestCase {XCTAssertTrue(SteamRestart.windowNeedsRestart(live: d3dmetal, window: .dxmt))XCTAssertFalse(SteamRestart.windowNeedsRestart(live: dxmt, window: .dxmt), "already drawing")XCTAssertFalse(SteamRestart.windowNeedsRestart(live: dxvk, window: .dxmt), "not the black case")- XCTAssertFalse(SteamRestart.windowNeedsRestart(live: d3dmetal, window: nil), "the window keeps the environment's mode")+ XCTAssertFalse(SteamRestart.windowNeedsRestart(live: d3dmetal, window: .d3dmetal), "the player chose D3DMetal for the window")+ }++ /// highball#565: a DXMT environment whose game ran with D3DMetal (its own mode or its database+ /// row) left Steam on D3DMetal, and Show brought back "steamwebhelper is not responding".+ func testSteamWindowRestartsInADXMTEnvironment() {+ let engine = "/Users/x/Library/Application Support/Highball/engines/x64-sikarugir10.0_6-r28"+ let d3dmetal = ["WINEDLLPATH_PREPEND": "\(engine)/renderers/d3dmetal-tsshim/wine:\(engine)/frameworks/renderer/d3dmetal/wine"]+ let window = SteamRestart.windowMode(shortcut: nil, environment: .dxmt, dxmtRuns: true)+ XCTAssertEqual(window, .dxmt)+ XCTAssertTrue(SteamRestart.windowNeedsRestart(live: d3dmetal, window: window))+ XCTAssertEqual(SteamRestart.windowMode(shortcut: nil, environment: .d3dmetal, dxmtRuns: true), .dxmt)+ XCTAssertEqual(SteamRestart.windowMode(shortcut: nil, environment: .d3dmetal, dxmtRuns: false), .d3dmetal)+ XCTAssertEqual(SteamRestart.windowMode(shortcut: .dxvk, environment: .d3dmetal, dxmtRuns: true), .dxvk)+ XCTAssertFalse(SteamRestart.windowNeedsRestart(live: d3dmetal,+ window: SteamRestart.windowMode(shortcut: .d3dmetal, environment: .dxmt, dxmtRuns: true)))}/// highball#241, #336: winetricks started its wine processes with the environment's msync while