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
Merge pull request #265 from matiasmg-ok/feat/add-games-settings-page
Gauthier Piarrettee2fcea884869
diff --cc Sources/HighballApp/GameDetailView.swiftindex 7b0eea8,00d34e1..d280323--- a/Sources/HighballApp/GameDetailView.swift+++ b/Sources/HighballApp/GameDetailView.swift@@@ -6,12 -6,7 +6,11 @@@ import HighballKistruct GameDetailView: View {@Environment(AppState.self) private var statelet passedItem: LibraryItem- @State private var showBottleSettings = false@State private var coverDropTargeted = false+ /// The launch arguments being typed; saved on Return and when the page closes, so a space+ /// typed between two arguments is not normalised away mid-word.+ @State private var argsText = ""+ @State private var argsLoaded = false/// The live row: after an install, a delete or a rename, the passed-in copy goes stale.private var item: LibraryItem { state.libraryItems.first { $0.id == passedItem.id } ?? passedItem }@State private var showWhy = false@@@ -409,16 -356,10 +405,16 @@@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)+ NavigationLink(L("Environment settings…"), value: EnvironmentSettingsDestination(name: bottle.name)).controlSize(.small)}- if !item.otherBottles.isEmpty {- row(L("Also installed in"), item.otherBottles.joined(separator: ", "))+ // Another copy plays from its own environment; once played there, the+ // tile follows it (highball#264).+ ForEach(item.otherBottles, id: \.self) { other in+ HStack(alignment: .firstTextBaseline, spacing: 12) {+ Text(L("Also installed in")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)+ Text(other).font(.callout)+ Button(L("Play there")) { state.play(item.homed(in: other)) }.controlSize(.small)+ }}HStack(alignment: .firstTextBaseline, spacing: 12) {Text(L("Files")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)diff --cc Sources/HighballApp/SettingsView.swiftindex 15c107a,93cb1b8..c79b440--- a/Sources/HighballApp/SettingsView.swift+++ b/Sources/HighballApp/SettingsView.swift@@@ -70,84 -75,77 +75,82 @@@ struct EnvironmentsPane: View}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)- ScrollView {- VStack(spacing: 8) {- ForEach(state.bottles, id: \.name) { bottle in- environmentCard(bottle)- }- 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)+ NavigationStack(path: $navigationPath) {+ 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)+ ScrollView {+ VStack(spacing: 8) {+ ForEach(state.bottles, id: \.name) { bottle in+ environmentCard(bottle)+ }+ 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))}- .padding(12)- .background(RoundedRectangle(cornerRadius: 10).fill(HB.card))}}- }- .frame(maxHeight: 170)- if let bottle = selected { details(bottle) }- Spacer(minLength: 0)- HStack(spacing: 10) {- Button(L("New environment…")) { showCreate = true }.disabled(state.busy)- Spacer()- // Where it all lives (#24, #68): games are big and internal disks are small.- Text(String(format: L("Kept in %@"), state.paths.home.path)).font(.caption).foregroundStyle(.secondary).lineLimit(1).truncationMode(.middle)- .help(state.paths.home.path)- Button(L("Change…")) { state.chooseHome() }.controlSize(.small).disabled(state.busy)- if HighballPaths.configuredHome() != nil {- Button(L("Default")) { state.useDefaultHome() }.controlSize(.small).disabled(state.busy)- .help(L("Back to ~/Library/Application Support/Highball, with the data"))+ .frame(maxHeight: 170)+ if let bottle = selected { details(bottle) }+ Spacer(minLength: 0)+ HStack(spacing: 10) {+ Button(L("New environment…")) { showCreate = true }.disabled(state.busy)+ Spacer()+ // Where it all lives (#24, #68): games are big and internal disks are small.+ Text(String(format: L("Kept in %@"), state.paths.home.path)).font(.caption).foregroundStyle(.secondary).lineLimit(1).truncationMode(.middle)+ .help(state.paths.home.path)+ Button(L("Change…")) { state.chooseHome() }.controlSize(.small).disabled(state.busy)+ if HighballPaths.configuredHome() != nil {+ Button(L("Default")) { state.useDefaultHome() }.controlSize(.small).disabled(state.busy)+ .help(L("Back to ~/Library/Application Support/Highball, with the data"))+ }+ if let b = selected {+ Button(L("Repair")) { state.repairBottle(b) }.disabled(state.busy)+ Button(L("Settings…")) { navigationPath.append(EnvironmentSettingsDestination(name: b.name)) }.help(L("Graphics, compatibility, engine, DLL overrides, environment variables and dependencies for this environment."))+ Button(L("Full page…")) { navigationPath.append(EnvironmentProgramsDestination(name: b.name)) }+ }+ Spacer()+ Text(L("Repair re-runs the Windows first boot. Games and Steam stay where they are."))+ .font(.caption).foregroundStyle(.secondary)}- if let b = selected {- Button(L("Repair")) { state.repairBottle(b) }.disabled(state.busy)- Button(L("Settings…")) { settingsName = b.name }.help(L("Graphics, compatibility, engine, DLL overrides, environment variables and dependencies for this environment."))- Button(L("Full page…")) { openName = b.name }+ }+ .padding(20)+ .navigationDestination(for: EnvironmentProgramsDestination.self) { destination in+ if let bottle = state.bottles.first(where: { $0.name == destination.name }) {+ BottleView(bottle: bottle, navigationPath: $navigationPath)}- Spacer()- Text(L("Repair re-runs the Windows first boot. Games and Steam stay where they are."))- .font(.caption).foregroundStyle(.secondary)}- }- .padding(20)- .sheet(isPresented: .init(get: { openName != nil }, set: { if !$0 { openName = nil } })) {- if let bottle = state.bottles.first(where: { $0.name == openName }) {- NavigationStack {- BottleView(bottle: bottle)- .toolbar { ToolbarItem(placement: .cancellationAction) { Button(L("Done")) { openName = nil } } }+ .navigationDestination(for: EnvironmentSettingsDestination.self) { destination in+ if let bottle = state.bottles.first(where: { $0.name == destination.name }) {+ EnvironmentSettingsPage(bottle: bottle, showsInlineBack: true)}- .frame(minWidth: 780, minHeight: 560)}- }- .sheet(isPresented: .init(get: { settingsName != nil }, set: { if !$0 { settingsName = nil } })) {- if let bottle = state.bottles.first(where: { $0.name == settingsName }) {- BottleSettingsSheet(bottle: bottle)+ .sheet(isPresented: $showCreate) { CreateBottleSheet() }+ .confirmationDialog("Delete environment \"\(pendingDelete ?? "")\"? This removes its Windows drive and everything installed in it, games included.",+ 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: $showCreate) { CreateBottleSheet() }- .confirmationDialog("Delete environment \"\(pendingDelete ?? "")\"? This removes its Windows drive and everything installed in it, games included.",- 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 }- }}+ /// Every game installed in the environment, also one whose tile lives in another (highball#264).+ private func footprint(_ bottle: Bottle) -> (count: Int, bytes: Int64) {+ LibraryIndex.footprint(of: bottle.name, items: state.libraryItems, steamGames: state.gamesByBottle[bottle.name] ?? [])+ }+private func sizeText(_ bottle: Bottle) -> String {- let bytes = state.libraryItems.filter { $0.bottleName == bottle.name }.reduce(Int64(0)) { $0 + $1.sizeOnDisk }+ let bytes = footprint(bottle).bytesreturn bytes > 0 ? ByteCountFormatter.string(fromByteCount: bytes, countStyle: .file) : ""}