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 restart: a frame generation change restarts the client too
Gauthier Piarrette46fc43e07abd
diff --git a/Sources/HighballKit/SteamRestart.swift b/Sources/HighballKit/SteamRestart.swiftindex 6583cd7..acf82ab 100644--- a/Sources/HighballKit/SteamRestart.swift+++ b/Sources/HighballKit/SteamRestart.swift@@ -39,6 +39,13 @@ public enum SteamRestart {return ["steam.exe", "steamwebhelper.exe", "steamservice.exe", "steamerrorreporter.exe", "steamerrorreporter64.exe", "gameoverlayui.exe"].contains(name)}+ /// "off", or the multiplier ("2x"). Pacing, flow scale and the rest still count as a+ /// difference in `reason`; the words only name the multiplier.+ static func frameGenerationName(of env: [String: String]) -> String {+ guard let m = env["LSFGM_MULTIPLIER"], m != "1" else { return "off" }+ return "\(m)x"+ }+public static func rendererName(ofLive env: [String: String]) -> String {let dirs = (env["WINEDLLPATH_PREPEND"] ?? "").split(separator: ":").compactMap { entry -> String? inlet parts = entry.split(separator: "/")@@ -67,6 +74,13 @@ public enum SteamRestart {for (key, what) in inherited where (live[key] == "1") != (wanted[key] == "1") {reasons.append("it runs with \(what) \(live[key] == "1" ? "on" : "off") and the game wants it \(wanted[key] == "1" ? "on" : "off")")}+ // Frame generation is a family of LSFGM_ variables the shim reads when the game starts,+ // so a toggle flipped while the client runs would otherwise leave the game where the+ // client was (highball#109 follow-up). Any difference in the family restarts the client.+ let liveFrameGen = live.filter { $0.key.hasPrefix("LSFGM_") }, wantedFrameGen = wanted.filter { $0.key.hasPrefix("LSFGM_") }+ if liveFrameGen != wantedFrameGen {+ reasons.append("it runs with frame generation \(frameGenerationName(of: live)) and the game wants \(frameGenerationName(of: wanted))")+ }for key in custom.sorted() where !inherited.contains(where: { $0.0 == key }) && live[key] != wanted[key] {switch (live[key], wanted[key]) {case (nil, let want?): reasons.append("it runs without \(key)=\(want)")diff --git a/Tests/HighballKitTests/SteamRestartTests.swift b/Tests/HighballKitTests/SteamRestartTests.swiftindex e91c3ac..2dfbf89 100644--- a/Tests/HighballKitTests/SteamRestartTests.swift+++ b/Tests/HighballKitTests/SteamRestartTests.swift@@ -52,6 +52,20 @@ final class SteamRestartTests: XCTestCase {"it runs with the Metal HUD off and the game wants it on")}+ func testFrameGenerationToggledWhileTheClientRunsRestartsIt() {+ var wanted = dxvk+ wanted["LSFGM_ENV"] = "1"; wanted["LSFGM_MULTIPLIER"] = "2"; wanted["LSFGM_DLL_PATH"] = "/e/lsfg/Lossless.dll"; wanted["LSFGM_PACING_MODE"] = "vsync"+ XCTAssertEqual(SteamRestart.reason(live: dxvk, wanted: wanted, wantedRenderer: "dxvk"),+ "it runs with frame generation off and the game wants 2x")+ XCTAssertEqual(SteamRestart.reason(live: wanted, wanted: dxvk, wantedRenderer: "dxvk"),+ "it runs with frame generation 2x and the game wants off")+ XCTAssertNil(SteamRestart.reason(live: wanted, wanted: wanted, wantedRenderer: "dxvk"))+ // Same multiplier, different pacing: the shim reads it at start, so it restarts too.+ var adaptive = wanted; adaptive["LSFGM_PACING_MODE"] = "adaptive"+ XCTAssertEqual(SteamRestart.reason(live: wanted, wanted: adaptive, wantedRenderer: "dxvk"),+ "it runs with frame generation 2x and the game wants 2x")+ }+func testGLContextSwitchMissingFromAnOlderClientRestartsIt() {// 0.9.24 sets CX_FWD_COMPAT_GL_CTX on every launch; a client started by 0.9.23 lacks it.var wanted = dxvk; wanted["CX_FWD_COMPAT_GL_CTX"] = "1"