add detection for Xbox app game folders

This commit is contained in:
Jesse Plamondon-Willard 2022-01-15 20:39:32 -05:00
parent d029dd652f
commit 6f05580191
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
4 changed files with 33 additions and 4 deletions

View File

@ -28,15 +28,31 @@
<_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 -->
<!-- GOG 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>
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files\GOG Games\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files\Steam\steamapps\common\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GOG Galaxy\Games\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GOG Games\Stardew Valley</GamePath>
<!-- Xbox app paths -->
<!--
The Xbox app saves the install path to the registry, but we can't use it here since it
saves the internal readonly path (like C:\Program Files\WindowsApps\Mutable\<package ID>)
instead of the mods-enabled path (like C:\Program Files\ModifiableWindowsApps\Stardew Valley).
Fortunately we can cheat a bit: players can customize the install drive, but they can't
change the install path on the drive.
-->
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files\ModifiableWindowsApps\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">D:\Program Files\ModifiableWindowsApps\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">E:\Program Files\ModifiableWindowsApps\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">F:\Program Files\ModifiableWindowsApps\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">G:\Program Files\ModifiableWindowsApps\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">H:\Program Files\ModifiableWindowsApps\Stardew Valley</GamePath>
<!-- Steam paths -->
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files\Steam\steamapps\common\Stardew Valley</GamePath>
<GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley</GamePath>
</PropertyGroup>
</When>

View File

@ -6,6 +6,7 @@
* Added automatic fix for custom maps which don't have a required tilesheet.
* Added automatic save recovery when the custom farm type isn't available anymore.
* Added the new game build number to the SMAPI console + log.
* The installer now detects Xbox app game folders.
* Fixed extra newlines shown in the console in non-developer mode.
* Fixed macOS launch issue when using some terminals (thanks to bruce2409!).
* Fixed Linux/macOS terminal ignoring backspace in Stardew Valley 1.5.5+.

View File

@ -412,6 +412,9 @@ The NuGet package is generated automatically in `StardewModdingAPI.ModBuildConfi
when you compile it.
## Release notes
## Upcoming release
* Added detection for Xbox app game folders.
## 4.0.0
Released 30 November 2021.

View File

@ -157,7 +157,7 @@ namespace StardewModdingAPI.Toolkit.Framework.GameScanning
yield return Path.Combine(steamPath.Replace('/', '\\'), @"steamapps\common\Stardew Valley");
#endif
// default paths
// default GOG/Steam paths
foreach (string programFiles in new[] { @"C:\Program Files", @"C:\Program Files (x86)" })
{
yield return $@"{programFiles}\GalaxyClient\Games\Stardew Valley";
@ -165,6 +165,15 @@ namespace StardewModdingAPI.Toolkit.Framework.GameScanning
yield return $@"{programFiles}\GOG Games\Stardew Valley";
yield return $@"{programFiles}\Steam\steamapps\common\Stardew Valley";
}
// default Xbox app paths
// The Xbox app saves the install path to the registry, but we can't use it
// here since it saves the internal readonly path (like C:\Program Files\WindowsApps\Mutable\<package ID>)
// instead of the mods-enabled path(like C:\Program Files\ModifiableWindowsApps\Stardew Valley).
// Fortunately we can cheat a bit: players can customize the install drive, but they can't
// change the install path on the drive.
for (char driveLetter = 'C'; driveLetter <= 'H'; driveLetter++)
yield return $@"{driveLetter}:\Program Files\ModifiableWindowsApps\Stardew Valley";
}
break;