Skip to content

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

The cloud saves row says only what Highball knows: nothing for an Epic game its library has not listed yet, "GOG keeps no cloud saves" for a GOG game with no client id, and that a game without store cloud saves keeps its own

Gabe5004ef6e8fd7
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index c63dccf..f05e152 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -3894,15 +3894,33 @@ final class AppState {
/// How GOG syncs each GOG game's saves (GOGSaves.CloudSetup), asked once a session per game.
@ObservationIgnored private var gogCloudSetups: [String: GOGSaves.CloudSetup] = [:]
- /// How an installed GOG game's saves sync, for its page; nil when GOG could not be asked.
+ /// Why gogCloudSetup has no answer for a game: not found in its environment, no client id
+ /// (GOG keeps no cloud saves for it), or GOG did not answer.
+ enum GOGCloudMiss: Error { case notFound, noClientID, unreachable }
+ @ObservationIgnored private var gogCloudMisses: [String: GOGCloudMiss] = [:]
+
+ /// Why the last gogCloudSetup for the game came back empty; nil once it has an answer.
+ func gogCloudMiss(for item: LibraryItem) -> GOGCloudMiss? { item.gogID.flatMap { gogCloudMisses[$0] } }
+
+ /// How an installed GOG game's saves sync, for its page; nil when there is no answer (gogCloudMiss says why).
func 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 { return nil }
+ guard let game = bottles.first(where: { $0.name == item.bottleName }).flatMap({ gogInstalled(item, in: $0) }) 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
+ }
}
/// Updates a game gogdl installed to GOG's newest build, then runs its setup again.
@@ -4294,8 +4312,10 @@ final class AppState {
default:
return nil
}
- if let estimate { downloadEstimates[key] = estimate; downloadEstimatesFetched[key] = Date(); saveDownloadEstimates() }
- return estimate ?? (refresh ? downloadEstimates[key] : nil)
+ // An answer with neither size (GOG's info without them) says nothing: never kept as the size.
+ let answer = estimate.flatMap { $0.download != nil || $0.disk != nil ? $0 : nil }
+ if let answer { downloadEstimates[key] = answer; downloadEstimatesFetched[key] = Date(); saveDownloadEstimates() }
+ return answer ?? (refresh ? downloadEstimates[key] : nil)
}
private static func estimateKey(_ item: LibraryItem, mac: Bool) -> String { "\(item.id)|\(mac ? "mac" : "windows")" }
diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swift
index fd4909a..1c5539a 100644
--- a/Sources/HighballApp/GameDetailView.swift
+++ b/Sources/HighballApp/GameDetailView.swift
@@ -491,15 +491,23 @@ struct GameDetailView: View {
// the moment before the owned refresh lands, is one Highball cannot say about.
guard let cloud = item.steamAppID.flatMap({ state.steamCloudByAppID[$0] }) else { return [] }
return [cloud ? L("Steam syncs this game's saves with Steam Cloud, for whichever account plays it.")
- : L("This game keeps its saves on this Mac.")]
+ : L("This game keeps its own saves, on this Mac or with its publisher's service.")]
case .epic:
- return [state.epicOwned.first { $0.app_name == item.epicAppName }?.cloudSaves == true
+ // Nothing until Epic's library lists the game, as for Steam.
+ guard let game = state.epicOwned.first(where: { $0.app_name == item.epicAppName }) else { return [] }
+ return [game.cloudSaves
? L("Epic's cloud keeps this game's saves when Epic's own launcher plays it. Played from Highball, they stay on this Mac.")
- : L("This game keeps its saves on this Mac.")]
+ : L("This game keeps its own saves, on this Mac or with its publisher's service.")]
default: break
}
guard cloudSetupAsked else { return [L("Checking…")] }
- guard let setup = cloudSetup, let id = item.gogID else { return [L("Highball could not reach GOG to see how this game saves.")] }
+ guard let setup = cloudSetup, let id = item.gogID else {
+ switch state.gogCloudMiss(for: item) {
+ case .noClientID: return [L("GOG keeps no cloud saves for this game.")]
+ case .notFound: return []
+ case .unreachable, nil: return [L("Highball could not reach GOG to see how this game saves.")]
+ }
+ }
let syncing = !state.gogSettings.cloudSavesOff.contains(id)
func line(_ folders: [GOGSaves.Location], synced: String, own: String) -> String {
folders.isEmpty ? own : syncing ? synced : L("Kept on this Mac: Sync saves with GOG, under Game settings, syncs them.")
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index 39b75e6..1699b44 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -409,7 +409,8 @@ enum L10n {
"La synchronisation du jeu : certains jeux envoient eux-mêmes leurs sauvegardes au cloud GOG, par le kit de GOG. Avec Highball, cela fonctionne quand comet tourne à côté du jeu, et le jeu l’indique quand il synchronise, comme Cyberpunk 2077.",
"Folders this game syncs": "Dossiers synchronisés par ce jeu",
"Steam syncs this game's saves with Steam Cloud, for whichever account plays it.": "Steam synchronise les sauvegardes de ce jeu avec Steam Cloud, pour le compte qui y joue.",
- "This game keeps its saves on this Mac.": "Ce jeu garde ses sauvegardes sur ce Mac.",
+ "This game keeps its own saves, on this Mac or with its publisher's service.": "Ce jeu gère lui-même ses sauvegardes, sur ce Mac ou avec le service de son éditeur.",
+ "GOG keeps no cloud saves for this game.": "GOG ne garde aucune sauvegarde dans le cloud pour ce jeu.",
"Epic's cloud keeps this game's saves when Epic's own launcher plays it. Played from Highball, they stay on this Mac.":
"Le cloud d’Epic garde les sauvegardes de ce jeu quand le lanceur d’Epic y joue. Lancées depuis Highball, elles restent sur ce Mac.",
"How Steam Cloud works": "Comment fonctionne Steam Cloud",
diff --git a/Sources/HighballKit/GOGSaves.swift b/Sources/HighballKit/GOGSaves.swift
index fc45c8d..133ccca 100644
--- a/Sources/HighballKit/GOGSaves.swift
+++ b/Sources/HighballKit/GOGSaves.swift
@@ -22,7 +22,10 @@ public struct GOGSaves: Sendable {
/// The client id cloud storage is keyed by: the info file's, else the manifest gogdl kept
/// (Control's info file has none; its manifest does), else GOG's latest build manifest for an
/// install with neither (an offline installer, a gogdl install from elsewhere), remembered.
- public func clientID(for game: GOGStore.InstalledGame) -> String? {
+ public func clientID(for game: GOGStore.InstalledGame) -> String? { (try? lookUpClientID(for: game)) ?? nil }
+
+ /// clientID(for:), telling GOG having none for the game (nil) from GOG not answering (throws).
+ public func lookUpClientID(for game: GOGStore.InstalledGame) throws -> String? {
if let id = game.clientID, !id.isEmpty { return id }
if let data = try? Data(contentsOf: store.installManifest(game)),
let obj = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
@@ -30,7 +33,7 @@ public struct GOGSaves: Sendable {
let cacheFile = store.dir.appending(path: "client-ids.json")
var cache = (try? JSONDecoder().decode([String: String].self, from: Data(contentsOf: cacheFile))) ?? [:]
if let id = cache[game.id] { return id }
- guard let id = try? Self.publishedClientID(productID: game.id) else { return nil }
+ guard let id = try Self.publishedClientID(productID: game.id) else { return nil }
cache[game.id] = id
try? JSONEncoder().encode(cache).write(to: cacheFile, options: .atomic)
return id