From 575eb8c5251b5351e9b4bff71fcd76a11bdef5d2 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 23 Apr 2019 12:35:09 -0400 Subject: update release notes --- docs/release-notes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/release-notes.md') diff --git a/docs/release-notes.md b/docs/release-notes.md index c02b2dd2..56ed2c8f 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,10 +1,10 @@ # Release notes ## 2.11.2 -Released 22 April 2019 for Stardew Valley 1.3.36. +Released 23 April 2019 for Stardew Valley 1.3.36. * For players: - * Fixed error when a custom map references certain vanilla tilesheets on MacOS. - * Fixed compatibility with Arch Linux. + * Fixed error when a custom map references certain vanilla tilesheets on Linux/Mac. + * Fixed compatibility with some Linux distros. ## 2.11.1 Released 17 March 2019 for Stardew Valley 1.3.36. -- cgit From 26cac2c12a2b9ae7d486c000406deb2958f5fe30 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 8 Mar 2019 21:49:35 -0500 Subject: prevent invalid items from breaking menus on hover --- docs/release-notes.md | 6 ++++++ src/SMAPI/Patches/ObjectErrorPatch.cs | 32 +++++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) (limited to 'docs/release-notes.md') diff --git a/docs/release-notes.md b/docs/release-notes.md index 56ed2c8f..0b0bfbbc 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,4 +1,10 @@ # Release notes +## 3.0 (upcoming release) +These changes have not been released yet. + +* For players: + * SMAPI now prevents invalid items from breaking menus on hover. + ## 2.11.2 Released 23 April 2019 for Stardew Valley 1.3.36. diff --git a/src/SMAPI/Patches/ObjectErrorPatch.cs b/src/SMAPI/Patches/ObjectErrorPatch.cs index 0481259d..d72201c3 100644 --- a/src/SMAPI/Patches/ObjectErrorPatch.cs +++ b/src/SMAPI/Patches/ObjectErrorPatch.cs @@ -1,8 +1,8 @@ using System.Diagnostics.CodeAnalysis; -using System.Reflection; using Harmony; using StardewModdingAPI.Framework.Patching; using StardewValley; +using StardewValley.Menus; using SObject = StardewValley.Object; namespace StardewModdingAPI.Patches @@ -24,10 +24,17 @@ namespace StardewModdingAPI.Patches /// The Harmony instance. public void Apply(HarmonyInstance harmony) { - MethodInfo method = AccessTools.Method(typeof(SObject), nameof(SObject.getDescription)); - MethodInfo prefix = AccessTools.Method(this.GetType(), nameof(ObjectErrorPatch.Prefix)); + // object.getDescription + harmony.Patch( + original: AccessTools.Method(typeof(SObject), nameof(SObject.getDescription)), + prefix: new HarmonyMethod(AccessTools.Method(this.GetType(), nameof(ObjectErrorPatch.Object_GetDescription_Prefix))) + ); - harmony.Patch(method, new HarmonyMethod(prefix), null); + // IClickableMenu.drawToolTip + harmony.Patch( + original: AccessTools.Method(typeof(IClickableMenu), nameof(IClickableMenu.drawToolTip)), + prefix: new HarmonyMethod(AccessTools.Method(this.GetType(), nameof(ObjectErrorPatch.IClickableMenu_DrawTooltip_Prefix))) + ); } @@ -40,7 +47,7 @@ namespace StardewModdingAPI.Patches /// Returns whether to execute the original method. /// This method must be static for Harmony to work correctly. See the Harmony documentation before renaming arguments. [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument names are defined by Harmony.")] - private static bool Prefix(SObject __instance, ref string __result) + private static bool Object_GetDescription_Prefix(SObject __instance, ref string __result) { // invalid bigcraftables crash instead of showing '???' like invalid non-bigcraftables if (!__instance.IsRecipe && __instance.bigCraftable.Value && !Game1.bigCraftablesInformation.ContainsKey(__instance.ParentSheetIndex)) @@ -51,5 +58,20 @@ namespace StardewModdingAPI.Patches return true; } + + /// The method to call instead of . + /// The instance being patched. + /// The item for which to draw a tooltip. + /// Returns whether to execute the original method. + /// This method must be static for Harmony to work correctly. See the Harmony documentation before renaming arguments. + [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Argument names are defined by Harmony.")] + private static bool IClickableMenu_DrawTooltip_Prefix(IClickableMenu __instance, Item hoveredItem) + { + // invalid edible item cause crash when drawing tooltips + if (hoveredItem is SObject obj && obj.Edibility != -300 && !Game1.objectInformation.ContainsKey(obj.ParentSheetIndex)) + return false; + + return true; + } } } -- cgit From 64331ffe8c8cb0fc19878bbf5349299c483f8d9d Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 13 Mar 2019 22:20:18 -0400 Subject: default Monitor.Log to trace --- docs/release-notes.md | 3 +++ src/SMAPI.Mods.SaveBackup/ModEntry.cs | 6 +++--- src/SMAPI/Framework/DeprecationManager.cs | 2 +- src/SMAPI/Framework/Monitor.cs | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) (limited to 'docs/release-notes.md') diff --git a/docs/release-notes.md b/docs/release-notes.md index 0b0bfbbc..1df3aa53 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -5,6 +5,9 @@ These changes have not been released yet. * For players: * SMAPI now prevents invalid items from breaking menus on hover. +* For modders: + * `this.Monitor.Log` now defaults to the `Trace` log level instead of `Debug`. + ## 2.11.2 Released 23 April 2019 for Stardew Valley 1.3.36. diff --git a/src/SMAPI.Mods.SaveBackup/ModEntry.cs b/src/SMAPI.Mods.SaveBackup/ModEntry.cs index d10131b3..30dbfbe6 100644 --- a/src/SMAPI.Mods.SaveBackup/ModEntry.cs +++ b/src/SMAPI.Mods.SaveBackup/ModEntry.cs @@ -46,7 +46,7 @@ namespace StardewModdingAPI.Mods.SaveBackup } catch (Exception ex) { - this.Monitor.Log($"Error backing up saves: {ex}"); + this.Monitor.Log($"Error backing up saves: {ex}", LogLevel.Error); } } @@ -87,7 +87,7 @@ namespace StardewModdingAPI.Mods.SaveBackup catch (Exception ex) when (ex is TypeLoadException || ex.InnerException is TypeLoadException) { // create uncompressed backup if compression fails - this.Monitor.Log("Couldn't zip the save backup, creating uncompressed backup instead."); + this.Monitor.Log("Couldn't zip the save backup, creating uncompressed backup instead.", LogLevel.Debug); this.Monitor.Log(ex.ToString(), LogLevel.Trace); this.RecursiveCopy(new DirectoryInfo(Constants.SavesPath), fallbackDir, copyRoot: false); } @@ -137,7 +137,7 @@ namespace StardewModdingAPI.Mods.SaveBackup } catch (Exception ex) { - this.Monitor.Log($"Error deleting old save backup '{file.Name}': {ex}"); + this.Monitor.Log($"Error deleting old save backup '{file.Name}': {ex}", LogLevel.Error); } } } diff --git a/src/SMAPI/Framework/DeprecationManager.cs b/src/SMAPI/Framework/DeprecationManager.cs index 3153bbb4..984bb487 100644 --- a/src/SMAPI/Framework/DeprecationManager.cs +++ b/src/SMAPI/Framework/DeprecationManager.cs @@ -132,7 +132,7 @@ namespace StardewModdingAPI.Framework else { this.Monitor.Log(message, level); - this.Monitor.Log(warning.StackTrace); + this.Monitor.Log(warning.StackTrace, LogLevel.Debug); } } } diff --git a/src/SMAPI/Framework/Monitor.cs b/src/SMAPI/Framework/Monitor.cs index 47ebc2d7..617bfd85 100644 --- a/src/SMAPI/Framework/Monitor.cs +++ b/src/SMAPI/Framework/Monitor.cs @@ -78,7 +78,7 @@ namespace StardewModdingAPI.Framework /// Log a message for the player or developer. /// The message to log. /// The log severity level. - public void Log(string message, LogLevel level = LogLevel.Debug) + public void Log(string message, LogLevel level = LogLevel.Trace) { this.LogImpl(this.Source, message, (ConsoleLogLevel)level); } -- cgit From 29d11a72c27c659b95e8d5eaa8b41463c2371638 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 18 Mar 2019 00:41:07 -0400 Subject: fix release note --- docs/release-notes.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs/release-notes.md') diff --git a/docs/release-notes.md b/docs/release-notes.md index 1df3aa53..5ba19e43 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -24,8 +24,10 @@ Released 17 March 2019 for Stardew Valley 1.3.36. * Updated mod compatibility list. * Fixed `world_clear` console command removing chests edited to have a debris name. -* For the web UI: +* For modders: * Added support for suppressing false-positive warnings in rare cases. + +* For the web UI: * The log parser now collapses redundant sections by default. * Fixed log parser column resize bug. -- cgit From 20912724a0dc61562ea00e12e9bbc472c93e6aa4 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 27 Mar 2019 21:13:46 -0400 Subject: fix errors during early startup not shown before exit --- docs/release-notes.md | 1 + src/SMAPI/Program.cs | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'docs/release-notes.md') diff --git a/docs/release-notes.md b/docs/release-notes.md index 5ba19e43..b22909f7 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -4,6 +4,7 @@ These changes have not been released yet. * For players: * SMAPI now prevents invalid items from breaking menus on hover. + * Fixed errors during early startup not shown before exit. * For modders: * `this.Monitor.Log` now defaults to the `Trace` log level instead of `Debug`. diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 2eec371c..3a34872a 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -30,10 +30,18 @@ namespace StardewModdingAPI /// The command-line arguments. public static void Main(string[] args) { - AppDomain.CurrentDomain.AssemblyResolve += Program.CurrentDomain_AssemblyResolve; - Program.AssertGamePresent(); - Program.AssertGameVersion(); - Program.Start(args); + try + { + AppDomain.CurrentDomain.AssemblyResolve += Program.CurrentDomain_AssemblyResolve; + Program.AssertGamePresent(); + Program.AssertGameVersion(); + Program.Start(args); + } + catch (Exception ex) + { + Console.WriteLine($"SMAPI failed to initialise: {ex}"); + Program.PressAnyKeyToExit(true); + } } -- cgit From 36efdcfce2c76df2dd5313f6a42ddb76467cf610 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 14 Apr 2019 22:04:32 -0400 Subject: update release notes (#636) --- docs/release-notes.md | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/release-notes.md') diff --git a/docs/release-notes.md b/docs/release-notes.md index b22909f7..6c9636c7 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -4,6 +4,7 @@ These changes have not been released yet. * For players: * SMAPI now prevents invalid items from breaking menus on hover. + * SMAPI now prevents invalid event preconditions from crashing the game (thanks to berkayylmao!). * Fixed errors during early startup not shown before exit. * For modders: -- cgit From e3a2c56a6d8c827240a2bd4ead86c7b412e826ab Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 9 May 2019 23:03:45 -0400 Subject: fix 'location list changed' verbose log not correctly listing changes --- docs/release-notes.md | 1 + src/SMAPI/Framework/SGame.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/release-notes.md') diff --git a/docs/release-notes.md b/docs/release-notes.md index 6c9636c7..fb6be0c0 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -9,6 +9,7 @@ These changes have not been released yet. * For modders: * `this.Monitor.Log` now defaults to the `Trace` log level instead of `Debug`. + * Fixed 'location list changed' verbose log not correctly listing changes. ## 2.11.2 Released 23 April 2019 for Stardew Valley 1.3.36. diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 9818314a..704eb6bc 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -705,8 +705,8 @@ namespace StardewModdingAPI.Framework if (this.Monitor.IsVerbose) { - string addedText = this.Watchers.LocationsWatcher.Added.Any() ? string.Join(", ", added.Select(p => p.Name)) : "none"; - string removedText = this.Watchers.LocationsWatcher.Removed.Any() ? string.Join(", ", removed.Select(p => p.Name)) : "none"; + string addedText = added.Any() ? string.Join(", ", added.Select(p => p.Name)) : "none"; + string removedText = removed.Any() ? string.Join(", ", removed.Select(p => p.Name)) : "none"; this.Monitor.Log($"Context: location list changed (added {addedText}; removed {removedText}).", LogLevel.Trace); } -- cgit From 77f85a701a1487539e1c54a4a7d7f92d58f99cc9 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 15 May 2019 20:51:28 -0400 Subject: update mod list filters to always display clicked mod link --- docs/release-notes.md | 3 +++ src/SMAPI.Web/Views/LogParser/Index.cshtml | 4 ++-- src/SMAPI.Web/wwwroot/Content/js/mods.js | 9 +++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'docs/release-notes.md') diff --git a/docs/release-notes.md b/docs/release-notes.md index fb6be0c0..99e05016 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -7,6 +7,9 @@ These changes have not been released yet. * SMAPI now prevents invalid event preconditions from crashing the game (thanks to berkayylmao!). * Fixed errors during early startup not shown before exit. +* For the web UI: + * When filtering the mod list, clicking a mod link now automatically adds it to the visible mods. + * For modders: * `this.Monitor.Log` now defaults to the `Trace` log level instead of `Debug`. * Fixed 'location list changed' verbose log not correctly listing changes. diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index babd0bd3..dff37d7d 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -17,10 +17,10 @@ { } - + - +