Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathoschild committed Oct 22, 2022
2 parents ce00f8f + 8090b30 commit 9ae6924
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 35 deletions.
2 changes: 1 addition & 1 deletion build/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repo. It imports the other MSBuild files as needed.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--set general build properties -->
<Version>3.17.1</Version>
<Version>3.17.2</Version>
<Product>SMAPI</Product>
<LangVersion>latest</LangVersion>
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
Expand Down
8 changes: 8 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
_If needed, you can update to SMAPI 3.16.0 first and then install the latest version._
-->

## 3.17.2
Released 21 October 2022 for Stardew Valley 1.5.6 or later.

* For players:
* Fixed installer crash if Steam's library data is invalid or in an old format; it'll now be ignored instead.
* For mod authors:
* Fixed image patches sometimes applied one pixel higher than expected after 3.17.0 (thanks to atravita!).

## 3.17.1
Released 10 October 2022 for Stardew Valley 1.5.6 or later.

Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.ConsoleCommands/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
"Version": "3.17.1",
"Version": "3.17.2",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
"MinimumApiVersion": "3.17.1"
"MinimumApiVersion": "3.17.2"
}
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.ErrorHandler/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Error Handler",
"Author": "SMAPI",
"Version": "3.17.1",
"Version": "3.17.2",
"Description": "Handles some common vanilla errors to log more useful info or avoid breaking the game.",
"UniqueID": "SMAPI.ErrorHandler",
"EntryDll": "ErrorHandler.dll",
"MinimumApiVersion": "3.17.1"
"MinimumApiVersion": "3.17.2"
}
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.SaveBackup/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Save Backup",
"Author": "SMAPI",
"Version": "3.17.1",
"Version": "3.17.2",
"Description": "Automatically backs up all your saves once per day into its folder.",
"UniqueID": "SMAPI.SaveBackup",
"EntryDll": "SaveBackup.dll",
"MinimumApiVersion": "3.17.1"
"MinimumApiVersion": "3.17.2"
}
1 change: 1 addition & 0 deletions src/SMAPI.Tests/SMAPI.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<PackageReference Include="Moq" Version="4.18.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>

<ItemGroup>
Expand Down
63 changes: 37 additions & 26 deletions src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,39 +261,50 @@ private IEnumerable<string> GetCustomInstallPaths()
/// <returns>The game directory, if found.</returns>
private string? GetPathFromSteamLibrary(string? steamPath)
{
if (steamPath == null)
return null;

// get .vdf file path
string libraryFoldersPath = Path.Combine(steamPath.Replace('/', '\\'), "steamapps\\libraryfolders.vdf");
if (!File.Exists(libraryFoldersPath))
return null;

// read data
using FileStream fileStream = File.OpenRead(libraryFoldersPath);
VdfDeserializer deserializer = new();
dynamic libraries = deserializer.Deserialize(fileStream);
if (libraries?.libraryfolders is null)
return null;

// get path from Stardew Valley app (if any)
foreach (dynamic pair in libraries.libraryfolders)
try
{
dynamic library = pair.Value;

foreach (dynamic app in library.apps)
if (steamPath == null)
return null;

// get .vdf file path
string libraryFoldersPath = Path.Combine(steamPath.Replace('/', '\\'), "steamapps\\libraryfolders.vdf");
if (!File.Exists(libraryFoldersPath))
return null;

// read data
using FileStream fileStream = File.OpenRead(libraryFoldersPath);
VdfDeserializer deserializer = new();
dynamic libraries = deserializer.Deserialize(fileStream);
if (libraries?.libraryfolders is null)
return null;

// get path from Stardew Valley app (if any)
foreach (dynamic pair in libraries.libraryfolders)
{
string key = app.Key;
if (key == GameScanner.SteamAppId)
dynamic library = pair.Value;

foreach (dynamic app in library.apps)
{
string path = library.path;
string key = app.Key;
if (key == GameScanner.SteamAppId)
{
string path = library.path;

return Path.Combine(path.Replace("\\\\", "\\"), "steamapps", "common", "Stardew Valley");
return Path.Combine(path.Replace("\\\\", "\\"), "steamapps", "common", "Stardew Valley");
}
}
}
}

return null;
return null;
}
catch
{
// The file might not be parseable in some cases (e.g. some players have an older Steam version using
// a different format). Ideally we'd log an error to know when it's actually an issue, but the SMAPI
// installer doesn't have a logging mechanism (and third-party code calling the toolkit may not either).
// So for now, just ignore the error and fallback to the other discovery mechanisms.
return null;
}
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/SMAPI/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal static class EarlyConstants
internal static int? LogScreenId { get; set; }

/// <summary>SMAPI's current raw semantic version.</summary>
internal static string RawApiVersion = "3.17.1";
internal static string RawApiVersion = "3.17.2";
}

/// <summary>Contains SMAPI's constants and assumptions.</summary>
Expand Down
2 changes: 1 addition & 1 deletion src/SMAPI/Framework/Content/AssetDataForImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private void PatchImageImpl(Color[] sourceData, int sourceWidth, int sourceHeigh
int topOffset = startIndex / sourceArea.Width;
int bottomOffset = endIndex / sourceArea.Width;

targetArea = new(targetArea.X, targetArea.Y + topOffset, targetArea.Width, bottomOffset - topOffset + 1);
targetArea = new(targetArea.X, targetArea.Y + topOffset - startRow, targetArea.Width, bottomOffset - topOffset + 1);
pixelCount = targetArea.Width * targetArea.Height;
sourceOffset = topOffset * sourceArea.Width;
}
Expand Down

0 comments on commit 9ae6924

Please sign in to comment.