Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
fix(reports): name the engine of the last run that was not aborted
raymondchinsd68c0f5249c9
diff --git a/app/Sources/BridgeplayApp/Model/GameReport.swift b/app/Sources/BridgeplayApp/Model/GameReport.swiftindex bade5b7..1166f0c 100644--- a/app/Sources/BridgeplayApp/Model/GameReport.swift+++ b/app/Sources/BridgeplayApp/Model/GameReport.swift@@ -55,18 +55,38 @@ enum GameReport {// The engine and backend of the most recent launch in bridgeplay-run.log:// runner: build winecx-11.17 (WineCX 11.17 (msync, D3DMetal)) at /…// graphics: backend=d3dmetal (carried over from the last launch)+ // A run aborted before launch (another tool picked to try a fix, refused by the prefix+ // check) never ran the game, so it does not replace the run before it. A log of nothing+ // but aborted runs still names what was tried.static func lastLaunch(in log: String) -> (engine: String?, backend: String?) {var engine: String?, backend: String?+ var run: (engine: String?, backend: String?) = (nil, nil)+ var aborted = false+ var tried: (engine: String?, backend: String?) = (nil, nil)+ func finishRun() {+ tried = (run.engine ?? tried.engine, run.backend ?? tried.backend)+ if !aborted {+ engine = run.engine ?? engine+ backend = run.backend ?? backend+ }+ run = (nil, nil)+ aborted = false+ }for line in log.split(separator: "\n") {- if line.hasPrefix("runner: build "), let open = line.firstIndex(of: "("),+ if line.hasPrefix("=== bridgeplay run ") {+ finishRun()+ } else if line.hasPrefix("runner: build "), let open = line.firstIndex(of: "("),let close = line.range(of: ") at ", options: .backwards) {- engine = String(line[line.index(after: open)..<close.lowerBound])+ run.engine = String(line[line.index(after: open)..<close.lowerBound])} else if line.hasPrefix("graphics: backend=") {let value = line.dropFirst("graphics: backend=".count).prefix { !$0.isWhitespace }- if backends.contains(String(value)) { backend = String(value) }+ if backends.contains(String(value)) { run.backend = String(value) }+ } else if line.hasPrefix("=== aborted ") {+ aborted = true}}- return (engine, backend)+ finishRun()+ return (engine ?? tried.engine, backend ?? tried.backend)}// Reports are public. Besides the home folder, run logs carry the Steam account namediff --git a/app/Tests/BridgeplayAppTests/GameReportTests.swift b/app/Tests/BridgeplayAppTests/GameReportTests.swiftindex 739828d..90276b5 100644--- a/app/Tests/BridgeplayAppTests/GameReportTests.swift+++ b/app/Tests/BridgeplayAppTests/GameReportTests.swift@@ -29,6 +29,25 @@ struct GameReportTests {#expect(launch.backend == "d3dmetal")}+ @Test("A run aborted before launch does not replace the one that ran")+ func abortedRun() {+ let runs = """+ === bridgeplay run Thu Oct 22 09:44:35 WIB 2026 ===+ runner: build winecx-11.17 (WineCX 11.17 (msync, D3DMetal)) at /a+ graphics: backend=d3dmetal (auto-detected, the engine has D3DMetal)+ === launching (waitforexitandrun): /a/wine /g/INSIDE.exe ===+ === bridgeplay run Thu Oct 22 09:48:47 WIB 2026 ===+ runner: build winehq-11.15 (WineHQ 11.15 - Rosetta) at /b+ === prefix was last run by build winecx-11.17 and this compatibility tool runs winehq-11.15 ===+ === aborted during prefix build check (exit 1) before launch ===+ """+ let launch = GameReport.lastLaunch(in: runs)+ #expect(launch.engine == "WineCX 11.17 (msync, D3DMetal)")+ #expect(launch.backend == "d3dmetal")+ let only = GameReport.lastLaunch(in: runs.components(separatedBy: "\n").suffix(4).joined(separator: "\n"))+ #expect(only.engine == "WineHQ 11.15 - Rosetta")+ }+@Test("The copied log hides the home folder")func redaction() {let text = GameReport.redacted(log, home: "/Users/tester")