Skip to content

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

Settings › Environments and the game page's Advanced follow the design canvas

Gauthier Piarretteedf264c599df
diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swift
index c2bb0e4..abc5c5a 100644
--- a/Sources/HighballApp/GameDetailView.swift
+++ b/Sources/HighballApp/GameDetailView.swift
@@ -185,47 +185,58 @@ struct GameDetailView: View {
}
private var advanced: some View {
- DisclosureGroup(isExpanded: $showAdvanced) {
- VStack(alignment: .leading, spacing: 8) {
- if let bottle {
- row(L("Environment"), bottle.name + (engineName.map { " · \($0)" } ?? ""))
- row(L("Graphics mode"), GamePageCopy.plainName(bottle.settings.renderer) + (bottle.settings.rendererExplicit ? L(" (set by you)") : ""))
- row(L("Engine"), bottle.settings.engineID)
- if let r = entry?.effectiveRenderer() { row(L("Verified with"), GamePageCopy.plainName(r)) }
+ VStack(alignment: .leading, spacing: 14) {
+ DisclosureGroup(isExpanded: $showAdvanced) {
+ VStack(alignment: .leading, spacing: 10) {
+ if let bottle {
+ HStack(alignment: .top, spacing: 12) {
+ Text(L("Graphics mode")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading).padding(.top, 4)
+ GraphicsModePicker(bottle: bottle)
+ }
+ row(L("Engine"), (state.engine(for: bottle)?.displayName).map { "\($0) · \(bottle.settings.engineID)" } ?? bottle.settings.engineID)
+ HStack(alignment: .firstTextBaseline, spacing: 12) {
+ Text(L("Environment")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)
+ Text(bottle.name).font(.callout)
+ Button(L("Environment settings…")) { showBottleSettings = true }.controlSize(.small)
+ }
+ if !item.otherBottles.isEmpty {
+ row(L("Also installed in"), item.otherBottles.joined(separator: ", "))
+ }
+ HStack(alignment: .firstTextBaseline, spacing: 12) {
+ Text(L("Files")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)
+ Button(L("Show the Windows drive")) { NSWorkspace.shared.open(bottle.driveC) }.controlSize(.small)
+ if PlayLink.target(for: item) != nil {
+ Button(L("Make a Mac app…")) { state.makeMacApp(for: item) }.controlSize(.small)
+ .help(L("A small app in ~/Applications/Highball that starts this game without opening Highball first."))
+ }
+ }
+ if let fixRecipe, item.installed {
+ HStack(alignment: .firstTextBaseline, spacing: 12) {
+ Text(L("Fix")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)
+ Button(fixApplied ? String(format: L("Re-apply the %@ fix"), fixRecipe.title) : String(format: L("Apply the %@ fix now"), fixRecipe.title)) {
+ state.applyRecipe(fixRecipe.id, to: bottle)
+ }
+ .controlSize(.small).disabled(state.busy)
+ }
+ }
+ }
+ }
+ .padding(.top, 10)
+ } label: {
+ HStack(spacing: 8) {
+ Text(L("Advanced")).font(.callout.weight(.medium))
+ Text(L("graphics mode · engine · environment · files")).font(.caption.monospaced()).foregroundStyle(.tertiary)
}
+ }
+ Divider()
+ VStack(alignment: .leading, spacing: 8) {
+ row(L("Source"), item.source == .steam ? "Steam" : item.source == .epic ? "Epic Games" : L("Windows program"))
if item.sizeOnDisk > 0 {
row(L("Size on disk"), ByteCountFormatter.string(fromByteCount: item.sizeOnDisk, countStyle: .file))
}
if let played = item.lastPlayed {
row(L("Last played"), played.formatted(date: .abbreviated, time: .shortened))
}
- if !item.otherBottles.isEmpty {
- row(L("Also installed in"), item.otherBottles.joined(separator: ", "))
- }
- HStack(spacing: 8) {
- if bottle != nil {
- Button(L("Environment settings…")) { showBottleSettings = true }
- Button(L("Show the Windows drive")) { if let b = bottle { NSWorkspace.shared.open(b.driveC) } }
- if PlayLink.target(for: item) != nil {
- Button(L("Make a Mac app…")) { state.makeMacApp(for: item) }
- .help(L("A small app in ~/Applications/Highball that starts this game without opening Highball first."))
- }
- }
- if let fixRecipe, let bottle, item.installed {
- Button(fixApplied ? String(format: L("Re-apply the %@ fix"), fixRecipe.title) : String(format: L("Apply the %@ fix now"), fixRecipe.title)) {
- state.applyRecipe(fixRecipe.id, to: bottle)
- }
- .disabled(state.busy)
- }
- }
- .controlSize(.small)
- .padding(.top, 4)
- }
- .padding(.top, 8)
- } label: {
- HStack(spacing: 8) {
- Text(L("Advanced")).font(.callout.weight(.medium))
- Text(L("graphics mode · engine · environment · files")).font(.caption.monospaced()).foregroundStyle(.tertiary)
}
}
.padding(.top, 6)
diff --git a/Sources/HighballApp/GraphicsModePicker.swift b/Sources/HighballApp/GraphicsModePicker.swift
new file mode 100644
index 0000000..ba9e00d
--- /dev/null
+++ b/Sources/HighballApp/GraphicsModePicker.swift
@@ -0,0 +1,72 @@
+import SwiftUI
+import HighballKit
+
+/// One picker for an environment's graphics mode (canvas "Advanced: Settings"). Automatic
+/// means the compatibility database decides per game, with the environment's own mode for games
+/// without a verdict; picking a mode makes it explicit, and recipes then leave it alone.
+struct GraphicsModePicker: View {
+ @Environment(AppState.self) private var state
+ let bottle: Bottle
+
+ private var live: Bottle { state.bottles.first { $0.name == bottle.name } ?? bottle }
+ private var d3dmetalAvailable: Bool { state.engine(for: live)?.rendererDir("d3dmetal") != nil }
+
+ /// nil = Automatic.
+ private var selection: Binding<Renderer?> {
+ Binding(get: { live.settings.rendererExplicit ? live.settings.renderer : nil },
+ set: { newValue in
+ var copy = live
+ if let r = newValue { copy.settings.renderer = r; copy.settings.rendererExplicit = true }
+ else { copy.settings.rendererExplicit = false }
+ state.update(copy)
+ })
+ }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 4) {
+ HStack(spacing: 10) {
+ Picker(L("Graphics mode"), selection: selection) {
+ Text(L("Automatic")).tag(Renderer?.none)
+ Text(GamePageCopy.plainName(.dxmt)).tag(Renderer?.some(.dxmt))
+ Text(GamePageCopy.plainName(.dxvk)).tag(Renderer?.some(.dxvk))
+ if d3dmetalAvailable { Text(GamePageCopy.plainName(.d3dmetal)).tag(Renderer?.some(.d3dmetal)) }
+ Text(GamePageCopy.plainName(.wined3d)).tag(Renderer?.some(.wined3d))
+ }
+ .labelsHidden().frame(maxWidth: 260)
+ }
+ Text(live.settings.rendererExplicit
+ ? String(format: L("%@ for every game in this environment, whatever the database says."), GamePageCopy.plainName(live.settings.renderer))
+ : String(format: L("The mode verified for each game; %@ for games without a verdict."), GamePageCopy.plainName(live.settings.renderer)))
+ .font(.caption).foregroundStyle(.secondary)
+ }
+ }
+}
+
+/// Installed Windows components as chips, with Add for the rest (canvas "Windows components").
+struct WindowsComponentsRow: View {
+ @Environment(AppState.self) private var state
+ let bottle: Bottle
+
+ var body: some View {
+ let live = state.bottles.first { $0.name == bottle.name } ?? bottle
+ let tweaks = AppState.tweakRecipes()
+ let installed = tweaks.filter { live.settings.recipes.contains($0.id) || state.tweakIsInstalled($0, in: live) }
+ let missing = tweaks.filter { r in !installed.contains { $0.id == r.id } }
+ HStack(spacing: 6) {
+ ForEach(installed, id: \.id) { r in
+ Label(r.title, systemImage: "checkmark").font(.caption.weight(.medium))
+ .padding(.horizontal, 8).padding(.vertical, 4)
+ .background(Capsule().fill(HB.good.opacity(0.18))).foregroundStyle(HB.good)
+ }
+ if installed.isEmpty { Text(L("None yet")).font(.caption).foregroundStyle(.secondary) }
+ if !missing.isEmpty {
+ Menu {
+ ForEach(missing, id: \.id) { r in
+ Button(r.title) { state.applyRecipe(r.id, to: live) }
+ }
+ } label: { Text(L("Add")).font(.caption) }
+ .menuStyle(.borderlessButton).fixedSize().disabled(state.busy)
+ }
+ }
+ }
+}
diff --git a/Sources/HighballApp/SettingsView.swift b/Sources/HighballApp/SettingsView.swift
index 7e4a617..d863066 100644
--- a/Sources/HighballApp/SettingsView.swift
+++ b/Sources/HighballApp/SettingsView.swift
@@ -19,63 +19,47 @@ struct SettingsView: View {
/// One environment by default, more only when two games need settings that conflict.
struct EnvironmentsPane: View {
@Environment(AppState.self) private var state
+ @State private var selectedName: String?
@State private var openName: String?
@State private var pendingDelete: String?
@State private var showCreate = false
+ private var selected: Bottle? {
+ state.bottles.first { $0.name == selectedName } ?? state.defaultBottle
+ }
+
var body: some View {
VStack(alignment: .leading, spacing: 14) {
Text(L("Highball keeps your games in one Windows environment and looks after it. A second one is only for a game whose settings conflict with the others."))
.font(.callout).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)
- List {
- ForEach(state.bottles, id: \.name) { bottle in
- HStack(spacing: 12) {
- Image(systemName: "cylinder.split.1x2").foregroundStyle(.secondary)
- VStack(alignment: .leading, spacing: 2) {
- HStack(spacing: 8) {
- Text(bottle.name).font(.headline)
- if bottle.name == AppState.defaultEnvironmentName {
- Text(L("DEFAULT")).font(.system(size: 9, weight: .bold)).padding(.horizontal, 6).padding(.vertical, 2)
- .background(Capsule().fill(HB.good.opacity(0.2))).foregroundStyle(HB.good)
- }
- if state.deletingBottles.contains(bottle.name) {
- Text(L("deleting…")).font(.caption).foregroundStyle(.secondary)
- }
- }
- Text("\(state.engine(for: bottle)?.displayName ?? bottle.settings.engineID) · \(GamePageCopy.plainName(bottle.settings.renderer)) · \((state.gamesByBottle[bottle.name] ?? []).count) " + L("titles"))
- .font(.caption.monospacedDigit()).foregroundStyle(.secondary)
- }
- Spacer()
- Button(L("Open")) { openName = bottle.name }.controlSize(.small)
+ ScrollView {
+ VStack(spacing: 8) {
+ ForEach(state.bottles, id: \.name) { bottle in
+ environmentCard(bottle)
}
- .padding(.vertical, 4)
- .contextMenu {
- Button(L("Open")) { openName = bottle.name }
- Button(L("Stop all processes")) { state.killBottle(bottle) }
- Button(L("Duplicate")) { state.duplicateBottle(bottle) }
- Button(L("Repair (re-run the Windows first boot)")) { state.repairBottle(bottle) }
- Divider()
- Button(L("Delete…"), role: .destructive) { pendingDelete = bottle.name }
- .disabled(state.deletingBottles.contains(bottle.name))
- }
- }
- ForEach(state.damagedBottles) { damaged in
- HStack(spacing: 12) {
- Image(systemName: "exclamationmark.triangle.fill").foregroundStyle(.orange)
- VStack(alignment: .leading, spacing: 2) {
- Text(damaged.name).font(.headline)
- Text(damaged.reason).font(.caption).foregroundStyle(.secondary)
+ ForEach(state.damagedBottles) { damaged in
+ HStack(spacing: 12) {
+ Image(systemName: "exclamationmark.triangle.fill").foregroundStyle(.orange)
+ VStack(alignment: .leading, spacing: 2) {
+ Text(damaged.name).font(.headline)
+ Text(damaged.reason).font(.caption).foregroundStyle(.secondary)
+ }
+ Spacer()
+ Button(L("Delete…"), role: .destructive) { pendingDelete = damaged.name }.controlSize(.small)
}
- Spacer()
- Button(L("Delete…"), role: .destructive) { pendingDelete = damaged.name }.controlSize(.small)
+ .padding(12)
+ .background(RoundedRectangle(cornerRadius: 10).fill(HB.card))
}
}
}
- .frame(minHeight: 220)
+ .frame(maxHeight: 170)
+ if let bottle = selected { details(bottle) }
+ Spacer(minLength: 0)
HStack(spacing: 10) {
Button(L("New environment…")) { showCreate = true }.disabled(state.busy)
- if let b = state.defaultBottle {
+ if let b = selected {
Button(L("Repair")) { state.repairBottle(b) }.disabled(state.busy)
+ Button(L("Full page…")) { openName = b.name }
}
Spacer()
Text(L("Repair re-runs the Windows first boot. Games and Steam stay where they are."))
@@ -100,6 +84,78 @@ struct EnvironmentsPane: View {
Button(L("Cancel"), role: .cancel) { pendingDelete = nil }
}
}
+
+ private func sizeText(_ bottle: Bottle) -> String {
+ let bytes = state.libraryItems.filter { $0.bottleName == bottle.name }.reduce(Int64(0)) { $0 + $1.sizeOnDisk }
+ return bytes > 0 ? ByteCountFormatter.string(fromByteCount: bytes, countStyle: .file) : ""
+ }
+
+ private func environmentCard(_ bottle: Bottle) -> some View {
+ let isSelected = selected?.name == bottle.name
+ let titles = state.libraryItems.filter { $0.bottleName == bottle.name }.count
+ return Button {
+ selectedName = bottle.name
+ } label: {
+ HStack(spacing: 12) {
+ Image(systemName: "cylinder.split.1x2").foregroundStyle(isSelected ? HB.amber : .secondary)
+ VStack(alignment: .leading, spacing: 2) {
+ HStack(spacing: 8) {
+ Text(bottle.name).font(.headline)
+ if bottle.name == AppState.defaultEnvironmentName {
+ Text(L("DEFAULT")).font(.system(size: 9, weight: .bold)).padding(.horizontal, 6).padding(.vertical, 2)
+ .background(Capsule().fill(HB.good.opacity(0.2))).foregroundStyle(HB.good)
+ }
+ if state.deletingBottles.contains(bottle.name) {
+ Text(L("deleting…")).font(.caption).foregroundStyle(.secondary)
+ }
+ }
+ Text([state.engine(for: bottle)?.displayName ?? bottle.settings.engineID,
+ String(format: L("%d titles"), titles),
+ sizeText(bottle)].filter { !$0.isEmpty }.joined(separator: " · "))
+ .font(.caption.monospacedDigit()).foregroundStyle(.secondary)
+ }
+ Spacer()
+ }
+ .padding(12)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .background(RoundedRectangle(cornerRadius: 10).fill(HB.card))
+ .overlay(RoundedRectangle(cornerRadius: 10).stroke(isSelected ? HB.amber.opacity(0.6) : HB.cardStroke))
+ .contextMenu {
+ Button(L("Full page…")) { openName = bottle.name }
+ Button(L("Stop all processes")) { state.killBottle(bottle) }
+ Button(L("Duplicate")) { state.duplicateBottle(bottle) }
+ Button(L("Repair (re-run the Windows first boot)")) { state.repairBottle(bottle) }
+ Divider()
+ Button(L("Delete…"), role: .destructive) { pendingDelete = bottle.name }
+ .disabled(state.deletingBottles.contains(bottle.name))
+ }
+ }
+
+ private func details(_ bottle: Bottle) -> some View {
+ VStack(alignment: .leading, spacing: 0) {
+ row(L("Graphics mode")) { GraphicsModePicker(bottle: bottle) }
+ Divider().padding(.vertical, 8)
+ row(L("Windows components")) { WindowsComponentsRow(bottle: bottle) }
+ Divider().padding(.vertical, 8)
+ row(L("Files")) {
+ Button(L("Show the Windows drive")) { NSWorkspace.shared.open(bottle.driveC) }
+ .buttonStyle(.link)
+ }
+ }
+ .padding(14)
+ .background(RoundedRectangle(cornerRadius: 10).fill(HB.card))
+ .overlay(RoundedRectangle(cornerRadius: 10).stroke(HB.cardStroke))
+ }
+
+ private func row<Content: View>(_ label: String, @ViewBuilder content: () -> Content) -> some View {
+ HStack(alignment: .top, spacing: 14) {
+ Text(label).font(.callout).frame(width: 150, alignment: .leading).padding(.top, 2)
+ content()
+ Spacer(minLength: 0)
+ }
+ }
}
struct EnginePane: View {