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 branch 'feat/mac-badges' into feat/gog-mac
Gabed31c1384d778
diff --cc Sources/HighballApp/AppState.swiftindex 2f2ac45,ec72901..d0af707--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@@ -4096,53 -3908,23 +4106,63 @@@ final class AppStatefunc gogCloudSetup(for item: LibraryItem) async -> GOGSaves.CloudSetup? {guard let id = item.gogID else { return nil }if let known = gogCloudSetups[id] { return known }- guard let game = bottles.first(where: { $0.name == item.bottleName }).flatMap({ gogInstalled(item, in: $0) }) else {+ let windows = bottles.first { $0.name == item.bottleName }.flatMap { gogInstalled(item, in: $0) }- guard let game = windows ?? gogMacInstalled[id]?.asInstalledGame else { return nil }++ guard let game = windows ?? gogMacInstalled[id]?.asInstalledGame else {+ gogCloudMisses[id] = .notFound+ return nil+ }let saves = GOGSaves(store: gogStore)- let setup = await Task.detached { saves.clientID(for: game).flatMap { try? saves.cloudSetup(clientID: $0) } }.value- if let setup { gogCloudSetups[id] = setup }- return setup+ let answer = await Task.detached { () -> Result<GOGSaves.CloudSetup, GOGCloudMiss> in+ do {+ guard let client = try saves.lookUpClientID(for: game) else { return .failure(.noClientID) }+ return .success(try saves.cloudSetup(clientID: client))+ } catch { return .failure(.unreachable) }+ }.value+ switch answer {+ case .success(let setup): gogCloudSetups[id] = setup; gogCloudMisses[id] = nil; return setup+ case .failure(let miss): gogCloudMisses[id] = miss; return nil+ }}+ /// The Mac build's cloud-save folders, empty when it has none or GOG cannot say.+ private func gogMacSaveLocations(_ game: GOGStore.InstalledGame) async -> [(GOGSaves.Location, URL)] {+ let saves = GOGSaves(store: gogStore)+ let locations = await Task.detached { () -> [GOGSaves.Location]? in+ guard let client = saves.clientID(for: game) else { return nil }+ return (try? saves.macLocations(clientID: client)) ?? nil+ }.value+ return (locations ?? []).compactMap { location in+ guard let folder = GOGSaves.resolveMac(location.template, installFolder: game.folder, gameID: game.id) else {+ appendLog("\(game.title): cloud saves at \(location.template) have no folder on this Mac, skipping that one")+ return nil+ }+ appendLog("\(game.title): cloud saves for the Mac version in \(folder.path)")+ return (location, folder)+ }+ }++ /// A GOG Mac build the player asked to move to the Trash: asked first, with what goes.+ var pendingGOGMacTrash: LibraryItem?++ /// What the Trash takes for a GOG game's Mac build, as the scan worked it out+ /// (GOGStore.macTrashTarget). Nil when there is none, or when it would be a folder holding+ /// other apps or another game's.+ func gogMacTrashTarget(for item: LibraryItem) -> URL? {+ item.gogID.flatMap { gogMacInstalled[$0]?.trashTarget }+ }++ /// Moves a GOG game's Mac build to the Trash, where it can still be put back. Only once the+ /// player said yes (pendingGOGMacTrash), and never while it runs.+ func gogTrashMac(_ item: LibraryItem) {+ guard refuseWhileRunning(item), let target = gogMacTrashTarget(for: item) else { return }+ NSWorkspace.shared.recycle([target]) { [weak self] _, error in+ Task { @MainActor in+ if let error { self?.appendLog("\(item.title): could not move the Mac version to the Trash: \(error.localizedDescription)") }+ await self?.refreshGOGMacInstalls()+ }+ }+ }+/// Updates a game gogdl installed to GOG's newest build, then runs its setup again.func gogUpdate(_ item: LibraryItem) {guard let bottleName = item.bottleName, let bottle = bottles.first(where: { $0.name == bottleName }),