From 72ee547e1e0eb502a90381b3c9f1da3a9c5f2b18 Mon Sep 17 00:00:00 2001 From: atravita-mods <94934860+atravita-mods@users.noreply.github.com> Date: Sat, 15 Oct 2022 11:03:39 -0400 Subject: [PATCH 1/5] And fixing the indexing math again. --- src/SMAPI/Framework/Content/AssetDataForImage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SMAPI/Framework/Content/AssetDataForImage.cs b/src/SMAPI/Framework/Content/AssetDataForImage.cs index 241c09a81..7c8cc6a84 100644 --- a/src/SMAPI/Framework/Content/AssetDataForImage.cs +++ b/src/SMAPI/Framework/Content/AssetDataForImage.cs @@ -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; } From e31c96d5b816caa9b0b9e950306b9292a87380d7 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 16 Oct 2022 15:08:39 -0400 Subject: [PATCH 2/5] add missing test adapter package --- src/SMAPI.Tests/SMAPI.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SMAPI.Tests/SMAPI.Tests.csproj b/src/SMAPI.Tests/SMAPI.Tests.csproj index 2c32a9325..597cd7dd7 100644 --- a/src/SMAPI.Tests/SMAPI.Tests.csproj +++ b/src/SMAPI.Tests/SMAPI.Tests.csproj @@ -19,6 +19,7 @@ + From 4e91174b3ed265c31c54b2242711ca9d51bae1ca Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 16 Oct 2022 15:17:03 -0400 Subject: [PATCH 3/5] update release notes --- docs/release-notes.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/release-notes.md b/docs/release-notes.md index 9c4fdefc6..ff5d61bab 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,6 +7,10 @@ _If needed, you can update to SMAPI 3.16.0 first and then install the latest version._ --> +## Upcoming release +* 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. From 0e4dd8a7b446d85d4603d55043af42aac5968b5a Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 17 Oct 2022 20:02:19 -0400 Subject: [PATCH 4/5] prevent Steam vdf read errors from crashing the installer --- docs/release-notes.md | 3 + .../Framework/GameScanning/GameScanner.cs | 63 +++++++++++-------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index ff5d61bab..02d085d57 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -8,6 +8,9 @@ --> ## Upcoming release +* 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!). diff --git a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs index 1d518738a..881428052 100644 --- a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs +++ b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs @@ -261,39 +261,50 @@ private IEnumerable GetCustomInstallPaths() /// The game directory, if found. 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 } From 8090b30c6e489ae213493328d6f84f15ca18a592 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 21 Oct 2022 20:12:02 -0400 Subject: [PATCH 5/5] prepare for release --- build/common.targets | 2 +- docs/release-notes.md | 5 +++-- src/SMAPI.Mods.ConsoleCommands/manifest.json | 4 ++-- src/SMAPI.Mods.ErrorHandler/manifest.json | 4 ++-- src/SMAPI.Mods.SaveBackup/manifest.json | 4 ++-- src/SMAPI/Constants.cs | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/build/common.targets b/build/common.targets index 2f1f822ea..3c22b9139 100644 --- a/build/common.targets +++ b/build/common.targets @@ -7,7 +7,7 @@ repo. It imports the other MSBuild files as needed. - 3.17.1 + 3.17.2 SMAPI latest $(AssemblySearchPaths);{GAC} diff --git a/docs/release-notes.md b/docs/release-notes.md index 02d085d57..a8ddb0a09 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,10 +7,11 @@ _If needed, you can update to SMAPI 3.16.0 first and then install the latest version._ --> -## Upcoming release +## 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!). diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json index ecac30bf7..d1296dbea 100644 --- a/src/SMAPI.Mods.ConsoleCommands/manifest.json +++ b/src/SMAPI.Mods.ConsoleCommands/manifest.json @@ -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" } diff --git a/src/SMAPI.Mods.ErrorHandler/manifest.json b/src/SMAPI.Mods.ErrorHandler/manifest.json index 3d7088760..c3757e8f2 100644 --- a/src/SMAPI.Mods.ErrorHandler/manifest.json +++ b/src/SMAPI.Mods.ErrorHandler/manifest.json @@ -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" } diff --git a/src/SMAPI.Mods.SaveBackup/manifest.json b/src/SMAPI.Mods.SaveBackup/manifest.json index c2bf5f05d..78821a3e1 100644 --- a/src/SMAPI.Mods.SaveBackup/manifest.json +++ b/src/SMAPI.Mods.SaveBackup/manifest.json @@ -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" } diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index ea41a4eef..77900ca68 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -52,7 +52,7 @@ internal static class EarlyConstants internal static int? LogScreenId { get; set; } /// SMAPI's current raw semantic version. - internal static string RawApiVersion = "3.17.1"; + internal static string RawApiVersion = "3.17.2"; } /// Contains SMAPI's constants and assumptions.