From 1cac3892848bef50a58b07c567f551974635b6d8 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 17 Oct 2020 22:03:43 -0400 Subject: fix error in heuristic rewriting --- src/SMAPI/Framework/ModLoading/Rewriters/HeuristicFieldRewriter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/SMAPI') diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicFieldRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicFieldRewriter.cs index ca04205c..f59a6ab1 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicFieldRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicFieldRewriter.cs @@ -68,7 +68,7 @@ namespace StardewModdingAPI.Framework.ModLoading.Rewriters private bool TryRewriteToProperty(ModuleDefinition module, Instruction instruction, FieldReference fieldRef, TypeDefinition declaringType, bool isRead) { // get equivalent property - PropertyDefinition property = declaringType.Properties.FirstOrDefault(p => p.Name == fieldRef.Name); + PropertyDefinition property = declaringType?.Properties.FirstOrDefault(p => p.Name == fieldRef.Name); MethodDefinition method = isRead ? property?.GetMethod : property?.SetMethod; if (method == null) return false; -- cgit From 70cf63c9075a126e7254b82d2d8109a451313920 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 18 Oct 2020 15:33:27 -0400 Subject: use update URL from server instead of hardcoding it --- src/SMAPI/Framework/Logging/LogManager.cs | 15 +++++--- src/SMAPI/Framework/SCore.cs | 57 +++++++++++++++++-------------- 2 files changed, 41 insertions(+), 31 deletions(-) (limited to 'src/SMAPI') diff --git a/src/SMAPI/Framework/Logging/LogManager.cs b/src/SMAPI/Framework/Logging/LogManager.cs index 094dd749..1e484709 100644 --- a/src/SMAPI/Framework/Logging/LogManager.cs +++ b/src/SMAPI/Framework/Logging/LogManager.cs @@ -195,9 +195,10 @@ namespace StardewModdingAPI.Framework.Logging /// Write an update alert marker file. /// The new version found. - public void WriteUpdateMarker(string version) + /// The download URL for the update. + public void WriteUpdateMarker(string version, string url) { - File.WriteAllText(Constants.UpdateMarker, version); + File.WriteAllText(Constants.UpdateMarker, $"{version}|{url}"); } /// Check whether SMAPI crashed or detected an update during the last session, and display them in the SMAPI console. @@ -206,13 +207,17 @@ namespace StardewModdingAPI.Framework.Logging // show update alert if (File.Exists(Constants.UpdateMarker)) { - string rawUpdateFound = File.ReadAllText(Constants.UpdateMarker); - if (SemanticVersion.TryParse(rawUpdateFound, out ISemanticVersion updateFound)) + string[] rawUpdateFound = File.ReadAllText(Constants.UpdateMarker).Split(new [] { '|' }, 2); + if (SemanticVersion.TryParse(rawUpdateFound[0], out ISemanticVersion updateFound)) { if (Constants.ApiVersion.IsPrerelease() && updateFound.IsNewerThan(Constants.ApiVersion)) { + string url = rawUpdateFound.Length > 1 + ? rawUpdateFound[1] + : Constants.HomePageUrl; + this.Monitor.Log("A new version of SMAPI was detected last time you played.", LogLevel.Error); - this.Monitor.Log($"You can update to {updateFound}: https://smapi.io.", LogLevel.Error); + this.Monitor.Log($"You can update to {updateFound}: {url}.", LogLevel.Error); this.Monitor.Log("Press any key to continue playing anyway. (This only appears when using a SMAPI beta.)", LogLevel.Info); Console.ReadKey(); } diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index f07e41f0..1b4c32bb 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -1195,37 +1195,42 @@ namespace StardewModdingAPI.Framework this.Monitor.Log("Checking for updates..."); // check SMAPI version - ISemanticVersion updateFound = null; - try { - // fetch update check - ModEntryModel response = client.GetModInfo(new[] { new ModSearchEntryModel("Pathoschild.SMAPI", Constants.ApiVersion, new[] { $"GitHub:{this.Settings.GitHubProjectName}" }) }, apiVersion: Constants.ApiVersion, gameVersion: Constants.GameVersion, platform: Constants.Platform).Single().Value; - if (response.SuggestedUpdate != null) - this.Monitor.Log($"You can update SMAPI to {response.SuggestedUpdate.Version}: {Constants.HomePageUrl}", LogLevel.Alert); - else - this.Monitor.Log(" SMAPI okay."); - - updateFound = response.SuggestedUpdate?.Version; + ISemanticVersion updateFound = null; + string updateUrl = null; + try + { + // fetch update check + ModEntryModel response = client.GetModInfo(new[] { new ModSearchEntryModel("Pathoschild.SMAPI", Constants.ApiVersion, new[] { $"GitHub:{this.Settings.GitHubProjectName}" }) }, apiVersion: Constants.ApiVersion, gameVersion: Constants.GameVersion, platform: Constants.Platform).Single().Value; + updateFound = response.SuggestedUpdate?.Version; + updateUrl = response.SuggestedUpdate?.Url ?? Constants.HomePageUrl; + + // log message + if (updateFound != null) + this.Monitor.Log($"You can update SMAPI to {updateFound}: {updateUrl}", LogLevel.Alert); + else + this.Monitor.Log(" SMAPI okay."); - // show errors - if (response.Errors.Any()) + // show errors + if (response.Errors.Any()) + { + this.Monitor.Log("Couldn't check for a new version of SMAPI. This won't affect your game, but you may not be notified of new versions if this keeps happening.", LogLevel.Warn); + this.Monitor.Log($"Error: {string.Join("\n", response.Errors)}"); + } + } + catch (Exception ex) { - this.Monitor.Log("Couldn't check for a new version of SMAPI. This won't affect your game, but you may not be notified of new versions if this keeps happening.", LogLevel.Warn); - this.Monitor.Log($"Error: {string.Join("\n", response.Errors)}"); + this.Monitor.Log("Couldn't check for a new version of SMAPI. This won't affect your game, but you won't be notified of new versions if this keeps happening.", LogLevel.Warn); + this.Monitor.Log(ex is WebException && ex.InnerException == null + ? $"Error: {ex.Message}" + : $"Error: {ex.GetLogSummary()}" + ); } - } - catch (Exception ex) - { - this.Monitor.Log("Couldn't check for a new version of SMAPI. This won't affect your game, but you won't be notified of new versions if this keeps happening.", LogLevel.Warn); - this.Monitor.Log(ex is WebException && ex.InnerException == null - ? $"Error: {ex.Message}" - : $"Error: {ex.GetLogSummary()}" - ); - } - // show update message on next launch - if (updateFound != null) - this.LogManager.WriteUpdateMarker(updateFound.ToString()); + // show update message on next launch + if (updateFound != null) + this.LogManager.WriteUpdateMarker(updateFound.ToString(), updateUrl); + } // check mod versions if (mods.Any()) -- cgit From 947d4545b1326bf6afbfb970d979dafd8ff2eb97 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 10 Nov 2020 20:11:52 -0500 Subject: fix 'collection was modified' error when using 'harmony summary' command in rare cases --- docs/release-notes.md | 1 + src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/SMAPI') diff --git a/docs/release-notes.md b/docs/release-notes.md index 3d131d07..14e5e81b 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -10,6 +10,7 @@ ## Upcoming release * For modders: * Fixed error when heuristically rewriting a property for a type that no longer exists. + * Fixed rare 'collection was modified' error when using 'harmony summary' console command in rare cases. * For the Console Commands mod: * `player_add` can now spawn shirts normally only available during character customization. diff --git a/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs b/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs index 8fdd4282..f3731d16 100644 --- a/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs +++ b/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs @@ -112,9 +112,9 @@ namespace StardewModdingAPI.Framework.Commands private IEnumerable GetAllPatches() { #if HARMONY_2 - foreach (MethodBase method in Harmony.GetAllPatchedMethods()) + foreach (MethodBase method in Harmony.GetAllPatchedMethods().ToArray()) #else - foreach (MethodBase method in this.HarmonyInstance.GetPatchedMethods()) + foreach (MethodBase method in this.HarmonyInstance.GetPatchedMethods().ToArray()) #endif { // get metadata for method -- cgit From 03506fc72ab33705a5b6ecd768d653acaabcc4e5 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 17 Nov 2020 19:09:00 -0500 Subject: update to TMXTile 1.5.7 --- docs/release-notes.md | 7 +++++-- src/SMAPI/SMAPI.csproj | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/SMAPI') diff --git a/docs/release-notes.md b/docs/release-notes.md index 14e5e81b..f73374c7 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -8,9 +8,12 @@ --> ## Upcoming release +* For players: + * Fixed error when heuristically rewriting a mod in rare cases (i.e. when it accesses a property for a type that no longer exists). + * Fixed rare 'collection was modified' error when using `harmony summary` console command in rare cases. + * For modders: - * Fixed error when heuristically rewriting a property for a type that no longer exists. - * Fixed rare 'collection was modified' error when using 'harmony summary' console command in rare cases. + * Updated TMXTile 1.5.6 → 1.5.7 to fix exported `.tmx` files losing tile index properties. * For the Console Commands mod: * `player_add` can now spawn shirts normally only available during character customization. diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj index 969071cf..acb1ecdf 100644 --- a/src/SMAPI/SMAPI.csproj +++ b/src/SMAPI/SMAPI.csproj @@ -16,7 +16,7 @@ - + -- cgit From 8a66532e7455298af6c004df2141c0c643919f3b Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 21 Nov 2020 12:40:44 -0500 Subject: update to TMXTile 1.5.8 --- docs/release-notes.md | 2 +- src/SMAPI/SMAPI.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/SMAPI') diff --git a/docs/release-notes.md b/docs/release-notes.md index f73374c7..04d37580 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -13,7 +13,7 @@ * Fixed rare 'collection was modified' error when using `harmony summary` console command in rare cases. * For modders: - * Updated TMXTile 1.5.6 → 1.5.7 to fix exported `.tmx` files losing tile index properties. + * Updated TMXTile 1.5.6 → 1.5.8 to fix exported `.tmx` files losing tile index properties. * For the Console Commands mod: * `player_add` can now spawn shirts normally only available during character customization. diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj index acb1ecdf..6344cb2f 100644 --- a/src/SMAPI/SMAPI.csproj +++ b/src/SMAPI/SMAPI.csproj @@ -16,7 +16,7 @@ - + -- cgit From a0cb83ed406fc0447e8edf00e680585005480d23 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 21 Nov 2020 14:08:04 -0500 Subject: prepare for release --- build/common.targets | 2 +- docs/release-notes.md | 10 ++++++---- src/SMAPI.Mods.ConsoleCommands/manifest.json | 4 ++-- src/SMAPI.Mods.SaveBackup/manifest.json | 4 ++-- src/SMAPI/Constants.cs | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src/SMAPI') diff --git a/build/common.targets b/build/common.targets index 8e687190..d8b29488 100644 --- a/build/common.targets +++ b/build/common.targets @@ -4,7 +4,7 @@ - 3.7.5 + 3.7.6 SMAPI latest diff --git a/docs/release-notes.md b/docs/release-notes.md index ac2dcce4..1115f482 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,13 +7,15 @@ * Migrated to Harmony 2.0 (see [_migrate to Harmony 2.0_](https://stardewvalleywiki.com/Modding:Migrate_to_Harmony_2.0) for more info). --> -## Upcoming release +## 3.7.6 +Released 21 November 2020 for Stardew Valley 1.4.1 or later. + * For players: - * Fixed error when heuristically rewriting a mod in rare cases (i.e. when it accesses a property for a type that no longer exists). - * Fixed rare 'collection was modified' error when using `harmony summary` console command in rare cases. + * Fixed error when heuristically rewriting an outdated mod in rare cases. + * Fixed rare 'collection was modified' error when using `harmony summary` console command. * For modders: - * Updated TMXTile 1.5.6 → 1.5.8 to fix exported `.tmx` files losing tile index properties. + * Updated TMXTile to 1.5.8 to fix exported `.tmx` files losing tile index properties. * For the Console Commands mod: * `player_add` can now spawn shirts normally only available during character customization. diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json index 300350e4..ddc55a73 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.7.5", + "Version": "3.7.6", "Description": "Adds SMAPI console commands that let you manipulate the game.", "UniqueID": "SMAPI.ConsoleCommands", "EntryDll": "ConsoleCommands.dll", - "MinimumApiVersion": "3.7.5" + "MinimumApiVersion": "3.7.6" } diff --git a/src/SMAPI.Mods.SaveBackup/manifest.json b/src/SMAPI.Mods.SaveBackup/manifest.json index d1d8ae32..0fe98909 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.7.5", + "Version": "3.7.6", "Description": "Automatically backs up all your saves once per day into its folder.", "UniqueID": "SMAPI.SaveBackup", "EntryDll": "SaveBackup.dll", - "MinimumApiVersion": "3.7.5" + "MinimumApiVersion": "3.7.6" } diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 754ab295..88f79811 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -51,7 +51,7 @@ namespace StardewModdingAPI ** Public ****/ /// SMAPI's current semantic version. - public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.7.5"); + public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.7.6"); /// The minimum supported version of Stardew Valley. public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.4.1"); -- cgit