Skip to content

Commit

Permalink
Add BuildId to GOG and Heroic (GOG)
Browse files Browse the repository at this point in the history
  • Loading branch information
erri120 committed Dec 10, 2024
1 parent cca7162 commit bb462fb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com) and this project adheres to [Semantic Versioning](https://semver.org).

## [Unreleased](https://github.com/erri120/GameFinder/compare/v4.2.4...HEAD)
## [Unreleased](https://github.com/erri120/GameFinder/compare/v4.4.0...HEAD)

## [Released](https://github.com/erri120/GameFinder/releases)

## [4.4.0](https://github.com/erri120/GameFinder/compare/v4.3.4...v4.4.0) - 2024-12-10

- GOG & Heroic (GOG): Add `BuildId`

## [4.3.3](https://github.com/erri120/GameFinder/compare/v4.3.2...v4.3.3) - 2024-10-31

- Wine: `users` instead of `Users`
Expand Down
3 changes: 2 additions & 1 deletion src/GameFinder.Launcher.Heroic/HeroicGOGGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ public record HeroicGOGGame(
GOGGameId Id,
string Name,
AbsolutePath Path,
string BuildId,
AbsolutePath WinePrefixPath,
DTOs.WineVersion WineVersion) : GOGGame(Id, Name, Path)
DTOs.WineVersion WineVersion) : GOGGame(Id, Name, Path, BuildId)
{
public WinePrefix GetWinePrefix()
{
Expand Down
2 changes: 1 addition & 1 deletion src/GameFinder.Launcher.Heroic/HeroicGOGHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ internal static OneOf<GOGGame, ErrorMessage> Parse(
var path = fileSystem.FromUnsanitizedFullPath(installed.InstallPath);
var winePrefixPath = fileSystem.FromUnsanitizedFullPath(gameConfig.WinePrefix);

return new HeroicGOGGame(GOGGameId.From(id), installed.AppName, path, winePrefixPath, gameConfig.WineVersion);
return new HeroicGOGGame(GOGGameId.From(id), installed.AppName, path, installed.BuildId, winePrefixPath, gameConfig.WineVersion);
}

internal static AbsolutePath GetGamesConfigJsonFile(AbsolutePath configPath, string name)
Expand Down
5 changes: 1 addition & 4 deletions src/GameFinder.StoreHandlers.GOG/GOGGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@ namespace GameFinder.StoreHandlers.GOG;
/// <summary>
/// Represents a game installed with GOG Galaxy.
/// </summary>
/// <param name="Id"></param>
/// <param name="Name"></param>
/// <param name="Path"></param>
[PublicAPI]
public record GOGGame(GOGGameId Id, string Name, AbsolutePath Path) : IGame;
public record GOGGame(GOGGameId Id, string Name, AbsolutePath Path, string BuildId) : IGame;
8 changes: 7 additions & 1 deletion src/GameFinder.StoreHandlers.GOG/GOGHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,16 @@ private OneOf<GOGGame, ErrorMessage> ParseSubKey(IRegistryKey gogKey, string sub
return new ErrorMessage($"{subKey.GetName()} doesn't have a string value \"path\"");
}

if (!subKey.TryGetString("buildId", out var buildId))
{
return new ErrorMessage($"{subKey.GetName()} doesn't have a string value \"buildId\"");
}

var game = new GOGGame(
GOGGameId.From(id),
name,
_fileSystem.FromUnsanitizedFullPath(path)
_fileSystem.FromUnsanitizedFullPath(path),
buildId
);

return game;
Expand Down
5 changes: 3 additions & 2 deletions tests/GameFinder.StoreHandlers.GOG.Tests/ArrangeHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static IEnumerable<GOGGame> SetupGames(IFileSystem fileSystem, InMemoryRe
var fixture = new Fixture();

fixture.Customize<GOGGame>(composer => composer
.FromFactory<long, string>((id, name) =>
.FromFactory<long, string, string>((id, name, buildId) =>
{
var path = fileSystem
.GetKnownPath(KnownPath.TempDirectory)
Expand All @@ -28,8 +28,9 @@ public static IEnumerable<GOGGame> SetupGames(IFileSystem fileSystem, InMemoryRe
gameKey.AddValue("gameID", id.ToString(CultureInfo.InvariantCulture));
gameKey.AddValue("gameName", name);
gameKey.AddValue("path", path.GetFullPath());
gameKey.AddValue("buildId", buildId);

return new GOGGame(GOGGameId.From(id), name, path);
return new GOGGame(GOGGameId.From(id), name, path, buildId);
})
.OmitAutoProperties());

Expand Down

0 comments on commit bb462fb

Please sign in to comment.