#18: Allow overriding GOG IDs

This commit is contained in:
mtkennerly 2022-11-03 15:49:44 +08:00
parent 2a78f01cad
commit a176083c3c
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
3 changed files with 446 additions and 6 deletions

View file

@ -1,3 +1,9 @@
BioShock 2:
gog:
id: 1806891286
BioShock 2 Remastered:
gog:
id: 1482265668
Overwatch: Overwatch:
# The game is no longer playable at all, # The game is no longer playable at all,
# and its save locations are identical to Overwatch 2, # and its save locations are identical to Overwatch 2,

File diff suppressed because it is too large Load diff

View file

@ -45,6 +45,8 @@ export interface Game {
}; };
} }
type OverriddenGame = Game & { omit?: boolean };
export interface Constraint { export interface Constraint {
os?: Os; os?: Os;
bit?: Bit; bit?: Bit;
@ -173,6 +175,16 @@ function integrateSteamData(game: Game, appInfo: SteamGameCache[""]): void {
} }
} }
function integrateOverriddenData(game: Game, override?: OverriddenGame) {
if (override?.gog?.id) {
game.gog = { id: override?.gog?.id };
}
}
function hasAnyData(game: Game): boolean {
return game.files !== undefined || game.registry !== undefined || game.steam?.id !== undefined || game.gog?.id !== undefined;
}
export class ManifestFile extends YamlFile<Manifest> { export class ManifestFile extends YamlFile<Manifest> {
path = `${REPO}/data/manifest.yaml`; path = `${REPO}/data/manifest.yaml`;
defaultData = {}; defaultData = {};
@ -197,8 +209,9 @@ export class ManifestFile extends YamlFile<Manifest> {
const game: Game = {}; const game: Game = {};
integrateWikiData(game, info); integrateWikiData(game, info);
integrateOverriddenData(game, overridden);
if (game.files === undefined && game.registry === undefined && game.steam?.id === undefined) { if (!hasAnyData(game)) {
continue; continue;
} }
if (game.steam?.id !== undefined) { if (game.steam?.id !== undefined) {
@ -211,9 +224,7 @@ export class ManifestFile extends YamlFile<Manifest> {
} }
export interface ManifestOverride { export interface ManifestOverride {
[game: string]: { [game: string]: OverriddenGame
omit?: boolean;
}
} }
export class ManifestOverrideFile extends YamlFile<ManifestOverride> { export class ManifestOverrideFile extends YamlFile<ManifestOverride> {