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
Whole-app review, batch 4: environment wording, ⌘O gating, dead sidebar code
Gauthier Piarrettefa11ad972faa
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex 425819b..ed29400 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -58,7 +58,7 @@ final class AppState {switch self {case .cancelTask: return L("Stopped. Nothing already downloaded is lost.")case .killBottle: return L("Stopped.")- case .killBottleThenRepair: return L("Stopped. Repairing the bottle so nothing half-installed stays behind.")+ case .killBottleThenRepair: return L("Stopped. Repairing the environment so nothing half-installed stays behind.")}}var bottleToRepair: Bottle? {@@ -129,8 +129,6 @@ final class AppState {/// Which primary surface the detail column shows. `selectedBottle` keeps backing every/// bottle action and the File-menu commands; it just stopped being the router.- enum Pane: Hashable { case library, bottles }- var pane: Pane = .libraryvar libraryItems: [LibraryItem] = []var libraryPlays: [String: LibraryStore.PlayRecord] = [:]var libraryStore: LibraryStore { LibraryStore(paths: paths) }@@ -603,7 +601,7 @@ final class AppState {if bottles.isEmpty, let engine = defaultEngine {await MainActor.run { self.stage = L("Preparing your Windows environment"); self.busyExpected = L("about 90 seconds") }_ = try await bottleStore.create(name: Self.defaultEnvironmentName, engine: engine)- await MainActor.run { self.appendLog("environment ready"); self.funnel(.environmentCreated); self.selectedBottle = Self.defaultEnvironmentName; self.pane = .library }+ await MainActor.run { self.appendLog("environment ready"); self.funnel(.environmentCreated); self.selectedBottle = Self.defaultEnvironmentName }}}}@@ -637,7 +635,7 @@ final class AppState {runBusy(L("Preparing your Windows environment"), expected: L("about 90 seconds"),done: DoneState(title: L("Highball is ready"), ctaTitle: nil, cta: nil)) { [self] in_ = try await bottleStore.create(name: Self.defaultEnvironmentName, engine: engine)- await MainActor.run { self.selectedBottle = Self.defaultEnvironmentName; self.pane = .library }+ await MainActor.run { self.selectedBottle = Self.defaultEnvironmentName }}}@@ -716,7 +714,7 @@ final class AppState {let notes = try await runner.apply(recipe) { line in Task { @MainActor in self.appendLog(line) } }for n in notes { await MainActor.run { self.appendLog("note: \(n)") } }}- await MainActor.run { self.selectedBottle = name; self.pane = .bottles }+ await MainActor.run { self.selectedBottle = name }}}@@ -1004,7 +1002,7 @@ final class AppState {// was in fact succeeding.guard !deletingBottles.contains(name) else { return }deletingBottles.insert(name)- runBusy("Deleting '\(name)'", showLogSheet: false,+ runBusy(String(format: L("Deleting the %@ environment"), name), showLogSheet: false,cleanup: { [weak self] in self?.deletingBottles.remove(name) }) { [self] inlet store = bottleStorelet killer = killerFor(name)@@ -1188,7 +1186,7 @@ final class AppState {}// .msi / .bat: an installer, which cannot stop cleanly, so it stays a blocking op.guard let engine = engine(for: bottle) else { return }- runBusy("Running \(url.lastPathComponent)", stop: .killBottleThenRepair(bottle, label: L("Stop and repair"))) { [self] in+ runBusy(String(format: L("Running %@"), url.lastPathComponent), stop: .killBottleThenRepair(bottle, label: L("Stop and repair"))) { [self] inlet runner = WineRunner(paths: paths, engine: engine, bottle: bottle)let args = ext == "msi" ? ["msiexec", "/i", url.path] : [url.path]_ = try await runner.run(args, renderer: .wined3d, label: url.lastPathComponent,@@ -1221,7 +1219,7 @@ final class AppState {// Repair is the escape hatch for a bottle whose 32-bit half never got built (#37);// refreshPrefix carries that check.try await BottleStore.refreshPrefix(runner: runner, bottle: bottle)- await MainActor.run { self.appendLog("bottle repaired — Windows environment refreshed") }+ await MainActor.run { self.appendLog("environment repaired — Windows first boot refreshed") }}}diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swiftindex 99f46ff..a62d54b 100644--- a/Sources/HighballApp/BottleView.swift+++ b/Sources/HighballApp/BottleView.swift@@ -70,10 +70,10 @@ struct BottleView: View {.toolbar {ToolbarItemGroup {if state.busy { ProgressView().controlSize(.small) }- Button { showSettings = true } label: { Label(L("Bottle settings"), systemImage: "slider.horizontal.3") }+ Button { showSettings = true } label: { Label(L("Environment settings"), systemImage: "slider.horizontal.3") }.help(L("Renderer, synchronization, Windows version…"))Menu {- Button(L("Open C: drive")) { NSWorkspace.shared.open(bottle.driveC) }+ Button(L("Show the Windows drive")) { NSWorkspace.shared.open(bottle.driveC) }Button(L("Stop all processes")) { state.killBottle(bottle) }} label: { Label(L("More"), systemImage: "ellipsis.circle") }}@@ -150,7 +150,7 @@ struct BottleView: View {.contextMenu {Button(L("Program settings…")) { editingPin = pin }Menu(L("Renderer override")) {- Button(L("Bottle default")) { state.setPinRenderer(nil, pin: pin, in: bottle) }+ Button(L("Environment default")) { state.setPinRenderer(nil, pin: pin, in: bottle) }ForEach(Renderer.allCases, id: \.self) { r inButton(r.rawValue.uppercased()) { state.setPinRenderer(r, pin: pin, in: bottle) }}@@ -351,7 +351,7 @@ struct BottleSettingsSheet: View {Toggle(L("Use ⌘C / ⌘V inside Windows apps"), isOn: binding(\.commandIsControl))Text(L("Maps the Command keys to Ctrl, so Mac copy and paste work in Steam and games. Option becomes Alt so Alt-based bindings keep working. Off = Wine's default, where Command acts as Alt.")).font(.caption).foregroundStyle(.secondary)- Text(L("Games run with the bottle’s sync (msync is fastest). Opening the Steam window restarts Windows processes with sync off — its interface needs it."))+ Text(L("Games run with the environment’s sync (msync is fastest). Opening the Steam window restarts Windows processes with sync off — its interface needs it.")).font(.caption).foregroundStyle(.secondary)}Section(L("Advanced")) {@@ -370,15 +370,15 @@ struct BottleSettingsSheet: View {}}.disabled(state.busy)- Text(L("Bottles never change engine on their own. Switching re-runs the Windows setup when the Wine build differs; switching back is the same step. An engine marked download is fetched first."))+ Text(L("Environments never change engine on their own. Switching re-runs the Windows setup when the Wine build differs; switching back is the same step. An engine marked download is fetched first.")).font(.caption).foregroundStyle(.secondary)}TextField(L("DLL overrides"), text: binding(\.dllOverrides), prompt: Text(verbatim: "version=n,b;winmm=n,b")).font(.body.monospaced())- Text(L("Extra Wine DLL overrides for this bottle, semicolon separated. Mods like Cyber Engine Tweaks need version=n,b."))+ Text(L("Extra Wine DLL overrides for this environment, semicolon separated. Mods like Cyber Engine Tweaks need version=n,b.")).font(.caption).foregroundStyle(.secondary)EnvEditor(bottle: bottle)- Text(L("Environment variables, one KEY=VALUE per line. Applied to everything launched in this bottle."))+ Text(L("Environment variables, one KEY=VALUE per line. Applied to everything launched in this environment.")).font(.caption).foregroundStyle(.secondary)}let tweaks = AppState.tweakRecipes()@@ -403,13 +403,13 @@ struct BottleSettingsSheet: View {}}Section {- Button(L("Delete bottle…"), role: .destructive) { confirmDelete = true }+ Button(L("Delete environment…"), role: .destructive) { confirmDelete = true }}}.formStyle(.grouped)}.frame(width: 560, height: 560)- .confirmationDialog(L("Delete this bottle? Its Windows drive and everything installed in it are removed."),+ .confirmationDialog(L("Delete this environment? Its Windows drive and everything installed in it are removed."),isPresented: $confirmDelete, titleVisibility: .visible) {Button(L("Delete"), role: .destructive) { dismiss(); state.deleteBottle(bottle.name) }Button(L("Cancel"), role: .cancel) {}@@ -569,7 +569,7 @@ struct PinSettingsSheet: View {.font(.caption).foregroundStyle(.secondary)}Picker(L("Renderer"), selection: $pin.renderer) {- Text(L("Bottle default")).tag(Renderer?.none)+ Text(L("Environment default")).tag(Renderer?.none)ForEach(Renderer.allCases, id: \.self) { r inText(r.rawValue.uppercased()).tag(Renderer?.some(r))}diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swiftindex 3d4e920..20370f1 100644--- a/Sources/HighballApp/HighballApp.swift+++ b/Sources/HighballApp/HighballApp.swift@@ -27,9 +27,9 @@ struct HighballApp: App {.windowResizability(.contentSize).commands {CommandGroup(after: .newItem) {- Button(L("Run Windows Program…")) { state.chooseProgramToRun() }+ Button(L("A Windows program I have…")) { state.chooseProgramToRun() }.keyboardShortcut("o")- .disabled(state.selectedBottle == nil)+ .disabled(state.busy || state.bottles.isEmpty)}CommandGroup(after: .appInfo) {CheckForUpdatesView(updater: delegate.updaterController.updater)@@ -108,8 +108,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate {struct ContentView: View {@Environment(AppState.self) private var state- @State private var showCreate = false- @State private var pendingDelete: String?/// Where a dropped or chosen program runs: the environment page it came from, else the default.private var runTarget: Bottle? {@@ -151,7 +149,6 @@ struct ContentView: View {}// Everything that takes time lives on one strip at the bottom, never modal (UX plan 0.5)..safeAreaInset(edge: .bottom, spacing: 0) { ActivityStrip() }- .sheet(isPresented: $showCreate) { CreateBottleSheet() }// A Windows program dropped anywhere on the window, or picked from Add games and ⌘O,// runs in the environment it was dropped on, else the default one..onDrop(of: [.fileURL], isTargeted: nil) { providers in@@ -162,7 +159,7 @@ struct ContentView: View {Task { @MainActor in state.pendingRunBottle = nil; state.pendingRun = url }} else {Task { @MainActor in- state.errorMessage = String(format: L("'%@' isn't a Windows program. You can drop .exe, .msi or .bat files here."), url.lastPathComponent)+ state.fail(HighballError.failed(String(format: L("'%@' isn't a Windows program. You can drop .exe, .msi or .bat files here."), url.lastPathComponent)))}}}@@ -175,12 +172,6 @@ struct ContentView: View {Button(L("Run and add to Programs")) { if let u = state.pendingRun, let b = runTarget { state.runDropped(u, in: b, andPin: true) }; state.pendingRun = nil }Button(L("Cancel"), role: .cancel) { state.pendingRun = nil }}- .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() }// Asked at the first game that needs it, never at install (UX plan §3.5). Nothing