Skip to content

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

feat(reports): optional note after Has issues or Didn't run, send display and Low Power setup

raymondchinsf2ffd1ee7eba
diff --git a/app/Sources/BridgeplayApp/Model/GameReport.swift b/app/Sources/BridgeplayApp/Model/GameReport.swift
index d4f8d23..bade5b7 100644
--- a/app/Sources/BridgeplayApp/Model/GameReport.swift
+++ b/app/Sources/BridgeplayApp/Model/GameReport.swift
@@ -1,4 +1,4 @@
-import Foundation
+import AppKit
import SystemConfiguration
// What a compatibility report says about this Mac and the game's last launch, and the
@@ -18,6 +18,7 @@ enum GameReport {
var memoryBytes: UInt64
var macOS: String
var bridgeplay: String
+ var setup: [String: String] = [:]
}
static var thisMac: Machine {
@@ -26,6 +27,20 @@ enum GameReport {
bridgeplay: ProductVersion.build.map { "\(ProductVersion.short) (\($0))" } ?? ProductVersion.short)
}
+ // Facts about the Mac when the report is made, which is soon after the game ran:
+ // displays: "2: built-in 3456x2234 120 Hz, 2560x1440 60 Hz", lowPower: "on"/"off".
+ @MainActor static func setup() -> [String: String] {
+ let screens = NSScreen.screens.map { screen -> String in
+ let pixels = screen.convertRectToBacking(screen.frame).size
+ let id = screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as? CGDirectDisplayID
+ let builtIn = id.map { CGDisplayIsBuiltin($0) != 0 } ?? false
+ return "\(builtIn ? "built-in " : "")\(Int(pixels.width))x\(Int(pixels.height)) \(screen.maximumFramesPerSecond) Hz"
+ }
+ var setup = ["lowPower": ProcessInfo.processInfo.isLowPowerModeEnabled ? "on" : "off"]
+ if !screens.isEmpty { setup["displays"] = "\(screens.count): " + screens.joined(separator: ", ") }
+ return setup
+ }
+
// "Apple M5 Max" → "M5 Max"; a chip the form doesn't list is "Other".
static func chip(_ brand: String) -> String {
let name = brand.replacingOccurrences(of: "Apple ", with: "").trimmingCharacters(in: .whitespaces)
diff --git a/app/Sources/BridgeplayApp/Model/PlayReports.swift b/app/Sources/BridgeplayApp/Model/PlayReports.swift
index 1bd03a7..c2bd70d 100644
--- a/app/Sources/BridgeplayApp/Model/PlayReports.swift
+++ b/app/Sources/BridgeplayApp/Model/PlayReports.swift
@@ -20,6 +20,10 @@ struct ReportPayload: Codable, Equatable, Sendable {
var engine: String?
var backend: String?
var session: String
+ // What the player wrote after Has Issues or Didn't Run, and a few facts about the Mac
+ // (GameReport.setup). Older endpoints ignore both.
+ var note: String?
+ var setup: [String: String]?
var log: String?
var wineLog: String?
@@ -28,7 +32,8 @@ struct ReportPayload: Codable, Equatable, Sendable {
static let wineLogLimit = 350_000
static func make(name: String, appID: String, status: ReportStatus, source: Source, session: GameSession,
- log: String?, wineLog: String?, machine: GameReport.Machine, install: String) -> ReportPayload {
+ log: String?, wineLog: String?, machine: GameReport.Machine, install: String,
+ note: String? = nil) -> ReportPayload {
let launch: (engine: String?, backend: String?) = log.map(GameReport.lastLaunch) ?? (nil, nil)
var summary = session.summary(wineLog: wineLog)
if source == .auto { summary += ". Status inferred from the log" }
@@ -37,6 +42,8 @@ struct ReportPayload: Codable, Equatable, Sendable {
chip: GameReport.chip(machine.chip), memory: GameReport.memory(machine.memoryBytes),
macos: machine.macOS, version: machine.bridgeplay, engine: launch.engine, backend: launch.backend,
session: summary,
+ note: note.map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }.flatMap { $0.isEmpty ? nil : String($0.prefix(1000)) },
+ setup: machine.setup.isEmpty ? nil : machine.setup,
log: log.map { String(GameReport.redacted($0).suffix(logLimit)) },
wineLog: wineLog.map { String(GameReport.redacted($0).suffix(wineLogLimit)) })
}
@@ -131,7 +138,7 @@ final class PlayReports {
// What the consent sheet is for: one answer, several from Report Your Games…, or
// turning auto-share on.
- enum ConsentRequest: Equatable { case answer(ReportStatus), bulk([String], ReportStatus), autoShare }
+ enum ConsentRequest: Equatable { case answer(ReportStatus, note: String?), bulk([String], ReportStatus), autoShare }
private(set) var nudges: [Nudge] = []
var consentRequest: ConsentRequest?
@@ -233,15 +240,15 @@ final class PlayReports {
}
// The player picked an answer on the card; the first one asks for consent.
- func answer(_ status: ReportStatus) {
+ func answer(_ status: ReportStatus, note: String? = nil) {
guard let nudge else { return }
guard hasConsent else {
- consentRequest = .answer(status)
+ consentRequest = .answer(status, note: note)
return
}
advance(past: nudge)
recordAsked(nudge.prefix.appID, answer: status)
- send(nudge, status: status, source: .tap)
+ send(nudge, status: status, source: .tap, note: note)
thanksGeneration += 1
let generation = thanksGeneration
thanking = true
@@ -256,7 +263,7 @@ final class PlayReports {
let request = consentRequest
consentRequest = nil
if alsoAutoShare || request == .autoShare { setAutoShare(true) }
- if case .answer(let status) = request { answer(status) }
+ if case .answer(let status, let note) = request { answer(status, note: note) }
if case .bulk(let appIDs, let status) = request { answerBulk(appIDs, status) }
}
@@ -398,14 +405,15 @@ final class PlayReports {
}
}
- private func send(_ nudge: Nudge, status: ReportStatus, source: ReportPayload.Source) {
+ private func send(_ nudge: Nudge, status: ReportStatus, source: ReportPayload.Source, note: String? = nil) {
let prefix = nudge.prefix, session = nudge.session
Task {
let logs = await Task.detached {
(try? String(contentsOf: PrefixLog.launch.url(for: prefix), encoding: .utf8),
try? String(contentsOf: PrefixLog.wine.url(for: prefix), encoding: .utf8))
}.value
- submit(Found(prefix: prefix, session: session, log: logs.0 ?? "", wineLog: logs.1), status: status, source: source)
+ submitAll([(Found(prefix: prefix, session: session, log: logs.0 ?? "", wineLog: logs.1), status)],
+ source: source, note: note)
}
}
@@ -415,13 +423,16 @@ final class PlayReports {
// Redacting a large log takes a moment, so payloads are built off the main thread, and
// sent one after another so a batch stays within the endpoint's rate limits.
- private func submitAll(_ items: [(Found, ReportStatus)], source: ReportPayload.Source) {
- let sender = sender(), machine = GameReport.thisMac, install = installID
+ private func submitAll(_ items: [(Found, ReportStatus)], source: ReportPayload.Source, note: String? = nil) {
+ var machine = GameReport.thisMac
+ machine.setup = GameReport.setup()
+ let sender = sender(), install = installID
Task.detached {
for (item, status) in items {
let payload = ReportPayload.make(
name: item.prefix.title, appID: item.prefix.appID, status: status, source: source, session: item.session,
- log: item.log.isEmpty ? nil : item.log, wineLog: item.wineLog, machine: machine, install: install)
+ log: item.log.isEmpty ? nil : item.log, wineLog: item.wineLog, machine: machine, install: install,
+ note: note)
let outcome = await sender.submit(payload)
AppLog.note("play report: \(payload.appid) \(payload.status.rawValue) (\(payload.source.rawValue)): \(outcome)")
}
diff --git a/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings b/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings
index ab46264..4bea1ff 100644
--- a/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings
+++ b/app/Sources/BridgeplayApp/Resources/Localization/Localizable.xcstrings
@@ -4194,6 +4194,22 @@
}
}
},
+ "For example: no sound, crashes when a level loads" : {
+ "localizations" : {
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Per esempio: niente audio, si chiude quando carica un livello"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "例如:没有声音,加载关卡时崩溃"
+ }
+ }
+ }
+ },
"Frame Generation (Experimental. Adds input lag)" : {
"localizations" : {
"it" : {
@@ -6994,18 +7010,18 @@
}
}
},
- "Reports are posted publicly in Bridgeplay's GitHub Discussions and counted on the compatibility list. Each one has the game, how it ran, your Mac's chip and memory, the macOS and Bridgeplay versions, the engine and backend, and the game's logs. Your home folder, user and computer names, Steam account name, Steam ID and email addresses are removed from the logs first. You don't need a GitHub account." : {
+ "Reports are posted publicly in Bridgeplay's GitHub Discussions and counted on the compatibility list. Each one has the game, how it ran, anything you write about it, your Mac's chip, memory and displays, the macOS and Bridgeplay versions, the engine and backend, and the game's logs. Your home folder, user and computer names, Steam account name, Steam ID and email addresses are removed from the logs first. You don't need a GitHub account." : {
"localizations" : {
"it" : {
"stringUnit" : {
"state" : "translated",
- "value" : "I report vengono pubblicati nelle GitHub Discussions di Bridgeplay e contati nell'elenco di compatibilità. Ognuno contiene il gioco, come è andato, chip e memoria del Mac, le versioni di macOS e Bridgeplay, motore e backend, e i log del gioco. Prima dell'invio vengono rimossi dai log la cartella Inizio, i nomi utente e computer, il nome dell'account Steam, lo Steam ID e gli indirizzi email. Non serve un account GitHub."
+ "value" : "I report vengono pubblicati nelle GitHub Discussions di Bridgeplay e contati nell'elenco di compatibilità. Ognuno contiene il gioco, come è andato, quello che scrivi al riguardo, chip, memoria e schermi del Mac, le versioni di macOS e Bridgeplay, motore e backend, e i log del gioco. Prima dell'invio vengono rimossi dai log la cartella Inizio, i nomi utente e computer, il nome dell'account Steam, lo Steam ID e gli indirizzi email. Non serve un account GitHub."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "报告会公开发布到 Bridgeplay 的 GitHub Discussions,并计入兼容性列表。每份报告包含游戏、运行情况、Mac 的芯片和内存、macOS 和 Bridgeplay 版本、引擎和后端,以及游戏日志。发送前会从日志中移除你的个人文件夹、用户名和电脑名称、Steam 账户名称、Steam ID 和电子邮件地址。不需要 GitHub 账户。"
+ "value" : "报告会公开发布到 Bridgeplay 的 GitHub Discussions,并计入兼容性列表。每份报告包含游戏、运行情况、你对此写下的说明、Mac 的芯片、内存和显示器、macOS 和 Bridgeplay 版本、引擎和后端,以及游戏日志。发送前会从日志中移除你的个人文件夹、用户名和电脑名称、Steam 账户名称、Steam ID 和电子邮件地址。不需要 GitHub 账户。"
}
}
}
@@ -7362,6 +7378,22 @@
}
}
},
+ "Send" : {
+ "localizations" : {
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Invia"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "发送"
+ }
+ }
+ }
+ },
"Set Up" : {
"localizations" : {
"it" : {
@@ -9797,6 +9829,22 @@
}
}
},
+ "What went wrong? Optional, and public with the report." : {
+ "localizations" : {
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cosa non ha funzionato? Facoltativo, e pubblico insieme al report."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "哪里出了问题?可不填,会随报告公开。"
+ }
+ }
+ }
+ },
"When motion is too fast to track, shows the nearest real frame instead of a smeared one." : {
"localizations" : {
"it" : {
diff --git a/app/Sources/BridgeplayApp/Views/PlayReportCard.swift b/app/Sources/BridgeplayApp/Views/PlayReportCard.swift
index 70b5f31..0f1e675 100644
--- a/app/Sources/BridgeplayApp/Views/PlayReportCard.swift
+++ b/app/Sources/BridgeplayApp/Views/PlayReportCard.swift
@@ -1,11 +1,52 @@
import SwiftUI
-// Asks how the last game session ran. One tap on an answer sends the report.
+// Asks how the last game session ran. Smooth sends at once; Has Issues and Didn't Run first
+// offer an optional note on what went wrong.
struct PlayReportCard: View {
let nudge: PlayReports.Nudge
+ @State private var pending: ReportStatus?
+ @State private var note = ""
private var reports: PlayReports { .shared }
var body: some View {
+ Group {
+ if let pending { noteRow(pending) } else { answerRow }
+ }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 10)
+ .background(.bar)
+ .overlay(alignment: .top) { Divider() }
+ .onChange(of: nudge.id) {
+ pending = nil
+ note = ""
+ }
+ }
+
+ private func noteRow(_ status: ReportStatus) -> some View {
+ HStack(alignment: .center, spacing: 12) {
+ Image(systemName: "text.bubble.fill")
+ .foregroundStyle(BP.blue)
+ .accessibilityHidden(true)
+ VStack(alignment: .leading, spacing: 4) {
+ Text("What went wrong? Optional, and public with the report.").font(BP.sans(13, .semibold))
+ TextField("For example: no sound, crashes when a level loads", text: $note)
+ .textFieldStyle(.roundedBorder)
+ .onSubmit { send(status) }
+ }
+ Spacer(minLength: 12)
+ Button("Back") { pending = nil }
+ Button("Send") { send(status) }
+ .buttonStyle(.borderedProminent)
+ }
+ }
+
+ private func send(_ status: ReportStatus) {
+ reports.answer(status, note: note)
+ pending = nil
+ note = ""
+ }
+
+ private var answerRow: some View {
HStack(alignment: .center, spacing: 12) {
Image(systemName: "gamecontroller.fill")
.foregroundStyle(BP.blue)
@@ -21,8 +62,8 @@ struct PlayReportCard: View {
Spacer(minLength: 12)
Button("Smooth") { reports.answer(.platinum) }
.buttonStyle(.borderedProminent)
- Button("Has issues") { reports.answer(.bronze) }
- Button("Didn't run") { reports.answer(.borked) }
+ Button("Has issues") { pending = .bronze }
+ Button("Didn't run") { pending = .borked }
// A click is Not Now; the menu also offers never asking about this game.
Menu {
Button("Not Now") { reports.dismiss() }
@@ -40,10 +81,6 @@ struct PlayReportCard: View {
.help("Not Now")
.accessibilityLabel("Not Now")
}
- .padding(.horizontal, 16)
- .padding(.vertical, 10)
- .background(.bar)
- .overlay(alignment: .top) { Divider() }
}
private var question: String {
@@ -83,7 +120,7 @@ struct PlayReportConsent: View {
VStack(alignment: .leading, spacing: 14) {
Text("Share how your games run?")
.font(BP.sans(17, .semibold))
- Text("Reports are posted publicly in Bridgeplay's GitHub Discussions and counted on the compatibility list. Each one has the game, how it ran, your Mac's chip and memory, the macOS and Bridgeplay versions, the engine and backend, and the game's logs. Your home folder, user and computer names, Steam account name, Steam ID and email addresses are removed from the logs first. You don't need a GitHub account.")
+ Text("Reports are posted publicly in Bridgeplay's GitHub Discussions and counted on the compatibility list. Each one has the game, how it ran, anything you write about it, your Mac's chip, memory and displays, the macOS and Bridgeplay versions, the engine and backend, and the game's logs. Your home folder, user and computer names, Steam account name, Steam ID and email addresses are removed from the logs first. You don't need a GitHub account.")
.foregroundStyle(BP.fg2)
.fixedSize(horizontal: false, vertical: true)
if reports.consentRequest != .autoShare {
diff --git a/app/Tests/BridgeplayAppTests/PlayReportsTests.swift b/app/Tests/BridgeplayAppTests/PlayReportsTests.swift
index 7800da9..b953f3a 100644
--- a/app/Tests/BridgeplayAppTests/PlayReportsTests.swift
+++ b/app/Tests/BridgeplayAppTests/PlayReportsTests.swift
@@ -89,6 +89,23 @@ struct PlayReportsTests {
let json = try JSONSerialization.jsonObject(with: JSONEncoder().encode(payload)) as? [String: Any]
#expect(json?["status"] as? String == "silver")
#expect(json?["source"] as? String == "auto")
+ #expect(json?["note"] == nil && json?["setup"] == nil, "absent, not null, for older endpoints")
+ }
+
+ @Test("The payload carries the player's note and the Mac's setup")
+ func payloadNoteAndSetup() {
+ var machine = GameReport.Machine(chip: "Apple M4", memoryBytes: 16 * 1_073_741_824,
+ macOS: "macOS 27.0", bridgeplay: "3.4.1 (42)")
+ machine.setup = ["lowPower": "off", "displays": "1: built-in 3024x1964 120 Hz"]
+ let make = { (note: String?) in
+ ReportPayload.make(name: "MGSV", appID: "287700", status: .bronze, source: .tap, session: .byHand(),
+ log: nil, wineLog: nil, machine: machine, install: "0F8FAD5B-D9CB-469F-A165-70867728950E",
+ note: note)
+ }
+ #expect(make(" no sound in cutscenes \n").note == "no sound in cutscenes")
+ #expect(make(" ").note == nil)
+ #expect(make(String(repeating: "x", count: 3000)).note?.count == 1000)
+ #expect(make(nil).setup?["lowPower"] == "off")
}
}
@@ -203,7 +220,7 @@ struct PlayReportsFlowTests {
reports.handle([found("10", minutes: 90), found("20", minutes: 20)])
#expect(reports.nudges.count == 2)
reports.answer(.platinum)
- #expect(reports.consentRequest == .answer(.platinum))
+ #expect(reports.consentRequest == .answer(.platinum, note: nil))
#expect(reports.nudges.count == 2, "nothing is sent before consent")
reports.consentRequest = nil
reports.dismiss()
@@ -218,7 +235,8 @@ struct PlayReportsFlowTests {
defer { try? FileManager.default.removeItem(at: queue) }
let (reports, _) = model("201", queue: queue)
reports.handle([found("10", minutes: 90)])
- reports.answer(.bronze)
+ reports.answer(.bronze, note: "no sound")
+ #expect(reports.consentRequest == .answer(.bronze, note: "no sound"), "the note waits for consent")
reports.consent(alsoAutoShare: false)
#expect(reports.nudges.isEmpty)
#expect(reports.thanking)