diff --git a/CHANGELOG.md b/CHANGELOG.md index d9659af6..09506dd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ### Changelog +#### Version - 3.0.1.6 - 9/??/2022 +* Fix Cyberpunk 2077 GoG recognition +* Add a CLI command `list-games` to list all games recognized by WJ and their versions/locations + #### Version - 3.0.1.5 - 9/26/2022 * Fix MO2ArchiveName resolution * Improve performance of the compiler stack diff --git a/Wabbajack.CLI/Program.cs b/Wabbajack.CLI/Program.cs index e86df3cb..1a1a56f6 100644 --- a/Wabbajack.CLI/Program.cs +++ b/Wabbajack.CLI/Program.cs @@ -81,6 +81,7 @@ internal class Program services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); }).Build(); diff --git a/Wabbajack.CLI/Verbs/ListGames.cs b/Wabbajack.CLI/Verbs/ListGames.cs new file mode 100644 index 00000000..242803a5 --- /dev/null +++ b/Wabbajack.CLI/Verbs/ListGames.cs @@ -0,0 +1,57 @@ +using System.CommandLine; +using System.CommandLine.Invocation; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Wabbajack.Downloaders.GameFile; +using Wabbajack.DTOs; +using Wabbajack.Paths.IO; + +namespace Wabbajack.CLI.Verbs; + +public class ListGames : IVerb +{ + private readonly ILogger _logger; + private readonly GameLocator _locator; + + public ListGames(ILogger logger, GameLocator locator) + { + _logger = logger; + _locator = locator; + } + public Command MakeCommand() + { + var command = new Command("list-games"); + command.Description = "Lists all games Wabbajack recognizes, and their installed versions/locations (if any)"; + command.Handler = CommandHandler.Create(Run); + return command; + } + + public async Task Run(CancellationToken token) + { + foreach (var game in GameRegistry.Games.OrderBy(g => g.Value.HumanFriendlyGameName)) + { + if (_locator.IsInstalled(game.Key)) + { + var location = _locator.GameLocation(game.Key); + var version = "unknown"; + var mainFile = game.Value.MainExecutable!.Value.RelativeTo(location); + + if (!mainFile.FileExists()) + _logger.LogWarning("Main file {file} for {game} does not exist", mainFile, game.Key); + + var versionInfo = FileVersionInfo.GetVersionInfo(mainFile.ToString()); + + _logger.LogInformation("[X] {Game} {Version} -> Path: {Path}", game.Value.HumanFriendlyGameName, versionInfo.ProductVersion ?? versionInfo.FileVersion, location); + } + else + { + _logger.LogInformation("[ ] {Game}", game.Value.HumanFriendlyGameName); + } + } + + return 0; + } +} \ No newline at end of file diff --git a/Wabbajack.DTOs/Game/GameRegistry.cs b/Wabbajack.DTOs/Game/GameRegistry.cs index 6090f4ea..e11064be 100644 --- a/Wabbajack.DTOs/Game/GameRegistry.cs +++ b/Wabbajack.DTOs/Game/GameRegistry.cs @@ -407,7 +407,7 @@ public static class GameRegistry { Game = Game.Cyberpunk2077, SteamIDs = new[] {1091500}, - GOGIDs = new [] {2093619782}, + GOGIDs = new [] {2093619782, 1423049311}, MO2Name = "Cyberpunk 2077", NexusName = "cyberpunk2077", NexusGameId = 3333, diff --git a/buildall.bat b/buildall.bat index 86b21191..52213a2c 100644 --- a/buildall.bat +++ b/buildall.bat @@ -7,7 +7,7 @@ mkdir c:\tmp\publish-wj dotnet clean dotnet restore -dotnet publish Wabbajack.App.Wpf\Wabbajack.App.Wpf.csproj --runtime win10-x64 --configuration Release /p:Platform=x64 -o c:\tmp\publish-wj\app /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained +dotnet publish Wabbajack.App.Wpf\Wabbajack.App.Wpf.csproj --runtime win10-x64 --configuration Release /p:Platform=x64 -o c:\tmp\publish-wj\app /p:PublishReadyToRun=true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained dotnet publish Wabbajack.Launcher\Wabbajack.Launcher.csproj --runtime win10-x64 --configuration Release /p:Platform=x64 -o c:\tmp\publish-wj\launcher /p:PublishTrimmed=true /p:PublishReadyToRun=true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained dotnet publish c:\oss\Wabbajack\Wabbajack.CLI\Wabbajack.CLI.csproj --runtime win10-x64 --configuration Release /p:Platform=x64 -o c:\tmp\publish-wj\app --self-contained "C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe" sign /t http://timestamp.sectigo.com c:\tmp\publish-wj\app\Wabbajack.exe