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
Play records Steam's controller-recommended notice as seen before it cold-starts Steam for a D3DMetal game. A client on the D3DMetal stack cannot draw the notice, so the first launch of Forza Horizon 6 waited at ShowInterstitials for good
Gauthier Piarrette397523390e53
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex b5cfc82..553fd65 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -2160,6 +2160,15 @@ final class AppState {case .noClient, .serves:break}+ // A client on the D3DMetal stack cannot draw Steam's "controller recommended" notice, so+ // a first launch would wait on it for good. No client runs at this point when the launch+ // cold-starts one, which is when the record can be written (see SteamLaunchNotice).+ if served == .d3dmetal, runner.runningSteamEnvironment() == nil {+ let root = bottle.driveC.appending(path: "Program Files (x86)/Steam")+ if SteamLaunchNotice.markSeen(steamRoot: root, appID: game.appid) > 0 {+ await MainActor.run { self.appendLog("Recorded Steam's controller notice for \(game.name) as seen: Steam cannot show it in D3DMetal mode.") }+ }+ }let note = headerNote, servedRenderer = servedlet box = LaunchOutcome()let log = logLine(box)diff --git a/Sources/HighballKit/SteamLaunchNotice.swift b/Sources/HighballKit/SteamLaunchNotice.swiftnew file mode 100644index 0000000..5a7880d--- /dev/null+++ b/Sources/HighballKit/SteamLaunchNotice.swift@@ -0,0 +1,84 @@+import Foundation++/// Steam's "controller recommended" notice, which a D3DMetal launch cannot show.+///+/// Before the first start of a game tagged "gamepad recommended", Steam's launch stops at+/// `ShowInterstitials` and its web UI draws a notice saying a controller is recommended. Once it+/// has been shown, the web UI records the game in its storage, which Steam keeps in the user's+/// `localconfig.vdf` under `UserLocalConfigStore/WebStorage`:+///+/// "Deck_ConfiguratorInterstitialsVersionSeen_GamepadRecommended" "1"+/// "Deck_ConfiguratorInterstitialsCheckbox_GamepadRecommended" "0"+/// "Deck_ConfiguratorInterstitialApps_GamepadRecommended" "[2483190]"+///+/// and never stops that game's launch for it again. A client started with the D3DMetal stack+/// cannot draw the notice (its browser helpers fail to present under D3DMetal, and on D3DMetal 4+/// they die on `setDisplaySyncEnabled:`), so the launch waits on a dialog that never appears.+/// Forza Horizon 6 stood at `ShowInterstitials` for good on its first Play in a fresh+/// environment on an M4 (2026-10-05); with these three values written first, Steam answered+/// itself within a second and started the game.+///+/// The notice only informs, and the player cannot see it in that mode anyway, so recording it+/// as seen before a D3DMetal launch takes nothing away. Steam keeps the file in memory while it+/// runs and writes it back on exit, so this has to happen while no client runs: the caller+/// does it right before a cold start.+public enum SteamLaunchNotice {+ static let appsKey = "Deck_ConfiguratorInterstitialApps_GamepadRecommended"+ static let fixedKeys = [("Deck_ConfiguratorInterstitialsVersionSeen_GamepadRecommended", "1"),+ ("Deck_ConfiguratorInterstitialsCheckbox_GamepadRecommended", "0")]++ /// Pure: the text of a `localconfig.vdf` with the notice recorded as seen for `appID`, or nil+ /// when nothing needs to change or the file has no `WebStorage` block to put it in (a client+ /// that has never shown its web UI; nothing is invented then).+ public static func markingSeen(in text: String, appID: Int) -> String? {+ let crlf = text.contains("\r\n")+ var lines = text.replacingOccurrences(of: "\r\n", with: "\n").components(separatedBy: "\n")+ func depth(_ l: String) -> Int { l.prefix { $0 == "\t" }.count }+ guard let ws = lines.indices.first(where: { lines[$0].trimmingCharacters(in: .whitespaces) == "\"WebStorage\"" && depth(lines[$0]) == 1 }),+ ws + 1 < lines.count, lines[ws + 1].trimmingCharacters(in: .whitespaces) == "{",+ var end = lines.indices.first(where: { $0 > ws + 1 && depth(lines[$0]) == 1 && lines[$0].trimmingCharacters(in: .whitespaces) == "}" })+ else { return nil }+ func pair(_ l: String) -> (key: String, value: String)? {+ let parts = l.trimmingCharacters(in: .whitespaces).components(separatedBy: "\"")+ guard parts.count >= 5, parts[0].isEmpty else { return nil }+ return (parts[1], parts[3])+ }+ func line(_ key: String, _ value: String) -> String { "\t\t\"\(key)\"\t\t\"\(value)\"" }+ var changed = false+ if let i = (ws + 2..<end).first(where: { pair(lines[$0])?.key == appsKey }) {+ let current = pair(lines[i])?.value ?? "[]"+ var apps = (try? JSONDecoder().decode([Int].self, from: Data(current.utf8))) ?? []+ if !apps.contains(appID) {+ apps.append(appID)+ lines[i] = line(appsKey, "[" + apps.map(String.init).joined(separator: ",") + "]")+ changed = true+ }+ } else {+ lines.insert(line(appsKey, "[\(appID)]"), at: end); end += 1; changed = true+ }+ for (key, value) in fixedKeys where !(ws + 2..<end).contains(where: { pair(lines[$0])?.key == key }) {+ lines.insert(line(key, value), at: end); end += 1; changed = true+ }+ guard changed else { return nil }+ let joined = lines.joined(separator: "\n")+ return crlf ? joined.replacingOccurrences(of: "\n", with: "\r\n") : joined+ }++ /// Records the notice as seen for `appID` in every Steam user's `localconfig.vdf` under+ /// `steamRoot`. Call it only while no Steam client runs in the environment. Returns how many+ /// files changed.+ @discardableResult+ public static func markSeen(steamRoot: URL, appID: Int) -> Int {+ let userdata = steamRoot.appending(path: "userdata")+ let users = (try? FileManager.default.contentsOfDirectory(at: userdata, includingPropertiesForKeys: nil)) ?? []+ var count = 0+ for user in users {+ let file = user.appending(path: "config/localconfig.vdf")+ guard let text = try? String(contentsOf: file, encoding: .utf8),+ let updated = markingSeen(in: text, appID: appID),+ (try? updated.write(to: file, atomically: true, encoding: .utf8)) != nil else { continue }+ count += 1+ }+ return count+ }+}diff --git a/Tests/HighballKitTests/SteamLaunchNoticeTests.swift b/Tests/HighballKitTests/SteamLaunchNoticeTests.swiftnew file mode 100644index 0000000..cebe6d6--- /dev/null+++ b/Tests/HighballKitTests/SteamLaunchNoticeTests.swift@@ -0,0 +1,67 @@+import XCTest+@testable import HighballKit++/// Steam's "controller recommended" notice is recorded as seen before a D3DMetal launch, the way+/// Steam's own web UI records it, and nothing else in the file moves.+final class SteamLaunchNoticeTests: XCTestCase {+ private let base = """+ "UserLocalConfigStore"+ {+ \t"Software"+ \t{+ \t\t"Valve"+ \t\t{+ \t\t}+ \t}+ \t"WebStorage"+ \t{+ \t\t"SomethingElse"\t\t"1"+ \t}+ \t"friends"+ \t{+ \t}+ }+ """++ func testAFirstGameAddsTheThreeValuesInsideWebStorage() throws {+ let out = try XCTUnwrap(SteamLaunchNotice.markingSeen(in: base, appID: 2483190))+ let lines = out.components(separatedBy: "\n")+ let ws = try XCTUnwrap(lines.firstIndex(of: "\t\"WebStorage\""))+ let close = try XCTUnwrap(lines[ws...].firstIndex(of: "\t}"))+ let block = lines[ws..<close].joined(separator: "\n")+ XCTAssertTrue(block.contains("\t\t\"Deck_ConfiguratorInterstitialApps_GamepadRecommended\"\t\t\"[2483190]\""))+ XCTAssertTrue(block.contains("\"Deck_ConfiguratorInterstitialsVersionSeen_GamepadRecommended\"\t\t\"1\""))+ XCTAssertTrue(block.contains("\"Deck_ConfiguratorInterstitialsCheckbox_GamepadRecommended\"\t\t\"0\""))+ XCTAssertTrue(block.contains("\"SomethingElse\""), "the block's own values stay")+ XCTAssertEqual(lines.count, base.components(separatedBy: "\n").count + 3, "three lines added, nothing removed")+ XCTAssertTrue(out.hasSuffix("\t\"friends\"\n\t{\n\t}\n}"), "what follows the block is untouched")+ }++ func testASecondGameJoinsTheListAndAGameAlreadyThereChangesNothing() throws {+ let first = try XCTUnwrap(SteamLaunchNotice.markingSeen(in: base, appID: 2483190))+ XCTAssertNil(SteamLaunchNotice.markingSeen(in: first, appID: 2483190), "already recorded")+ let second = try XCTUnwrap(SteamLaunchNotice.markingSeen(in: first, appID: 1551360))+ XCTAssertTrue(second.contains("\"Deck_ConfiguratorInterstitialApps_GamepadRecommended\"\t\t\"[2483190,1551360]\""))+ XCTAssertEqual(second.components(separatedBy: "VersionSeen").count, 2, "the fixed values are not added twice")+ }++ func testWindowsLineEndingsSurviveAndNoWebStorageMeansNoEdit() throws {+ let crlf = base.replacingOccurrences(of: "\n", with: "\r\n")+ let out = try XCTUnwrap(SteamLaunchNotice.markingSeen(in: crlf, appID: 7))+ XCTAssertFalse(out.replacingOccurrences(of: "\r\n", with: "").contains("\n"), "every line ends with CRLF again")+ let noStorage = "\"UserLocalConfigStore\"\n{\n\t\"friends\"\n\t{\n\t}\n}"+ XCTAssertNil(SteamLaunchNotice.markingSeen(in: noStorage, appID: 7), "nothing is invented in a file without the block")+ }++ func testEveryUserFileUnderTheSteamFolderIsMarked() throws {+ let root = FileManager.default.temporaryDirectory.appending(path: "steam-notice-\(UUID().uuidString)")+ defer { try? FileManager.default.removeItem(at: root) }+ for user in ["111", "222"] {+ let dir = root.appending(path: "userdata/\(user)/config")+ try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)+ try base.write(to: dir.appending(path: "localconfig.vdf"), atomically: true, encoding: .utf8)+ }+ XCTAssertEqual(SteamLaunchNotice.markSeen(steamRoot: root, appID: 2483190), 2)+ XCTAssertEqual(SteamLaunchNotice.markSeen(steamRoot: root, appID: 2483190), 0, "a second call finds it done")+ }+}