Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

play report: send the environment's settings along, only what was set away from default (#159)

Gauthier Piarretted2e1e0784bf8
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 3694782..a1582d4 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -1339,9 +1339,12 @@ final class AppState {
// one: two of three app-sent reports on 2026-09-13 arrived with the mode empty.
let renderer = record.renderer ?? bottle?.settings.renderer.rawValue
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "dev"
+ // The environment's settings go along (highball#159): a pinned program adds its own.
+ let pin = bottle?.settings.pins.first { $0.name == record.title }
+ let settings = bottle.map { PlayReport.settingsSummary($0.settings, pin: pin) }
NSWorkspace.shared.open(PlayReport.url(title: record.title, appid: record.appid, renderer: renderer,
chip: Machine.chip(), macos: Machine.macOSVersion(), engine: engine,
- minutes: record.seconds / 60, version: version))
+ minutes: record.seconds / 60, version: version, settings: settings))
postPlay = nil
}
diff --git a/Sources/HighballKit/PlayReport.swift b/Sources/HighballKit/PlayReport.swift
index 81f63eb..d3ee301 100644
--- a/Sources/HighballKit/PlayReport.swift
+++ b/Sources/HighballKit/PlayReport.swift
@@ -21,13 +21,14 @@ public enum PlayReport {
/// The issue URL for highball-db's report form, its fields prefilled by id. Query items use
/// the form's field ids, which GitHub reads into the matching inputs.
public static func url(title: String, appid: Int?, renderer: String?, chip: String, macos: String,
- engine: String, minutes: Int, version: String? = nil) -> URL {
+ engine: String, minutes: Int, version: String? = nil, settings: String? = nil) -> URL {
var comps = URLComponents(string: "https://github.com/gauthierpiarrette/highball-db/issues/new")!
var items = [URLQueryItem(name: "template", value: template),
URLQueryItem(name: "title", value: title)]
if let appid { items.append(URLQueryItem(name: "steam_appid", value: String(appid))) }
if let renderer { items.append(URLQueryItem(name: "renderer", value: renderer)) }
if let version { items.append(URLQueryItem(name: "version", value: version)) }
+ if let settings, !settings.isEmpty { items.append(URLQueryItem(name: "settings", value: settings)) }
items += [URLQueryItem(name: "chip", value: chip),
URLQueryItem(name: "macos", value: macos),
URLQueryItem(name: "engine", value: engine),
@@ -35,4 +36,39 @@ public enum PlayReport {
comps.queryItems = items
return comps.url!
}
+
+ /// The settings that shaped the session, one per line, for the form's "Environment settings"
+ /// field: the environment's mode, sync, Windows version and scale, then everything set away
+ /// from its default (HUD, frame cap, frame generation, DLL overrides, extra variables, per-app
+ /// DXVK options, recipes) and the program's own mode, arguments and variables when it has
+ /// them. Defaults stay out so a reader sees what was chosen (highball#159 asked for every
+ /// setting; a setting at its default says nothing about the run).
+ public static func settingsSummary(_ s: BottleSettings, pin: Pin? = nil) -> String {
+ var lines = ["mode \(s.renderer.rawValue), sync \(s.sync.rawValue), Windows \(s.windowsVersion.rawValue), scale \(s.dpiScale) dpi"]
+ if s.metalHUD { lines.append("Metal HUD on") }
+ if s.dxvkAsync { lines.append("DXVK async shader compilation on") }
+ if s.advertiseAVX { lines.append("AVX advertised") }
+ if s.fpsCap > 0 { lines.append("frame cap \(s.fpsCap)") }
+ if s.frameGen > 1 {
+ var fg = "frame generation \(s.frameGen)x"
+ if s.frameGenAdaptive { fg += ", adaptive" }
+ if s.frameGenFlowScale != 100 { fg += ", flow \(s.frameGenFlowScale)%" }
+ if s.frameGenPerformance { fg += ", performance" }
+ if !s.frameGenForceVsync { fg += ", vsync off" }
+ lines.append(fg)
+ }
+ if !s.commandIsControl { lines.append("Command keys left as Alt") }
+ if !s.dllOverrides.isEmpty { lines.append("DLL overrides \(s.dllOverrides)") }
+ for (k, v) in s.environment.sorted(by: { $0.key < $1.key }) { lines.append("\(k)=\(v)") }
+ for (exe, opts) in s.dxvkAppConfig.sorted(by: { $0.key < $1.key }) {
+ lines.append("dxvk.conf [\(exe)] " + opts.sorted { $0.key < $1.key }.map { "\($0.key)=\($0.value)" }.joined(separator: " "))
+ }
+ if !s.recipes.isEmpty { lines.append("recipes \(s.recipes.joined(separator: ", "))") }
+ if let pin {
+ if let r = pin.renderer { lines.append("program mode \(r.rawValue)") }
+ if !pin.arguments.isEmpty { lines.append("program arguments \(pin.arguments.joined(separator: " "))") }
+ for (k, v) in pin.environment.sorted(by: { $0.key < $1.key }) { lines.append("program \(k)=\(v)") }
+ }
+ return lines.joined(separator: "\n")
+ }
}
diff --git a/Tests/HighballKitTests/PlayReportTests.swift b/Tests/HighballKitTests/PlayReportTests.swift
index 432c5ea..ffd7f2f 100644
--- a/Tests/HighballKitTests/PlayReportTests.swift
+++ b/Tests/HighballKitTests/PlayReportTests.swift
@@ -28,6 +28,31 @@ final class PlayReportTests: XCTestCase {
XCTAssertFalse(names.contains("renderer"))
}
+ func testSettingsSummaryListsWhatWasChosen() {
+ var s = BottleSettings(name: "Gaming", engineID: "e")
+ XCTAssertEqual(PlayReport.settingsSummary(s), "mode dxmt, sync msync, Windows win10, scale 96 dpi",
+ "defaults say nothing about the run, so only the always-on line remains")
+ s.fpsCap = 60; s.frameGen = 2; s.frameGenAdaptive = true; s.metalHUD = true
+ s.environment = ["DXMT_ALLOW_CROSS_PROCESS_SWAPCHAIN": "1"]
+ s.dxvkAppConfig = ["csgo.exe": ["d3d9.customDeviceId": "73BF"]]
+ s.recipes = ["steam"]
+ let pin = Pin(name: "Skyrim", path: "x.exe", arguments: ["-dx11"], environment: ["A": "b"], renderer: .d3dmetal)
+ let lines = PlayReport.settingsSummary(s, pin: pin).split(separator: "\n").map(String.init)
+ XCTAssertEqual(lines, ["mode dxmt, sync msync, Windows win10, scale 96 dpi", "Metal HUD on", "frame cap 60",
+ "frame generation 2x, adaptive", "DXMT_ALLOW_CROSS_PROCESS_SWAPCHAIN=1",
+ "dxvk.conf [csgo.exe] d3d9.customDeviceId=73BF", "recipes steam",
+ "program mode d3dmetal", "program arguments -dx11", "program A=b"])
+ }
+
+ func testSettingsReachTheForm() throws {
+ let url = PlayReport.url(title: "X", appid: nil, renderer: nil, chip: "c", macos: "m", engine: "e", minutes: 1,
+ settings: "frame cap 60\nMetal HUD on")
+ let q = Dictionary(uniqueKeysWithValues: (URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems ?? []).map { ($0.name, $0.value ?? "") })
+ XCTAssertEqual(q["settings"], "frame cap 60\nMetal HUD on")
+ let bare = PlayReport.url(title: "X", appid: nil, renderer: nil, chip: "c", macos: "m", engine: "e", minutes: 1, settings: "")
+ XCTAssertFalse(URLComponents(url: bare, resolvingAgainstBaseURL: false)?.queryItems?.contains { $0.name == "settings" } ?? true)
+ }
+
func testSessionRecordWithoutRendererStillDecodes() throws {
let old = Data(#"{"title":"T","bottle":"B","appid":1,"started":0,"ended":120,"reason":"ended"}"#.utf8)
let r = try JSONDecoder().decode(SessionRecord.self, from: old)