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
Map Palatino Linotype to the Mac Palatino face in every bottle.
Nathan Pierce051f37e6b723
diff --git a/Sources/HighballKit/WineRunner.swift b/Sources/HighballKit/WineRunner.swiftindex 75621a3..ed4212f 100644--- a/Sources/HighballKit/WineRunner.swift+++ b/Sources/HighballKit/WineRunner.swift@@ -11,6 +11,26 @@ public struct LaunchResult: Sendable {public var crashedEarly: Bool { duration < 10 && exitStatus != 0 }}+/// Windows face names that macOS installs under a different family name. GDI+ looks up the+/// Windows name and draws no text when the family is missing. The prefix stores the map in+/// `HKLM\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes`.+public enum MacFontSubstitutes {+ public static let registryKey = #"HKLM\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes"#+ /// Key text as `system.reg` writes it.+ static let fileKey = #"Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes"#+ /// Palatino Linotype is the Windows name. macOS ships that family as Palatino.+ public static let pairs: [(windowsName: String, macName: String)] = [+ ("Palatino Linotype", "Palatino"),+ ]++ /// Pairs whose Windows name is absent or points somewhere else.+ public static func missing(in systemReg: String) -> [(windowsName: String, macName: String)] {+ pairs.filter { pair in+ RegistryText.value(in: systemReg, key: fileKey, name: pair.windowsName) != "\"\(pair.macName)\""+ }+ }+}+/// Launches Wine processes for a bottle and captures their output to `logs/`.public struct WineRunner: Sendable {public let paths: HighballPaths@@ -263,6 +283,7 @@ public struct WineRunner: Sendable {/// everything it and its children print lands in the log. The call returns when the program exits.@discardableResultpublic func start(_ executable: URL, arguments: [String] = [], renderer: Renderer? = nil, extraEnvironment: [String: String] = [:], workingDirectory: URL? = nil, headerNote: String? = nil, onOutput: (@Sendable (String) -> Void)? = nil) async throws -> LaunchResult {+ await syncMacFontSubstitutes()await syncDllOverridesRegistry()await syncEngineAppDefaults()await syncKeyboardRegistry()@@ -539,6 +560,18 @@ public struct WineRunner: Sendable {static let dllOverridesKey = #"HKCU\Software\Wine\DllOverrides"#+ /// Writes the Mac font names that stand in for Windows face names. One write per missing+ /// name, then nothing: the prefix registry is what every later process reads, including a+ /// game that an already-running Steam starts. `start` calls this. A registry file that does+ /// not exist yet (a bottle still in its first boot) is left alone.+ func syncMacFontSubstitutes() async {+ let regURL = bottle.url.appending(path: "system.reg")+ guard let text = try? String(contentsOf: regURL, encoding: .utf8) else { return }+ for pair in MacFontSubstitutes.missing(in: text) {+ try? await regAdd(key: MacFontSubstitutes.registryKey, name: pair.windowsName, type: "REG_SZ", data: pair.macName)+ }+ }+/// Mirrors the bottle's DLL-overrides field into the prefix registry. The env var reaches only/// process trees Highball spawns itself; a game launched through an already-running Steam client/// inherits Steam's environment from before the setting changed and never sees the override, sodiff --git a/Tests/HighballKitTests/RegressionTests.swift b/Tests/HighballKitTests/RegressionTests.swiftindex f80588d..85ec84f 100644--- a/Tests/HighballKitTests/RegressionTests.swift+++ b/Tests/HighballKitTests/RegressionTests.swift@@ -1517,6 +1517,26 @@ extension RegressionTests {XCTAssertEqual(WineRunner.exitCodeNote(for: 67), "")}+ func testMacFontSubstituteFillsOnlyAMissingWindowsName() {+ let bare = """+ [Software\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\FontSubstitutes] 1+ "Helvetica"="Arial"+ """+ XCTAssertEqual(MacFontSubstitutes.missing(in: bare).map(\.windowsName), ["Palatino Linotype"])++ let mapped = """+ [Software\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\FontSubstitutes] 1+ "Palatino Linotype"="Palatino"+ """+ XCTAssertTrue(MacFontSubstitutes.missing(in: mapped).isEmpty)++ let other = """+ [Software\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\FontSubstitutes] 1+ "Palatino Linotype"="Times New Roman"+ """+ XCTAssertEqual(MacFontSubstitutes.missing(in: other).map(\.macName), ["Palatino"])+ }+// Play-gate: only provably harmless steps may run silently at Play (no wine process —// the msync trap #32 — and no long installs). Heavy or wine-touching steps must prompt.func testRecipeAutoApplyClassification() throws {