Skip to content

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

GOG and Epic games show when the purchase includes a Mac version

Gabe54a1d52f8f0c
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index a881cf8..b699d3c 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -3588,7 +3588,7 @@ final class AppState {
private struct LibraryCache: Codable {
struct EpicGame: Codable {
- var appName: String, title: String, artworkWide: URL?, artworkTall: URL?
+ var appName: String, title: String, artworkWide: URL?, artworkTall: URL?, listsMac: Bool
var cloudSaves: Bool?
}
var epicOwned: [EpicGame] = []
@@ -3612,7 +3612,7 @@ final class AppState {
let cache = try? JSONDecoder().decode(LibraryCache.self, from: Data(contentsOf: libraryCacheFile)) else { return }
if epicStore.isAuthenticated {
epicOwned = cache.epicOwned.map {
- var game = EpicStore.Game(app_name: $0.appName, app_title: $0.title, artworkWide: $0.artworkWide, artworkTall: $0.artworkTall)
+ var game = EpicStore.Game(app_name: $0.appName, app_title: $0.title, artworkWide: $0.artworkWide, artworkTall: $0.artworkTall, listsMac: $0.listsMac)
game.cloudSaves = $0.cloudSaves ?? false
return game
}
@@ -3624,7 +3624,7 @@ final class AppState {
private func saveLibraryCache() {
let cache = LibraryCache(
epicOwned: epicOwned.map { .init(appName: $0.app_name, title: $0.app_title, artworkWide: $0.artworkWide, artworkTall: $0.artworkTall,
- cloudSaves: $0.cloudSaves) },
+ listsMac: $0.listsMac, cloudSaves: $0.cloudSaves) },
epicInstalls: epicInstalls, gogGames: gogGames)
try? JSONEncoder().encode(cache).write(to: libraryCacheFile, options: .atomic)
}
@@ -4087,9 +4087,9 @@ final class AppState {
(downloadEstimatesFetched[Self.estimateKey(item, mac: mac)] ?? .distantPast) < Date().addingTimeInterval(-86_400)
}
- /// A native Mac version the store offers: Steam's (MacSteamBuild).
+ /// A native Mac version the store offers: Steam's (MacSteamBuild), or one GOG or Epic lists.
func offersMacVersion(_ item: LibraryItem) -> Bool {
- item.installedOnMac || (item.source == .steam && macSteamBuild(for: item) != nil)
+ item.installedOnMac || (item.source == .steam ? macSteamBuild(for: item) != nil : item.macListed)
}
private var sizePrefetch: Task<Void, Never>?
diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swift
index 2ff9f0d..dca0897 100644
--- a/Sources/HighballApp/GameDetailView.swift
+++ b/Sources/HighballApp/GameDetailView.swift
@@ -151,6 +151,8 @@ struct GameDetailView: View {
.textSelection(.enabled)
if let macBuild {
macBlock(macBuild)
+ } else if item.macListed, item.source == .gog || item.source == .epic {
+ storeMacBlock
} else if let outdated = GamePageCopy.outdatedMacBuild(appInfo: item.steamAppID.flatMap { state.macAppInfoByAppID[$0] }, entry: entry) {
Label(L(outdated), systemImage: "apple.logo").font(.callout).foregroundStyle(.secondary)
}
@@ -395,6 +397,27 @@ struct GameDetailView: View {
.overlay(RoundedRectangle(cornerRadius: 10).stroke(.white.opacity(0.35)))
}
+ /// A Mac version GOG's or Epic's catalog lists (LibraryItem.macListed): the purchase includes
+ /// it, and the store's own app or site hands it out. Listed is not proven: an old 32-bit Mac
+ /// build no longer runs, and neither catalog says which.
+ private var storeMacBlock: some View {
+ let gog = item.source == .gog
+ return HStack(alignment: .top, spacing: 10) {
+ Image(systemName: "apple.logo").foregroundStyle(.secondary).padding(.top, 2)
+ VStack(alignment: .leading, spacing: 6) {
+ Text(gog ? L("Your GOG purchase includes a Mac version") : L("Your Epic purchase includes a Mac version"))
+ .font(.callout.weight(.semibold))
+ Text(gog ? L("GOG lists a Mac build of this game. It runs without Windows or Wine, though some older Mac versions no longer start on current macOS.")
+ : L("Epic lists a Mac build of this game. It runs without Windows or Wine, though some older Mac versions no longer start on current macOS."))
+ .font(.callout).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)
+ }
+ Spacer(minLength: 0)
+ }
+ .padding(12)
+ .background(HB.card, in: RoundedRectangle(cornerRadius: 10))
+ .overlay(RoundedRectangle(cornerRadius: 10).stroke(.white.opacity(0.35)))
+ }
+
static func bytes(_ count: Int64) -> String { ByteCountFormatter.string(fromByteCount: count, countStyle: .file) }
/// How the game saves, said as what it does, with an explanation a click away: Steam Cloud's
@@ -477,7 +500,7 @@ struct GameDetailView: View {
.padding(16).frame(width: 380, alignment: .leading)
}
- /// A native Mac version exists: Steam's (MacSteamBuild).
+ /// A native Mac version exists: Steam's (MacSteamBuild), or one GOG or Epic lists.
private var hasMacVersion: Bool { state.offersMacVersion(item) }
/// The Windows build (or the program): on disk when installed, the store's figure before.
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index 33fef2c..9b4c75e 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -395,6 +395,14 @@ enum L10n {
"Not installed in any bottle": "Installé dans aucune bouteille",
"Also installed in %@": "Aussi installé dans %@",
"Source": "Source",
+ "GOG lists a Mac version": "GOG propose une version Mac",
+ "Epic lists a Mac version": "Epic propose une version Mac",
+ "Your GOG purchase includes a Mac version": "Votre achat GOG comprend une version Mac",
+ "Your Epic purchase includes a Mac version": "Votre achat Epic comprend une version Mac",
+ "GOG lists a Mac build of this game. It runs without Windows or Wine, though some older Mac versions no longer start on current macOS.":
+ "GOG propose une version Mac de ce jeu. Elle se lance sans Windows ni Wine, mais certaines anciennes versions Mac ne démarrent plus sur les macOS récents.",
+ "Epic lists a Mac build of this game. It runs without Windows or Wine, though some older Mac versions no longer start on current macOS.":
+ "Epic propose une version Mac de ce jeu. Elle se lance sans Windows ni Wine, mais certaines anciennes versions Mac ne démarrent plus sur les macOS récents.",
"How this game's saves sync": "Comment se synchronisent les sauvegardes de ce jeu",
"Highball could not reach GOG to see how this game saves.": "Highball n’a pas pu joindre GOG pour voir comment ce jeu sauvegarde.",
"Kept on this Mac: Sync saves with GOG, under Game settings, syncs them.": "Gardées sur ce Mac : Synchroniser avec GOG, dans les réglages du jeu, les synchronise.",
@@ -430,6 +438,7 @@ enum L10n {
"Uses %@ of space": "Occupe %@",
"Saves": "Sauvegardes",
"Steam Cloud saves": "Sauvegardes Steam Cloud",
+ "Games with a native Mac version, which runs without Wine.": "Les jeux qui ont une version Mac native, qui tourne sans Wine.",
"Last played": "Dernière partie",
"Windows program": "Programme Windows",
"Choose cover image…": "Choisir une image de couverture…",
diff --git a/Sources/HighballApp/LibraryView.swift b/Sources/HighballApp/LibraryView.swift
index 387adcf..8fecc22 100644
--- a/Sources/HighballApp/LibraryView.swift
+++ b/Sources/HighballApp/LibraryView.swift
@@ -22,6 +22,7 @@ struct LibraryView: View {
/// that read as a bug (highball#257).
@AppStorage("library.installedOnly") private var installedOnly = false
@AppStorage("library.verifiedOnly") private var verifiedOnly = false
+ @AppStorage("library.macOnly") private var macOnly = false
/// Shows the games the player hid, and only them, so one can be brought back (highball#445).
/// Not kept across starts: a library that opened on its hidden games alone would look emptied.
@State private var showingHidden = false
@@ -41,6 +42,8 @@ struct LibraryView: View {
shown.filter { item in
if let sourceFilter, item.source != sourceFilter { return false }
if installedOnly && !item.installedAnywhere { return false }
+ // A native Mac version from any store: Steam's (MacSteamBuild), or one GOG or Epic lists.
+ if macOnly && state.macSteamBuild(for: item) == nil && !item.macListed && !item.installedOnMac { return false }
if verifiedOnly {
guard state.gameDB.entry(for: item)?.status == "verified-local" else { return false }
}
@@ -66,7 +69,7 @@ struct LibraryView: View {
// Installed games first, large, with Play on the cover. The verdict stays under
// every cover, the grid below keeps every game, and the row steps aside as soon as
// a search or a filter is on.
- if !homeItems.isEmpty && search.isEmpty && sourceFilter == nil && !installedOnly && !verifiedOnly && !showingHidden {
+ if !homeItems.isEmpty && search.isEmpty && sourceFilter == nil && !installedOnly && !verifiedOnly && !macOnly && !showingHidden {
VStack(alignment: .leading, spacing: 12) {
HStack(alignment: .firstTextBaseline, spacing: 8) {
HB.eyebrow(L("Installed games"))
@@ -139,6 +142,8 @@ struct LibraryView: View {
Divider().frame(height: 16)
FilterChip(label: L("Installed"), on: installedOnly) { installedOnly.toggle() }
FilterChip(label: L("Verified"), on: verifiedOnly) { verifiedOnly.toggle() }
+ FilterChip(label: "Mac", symbol: "apple.logo", on: macOnly) { macOnly.toggle() }
+ .help(L("Games with a native Mac version, which runs without Wine."))
// Only once a game in the library is hidden: the chip is the way back to it.
if showingHidden || state.libraryItems.contains(where: state.isHidden) {
FilterChip(label: L("Hidden"), on: showingHidden) { showingHidden.toggle() }
@@ -238,11 +243,15 @@ struct LibraryView: View {
struct FilterChip: View {
let label: String
+ var symbol: String? = nil
let on: Bool
let action: () -> Void
var body: some View {
Button(action: action) {
- Text(label)
+ HStack(spacing: 4) {
+ if let symbol { Image(systemName: symbol).font(.system(size: 11, weight: .semibold)) }
+ Text(label)
+ }
.font(.system(size: 12.5, weight: .semibold))
.padding(.horizontal, 12).padding(.vertical, 4)
.background(Capsule().fill(on ? HB.amber : HB.card))
@@ -297,7 +306,7 @@ struct LibraryTile: View {
}
.transition(.opacity)
}
- SourceBadge(source: item.source, mac: state.macSteamBuild(for: item))
+ SourceBadge(source: item.source, mac: state.macSteamBuild(for: item), macListed: item.macListed)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.padding(6)
if let appid = item.steamAppID, state.session(forAppID: appid) != nil {
@@ -460,13 +469,15 @@ struct SourceBadge: View {
/// A native Mac build on Steam (MacSteamBuild): an Apple logo in front of the label, and the
/// whole badge lit when Steam for Mac has it installed.
var mac: MacSteamBuild? = nil
+ /// GOG's or Epic's catalog lists a Mac version (LibraryItem.macListed): the logo, unlit.
+ var macListed = false
private var label: String {
switch source { case .steam: "STEAM"; case .epic: "EPIC"; case .gog: "GOG"; case .pin: "EXE"; case .battlenet: "BATTLE.NET" }
}
private var lit: Bool { mac == .installed }
var body: some View {
HStack(spacing: 3) {
- if mac != nil { Image(systemName: "apple.logo").font(.system(size: 8, weight: .semibold)) }
+ if mac != nil || macListed { Image(systemName: "apple.logo").font(.system(size: 8, weight: .semibold)) }
Text(label)
}
.font(.system(size: 8.5, weight: lit ? .bold : .medium).monospaced())
@@ -475,7 +486,8 @@ struct SourceBadge: View {
.background(RoundedRectangle(cornerRadius: 4).fill(lit ? .white.opacity(0.92) : .black.opacity(0.55)))
.overlay(RoundedRectangle(cornerRadius: 4).stroke(.white.opacity(lit ? 0 : 0.18), lineWidth: 0.5))
.foregroundStyle(lit ? .black : .white.opacity(0.92))
- .help(lit ? L("Installed in Steam for Mac") : mac != nil ? L("Native Mac build on Steam") : "")
+ .help(lit ? L("Installed in Steam for Mac") : mac != nil ? L("Native Mac build on Steam")
+ : macListed ? (source == .gog ? L("GOG lists a Mac version") : L("Epic lists a Mac version")) : "")
}
}
diff --git a/Sources/HighballKit/EpicStore.swift b/Sources/HighballKit/EpicStore.swift
index d78b43e..7dddede 100644
--- a/Sources/HighballKit/EpicStore.swift
+++ b/Sources/HighballKit/EpicStore.swift
@@ -108,18 +108,22 @@ public struct EpicStore: Sendable {
/// 2:3 cover for the future unified library. Same type mapping Heroic uses.
public let artworkWide: URL?
public let artworkTall: URL?
+ /// The catalog item lists a Mac release beside the Windows one (metadata.releaseInfo's
+ /// platforms), which the same purchase includes.
+ public let listsMac: Bool
/// The catalog item names a cloud save folder (metadata.customAttributes.CloudSaveFolder):
/// Epic's cloud keeps its saves when Epic's own launcher syncs them.
public var cloudSaves = false
- public init(app_name: String, app_title: String, artworkWide: URL? = nil, artworkTall: URL? = nil) {
+ public init(app_name: String, app_title: String, artworkWide: URL? = nil, artworkTall: URL? = nil, listsMac: Bool = false) {
self.app_name = app_name; self.app_title = app_title
- self.artworkWide = artworkWide; self.artworkTall = artworkTall
+ self.artworkWide = artworkWide; self.artworkTall = artworkTall; self.listsMac = listsMac
}
private enum CodingKeys: String, CodingKey { case app_name, app_title, metadata }
- private enum MetadataKeys: String, CodingKey { case keyImages, customAttributes }
+ private enum MetadataKeys: String, CodingKey { case keyImages, releaseInfo, customAttributes }
private struct KeyImage: Codable { let type: String?; let url: String? }
+ private struct ReleaseInfo: Codable { let platform: [String]? }
private struct CustomAttribute: Codable { let value: String? }
public init(from decoder: Decoder) throws {
@@ -127,11 +131,14 @@ public struct EpicStore: Sendable {
app_name = try c.decode(String.self, forKey: .app_name)
app_title = try c.decode(String.self, forKey: .app_title)
var images: [KeyImage] = []
+ var releases: [ReleaseInfo] = []
if let md = try? c.nestedContainer(keyedBy: MetadataKeys.self, forKey: .metadata) {
images = (try? md.decode([KeyImage].self, forKey: .keyImages)) ?? []
+ releases = (try? md.decode([ReleaseInfo].self, forKey: .releaseInfo)) ?? []
let attributes = (try? md.decode([String: CustomAttribute].self, forKey: .customAttributes)) ?? [:]
cloudSaves = !(attributes["CloudSaveFolder"]?.value ?? "").isEmpty
}
+ listsMac = releases.contains { $0.platform?.contains("Mac") == true }
func first(_ types: [String]) -> URL? {
for t in types {
if let u = images.first(where: { $0.type == t })?.url, let url = URL(string: u) { return url }
@@ -143,7 +150,8 @@ public struct EpicStore: Sendable {
}
public func encode(to encoder: Encoder) throws {
- // Artwork is derived from legendary's metadata on every decode; only identity persists.
+ // Artwork and platforms are derived from legendary's metadata on every decode; only
+ // identity persists.
var c = encoder.container(keyedBy: CodingKeys.self)
try c.encode(app_name, forKey: .app_name)
try c.encode(app_title, forKey: .app_title)
diff --git a/Sources/HighballKit/GOGLibrary.swift b/Sources/HighballKit/GOGLibrary.swift
index 854e1a6..04de038 100644
--- a/Sources/HighballKit/GOGLibrary.swift
+++ b/Sources/HighballKit/GOGLibrary.swift
@@ -15,10 +15,14 @@ extension GOGStore {
public let steamAppID: Int?
public let gogVerticalCover: URL?
public let gogWide: URL?
+ /// gamesdb lists macOS among the release's systems; every GOG purchase includes each
+ /// system's build. nil in an entry cached before this was read: looked up again.
+ public let listsMac: Bool?
- public init(id: String, title: String, steamAppID: Int? = nil, gogVerticalCover: URL? = nil, gogWide: URL? = nil) {
+ public init(id: String, title: String, steamAppID: Int? = nil, gogVerticalCover: URL? = nil, gogWide: URL? = nil,
+ listsMac: Bool? = nil) {
self.id = id; self.title = title; self.steamAppID = steamAppID
- self.gogVerticalCover = gogVerticalCover; self.gogWide = gogWide
+ self.gogVerticalCover = gogVerticalCover; self.gogWide = gogWide; self.listsMac = listsMac
}
public var artworkTall: URL? {
@@ -62,7 +66,8 @@ extension GOGStore {
var cache = (try? JSONDecoder.highball.decode([String: CachedRelease].self, from: Data(contentsOf: libraryCacheFile))) ?? [:]
let stale = Date().addingTimeInterval(-7 * 86_400)
- let missing = releases.filter { (cache[$0.id]?.fetched ?? .distantPast) < stale }
+ // Entries from before the systems were read are looked up again, once.
+ let missing = releases.filter { (cache[$0.id]?.fetched ?? .distantPast) < stale || cache[$0.id]?.game.map { $0.listsMac == nil } == true }
try await withThrowingTaskGroup(of: (String, CachedRelease?).self) { group in
var next = missing.makeIterator()
func add() -> Bool {
@@ -110,8 +115,10 @@ extension GOGStore {
let steam = (game["releases"] as? [[String: Any]] ?? [])
.first { $0["platform_id"] as? String == "steam" }
.flatMap { ($0["external_id"] as? String).flatMap(Int.init) }
+ let systems = (obj["supported_operating_systems"] as? [[String: Any]] ?? []).compactMap { $0["slug"] as? String }
return Game(id: id, title: title, steamAppID: steam,
- gogVerticalCover: image("vertical_cover"), gogWide: image("horizontal_artwork") ?? image("background"))
+ gogVerticalCover: image("vertical_cover"), gogWide: image("horizontal_artwork") ?? image("background"),
+ listsMac: systems.contains("osx"))
}
/// Looks up games the account may not list (an installed game from an offline installer while
diff --git a/Sources/HighballKit/Library.swift b/Sources/HighballKit/Library.swift
index 6149515..307c2fc 100644
--- a/Sources/HighballKit/Library.swift
+++ b/Sources/HighballKit/Library.swift
@@ -40,18 +40,23 @@ public struct LibraryItem: Identifiable, Sendable, Hashable {
public let otherBottles: [String]
public let sizeOnDisk: Int64
public let lastPlayed: Date?
+ /// GOG's or Epic's catalog lists a Mac version of the game, which the same purchase includes.
+ /// Listed, not proven to run: neither catalog tells a 32-bit build macOS stopped running from
+ /// a current one (Steam's builds have MacSteamBuild instead).
+ public let macListed: Bool
public init(source: LibrarySource, id: String, title: String, bottleName: String?,
installed: Bool, installedOnMac: Bool = false, steamAppID: Int? = nil, epicAppName: String? = nil,
gogID: String? = nil, gogSteamAppID: Int? = nil, battleNetProduct: String? = nil,
pinID: UUID? = nil, artworkTall: URL? = nil, artworkWide: URL? = nil,
- otherBottles: [String] = [], sizeOnDisk: Int64 = 0, lastPlayed: Date? = nil) {
+ otherBottles: [String] = [], sizeOnDisk: Int64 = 0, lastPlayed: Date? = nil, macListed: Bool = false) {
self.source = source; self.id = id; self.title = title; self.bottleName = bottleName
self.installed = installed; self.installedOnMac = installedOnMac
self.steamAppID = steamAppID; self.epicAppName = epicAppName
self.gogID = gogID; self.gogSteamAppID = gogSteamAppID; self.battleNetProduct = battleNetProduct
self.pinID = pinID; self.artworkTall = artworkTall; self.artworkWide = artworkWide
self.otherBottles = otherBottles; self.sizeOnDisk = sizeOnDisk; self.lastPlayed = lastPlayed
+ self.macListed = macListed
}
/// Playable here in either build: the Windows one in a bottle or the Mac one in Steam for Mac.
@@ -69,7 +74,7 @@ public struct LibraryItem: Identifiable, Sendable, Hashable {
installedOnMac: installedOnMac, steamAppID: steamAppID, epicAppName: epicAppName,
gogID: gogID, gogSteamAppID: gogSteamAppID, battleNetProduct: battleNetProduct,
pinID: pinID, artworkTall: artworkTall, artworkWide: artworkWide,
- otherBottles: others, sizeOnDisk: holds ? 0 : sizeOnDisk, lastPlayed: lastPlayed)
+ otherBottles: others, sizeOnDisk: holds ? 0 : sizeOnDisk, lastPlayed: lastPlayed, macListed: macListed)
}
}
@@ -336,7 +341,7 @@ public enum LibraryIndex {
source: .epic, id: id, title: game.app_title, bottleName: home,
installed: home != nil, epicAppName: game.app_name,
artworkTall: game.artworkTall, artworkWide: game.artworkWide,
- lastPlayed: plays[id]?.lastPlayedAt))
+ lastPlayed: plays[id]?.lastPlayedAt, macListed: game.listsMac))
}
// GOG: one tile per game. Installs are read from disk (GOGStore.installedGames), so a game
@@ -367,7 +372,8 @@ public enum LibraryIndex {
installed: primary != nil, gogID: id, gogSteamAppID: meta?.steamAppID,
artworkTall: meta?.artworkTall, artworkWide: meta?.artworkWide,
otherBottles: copies.map(\.bottle).filter { $0 != primary?.bottle }.sorted(),
- lastPlayed: ([itemID] + standing.filter { $0.gogItemID == itemID }.map(\.pinItemID)).compactMap { plays[$0]?.lastPlayedAt }.max()))
+ lastPlayed: ([itemID] + standing.filter { $0.gogItemID == itemID }.map(\.pinItemID)).compactMap { plays[$0]?.lastPlayedAt }.max(),
+ macListed: meta?.listsMac == true))
}
// Battle.net: one tile per game like Steam's, homed where it was last played, then in the
diff --git a/Tests/HighballKitTests/StoreMacVersionTests.swift b/Tests/HighballKitTests/StoreMacVersionTests.swift
new file mode 100644
index 0000000..abd0243
--- /dev/null
+++ b/Tests/HighballKitTests/StoreMacVersionTests.swift
@@ -0,0 +1,50 @@
+import XCTest
+@testable import HighballKit
+
+/// GOG's and Epic's catalogs list a game's Mac release beside the Windows one, which the same
+/// purchase includes: the tile's Apple logo and the game page's Mac section come from that.
+final class StoreMacVersionTests: XCTestCase {
+ func testGOGReleaseListingMacOSIsMarked() throws {
+ let json = """
+ {"type":"game","title":{"*":"Jill of the Jungle"},"game":{"releases":[]},
+ "supported_operating_systems":[{"slug":"windows","name":"Windows"},{"slug":"osx","name":"macOS"}]}
+ """
+ XCTAssertEqual(try XCTUnwrap(GOGStore.parseRelease(id: "1", data: Data(json.utf8))).listsMac, true)
+ let windowsOnly = #"{"type":"game","title":{"*":"Control"},"game":{},"supported_operating_systems":[{"slug":"windows"}]}"#
+ XCTAssertEqual(try XCTUnwrap(GOGStore.parseRelease(id: "2", data: Data(windowsOnly.utf8))).listsMac, false)
+ }
+
+ /// An entry cached before the systems were read decodes with nil, which looks it up again.
+ func testGOGCacheFromBeforeReadsAsUnknown() throws {
+ let old = #"{"id":"1","title":"Old"}"#
+ XCTAssertNil(try JSONDecoder().decode(GOGStore.Game.self, from: Data(old.utf8)).listsMac)
+ }
+
+ func testEpicCatalogItemListingMacIsMarked() throws {
+ let json = """
+ [{"app_name":"Garlic","app_title":"Enter the Gungeon",
+ "metadata":{"releaseInfo":[{"appId":"Garlic","platform":["Mac","Win32","Windows"]}]}},
+ {"app_name":"Duck","app_title":"Cardpocalypse","metadata":{"releaseInfo":[{"platform":["Windows"]}]}},
+ {"app_name":"Bare","app_title":"No metadata"}]
+ """
+ let games = try JSONDecoder().decode([EpicStore.Game].self, from: Data(json.utf8))
+ XCTAssertEqual(games.map(\.listsMac), [true, false, false])
+ let cloud = #"[{"app_name":"A","app_title":"A","metadata":{"customAttributes":{"CloudSaveFolder":{"type":"STRING","value":"{AppData}/A/Saved"}}}}]"#
+ XCTAssertEqual(try JSONDecoder().decode([EpicStore.Game].self, from: Data(cloud.utf8)).map(\.cloudSaves), [true])
+ XCTAssertEqual(games.map(\.cloudSaves), [false, false, false])
+ }
+
+ func testLibraryCarriesTheListingToGOGAndEpicTiles() {
+ let items = LibraryIndex.build(
+ bottles: [], steamByBottle: [:],
+ epicOwned: [EpicStore.Game(app_name: "Garlic", app_title: "Enter the Gungeon", listsMac: true),
+ EpicStore.Game(app_name: "Duck", app_title: "Cardpocalypse")],
+ epicInstalls: [:],
+ gogGames: [GOGStore.Game(id: "1", title: "Jill of the Jungle", listsMac: true)])
+ let listed = Dictionary(uniqueKeysWithValues: items.map { ($0.id, $0.macListed) })
+ XCTAssertEqual(listed["epic:Garlic"], true)
+ XCTAssertEqual(listed["epic:Duck"], false)
+ XCTAssertEqual(listed["gog:1"], true)
+ }
+}
+