Skip to content

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

UX/UI pass: game library, staged progress, edit actions, identity, French

Gauthier Piarretted4d43d9e8a25
diff --git a/Scripts/make-app.sh b/Scripts/make-app.sh
index e8923e5..fc83fe9 100755
--- a/Scripts/make-app.sh
+++ b/Scripts/make-app.sh
@@ -17,6 +17,19 @@ if [ ! -d "$RECIPES" ]; then
[ -d "$RECIPES" ] || git clone --depth 1 https://github.com/gauthierpiarrette/highball-db.git .build/highball-db
fi
for f in "$RECIPES"/launchers/*.json "$RECIPES"/games/*.json; do cp "$f" "$APP/Contents/Resources/"; done
+# Compatibility DB entries (for in-app status pills on the games grid).
+DBDIR="$(dirname "$RECIPES")/db/games"
+if [ -d "$DBDIR" ]; then mkdir -p "$APP/Contents/Resources/db-games"; cp "$DBDIR"/*.json "$APP/Contents/Resources/db-games/"; fi
+# App icon: rendered from source, packed to icns.
+ICONWORK=.build/icon
+mkdir -p "$ICONWORK/AppIcon.iconset"
+swift Scripts/make-icon.swift "$ICONWORK/AppIcon-1024.png" >/dev/null
+for sz in 16 32 128 256 512; do
+ sips -z $sz $sz "$ICONWORK/AppIcon-1024.png" --out "$ICONWORK/AppIcon.iconset/icon_${sz}x${sz}.png" >/dev/null
+ d=$((sz*2)); sips -z $d $d "$ICONWORK/AppIcon-1024.png" --out "$ICONWORK/AppIcon.iconset/icon_${sz}x${sz}@2x.png" >/dev/null
+done
+iconutil -c icns "$ICONWORK/AppIcon.iconset" -o "$APP/Contents/Resources/AppIcon.icns"
+sips -z 512 512 "$ICONWORK/AppIcon-1024.png" --out "$APP/Contents/Resources/AppIcon.png" >/dev/null
cat > "$APP/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -29,6 +42,7 @@ cat > "$APP/Contents/Info.plist" <<PLIST
<key>CFBundleShortVersionString</key><string>0.1.0</string>
<key>CFBundleVersion</key><string>1</string>
<key>LSMinimumSystemVersion</key><string>14.0</string>
+ <key>CFBundleIconFile</key><string>AppIcon</string>
<key>NSHighResolutionCapable</key><true/>
<key>NSHumanReadableCopyright</key><string>GPL-3.0 — no paid tier, ever.</string>
</dict></plist>
diff --git a/Scripts/make-icon.swift b/Scripts/make-icon.swift
new file mode 100644
index 0000000..e58f427
--- /dev/null
+++ b/Scripts/make-icon.swift
@@ -0,0 +1,97 @@
+// Renders the Highball app icon (a highball glass, amber on charcoal) to a PNG.
+// Usage: swift Scripts/make-icon.swift <output.png> [size]
+import AppKit
+import CoreGraphics
+
+let output = CommandLine.arguments.count > 1 ? CommandLine.arguments[1] : "AppIcon-1024.png"
+let S = CGFloat(CommandLine.arguments.count > 2 ? Double(CommandLine.arguments[2]) ?? 1024 : 1024)
+
+let image = NSImage(size: NSSize(width: S, height: S), flipped: false) { _ in
+ guard let ctx = NSGraphicsContext.current?.cgContext else { return false }
+ let u = S / 1024.0 // unit
+
+ func rr(_ x: CGFloat, _ y: CGFloat, _ w: CGFloat, _ h: CGFloat, _ r: CGFloat) -> CGPath {
+ CGPath(roundedRect: CGRect(x: x * u, y: y * u, width: w * u, height: h * u),
+ cornerWidth: r * u, cornerHeight: r * u, transform: nil)
+ }
+ func color(_ hex: UInt32, _ a: CGFloat = 1) -> CGColor {
+ CGColor(red: CGFloat((hex >> 16) & 0xFF) / 255, green: CGFloat((hex >> 8) & 0xFF) / 255,
+ blue: CGFloat(hex & 0xFF) / 255, alpha: a)
+ }
+ func gradient(_ path: CGPath, _ top: UInt32, _ bottom: UInt32, alpha: CGFloat = 1) {
+ ctx.saveGState()
+ ctx.addPath(path); ctx.clip()
+ let g = CGGradient(colorsSpace: CGColorSpaceCreateDeviceRGB(),
+ colors: [color(top, alpha), color(bottom, alpha)] as CFArray, locations: [0, 1])!
+ let box = path.boundingBox
+ ctx.drawLinearGradient(g, start: CGPoint(x: box.midX, y: box.maxY),
+ end: CGPoint(x: box.midX, y: box.minY), options: [])
+ ctx.restoreGState()
+ }
+
+ // macOS squircle-ish canvas with standard margin
+ let plate = rr(100, 100, 824, 824, 185)
+ ctx.saveGState()
+ ctx.setShadow(offset: CGSize(width: 0, height: -12 * u), blur: 24 * u, color: color(0x000000, 0.35))
+ gradient(plate, 0x2A2117, 0x16110A)
+ ctx.restoreGState()
+
+ // faint amber glow behind the glass
+ let glow = CGPath(ellipseIn: CGRect(x: 292 * u, y: 210 * u, width: 440 * u, height: 300 * u), transform: nil)
+ gradient(glow, 0xD79A45, 0x16110A, alpha: 0.18)
+
+ // glass body (tall highball)
+ let glass = rr(362, 240, 300, 560, 42)
+ // liquid: lower two thirds
+ ctx.saveGState()
+ ctx.addPath(glass); ctx.clip()
+ gradient(rr(362, 240, 300, 360, 42), 0xE3A94F, 0x9A5E17)
+ // soda fizz head: thin lighter band at liquid surface
+ ctx.setFillColor(color(0xF3CE8B, 0.85))
+ ctx.fill(CGRect(x: 362 * u, y: 584 * u, width: 300 * u, height: 18 * u))
+ ctx.restoreGState()
+
+ // ice cubes
+ for (x, y, r, a) in [(398.0, 470.0, -12.0, 0.85), (520.0, 420.0, 18.0, 0.75)] {
+ ctx.saveGState()
+ ctx.translateBy(x: (x + 55) * u, y: (y + 55) * u)
+ ctx.rotate(by: r * .pi / 180)
+ let cube = CGPath(roundedRect: CGRect(x: -55 * u, y: -55 * u, width: 110 * u, height: 110 * u),
+ cornerWidth: 22 * u, cornerHeight: 22 * u, transform: nil)
+ ctx.addPath(cube)
+ ctx.setFillColor(color(0xFFF6E6, a * 0.55))
+ ctx.fillPath()
+ ctx.addPath(cube)
+ ctx.setStrokeColor(color(0xFFFFFF, 0.65))
+ ctx.setLineWidth(6 * u)
+ ctx.strokePath()
+ ctx.restoreGState()
+ }
+
+ // bubbles rising through the liquid
+ for (x, y, r) in [(430.0, 300.0, 10.0), (560.0, 340.0, 13.0), (480.0, 380.0, 8.0), (610.0, 290.0, 9.0)] {
+ ctx.setFillColor(color(0xFFF0D0, 0.7))
+ ctx.fillEllipse(in: CGRect(x: (x - r) * u, y: (y - r) * u, width: 2 * r * u, height: 2 * r * u))
+ }
+
+ // glass outline + left highlight
+ ctx.addPath(glass)
+ ctx.setStrokeColor(color(0xF5EBDD, 0.9))
+ ctx.setLineWidth(16 * u)
+ ctx.strokePath()
+ ctx.setStrokeColor(color(0xFFFFFF, 0.35))
+ ctx.setLineWidth(10 * u)
+ ctx.move(to: CGPoint(x: 396 * u, y: 730 * u))
+ ctx.addLine(to: CGPoint(x: 396 * u, y: 330 * u))
+ ctx.strokePath()
+
+ return true
+}
+
+guard let tiff = image.tiffRepresentation,
+ let rep = NSBitmapImageRep(data: tiff),
+ let png = rep.representation(using: .png, properties: [:]) else {
+ fatalError("render failed")
+}
+try! png.write(to: URL(fileURLWithPath: output))
+print("wrote \(output) (\(Int(S))px)")
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index fef2b02..0edfb1a 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -7,10 +7,13 @@ final class AppState {
var engines: [InstalledEngine] = []
var bottles: [Bottle] = []
var selectedBottle: String?
+ var gamesByBottle: [String: [SteamGame]] = [:]
+ var gameDB = GameDB(directories: [])
// Long-running work
var busy = false
var busyTitle = ""
+ var stage = ""
var logLines: [String] = []
var showLog = false
@@ -41,6 +44,15 @@ final class AppState {
needsOnboarding = engines.isEmpty
rosettaInstalled = FileManager.default.fileExists(atPath: "/Library/Apple/usr/share/rosetta/rosetta")
if selectedBottle == nil { selectedBottle = bottles.first?.name }
+ gamesByBottle = Dictionary(uniqueKeysWithValues: bottles.map { ($0.name, SteamLibrary.games(in: $0)) })
+ if gameDB.byAppID.isEmpty {
+ var dirs: [URL] = []
+ if let res = Bundle.main.resourceURL { dirs.append(res.appending(path: "db-games")) }
+ if let root = Self.repoRoot {
+ dirs.append(root.deletingLastPathComponent().appending(path: "highball-db/db/games"))
+ }
+ gameDB = GameDB(directories: dirs)
+ }
}
func engine(for bottle: Bottle) -> InstalledEngine? {
@@ -50,10 +62,30 @@ final class AppState {
private func appendLog(_ line: String) {
logLines.append(line)
if logLines.count > 400 { logLines.removeFirst(logLines.count - 400) }
+ if let s = Self.stage(for: line) { stage = s }
+ }
+
+ /// Turns raw Wine/recipe output into a human stage line.
+ static func stage(for line: String) -> String? {
+ if let m = line.firstMatch(of: #/\[(?<r>[a-z0-9-]+)\] step (?<a>\d+)/(?<b>\d+)/#) {
+ return "Step \(m.a) of \(m.b)"
+ }
+ if line.contains("Downloading update (") {
+ if let m = line.firstMatch(of: #/\((?<x>[\d,]+) of (?<y>[\d,]+) KB\)/#) {
+ return "Steam is updating itself — \(m.x) of \(m.y) KB"
+ }
+ return "Steam is updating itself"
+ }
+ if line.contains("Extracting package") { return "Extracting the Steam client — this takes a few minutes" }
+ if line.contains("Installing update") { return "Installing the Steam client update" }
+ if line.contains("Update complete") { return "Steam update complete — launching" }
+ if line.hasPrefix("downloaded ") { return "Downloaded \(line.dropFirst(11))" }
+ if line.contains("wineboot") && line.contains("start") { return "Preparing the Windows environment" }
+ return nil
}
private func runBusy(_ title: String, showLogSheet: Bool = true, _ work: @escaping () async throws -> Void) {
- busy = true; busyTitle = title; logLines = []; showLog = showLogSheet
+ busy = true; busyTitle = title; stage = ""; logLines = []; showLog = showLogSheet
Task {
do { try await work() } catch { errorMessage = "\(error)" }
busy = false
@@ -125,6 +157,70 @@ final class AppState {
do { try bottleStore.update(bottle); refresh() } catch { errorMessage = "\(error)" }
}
+ func deleteBottle(_ name: String) {
+ killBottleNamed(name)
+ do { try bottleStore.delete(name); if selectedBottle == name { selectedBottle = nil }; refresh() }
+ catch { errorMessage = "\(error)" }
+ }
+
+ private func killBottleNamed(_ name: String) {
+ if let bottle = bottles.first(where: { $0.name == name }) { killBottle(bottle) }
+ }
+
+ func removePin(_ pin: Pin, from bottle: Bottle) {
+ var copy = bottle
+ copy.settings.pins.removeAll { $0.id == pin.id }
+ update(copy)
+ }
+
+ func setPinRenderer(_ renderer: Renderer?, pin: Pin, in bottle: Bottle) {
+ var copy = bottle
+ if let i = copy.settings.pins.firstIndex(where: { $0.id == pin.id }) {
+ copy.settings.pins[i].renderer = renderer
+ update(copy)
+ }
+ }
+
+ /// Launch a Steam game by appid through the bottle's Steam client.
+ func launchGame(_ game: SteamGame, in bottle: Bottle) {
+ guard let engine = engine(for: bottle) else { return }
+ let steam = bottle.driveC.appending(path: "Program Files (x86)/Steam/steam.exe")
+ let renderer = gameDB[game.appid]?.renderer
+ runBusy("Running \(game.name)", showLogSheet: false) { [self] in
+ let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)
+ let result = try await runner.start(steam, arguments: ["-silent", "-applaunch", String(game.appid)], renderer: renderer) { line in
+ Task { @MainActor in self.appendLog(line) }
+ }
+ if result.crashedEarly {
+ let current = renderer ?? bottle.settings.renderer
+ let next: Renderer = current == .dxmt ? .d3dmetal : (current == .d3dmetal ? .dxvk : .dxmt)
+ await MainActor.run {
+ self.crashSuggestion = CrashSuggestion(program: game.name, renderer: next, logPath: result.log.path)
+ }
+ }
+ }
+ }
+
+ /// Handle an .exe/.msi dropped on a bottle: run it (installer) inside the bottle.
+ func runDropped(_ url: URL, in bottle: Bottle, andPin: Bool) {
+ guard let engine = engine(for: bottle) else { return }
+ runBusy("Running \(url.lastPathComponent)") { [self] in
+ let runner = WineRunner(paths: paths, engine: engine, bottle: bottle)
+ let isMSI = url.pathExtension.lowercased() == "msi"
+ let args = isMSI ? ["msiexec", "/i", url.path] : [url.path]
+ _ = try await runner.run(args, renderer: .wined3d, label: url.lastPathComponent) { line in
+ Task { @MainActor in self.appendLog(line) }
+ }
+ if andPin {
+ await MainActor.run {
+ var copy = bottle
+ copy.settings.pins.append(Pin(name: url.deletingPathExtension().lastPathComponent, path: url.lastPathComponent))
+ self.update(copy)
+ }
+ }
+ }
+ }
+
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 b912a5c..26badb0 100644
--- a/Sources/HighballApp/BottleView.swift
+++ b/Sources/HighballApp/BottleView.swift
@@ -12,14 +12,17 @@ struct BottleView: View {
return FileManager.default.fileExists(atPath: engine.frameworksDir.appending(path: "renderer/d3dmetal/wine").path)
}
+ @State private var droppedURL: URL?
+
var body: some View {
Form {
Section {
header
}
- Section("Programs") {
+ gamesSection
+ Section(L("Programs")) {
if bottle.settings.pins.isEmpty {
- Text("Nothing installed yet — add a launcher below.").foregroundStyle(.secondary)
+ Text(L("Nothing installed yet — add a launcher below.")).foregroundStyle(.secondary)
}
ForEach(bottle.settings.pins) { pin in
HStack {
@@ -29,12 +32,22 @@ struct BottleView: View {
}
Spacer()
if let r = pin.renderer { RendererBadge(renderer: r) }
- Button("Run") { state.launch(pin: pin, in: bottle) }
+ Button(L("Run")) { state.launch(pin: pin, in: bottle) }
.disabled(state.busy)
}
+ .contextMenu {
+ Menu("Renderer override") {
+ Button(L("Bottle default")) { state.setPinRenderer(nil, pin: pin, in: bottle) }
+ ForEach(Renderer.allCases, id: \.self) { r in
+ Button(r.rawValue.uppercased()) { state.setPinRenderer(r, pin: pin, in: bottle) }
+ }
+ }
+ Divider()
+ Button(L("Remove from list"), role: .destructive) { state.removePin(pin, from: bottle) }
+ }
}
}
- Section("Install a launcher") {
+ Section(L("Install a launcher")) {
HStack(spacing: 8) {
ForEach(AppState.launcherRecipes.filter { id in !bottle.settings.recipes.contains(id) }, id: \.self) { id in
if let recipe = AppState.recipe(id) {
@@ -43,21 +56,53 @@ struct BottleView: View {
}
}
}
- Text("Kernel anti-cheat titles (Valorant, Fortnite, Destiny 2…) can’t work through Wine — check the compatibility database before big downloads.")
+ Text(L("Kernel anti-cheat titles (Valorant, Fortnite, Destiny 2…) can’t work through Wine — check the compatibility database before big downloads."))
.font(.caption).foregroundStyle(.secondary)
}
- Section("Graphics & compatibility") {
+ Section(L("Graphics & compatibility")) {
settings
}
}
.formStyle(.grouped)
- .navigationTitle(bottle.name)
+ .navigationTitle("Highball")
+ .navigationSubtitle(bottle.name)
+ .onDrop(of: [.fileURL], isTargeted: nil) { providers in
+ guard let provider = providers.first else { return false }
+ _ = provider.loadObject(ofClass: URL.self) { url, _ in
+ guard let url, ["exe", "msi", "bat"].contains(url.pathExtension.lowercased()) else { return }
+ Task { @MainActor in droppedURL = url }
+ }
+ return true
+ }
+ .confirmationDialog("Run \(droppedURL?.lastPathComponent ?? "") in this bottle?",
+ isPresented: .init(get: { droppedURL != nil }, set: { if !$0 { droppedURL = nil } }),
+ titleVisibility: .visible) {
+ Button(L("Run")) { if let u = droppedURL { state.runDropped(u, in: bottle, andPin: false) }; droppedURL = nil }
+ Button(L("Run and add to Programs")) { if let u = droppedURL { state.runDropped(u, in: bottle, andPin: true) }; droppedURL = nil }
+ Button(L("Cancel"), role: .cancel) { droppedURL = nil }
+ }
.toolbar {
- Button { state.killBottle(bottle) } label: { Label("Stop all", systemImage: "stop.circle") }
+ Button { state.killBottle(bottle) } label: { Label(L("Stop all"), systemImage: "stop.circle") }
.help("Kill every Windows process in this bottle (wineserver -k)")
}
}
+ @ViewBuilder private var gamesSection: some View {
+ let games = state.gamesByBottle[bottle.name] ?? []
+ if !games.isEmpty {
+ Section(L("Games")) {
+ LazyVGrid(columns: [GridItem(.adaptive(minimum: 210), spacing: 12)], spacing: 12) {
+ ForEach(games) { game in
+ GameCard(game: game, entry: state.gameDB[game.appid], busy: state.busy) {
+ state.launchGame(game, in: bottle)
+ }
+ }
+ }
+ .padding(.vertical, 4)
+ }
+ }
+ }
+
private var header: some View {
HStack(spacing: 14) {
Image(systemName: "wineglass.fill").font(.largeTitle).foregroundStyle(.tint)
@@ -66,24 +111,24 @@ struct BottleView: View {
Text("engine \(bottle.settings.engineID)").font(.caption).foregroundStyle(.secondary)
}
Spacer()
- Button("Open C: drive") { NSWorkspace.shared.open(bottle.driveC) }
+ Button(L("Open C: drive")) { NSWorkspace.shared.open(bottle.driveC) }
}
}
@ViewBuilder private var settings: some View {
- Picker("Renderer", selection: binding(\.renderer)) {
- Text("DXMT — D3D10/11 → Metal (default)").tag(Renderer.dxmt)
+ Picker(L("Renderer"), selection: binding(\.renderer)) {
+ Text(L("DXMT — D3D10/11 → Metal (default)")).tag(Renderer.dxmt)
if d3dmetalAvailable {
- Text("D3DMetal — D3D11/12, Apple").tag(Renderer.d3dmetal)
+ Text(L("D3DMetal — D3D11/12, Apple")).tag(Renderer.d3dmetal)
}
- Text("DXVK — D3D9/10/11 → Vulkan").tag(Renderer.dxvk)
- Text("WineD3D — slow fallback").tag(Renderer.wined3d)
+ Text(L("DXVK — D3D9/10/11 → Vulkan")).tag(Renderer.dxvk)
+ Text(L("WineD3D — slow fallback")).tag(Renderer.wined3d)
}
if !d3dmetalAvailable && d3dmetalPossible {
HStack {
- Text("D3DMetal (needed for DirectX 12) requires accepting Apple’s Game Porting Toolkit license.")
+ Text(L("D3DMetal (needed for DirectX 12) requires accepting Apple’s Game Porting Toolkit license."))
.font(.caption).foregroundStyle(.secondary)
- Button("Review license…") {
+ Button(L("Review license…")) {
Task { @MainActor in
state.loadGPTKLicense()
state.showGPTKLicense = true
@@ -91,16 +136,16 @@ struct BottleView: View {
}.controlSize(.small)
}
}
- Picker("Synchronization", selection: binding(\.sync)) {
- Text("None — required for Steam/CEF launchers").tag(SyncMode.none)
- Text("msync — fastest for most games").tag(SyncMode.msync)
+ Picker(L("Synchronization"), selection: binding(\.sync)) {
+ Text(L("None — required for Steam/CEF launchers")).tag(SyncMode.none)
+ Text(L("msync — fastest for most games")).tag(SyncMode.msync)
Text("esync").tag(SyncMode.esync)
}
- Picker("Windows version", selection: binding(\.windowsVersion)) {
+ Picker(L("Windows version"), selection: binding(\.windowsVersion)) {
ForEach(WindowsVersion.allCases, id: \.self) { Text($0.rawValue).tag($0) }
}
- Toggle("Metal performance HUD", isOn: binding(\.metalHUD))
- Toggle("Advertise AVX to games (Rosetta)", isOn: binding(\.advertiseAVX))
+ Toggle(L("Metal performance HUD"), isOn: binding(\.metalHUD))
+ Toggle(L("Advertise AVX to games (Rosetta)"), isOn: binding(\.advertiseAVX))
}
private func binding<T>(_ keyPath: WritableKeyPath<BottleSettings, T>) -> Binding<T> {
@@ -114,6 +159,65 @@ struct BottleView: View {
}
}
+struct GameCard: View {
+ let game: SteamGame
+ let entry: GameDBEntry?
+ let busy: Bool
+ let play: () -> Void
+
+ private var statusLabel: (String, Color)? {
+ switch entry?.status {
+ case "verified-local": return ("Verified", .green)
+ case "reported-upstream": return ("Reported", .blue)
+ case "community": return ("Community", .orange)
+ case "blocked-anticheat": return ("Blocked — anti-cheat", .red)
+ default: return nil
+ }
+ }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 6) {
+ AsyncImage(url: game.headerImage) { phase in
+ switch phase {
+ case .success(let image): image.resizable().aspectRatio(contentMode: .fill)
+ default:
+ ZStack {
+ Rectangle().fill(.quaternary)
+ Image(systemName: "gamecontroller").font(.title).foregroundStyle(.secondary)
+ }
+ }
+ }
+ .frame(height: 96)
+ .clipShape(RoundedRectangle(cornerRadius: 6))
+
+ Text(game.name).font(.callout.weight(.semibold)).lineLimit(1)
+ HStack {
+ if let (label, color) = statusLabel {
+ Text(label)
+ .font(.caption2.monospaced())
+ .padding(.horizontal, 5).padding(.vertical, 1)
+ .foregroundStyle(color)
+ .overlay(RoundedRectangle(cornerRadius: 3).stroke(color.opacity(0.6)))
+ }
+ if let r = entry?.renderer {
+ Text(r.rawValue.uppercased()).font(.caption2.monospaced()).foregroundStyle(.secondary)
+ }
+ Spacer()
+ Button(L("Play")) { play() }
+ .controlSize(.small)
+ .disabled(busy || !game.isReady || entry?.isBlocked == true)
+ }
+ if entry?.isBlocked == true {
+ Text(entry?.notes ?? "Kernel anti-cheat — cannot work under Wine.")
+ .font(.caption2).foregroundStyle(.red).lineLimit(2)
+ }
+ }
+ .padding(8)
+ .background(RoundedRectangle(cornerRadius: 8).fill(.background.secondary))
+ .help(entry?.notes ?? game.name)
+ }
+}
+
struct RendererBadge: View {
let renderer: Renderer
var body: some View {
@@ -132,13 +236,13 @@ struct OnboardingView: View {
VStack(spacing: 18) {
Image(systemName: "wineglass.fill").font(.system(size: 52)).foregroundStyle(.tint)
Text("Highball").font(.system(size: 34, weight: .heavy, design: .rounded))
- Text("Run Windows games on your Mac. Highball downloads a verified Wine engine (~500 MB) from public upstream releases — nothing is hosted by Highball itself.")
+ Text(L("Run Windows games on your Mac. Highball downloads a verified Wine engine (~500 MB) from public upstream releases — nothing is hosted by Highball itself."))
.multilineTextAlignment(.center).frame(maxWidth: 440).foregroundStyle(.secondary)
if !state.rosettaInstalled {
GroupBox {
VStack(alignment: .leading, spacing: 6) {
- Label("Rosetta 2 is required", systemImage: "exclamationmark.triangle")
+ Label(L("Rosetta 2 is required"), systemImage: "exclamationmark.triangle")
Text("Run in Terminal: softwareupdate --install-rosetta --agree-to-license").font(.caption.monospaced())
}
}.frame(maxWidth: 440)
@@ -146,10 +250,10 @@ struct OnboardingView: View {
Toggle(isOn: $acceptGPTK) {
VStack(alignment: .leading, spacing: 2) {
- Text("Enable D3DMetal (DirectX 12 support)")
+ Text(L("Enable D3DMetal (DirectX 12 support)"))
HStack(spacing: 4) {
- Text("Requires accepting").font(.caption).foregroundStyle(.secondary)
- Button("Apple’s Game Porting Toolkit license") {
+ Text(L("Requires accepting")).font(.caption).foregroundStyle(.secondary)
+ Button(L("Apple’s Game Porting Toolkit license")) {
Task { @MainActor in
state.loadGPTKLicense()
state.showGPTKLicense = true
@@ -164,7 +268,7 @@ struct OnboardingView: View {
Button {
state.installDefaultEngine(acceptGPTK: acceptGPTK)
} label: {
- Text(state.busy ? "Installing…" : "Install engine")
+ Text(state.busy ? L("Installing…") : L("Install engine"))
.frame(minWidth: 180)
}
.buttonStyle(.borderedProminent)
@@ -194,12 +298,12 @@ struct GPTKLicenseSheet: View {
.frame(width: 640, height: 380)
.background(.quaternary.opacity(0.4))
HStack {
- Text("Non-commercial use only · no modification · Apple hardware only")
+ Text(L("Non-commercial use only · no modification · Apple hardware only"))
.font(.caption).foregroundStyle(.secondary)
Spacer()
- Button("Close") { dismiss() }
+ Button(L("Close")) { dismiss() }
if let engine = state.engines.first, engine.rendererDir("d3dmetal") == nil {
- Button("Accept & enable D3DMetal") {
+ Button(L("Accept & enable D3DMetal")) {
state.acceptGPTK(engine: engine)
dismiss()
}.buttonStyle(.borderedProminent)
diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swift
index d5ec987..e48a7c4 100644
--- a/Sources/HighballApp/HighballApp.swift
+++ b/Sources/HighballApp/HighballApp.swift
@@ -11,7 +11,8 @@ struct HighballApp: App {
WindowGroup("Highball") {
ContentView()
.environment(state)
- .frame(minWidth: 780, minHeight: 520)
+ .tint(Color(red: 0.78, green: 0.55, blue: 0.20))
+ .frame(minWidth: 820, minHeight: 560)
.onAppear { state.refresh() }
}
.windowResizability(.contentSize)
@@ -23,6 +24,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
// Works as a bare SwiftPM executable during development: give it a real UI presence.
NSApp.setActivationPolicy(.regular)
NSApp.activate(ignoringOtherApps: true)
+ if let iconURL = Bundle.main.url(forResource: "AppIcon", withExtension: "png"),
+ let icon = NSImage(contentsOf: iconURL) {
+ NSApp.applicationIconImage = icon
+ }
}
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { true }
}
@@ -30,6 +35,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
struct ContentView: View {
@Environment(AppState.self) private var state
@State private var showCreate = false
+ @State private var pendingDelete: String?
var body: some View {
@Bindable var state = state
@@ -39,14 +45,19 @@ struct ContentView: View {
} else {
NavigationSplitView {
List(selection: $state.selectedBottle) {
- Section("Bottles") {
+ Section(L("Bottles")) {
ForEach(state.bottles, id: \.name) { bottle in
Label(bottle.name, systemImage: "wineglass")
.tag(bottle.name)
+ .contextMenu {
+ Button(L("Stop all processes")) { state.killBottle(bottle) }
+ Divider()
+ Button(L("Delete bottle…"), role: .destructive) { pendingDelete = bottle.name }
+ }
}
}
if let engine = state.engines.first {
- Section("Engine") {
+ Section(L("Engine")) {
VStack(alignment: .leading, spacing: 2) {
Text(engine.id).font(.caption).lineLimit(1)
Text((try? engine.wineVersion()) ?? "")
@@ -57,23 +68,29 @@ struct ContentView: View {
}
.navigationSplitViewColumnWidth(min: 200, ideal: 230)
.toolbar {
- Button { showCreate = true } label: { Label("New Bottle", systemImage: "plus") }
+ Button { showCreate = true } label: { Label(L("New Bottle"), systemImage: "plus") }
}
} detail: {
if let name = state.selectedBottle,
let bottle = state.bottles.first(where: { $0.name == name }) {
BottleView(bottle: bottle)
} else {
- ContentUnavailableView("No bottle selected", systemImage: "wineglass",
- description: Text("Create a bottle to install Steam and play."))
+ ContentUnavailableView(L("No bottle selected"), systemImage: "wineglass",
+ description: Text(L("Create a bottle to install Steam and play.")))
}
}
}
}
.sheet(isPresented: $showCreate) { CreateBottleSheet() }
+ .confirmationDialog("Delete bottle \"\(pendingDelete ?? "")\"? This removes its Windows drive and everything installed in it.",
+ isPresented: .init(get: { pendingDelete != nil }, set: { if !$0 { pendingDelete = nil } }),
+ titleVisibility: .visible) {
+ Button(L("Delete"), role: .destructive) { if let n = pendingDelete { state.deleteBottle(n) }; pendingDelete = nil }
+ Button(L("Cancel"), role: .cancel) { pendingDelete = nil }
+ }
.sheet(isPresented: $state.showLog) { LogSheet() }
.sheet(isPresented: $state.showGPTKLicense) { GPTKLicenseSheet() }
- .alert("Something went wrong", isPresented: .init(
+ .alert(L("Something went wrong"), isPresented: .init(
get: { state.errorMessage != nil },
set: { if !$0 { state.errorMessage = nil } })) {
Button("OK") { state.errorMessage = nil }
@@ -87,7 +104,7 @@ struct ContentView: View {
state.update(bottle)
}
},
- secondaryButton: .cancel(Text("Keep current")))
+ secondaryButton: .cancel(Text(L("Keep current"))))
}
}
}
@@ -100,15 +117,15 @@ struct CreateBottleSheet: View {
var body: some View {
VStack(alignment: .leading, spacing: 14) {
- Text("New bottle").font(.title2.bold())
- TextField("Name", text: $name).textFieldStyle(.roundedBorder).frame(width: 260)
- Toggle("Install Steam in it (recommended)", isOn: $installSteam)
- Text("A bottle is an isolated Windows environment. First boot takes about 90 seconds; the Steam install adds a download and a slow one-time client update.")
+ Text(L("New bottle")).font(.title2.bold())
+ TextField(L("Name"), text: $name).textFieldStyle(.roundedBorder).frame(width: 260)
+ Toggle(L("Install Steam in it (recommended)"), isOn: $installSteam)
+ Text(L("A bottle is an isolated Windows environment. First boot takes about 90 seconds; the Steam install adds a download and a slow one-time client update."))
.font(.callout).foregroundStyle(.secondary).frame(maxWidth: 380, alignment: .leading)
HStack {
Spacer()
- Button("Cancel") { dismiss() }
- Button("Create") {
+ Button(L("Cancel")) { dismiss() }
+ Button(L("Create")) {
dismiss()
state.createBottle(name: name, recipeID: installSteam ? "steam" : nil)
}
@@ -128,24 +145,32 @@ struct LogSheet: View {
VStack(alignment: .leading, spacing: 8) {
HStack {
if state.busy { ProgressView().controlSize(.small) }
- Text(state.busy ? state.busyTitle : "Done").font(.headline)
+ Text(state.busy ? state.busyTitle : L("Done")).font(.headline)
Spacer()
Button(state.busy ? "Hide" : "Close") { dismiss() }
}
- ScrollViewReader { proxy in
- ScrollView {
- LazyVStack(alignment: .leading, spacing: 1) {
- ForEach(Array(state.logLines.enumerated()), id: \.offset) { i, line in
- Text(line).font(.system(size: 11, design: .monospaced))
- .frame(maxWidth: .infinity, alignment: .leading)
- .id(i)
+ if !state.stage.isEmpty {
+ Label(state.stage, systemImage: "clock")
+ .font(.callout)
+ .foregroundStyle(.secondary)
+ }
+ DisclosureGroup(L("Details")) {
+ ScrollViewReader { proxy in
+ ScrollView {
+ LazyVStack(alignment: .leading, spacing: 1) {
+ ForEach(Array(state.logLines.enumerated()), id: \.offset) { i, line in
+ Text(line).font(.system(size: 11, design: .monospaced))
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .id(i)
+ }
}
}
+ .onChange(of: state.logLines.count) { _, n in proxy.scrollTo(max(0, n - 1)) }
+ .frame(height: 240)
+ .background(.quaternary.opacity(0.4))
}
- .onChange(of: state.logLines.count) { _, n in proxy.scrollTo(max(0, n - 1)) }
}
- .frame(width: 620, height: 320)
- .background(.quaternary.opacity(0.4))
+ .frame(width: 620)
}
.padding(16)
}
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
new file mode 100644
index 0000000..3aeb374
--- /dev/null
+++ b/Sources/HighballApp/L10n.swift
@@ -0,0 +1,87 @@
+import Foundation
+
+/// Tiny localization layer: English strings are the keys; French ships first.
+/// (A proper String Catalog needs an Xcode project; this keeps SwiftPM-only builds localized.)
+func L(_ en: String) -> String {
+ guard Locale.preferredLanguages.first?.hasPrefix("fr") == true else { return en }
+ return L10n.fr[en] ?? en
+}
+
+enum L10n {
+ static let fr: [String: String] = [
+ // Sidebar & shell
+ "Bottles": "Bouteilles",
+ "Engine": "Moteur",
+ "New Bottle": "Nouvelle bouteille",
+ "No bottle selected": "Aucune bouteille sélectionnée",
+ "Create a bottle to install Steam and play.": "Créez une bouteille pour installer Steam et jouer.",
+ "Stop all processes": "Arrêter tous les processus",
+ "Delete bottle…": "Supprimer la bouteille…",
+ "Delete": "Supprimer",
+ "Cancel": "Annuler",
+ "Something went wrong": "Un problème est survenu",
+
+ // Bottle view
+ "Programs": "Programmes",
+ "Nothing installed yet — add a launcher below.": "Rien d’installé pour l’instant — ajoutez un launcher ci-dessous.",
+ "Run": "Lancer",
+ "Games": "Jeux",
+ "Play": "Jouer",
+ "Install a launcher": "Installer un launcher",
+ "Kernel anti-cheat titles (Valorant, Fortnite, Destiny 2…) can’t work through Wine — check the compatibility database before big downloads.":
+ "Les jeux à anti-cheat noyau (Valorant, Fortnite, Destiny 2…) ne peuvent pas fonctionner via Wine — consultez la base de compatibilité avant les gros téléchargements.",
+ "Graphics & compatibility": "Graphismes et compatibilité",
+ "Renderer": "Moteur de rendu",
+ "Synchronization": "Synchronisation",
+ "Windows version": "Version de Windows",
+ "Metal performance HUD": "HUD de performance Metal",
+ "Advertise AVX to games (Rosetta)": "Annoncer AVX aux jeux (Rosetta)",
+ "Open C: drive": "Ouvrir le disque C:",
+ "Stop all": "Tout arrêter",
+ "Renderer override": "Forcer un moteur de rendu",
+ "Bottle default": "Réglage de la bouteille",
+ "Remove from list": "Retirer de la liste",
+ "None — required for Steam/CEF launchers": "Aucune — requise pour Steam et les launchers CEF",
+ "msync — fastest for most games": "msync — le plus rapide pour la plupart des jeux",
+ "DXMT — D3D10/11 → Metal (default)": "DXMT — D3D10/11 → Metal (défaut)",
+ "D3DMetal — D3D11/12, Apple": "D3DMetal — D3D11/12, Apple",
+ "DXVK — D3D9/10/11 → Vulkan": "DXVK — D3D9/10/11 → Vulkan",
+ "WineD3D — slow fallback": "WineD3D — solution de repli, lent",
+ "D3DMetal (needed for DirectX 12) requires accepting Apple’s Game Porting Toolkit license.":
+ "D3DMetal (nécessaire pour DirectX 12) demande d’accepter la licence du Game Porting Toolkit d’Apple.",
+ "Review license…": "Lire la licence…",
+
+ // Sheets & dialogs
+ "New bottle": "Nouvelle bouteille",
+ "Name": "Nom",
+ "Install Steam in it (recommended)": "Y installer Steam (recommandé)",
+ "A bottle is an isolated Windows environment. First boot takes about 90 seconds; the Steam install adds a download and a slow one-time client update.":
+ "Une bouteille est un environnement Windows isolé. Le premier démarrage prend environ 90 secondes ; l’installation de Steam ajoute un téléchargement et une longue mise à jour initiale.",
+ "Create": "Créer",
+ "Done": "Terminé",
+ "Hide": "Masquer",
+ "Close": "Fermer",
+ "Details": "Détails",
+ "Run and add to Programs": "Lancer et ajouter aux programmes",
+ "Keep current": "Garder l’actuel",
+ "Accept & enable D3DMetal": "Accepter et activer D3DMetal",
+ "Non-commercial use only · no modification · Apple hardware only":
+ "Usage non commercial uniquement · aucune modification · matériel Apple uniquement",
+
+ // Onboarding
+ "Run Windows games on your Mac. Highball downloads a verified Wine engine (~500 MB) from public upstream releases — nothing is hosted by Highball itself.":
+ "Jouez à vos jeux Windows sur votre Mac. Highball télécharge un moteur Wine vérifié (~500 Mo) depuis des publications publiques — Highball n’héberge aucun binaire.",
+ "Rosetta 2 is required": "Rosetta 2 est requis",
+ "Enable D3DMetal (DirectX 12 support)": "Activer D3DMetal (prise en charge de DirectX 12)",
+ "Requires accepting": "Nécessite d’accepter",
+ "Apple’s Game Porting Toolkit license": "la licence du Game Porting Toolkit d’Apple",
+ "Install engine": "Installer le moteur",
+ "Installing…": "Installation…",
+
+ // Status pills
+ "Verified": "Vérifié",
+ "Reported": "Signalé",
+ "Community": "Communauté",
+ "Blocked — anti-cheat": "Bloqué — anti-cheat",
+ ]
+}
diff --git a/Sources/HighballKit/SteamLibrary.swift b/Sources/HighballKit/SteamLibrary.swift
new file mode 100644
index 0000000..665a989
--- /dev/null
+++ b/Sources/HighballKit/SteamLibrary.swift
@@ -0,0 +1,92 @@
+import Foundation
+
+/// A game installed by the Windows Steam client inside a bottle, read from
+/// `steamapps/appmanifest_<appid>.acf`.
+public struct SteamGame: Identifiable, Sendable, Hashable {
+ public let appid: Int
+ public let name: String
+ public let installdir: String
+ public let sizeOnDisk: Int64
+ public let stateFlags: Int
+
+ public var id: Int { appid }
+ /// StateFlags 4 = fully installed; anything else is updating/downloading/broken.
+ public var isReady: Bool { stateFlags == 4 }
+
+ /// Steam CDN artwork (no key needed).
+ public var headerImage: URL { URL(string: "https://cdn.akamai.steamstatic.com/steam/apps/\(appid)/header.jpg")! }
+ public var capsuleImage: URL { URL(string: "https://cdn.akamai.steamstatic.com/steam/apps/\(appid)/library_600x900.jpg")! }
+}
+
+public enum SteamLibrary {
+ /// Path of the Windows Steam install inside a bottle, if present.
+ public static func steamRoot(of bottle: Bottle) -> URL? {
+ let root = bottle.driveC.appending(path: "Program Files (x86)/Steam")
+ return FileManager.default.fileExists(atPath: root.appending(path: "steam.exe").path) ? root : nil
+ }
+
+ /// All games known to the bottle's Steam library folders.
+ public static func games(in bottle: Bottle) -> [SteamGame] {
+ guard let root = steamRoot(of: bottle) else { return [] }
+ let steamapps = root.appending(path: "steamapps")
+ guard let entries = try? FileManager.default.contentsOfDirectory(at: steamapps, includingPropertiesForKeys: nil) else { return [] }
+ return entries
+ .filter { $0.lastPathComponent.hasPrefix("appmanifest_") && $0.pathExtension == "acf" }
+ .compactMap { parseManifest($0) }
+ .filter { $0.appid != 228980 } // Steamworks Common Redistributables — not a game
+ .sorted { $0.name.localizedCaseInsensitiveCompare($1.name) == .orderedAscending }
+ }
+
+ /// Minimal ACF (Valve KeyValues) reader: flat `"key" "value"` pairs are all we need.
+ static func parseManifest(_ url: URL) -> SteamGame? {
+ guard let text = try? String(contentsOf: url, encoding: .utf8) else { return nil }
+ var fields: [String: String] = [:]
+ let pattern = #/"([A-Za-z]+)"\s+"([^"]*)"/#
+ for match in text.matches(of: pattern) where fields[String(match.1)] == nil {
+ fields[String(match.1)] = String(match.2)
+ }
+ guard let appidText = fields["appid"], let appid = Int(appidText), let name = fields["name"] else { return nil }
+ return SteamGame(
+ appid: appid,
+ name: name,
+ installdir: fields["installdir"] ?? "",
+ sizeOnDisk: Int64(fields["SizeOnDisk"] ?? "") ?? 0,
+ stateFlags: Int(fields["StateFlags"] ?? "") ?? 0
+ )
+ }
+}
+
+// MARK: - Compatibility database (db/games entries from highball-db)
+
+/// One entry of the open compatibility database, as published in highball-db `db/games/*.json`.
+public struct GameDBEntry: Codable, Sendable {
+ public var id: String
+ public var title: String
+ public var steam_appid: Int?
+ public var status: String // verified-local | reported-upstream | community | blocked-anticheat
+ public var renderer: Renderer?
+ public var provenance: String?
+ public var notes: String?
+
+ public var isBlocked: Bool { status == "blocked-anticheat" }
+}
+
+public struct GameDB: Sendable {
+ public let byAppID: [Int: GameDBEntry]
+
+ public init(directories: [URL]) {
+ var index: [Int: GameDBEntry] = [:]
+ for dir in directories {
+ guard let files = try? FileManager.default.contentsOfDirectory(at: dir, includingPropertiesForKeys: nil) else { continue }
+ for file in files where file.pathExtension == "json" {
+ guard let data = try? Data(contentsOf: file),
+ let entry = try? JSONDecoder().decode(GameDBEntry.self, from: data),
+ let appid = entry.steam_appid else { continue }
+ index[appid] = entry
+ }
+ }
+ byAppID = index
+ }
+
+ public subscript(appid: Int) -> GameDBEntry? { byAppID[appid] }
+}
diff --git a/Tests/GinKitTests/BottleTests.swift b/Tests/GinKitTests/BottleTests.swift
index d41e30c..242bde7 100644
--- a/Tests/GinKitTests/BottleTests.swift
+++ b/Tests/GinKitTests/BottleTests.swift
@@ -40,3 +40,25 @@ final class BottleTests: XCTestCase {
XCTAssertEqual(m.orderedComponents.first?.name, "dxmt")
}
}
+
+final class SteamLibraryTests: XCTestCase {
+ func testACFParse() throws {
+ let acf = """
+ "AppState"
+ {
+ \t"appid"\t\t"1902490"
+ \t"name"\t\t"Aperture Desk Job"
+ \t"StateFlags"\t\t"4"
+ \t"installdir"\t\t"Aperture Desk Job"
+ \t"SizeOnDisk"\t\t"3406000000"
+ }
+ """
+ let tmp = FileManager.default.temporaryDirectory.appending(path: "appmanifest_1902490.acf")
+ try acf.write(to: tmp, atomically: true, encoding: .utf8)
+ let game = SteamLibrary.parseManifest(tmp)
+ XCTAssertEqual(game?.appid, 1902490)
+ XCTAssertEqual(game?.name, "Aperture Desk Job")
+ XCTAssertTrue(game?.isReady == true)
+ XCTAssertEqual(game?.sizeOnDisk, 3_406_000_000)
+ }
+}