Skip to content

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

feat: Retina mode toggle (native resolution) per bottle

Gauthier Piarrettedefcc523e51a
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 6b8c3ae..912db66 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -243,6 +243,16 @@ final class AppState {
}
}
+ func setRetina(_ on: Bool, in bottle: Bottle) {
+ guard let engine = engine(for: bottle) else { return }
+ var copy = bottle
+ copy.settings.retinaMode = on
+ update(copy)
+ runBusy(on ? "Enabling Retina mode" : "Disabling Retina mode", showLogSheet: false) { [self] in
+ try await WineRunner(paths: paths, engine: engine, bottle: copy).setRetinaMode(on)
+ }
+ }
+
func killBottle(_ bottle: Bottle) {
guard let engine = engine(for: bottle) else { return }
try? WineRunner(paths: paths, engine: engine, bottle: bottle).kill()
diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swift
index 0fcd16b..0353e1c 100644
--- a/Sources/HighballApp/BottleView.swift
+++ b/Sources/HighballApp/BottleView.swift
@@ -454,6 +454,9 @@ struct BottleSettingsSheet: View {
Text("60 fps").tag(60)
Text("120 fps").tag(120)
}
+ Toggle(L("Retina mode (native resolution)"), isOn: retinaBinding)
+ Text(L("Crisper text and UI at your display's full resolution. Heavy games may run slower — pair with the frame rate cap."))
+ .font(.caption).foregroundStyle(.secondary)
}
Section(L("Compatibility")) {
Picker(L("Synchronization"), selection: binding(\.sync)) {
@@ -482,6 +485,12 @@ struct BottleSettingsSheet: View {
}
}
+ private var retinaBinding: Binding<Bool> {
+ Binding(
+ get: { (state.bottles.first { $0.name == bottle.name } ?? bottle).settings.retinaMode },
+ set: { on in state.setRetina(on, in: state.bottles.first { $0.name == bottle.name } ?? bottle) })
+ }
+
private func binding<T>(_ keyPath: WritableKeyPath<BottleSettings, T>) -> Binding<T> {
Binding(
get: { (state.bottles.first { $0.name == bottle.name } ?? bottle).settings[keyPath: keyPath] },
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index e239ac2..dffd41e 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -33,6 +33,11 @@ enum L10n {
"Stop Everything & Quit": "Tout arrêter et quitter",
"Leave Running & Quit": "Laisser tourner et quitter",
"Stop All Windows Processes": "Arrêter tous les processus Windows",
+ "Retina mode (native resolution)": "Mode Retina (résolution native)",
+ "Crisper text and UI at your display's full resolution. Heavy games may run slower — pair with the frame rate cap.":
+ "Texte et interface plus nets à la pleine résolution de votre écran. Les jeux exigeants peuvent ralentir — combinez avec la limite d'images par seconde.",
+ "Enabling Retina mode": "Activation du mode Retina",
+ "Disabling Retina mode": "Désactivation du mode Retina",
// Bottle view
"Programs": "Programmes",
diff --git a/Sources/HighballKit/Bottle.swift b/Sources/HighballKit/Bottle.swift
index 61b5729..2af8fd3 100644
--- a/Sources/HighballKit/Bottle.swift
+++ b/Sources/HighballKit/Bottle.swift
@@ -73,6 +73,8 @@ public struct BottleSettings: Codable, Sendable {
public var dxvkAsync: Bool = true
/// Cap the frame rate (0 = uncapped). Applied per renderer (DXVK_FRAME_RATE / DXMT_CONFIG).
public var fpsCap: Int = 0
+ /// Wine Mac driver Retina mode: expose native pixels + 192 DPI (applied via registry on toggle).
+ public var retinaMode: Bool = false
public var environment: [String: String] = [:]
public var pins: [Pin] = []
public var recipes: [String] = []
@@ -95,6 +97,7 @@ public struct BottleSettings: Codable, Sendable {
advertiseAVX = try c.decodeIfPresent(Bool.self, forKey: .advertiseAVX) ?? false
dxvkAsync = try c.decodeIfPresent(Bool.self, forKey: .dxvkAsync) ?? true
fpsCap = try c.decodeIfPresent(Int.self, forKey: .fpsCap) ?? 0
+ retinaMode = try c.decodeIfPresent(Bool.self, forKey: .retinaMode) ?? false
environment = try c.decodeIfPresent([String: String].self, forKey: .environment) ?? [:]
pins = try c.decodeIfPresent([Pin].self, forKey: .pins) ?? []
recipes = try c.decodeIfPresent([String].self, forKey: .recipes) ?? []
diff --git a/Sources/HighballKit/WineRunner.swift b/Sources/HighballKit/WineRunner.swift
index 2de99d6..4569ab0 100644
--- a/Sources/HighballKit/WineRunner.swift
+++ b/Sources/HighballKit/WineRunner.swift
@@ -114,6 +114,13 @@ public struct WineRunner: Sendable {
return line.split(whereSeparator: \.isWhitespace).last.map(String.init)
}
+ /// Wine's Mac driver renders at 1x by default. Retina mode exposes native pixels (crisper,
+ /// ~4x GPU work at native res) with a 192 DPI bump so Windows UI stays readable.
+ public func setRetinaMode(_ on: Bool) async throws {
+ try await regAdd(key: #"HKCU\Software\Wine\Mac Driver"#, name: "RetinaMode", type: "REG_SZ", data: on ? "y" : "n")
+ try await regAdd(key: #"HKCU\Control Panel\Desktop"#, name: "LogPixels", type: "REG_DWORD", data: on ? "192" : "96")
+ }
+
public func setWindowsVersion(_ v: WindowsVersion) async throws {
_ = try await run(["winecfg", "-v", v.rawValue], renderer: .wined3d, label: "winecfg")
}
diff --git a/Sources/highball/main.swift b/Sources/highball/main.swift
index 2764f15..5fe3a10 100644
--- a/Sources/highball/main.swift
+++ b/Sources/highball/main.swift
@@ -109,7 +109,7 @@ struct Bottle: AsyncParsableCommand {
}
struct Set: AsyncParsableCommand {
- static let configuration = CommandConfiguration(abstract: "Change a bottle setting: renderer, winver, sync, hud, avx, env KEY=VALUE")
+ static let configuration = CommandConfiguration(abstract: "Change a bottle setting: renderer, winver, sync, hud, avx, retina, env KEY=VALUE")
@Argument var name: String
@Argument var setting: String
@Argument var value: String
@@ -127,6 +127,11 @@ struct Bottle: AsyncParsableCommand {
case "sync": guard let s = SyncMode(rawValue: value) else { fail("bad sync") }; b.settings.sync = s
case "hud": b.settings.metalHUD = (value == "1" || value == "true")
case "avx": b.settings.advertiseAVX = (value == "1" || value == "true")
+ case "retina":
+ let on = (value == "1" || value == "true")
+ b.settings.retinaMode = on
+ let eng = try EngineStore().engine(b.settings.engineID)
+ try await WineRunner(engine: eng, bottle: b).setRetinaMode(on)
case "env":
let parts = value.split(separator: "=", maxSplits: 1).map(String.init)
guard parts.count == 2 else { fail("env expects KEY=VALUE") }