Skip to content

Commit 2275ea4

Browse files
authored
Merge pull request #15 from tekgator/dev
v1.3.0
2 parents 77ae994 + 693382f commit 2275ea4

19 files changed

+582
-3
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
## [Unreleased]
55

66

7+
## [1.3.0] - 2022-11-09
8+
### Added
9+
- Add Rockstar Games plugin for interacting with Rockstar Games launcher and games
10+
- If Launcher cannot provide executable add option to search Windows GameConfigStore for the game executable
11+
12+
713
## [1.2.1] - 2022-04-09
814
### Fixed
915
- Mark BattleNet Plugin as private asset so it is not a dependency

GameLib.Core/LauncherOptions.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
public class LauncherOptions
44
{
55
/// <summary>
6-
/// Define if Launcher plugin should use local catalog data to get more detailed information about specific games
6+
/// Define if Launcher plugin should use local catalog data (if present)
7+
/// to get more detailed information about specific games
78
/// Note: Can in increase load time for the plugin
89
/// </summary>
910
public bool LoadLocalCatalogData { get; init; } = true;
1011

12+
/// <summary>
13+
/// If executable cannot be found via the "regular" way try searching Windows GameConfigStore
14+
/// </summary>
15+
public bool SearchGameConfigStore { get; init; } = true;
16+
1117
/// <summary>
1218
/// Define if Launcher plugin should use online query's to get more detailed information about specific games
1319
/// Note: Can in increase load time for the plugin

GameLib.Core/Util/RegistryUtil.cs

+37
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,43 @@ public static class RegistryUtil
2424
return executablePath;
2525
}
2626

27+
/// <summary>
28+
/// Search the Windows GameConfigStore for the game executable
29+
/// NOTE: this detection mode does not work for all games, also
30+
/// the game must have started at least once to appear in GameConfigStore
31+
/// </summary>
32+
/// <param name="installDir">Installation directory of the game</param>
33+
/// <returns>The path of the executable; <see langword="null"/> if not found</returns>
34+
public static string? SearchGameConfigStore(string installDir)
35+
{
36+
const string RegistryPath = @"System\GameConfigStore\Children";
37+
38+
using var regKey = GetKey(RegistryHive.CurrentUser, RegistryPath, true);
39+
40+
if (regKey is null)
41+
{
42+
return null;
43+
}
44+
45+
foreach (var subKey in regKey.GetSubKeyNames())
46+
{
47+
var executablePath = PathUtil.Sanitize(GetValue(RegistryHive.CurrentUser, $@"{RegistryPath}\{subKey}", "MatchedExeFullPath", string.Empty));
48+
if (string.IsNullOrEmpty(executablePath))
49+
{
50+
continue;
51+
}
52+
53+
if (executablePath.StartsWith(installDir, StringComparison.OrdinalIgnoreCase) &&
54+
File.Exists(executablePath) &&
55+
PathUtil.IsExecutable(executablePath))
56+
{
57+
return executablePath;
58+
}
59+
}
60+
61+
return null;
62+
}
63+
2764
/// <summary>
2865
/// Gets the registry key for the passed Hive and KeyName
2966
/// Firstly it checks in the 32bit environment, if no key found in the 64bit environment

GameLib.Demo/GameLib.Demo.Console/GameLib.Demo.Console.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.Steam\GameLib.Plugin.Steam.csproj" />
2222
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.Gog\GameLib.Plugin.Gog.csproj" />
2323
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.Epic\GameLib.Plugin.Epic.csproj" />
24+
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.Rockstar\GameLib.Plugin.Rockstar.csproj" />
2425
</ItemGroup>
2526

2627
</Project>

GameLib.Demo/GameLib.Demo.Wpf/GameLib.Demo.Wpf.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,14 @@
5959
</ItemGroup>
6060

6161
<ItemGroup>
62+
<ProjectReference Include="..\..\GameLib\GameLib.csproj" />
6263
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.BattleNet\GameLib.Plugin.BattleNet.csproj" />
6364
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.Epic\GameLib.Plugin.Epic.csproj" />
6465
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.Gog\GameLib.Plugin.Gog.csproj" />
6566
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.Origin\GameLib.Plugin.Origin.csproj" />
67+
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.Rockstar\GameLib.Plugin.Rockstar.csproj" />
6668
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.Steam\GameLib.Plugin.Steam.csproj" />
6769
<ProjectReference Include="..\..\GameLib.Plugin\GameLib.Plugin.Ubisoft\GameLib.Plugin.Ubisoft.csproj" />
68-
<ProjectReference Include="..\..\GameLib\GameLib.csproj" />
6970
</ItemGroup>
7071

7172
<ItemGroup>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0-windows</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<IsPackable>false</IsPackable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="System.ComponentModel.Composition" Version="6.0.0" />
12+
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
13+
<PackageReference Include="System.Resources.Extensions" Version="6.0.0" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="..\..\GameLib.Core\GameLib.Core.csproj" />
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<Compile Update="Properties\Resources.Designer.cs">
22+
<DesignTime>True</DesignTime>
23+
<AutoGen>True</AutoGen>
24+
<DependentUpon>Resources.resx</DependentUpon>
25+
</Compile>
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<EmbeddedResource Update="Properties\Resources.resx">
30+
<Generator>PublicResXFileCodeGenerator</Generator>
31+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
32+
</EmbeddedResource>
33+
</ItemGroup>
34+
35+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Gamelib.Core.Util;
2+
using GameLib.Core;
3+
using System.Drawing;
4+
5+
namespace GameLib.Plugin.Rockstar.Model;
6+
7+
public class RockstarGame : IGame
8+
{
9+
#region Interface implementations
10+
public string Id { get; internal set; } = string.Empty;
11+
12+
public Guid LauncherId { get; internal set; } = Guid.Empty;
13+
14+
public string Name { get; internal set; } = string.Empty;
15+
16+
public string InstallDir { get; internal set; } = string.Empty;
17+
18+
public string ExecutablePath { get; internal set; } = string.Empty;
19+
20+
public string Executable { get; internal set; } = string.Empty;
21+
22+
public Icon? ExecutableIcon => PathUtil.GetFileIcon(ExecutablePath);
23+
24+
public string WorkingDir { get; internal set; } = string.Empty;
25+
26+
public string LaunchString { get; internal set; } = string.Empty;
27+
28+
public DateTime InstallDate { get; internal set; } = DateTime.MinValue;
29+
30+
public bool IsRunning => ProcessUtil.IsProcessRunning(Executable);
31+
#endregion
32+
33+
public string Version { get; internal set; } = string.Empty;
34+
}

GameLib.Plugin/GameLib.Plugin.Rockstar/Properties/Resources.Designer.cs

+103
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)