Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

fix(reports): a game that quits cleanly within a minute is asked about too

raymondchins8ac12b24fec9
diff --git a/app/Sources/BridgeplayApp/Model/GameSession.swift b/app/Sources/BridgeplayApp/Model/GameSession.swift
index 78bc665..1a88603 100644
--- a/app/Sources/BridgeplayApp/Model/GameSession.swift
+++ b/app/Sources/BridgeplayApp/Model/GameSession.swift
@@ -65,10 +65,11 @@ struct GameSession: Equatable, Sendable {
return nil
}
- // Worth asking about: ended in the last three days, and not opened and closed at once.
+ // Worth asking about: ended in the last three days. A game that quits cleanly within a
+ // minute often showed an error dialog first (SteamAPI_Init failed), so it is asked too.
func worthAsking(now: Date = Date(), wineLog: String?) -> Bool {
guard now.timeIntervalSince(ended) < 3 * 86400 else { return false }
- return (seconds ?? 60) >= 60 || crashed(wineLog: wineLog)
+ return (seconds ?? 60) >= 60 || exitStatus == 0 || crashed(wineLog: wineLog)
}
static func byHand(now: Date = Date()) -> GameSession {
diff --git a/app/Tests/BridgeplayAppTests/PlayReportsTests.swift b/app/Tests/BridgeplayAppTests/PlayReportsTests.swift
index b953f3a..def25fe 100644
--- a/app/Tests/BridgeplayAppTests/PlayReportsTests.swift
+++ b/app/Tests/BridgeplayAppTests/PlayReportsTests.swift
@@ -65,7 +65,9 @@ struct PlayReportsTests {
#expect(session(45, status: 143, steam: true).inferredStatus(wineLog: nil) == .silver)
#expect(session(45, status: 5).inferredStatus(wineLog: nil) == nil)
#expect(session(10, status: 0).inferredStatus(wineLog: nil) == nil)
- #expect(!session(0.5, status: 0).worthAsking(wineLog: nil))
+ #expect(session(0.5, status: 0).worthAsking(wineLog: nil))
+ #expect(session(0.1, status: 0).inferredStatus(wineLog: nil) == nil)
+ #expect(!session(0.5, status: 143, steam: true).worthAsking(wineLog: nil))
#expect(session(0.5, status: 5).worthAsking(wineLog: nil))
#expect(!session(60, status: 0).worthAsking(now: Date().addingTimeInterval(4 * 86400), wineLog: nil))
}
@@ -263,6 +265,20 @@ struct PlayReportsFlowTests {
#expect(updated.nudge?.prefix.appID == "10", "one card at a time, newest session first")
}
+ @Test("A game that quits cleanly within seconds is asked about once per version")
+ func quickCleanExit() throws {
+ let queue = try scratchDirectory("reports")
+ defer { try? FileManager.default.removeItem(at: queue) }
+ let (reports, _) = model("201", queue: queue)
+ let quick = found("30", minutes: 0.1, ago: 60)
+ #expect(quick.session.worthAsking(wineLog: nil))
+ reports.handle([quick])
+ #expect(reports.nudge?.prefix.appID == "30")
+ reports.dismiss()
+ reports.handle([found("30", minutes: 0.1)])
+ #expect(reports.nudges.isEmpty, "asked again in the same version")
+ }
+
@Test("A crash after a Smooth answer asks again in the same version")
func crashAfterSmooth() throws {
let queue = try scratchDirectory("reports")