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
GOG saves: an install from before the history counts from its marker again, since gogdl's files postdate its folder
Gabe95d316bb3842
diff --git a/Sources/HighballKit/GOGLibrary.swift b/Sources/HighballKit/GOGLibrary.swiftindex 8c5a9f6..79564cf 100644--- a/Sources/HighballKit/GOGLibrary.swift+++ b/Sources/HighballKit/GOGLibrary.swift@@ -540,10 +540,10 @@ extension GOGStore {driveC.appending(path: "highball/gog-setup/\(game.id).history.json")}- /// An install set up before the history was kept falls back to the earliest of its marker's,- /// info file's and folder's dates for its first setup (storedHistory). One Highball never set- /// up (an offline installer's: no manifest, so no setup and no marker) falls back to when its- /// goggame-<id>.info file landed on this disk, which the install wrote. nil firstSetup: none of them exists, so nothing tells the game's files+ /// An install set up before the history was kept falls back to the marker's date for its+ /// first setup. One Highball never set up (an offline installer's: no manifest, so no setup+ /// and no marker) falls back to when its goggame-<id>.info file landed on this disk, which+ /// the install wrote. nil firstSetup: none of them exists, so nothing tells the game's files/// from the installer's.public static func history(for game: InstalledGame, driveC: URL) -> InstallHistory {var history = storedHistory(for: game, driveC: driveC)@@ -551,18 +551,13 @@ extension GOGStore {return history}- /// The history file, or for an install set up before it was kept (a marker, no history) the- /// earliest of the marker's date, the info file's and the game folder's creation: setup- /// rewrote the marker on every update before the history was kept, so the marker alone would- /// leave out saves written before the last update. That can also count files an old update- /// rewrote, which only copies more. Not the info file's for an install with no marker: setup- /// and updates record from this, and setup runs after gogdl wrote the info file, so what it- /// put down would count as the game's.+ /// The history file, or the marker's date. Not the info file's: setup and updates record+ /// from this, and setup runs after gogdl wrote the info file, so what it put down would+ /// count as the game's.private static func storedHistory(for game: InstalledGame, driveC: URL) -> InstallHistory {var history = InstallHistory.read(historyFile(for: game, driveC: driveC)) ?? InstallHistory()- if history.firstSetup == nil,- let marked = try? setupMarker(for: game, driveC: driveC).resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate {- history.firstSetup = [marked, installedDate(of: game)].compactMap { $0 }.min()+ if history.firstSetup == nil {+ history.firstSetup = try? setupMarker(for: game, driveC: driveC).resourceValues(forKeys: [.contentModificationDateKey]).contentModificationDate}return history}diff --git a/Tests/HighballKitTests/GOGSaveSafetyTests.swift b/Tests/HighballKitTests/GOGSaveSafetyTests.swiftindex 3a03628..99ad50f 100644--- a/Tests/HighballKitTests/GOGSaveSafetyTests.swift+++ b/Tests/HighballKitTests/GOGSaveSafetyTests.swift@@ -279,30 +279,6 @@ final class GOGSaveSafetyTests: XCTestCase {XCTAssertEqual(GOGStore.history(for: game, driveC: driveC).firstSetup, marked, "the marker's old date, read before it is rewritten")}- /// An install updated before the history was kept: the update rewrote the marker, so a save- /// written beside the exe before it is older than the marker. The install counts from the- /// earliest of the marker, the info file and the folder, so Keep still copies that save.- func testAnInstallUpdatedBeforeTheHistoryCountsFromItsEarliestDate() throws {- let saves = GOGSaves(store: GOGStore(paths: HighballPaths(home: root.appending(path: "home"))))- let driveC = root.appending(path: "drive_c")- let game = GOGStore.InstalledGame(id: "7", title: "Game", folder: driveC.appending(path: "GOG Games/Game"), buildID: "b2", clientID: nil, dlcIDs: [], tasks: [])- let installed = Date().addingTimeInterval(-86400 * 30)- let updated = Date().addingTimeInterval(-86400)- let info = game.folder.appending(path: "goggame-7.info")- try write(#"{"gameId":"7","name":"Game"}"#, to: info, dated: updated)- try FileManager.default.setAttributes([.creationDate: installed], ofItemAtPath: info.path)- try FileManager.default.setAttributes([.creationDate: installed], ofItemAtPath: game.folder.path)- try write("b2", to: GOGStore.setupMarker(for: game, driveC: driveC), dated: updated)- try write("exe", to: game.folder.appending(path: "game.exe"), dated: installed.addingTimeInterval(-86400))- try write("save", to: game.folder.appending(path: "slot1.sav"), dated: installed.addingTimeInterval(86400))- XCTAssertEqual(GOGStore.history(for: game, driveC: driveC).firstSetup, installed)- let copy = try XCTUnwrap(try saves.backUpGameFolder(game, driveC: driveC))- XCTAssertEqual(try GOGSaves.files(in: copy).map { GOGSaves.relativePath(of: $0, in: copy) }, ["slot1.sav"])- // The next setup stores that date, not the marker's.- GOGStore.markSetupDone(for: game, driveC: driveC)- XCTAssertEqual(GOGStore.history(for: game, driveC: driveC).firstSetup, installed)- }-/// An offline installer's game (no manifest, so never set up and no marker) counts from when/// its goggame-<id>.info file was created, or its folder if earlier (a patch rewrites the/// info file). The installer's files, dated when they were built, and its records at the top