Skip to content

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

GOG: hidden pins hide their GOG tile; tool launch choices skip save sync and comet

Gabe31b297ca154d
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index db5b971..1e5ee74 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -3527,6 +3527,7 @@ final class AppState {
libraryLaunchArgs = store.launchArguments()
libraryDisplays = store.displayChoices()
customNames = nameStore.names()
+ hiddenItems = store.hiddenIDs()
coverVersion += 1
}
@@ -3720,8 +3721,9 @@ final class AppState {
let store = gogStore
let settings = gogSettings
let extraArguments = pin?.extraArguments ?? launchArguments(for: item) // the page's Launch arguments, after the task's own
- let useComet = !retryingWithoutComet && gogSignedIn && settings.cometOff[game.id] == nil
- let useSaves = gogSignedIn && !settings.cloudSavesOff.contains(game.id)
+ let syncs = pin?.syncsLikeTheGame ?? true // a pinned tool runs without saves and comet
+ let useComet = syncs && !retryingWithoutComet && gogSignedIn && settings.cometOff[game.id] == nil
+ let useSaves = syncs && gogSignedIn && !settings.cloudSavesOff.contains(game.id)
runBusy(String(format: L("Starting %@"), item.title), done: .handedOff, stop: .killBottle(bottle, label: L("Stop"))) { [self] in
await removeMacMetadataFiles(from: game.folder, of: item.title)
if store.hasManifest(game), !GOGStore.setupDone(for: game, driveC: bottle.driveC) {
diff --git a/Sources/HighballKit/Library.swift b/Sources/HighballKit/Library.swift
index 86c178a..6149515 100644
--- a/Sources/HighballKit/Library.swift
+++ b/Sources/HighballKit/Library.swift
@@ -127,6 +127,11 @@ public enum LibraryIndex {
/// page: only then does the tile stand for the pin's own (Ghostrunner pinned with -dx12
/// keeps its tile while the page plays the game's default).
public let tilePlaysIt: Bool
+
+ /// Whether starting the pin brings cloud saves along and runs comet: only for a game task.
+ /// A tool or settings program among the launch choices (category "tool") still plays as
+ /// the GOG game, but a settings window has no saves to sync and no achievements to earn.
+ public var syncsLikeTheGame: Bool { task.category == nil || task.category == "game" }
}
/// `launchChoice` is GOGSettings.launchChoice, what each GOG tile's Play runs.
@@ -216,6 +221,8 @@ public enum LibraryIndex {
try? names.setName(name, for: to)
}
if covers.coverURL(for: from) != nil, covers.coverURL(for: to) == nil { try? covers.copyCover(from: from, to: to) }
+ let hidden = store.hiddenIDs()
+ if LibraryStore.isHidden(from, in: hidden), !LibraryStore.isHidden(to, in: hidden) { store.setHidden(true, for: to) }
settings.carriedOverPins.insert(from)
lines.append("\(from): shown as its GOG game (\(to)) from now on; its settings, name and cover went along")
}
diff --git a/Tests/HighballKitTests/GOGStoreTests.swift b/Tests/HighballKitTests/GOGStoreTests.swift
index 27c86e0..3042335 100644
--- a/Tests/HighballKitTests/GOGStoreTests.swift
+++ b/Tests/HighballKitTests/GOGStoreTests.swift
@@ -502,6 +502,45 @@ final class GOGStoreTests: XCTestCase {
XCTAssertEqual(names.name(for: "gog:1"), "Renamed again")
}
+ /// Owner review on #539: a program the player hid came back as a visible GOG tile once that
+ /// tile stood for it. Hide goes along with the name and cover, once, and a GOG tile the player
+ /// showed again after that stays shown.
+ func testCarryOverTakesHideOnce() throws {
+ let home = FileManager.default.temporaryDirectory.appending(path: "gog-carry-hide-\(UUID().uuidString)")
+ defer { try? FileManager.default.removeItem(at: home) }
+ let paths = HighballPaths(home: home)
+ let store = LibraryStore(paths: paths)
+ let task = GOGStore.PlayTask(path: "Game.exe")
+ let uuid = UUID(), shown = UUID()
+ let hidden = LibraryIndex.CoveredPin(pinItemID: "pin:Games:\(uuid.uuidString)", gogItemID: "gog:1", extraArguments: [], task: task, tilePlaysIt: true)
+ let visible = LibraryIndex.CoveredPin(pinItemID: "pin:Games:\(shown.uuidString)", gogItemID: "gog:2", extraArguments: [], task: task, tilePlaysIt: true)
+ // Hidden under an earlier name of its environment (PinID) counts too.
+ store.setHidden(true, for: "pin:Old name:\(uuid.uuidString)")
+
+ var settings = GOGSettings()
+ LibraryIndex.carryOver([hidden, visible], paths: paths, settings: &settings)
+ XCTAssertTrue(LibraryStore.isHidden("gog:1", in: store.hiddenIDs()))
+ XCTAssertFalse(LibraryStore.isHidden("gog:2", in: store.hiddenIDs()), "a program the player did not hide leaves its GOG tile shown")
+
+ // Once only: showing the GOG tile again is not undone by the next rebuild.
+ store.setHidden(false, for: "gog:1")
+ LibraryIndex.carryOver([hidden], paths: paths, settings: &settings)
+ XCTAssertFalse(LibraryStore.isHidden("gog:1", in: store.hiddenIDs()))
+ }
+
+ /// Owner review on #539: a pinned tool among a game's launch choices (category "tool") plays
+ /// as the GOG game, but must not bring cloud saves down or up, nor run comet, around a
+ /// settings window. Game tasks, and tasks that name no category, still do.
+ func testPinnedToolSkipsSavesAndComet() {
+ func pin(_ category: String?) -> LibraryIndex.CoveredPin {
+ LibraryIndex.CoveredPin(pinItemID: "pin:Games:\(UUID().uuidString)", gogItemID: "gog:1", extraArguments: [],
+ task: GOGStore.PlayTask(path: "Tool.exe", category: category), tilePlaysIt: false)
+ }
+ XCTAssertFalse(pin("tool").syncsLikeTheGame)
+ XCTAssertTrue(pin("game").syncsLikeTheGame)
+ XCTAssertTrue(pin(nil).syncsLikeTheGame)
+ }
+
// MARK: Launch option swaps (round 3)
/// Ghostrunner with a default task, a DX12 choice, a Benchmark choice nobody pinned, and a