summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-01-17 15:06:04 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-01-17 15:06:04 -0500
commitcfe2c3975f8be62581195fbfffc41528f22b2ee3 (patch)
tree47998fbefecf44f3e5b375a04c15369ec558cad6
parent516b2fc010ba9a794297ae74b4c5de321ffd0a70 (diff)
downloadSMAPI-cfe2c3975f8be62581195fbfffc41528f22b2ee3.tar.gz
SMAPI-cfe2c3975f8be62581195fbfffc41528f22b2ee3.tar.bz2
SMAPI-cfe2c3975f8be62581195fbfffc41528f22b2ee3.zip
prefer GOG/Steam registry paths when scanning for game folder
-rw-r--r--build/find-game-folder.targets15
-rw-r--r--docs/release-notes.md3
-rw-r--r--src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs22
3 files changed, 22 insertions, 18 deletions
diff --git a/build/find-game-folder.targets b/build/find-game-folder.targets
index a4200662..02abb54b 100644
--- a/build/find-game-folder.targets
+++ b/build/find-game-folder.targets
@@ -20,6 +20,14 @@
</When>
<When Condition="$(OS) == 'Windows_NT'">
<PropertyGroup>
+ <!-- registry paths -->
+ <GamePath Condition="!Exists('$(GamePath)')">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\GOG.com\Games\1453375253', 'PATH', null, RegistryView.Registry32))</GamePath>
+ <GamePath Condition="!Exists('$(GamePath)')">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 413150', 'InstallLocation', null, RegistryView.Registry64, RegistryView.Registry32))</GamePath>
+
+ <!-- derive from Steam library path -->
+ <_SteamLibraryPath>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Valve\Steam', 'SteamPath', null, RegistryView.Registry32))</_SteamLibraryPath>
+ <GamePath Condition="!Exists('$(GamePath)') AND '$(_SteamLibraryPath)' != ''">$(_SteamLibraryPath)\steamapps\common\Stardew Valley</GamePath>
+
<!-- default paths -->
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files\GalaxyClient\Games\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files\GOG Galaxy\Games\Stardew Valley</GamePath>
@@ -29,13 +37,6 @@
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GOG Galaxy\Games\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley</GamePath>
- <!-- registry paths -->
- <GamePath Condition="!Exists('$(GamePath)')">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\GOG.com\Games\1453375253', 'PATH', null, RegistryView.Registry32))</GamePath>
- <GamePath Condition="!Exists('$(GamePath)')">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 413150', 'InstallLocation', null, RegistryView.Registry64, RegistryView.Registry32))</GamePath>
-
- <!-- derive from Steam library path -->
- <_SteamLibraryPath>$([MSBuild]::GetRegistryValueFromView('HKEY_CURRENT_USER\SOFTWARE\Valve\Steam', 'SteamPath', null, RegistryView.Registry32))</_SteamLibraryPath>
- <GamePath Condition="!Exists('$(GamePath)') AND '$(_SteamLibraryPath)' != ''">$(_SteamLibraryPath)\steamapps\common\Stardew Valley</GamePath>
</PropertyGroup>
</When>
</Choose>
diff --git a/docs/release-notes.md b/docs/release-notes.md
index d448c726..663ab667 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -8,6 +8,9 @@
-->
## Upcoming release
+* For players:
+ * Improved game path detection. The installer now prefers the path installed through Steam or GOG Galaxy.
+
* For modders:
* Expanded `PerScreen<T>` API: you can now get/set the value for any screen, get all active values, or clear all values.
* Expanded player info received from multiplayer API/events with new `IsSplitScreen` and `ScreenID` fields.
diff --git a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs
index d4c82180..055e3b6d 100644
--- a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs
+++ b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs
@@ -90,14 +90,6 @@ namespace StardewModdingAPI.Toolkit.Framework.GameScanning
case Platform.Windows:
{
- // Windows
- foreach (string programFiles in new[] { @"C:\Program Files", @"C:\Program Files (x86)" })
- {
- yield return $@"{programFiles}\GalaxyClient\Games\Stardew Valley";
- yield return $@"{programFiles}\GOG Galaxy\Games\Stardew Valley";
- yield return $@"{programFiles}\Steam\steamapps\common\Stardew Valley";
- }
-
// Windows registry
#if SMAPI_FOR_WINDOWS
IDictionary<string, string> registryKeys = new Dictionary<string, string>
@@ -113,10 +105,18 @@ namespace StardewModdingAPI.Toolkit.Framework.GameScanning
}
// via Steam library path
- string steampath = this.GetCurrentUserRegistryValue(@"Software\Valve\Steam", "SteamPath");
- if (steampath != null)
- yield return Path.Combine(steampath.Replace('/', '\\'), @"steamapps\common\Stardew Valley");
+ string steamPath = this.GetCurrentUserRegistryValue(@"Software\Valve\Steam", "SteamPath");
+ if (steamPath != null)
+ yield return Path.Combine(steamPath.Replace('/', '\\'), @"steamapps\common\Stardew Valley");
#endif
+
+ // Windows
+ foreach (string programFiles in new[] { @"C:\Program Files", @"C:\Program Files (x86)" })
+ {
+ yield return $@"{programFiles}\GalaxyClient\Games\Stardew Valley";
+ yield return $@"{programFiles}\GOG Galaxy\Games\Stardew Valley";
+ yield return $@"{programFiles}\Steam\steamapps\common\Stardew Valley";
+ }
}
break;