From 9240bdbf9b6b54d820cb01953ceea31f5e06598e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 7 Feb 2019 22:28:55 -0500 Subject: fix save folder constants not available during early load stages --- docs/release-notes.md | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index e08e7af4..cde04226 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,4 +1,9 @@ # Release notes +## Upcoming + +* For modders: + * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. + ## 2.10.1 Released 30 December 2018 for Stardew Valley 1.3.32. -- cgit From d8dd4b4c18f571c6e8a7264f0168a69fd04bce70 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 7 Feb 2019 22:30:09 -0500 Subject: fix LoadStage.SaveParsed raised before save data available --- docs/release-notes.md | 1 + src/SMAPI/Framework/SGame.cs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index cde04226..9c3ff1c6 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -3,6 +3,7 @@ * For modders: * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. + * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. ## 2.10.1 Released 30 December 2018 for Stardew Valley 1.3.32. diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 6aff6c01..a90e8264 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -290,6 +290,7 @@ namespace StardewModdingAPI.Framework // Run async tasks synchronously to avoid issues due to mod events triggering // concurrently with game code. + bool saveParsed = false; if (Game1.currentLoader != null) { this.Monitor.Log("Game loader synchronising...", LogLevel.Trace); @@ -298,7 +299,8 @@ namespace StardewModdingAPI.Framework // raise load stage changed switch (Game1.currentLoader.Current) { - case 20: + case 20 when (!saveParsed && SaveGame.loaded != null): + saveParsed = true; this.OnLoadStageChanged(LoadStage.SaveParsed); break; -- cgit From ce060f30e69744ef4129998473220bf011c89fee Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 7 Feb 2019 22:34:18 -0500 Subject: set max game version to avoid confusion when 1.3.35 releases --- docs/release-notes.md | 3 +++ src/SMAPI/Constants.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 9c3ff1c6..62d9b6db 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,6 +1,9 @@ # Release notes ## Upcoming +* For players: + * Restrict to Stardew Valley 1.3.33 or earlier (to avoid confusion when SDV 1.3.35 is released). + * For modders: * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index dde8f2a0..f8d1638e 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -26,7 +26,7 @@ namespace StardewModdingAPI public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.3.32"); /// The maximum supported version of Stardew Valley. - public static ISemanticVersion MaximumGameVersion { get; } = null; + public static ISemanticVersion MaximumGameVersion { get; } = new GameVersion("1.3.33"); /// The target game platform. public static GamePlatform TargetPlatform => (GamePlatform)Constants.Platform; -- cgit From 1db640d29557c8574e6442ad9824988358929e24 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 31 Dec 2018 13:03:59 -0500 Subject: add mod page link to 'missing dependency' errors for the most common dependencies --- docs/release-notes.md | 1 + .../wwwroot/StardewModdingAPI.metadata.json | 79 ++++++++++++++++++---- 2 files changed, 65 insertions(+), 15 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 62d9b6db..dc729ca5 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -2,6 +2,7 @@ ## Upcoming * For players: + * Added mod page link to 'missing dependency' errors for the most common dependencies. * Restrict to Stardew Valley 1.3.33 or earlier (to avoid confusion when SDV 1.3.35 is released). * For modders: diff --git a/src/SMAPI.Web/wwwroot/StardewModdingAPI.metadata.json b/src/SMAPI.Web/wwwroot/StardewModdingAPI.metadata.json index b16cb99f..c0e48150 100644 --- a/src/SMAPI.Web/wwwroot/StardewModdingAPI.metadata.json +++ b/src/SMAPI.Web/wwwroot/StardewModdingAPI.metadata.json @@ -51,6 +51,70 @@ * mod is no longer compatible. */ "ModData": { + /********* + ** Common dependencies for friendly errors + *********/ + "Advanced Location Loader": { + "ID": "Entoarox.AdvancedLocationLoader", + "Default | UpdateKey": "Nexus:2270" + }, + + "Content Patcher": { + "ID": "Pathoschild.ContentPatcher", + "Default | UpdateKey": "Nexus:1915" + }, + + "Custom Farming Redux": { + "ID": "Platonymous.CustomFarming", + "Default | UpdateKey": "Nexus:991" + }, + + "Custom Shirts": { + "ID": "Platonymous.CustomShirts", + "Default | UpdateKey": "Nexus:2416" + }, + + "Entoarox Framework": { + "ID": "Entoarox.EntoaroxFramework", + "Default | UpdateKey": "Nexus:2269" + }, + + "JSON Assets": { + "ID": "spacechase0.JsonAssets", + "Default | UpdateKey": "Nexus:1720" + }, + + "Mail Framework": { + "ID": "DIGUS.MailFrameworkMod", + "Default | UpdateKey": "Nexus:1536" + }, + + "MTN": { + "ID": "SgtPickles.MTN", + "Default | UpdateKey": "Nexus:2256", + "~1.2.5 | Status": "AssumeBroken" // replaces Game1.multiplayer, which breaks SMAPI's multiplayer API. + }, + + "PyTK": { + "ID": "Platonymous.Toolkit", + "Default | UpdateKey": "Nexus:1726" + }, + + "SpaceCore": { + "ID": "spacechase0.SpaceCore", + "Default | UpdateKey": "Nexus:1348" + }, + + "Stardust Core": { + "ID": "Omegasis.StardustCore", + "Default | UpdateKey": "Nexus:2341" + }, + + "TMX Loader": { + "ID": "Platonymous.TMXLoader", + "Default | UpdateKey": "Nexus:1820" + }, + /********* ** Content packs *********/ @@ -172,11 +236,6 @@ "MapRemoteVersions": { "1.1": "1.0" } // manifest not updated }, - "Custom Shirts": { - "ID": "Platonymous.CustomShirts", - "Default | UpdateKey": "Nexus:2416" // keep for dependencies - }, - "Dynamic Horses": { "ID": "Bpendragon-DynamicHorses", "MapRemoteVersions": { "1.2": "1.1-release" } // manifest not updated @@ -258,11 +317,6 @@ "~1.0.1 | Status": "AssumeBroken" // doesn't do anything as of SDV 1.2.33 (bad Harmony patch?) }, - "MTN": { - "ID": "SgtPickles.MTN", - "~1.2.5 | Status": "AssumeBroken" // replaces Game1.multiplayer, which breaks SMAPI's multiplayer API. - }, - "Multiple Sprites and Portraits On Rotation (File Loading)": { "ID": "FileLoading", "MapLocalVersions": { "1.1": "1.12" } @@ -290,11 +344,6 @@ "Default | UpdateKey": "GitHub:lambui/StardewValleyMod_OmniFarm" }, - "PyTK - Platonymous Toolkit": { - "ID": "Platonymous.Toolkit", - "Default | UpdateKey": "Nexus:1726" - }, - "Point-and-Plant": { "ID": "jwdred.PointAndPlant", "MapRemoteVersions": { "1.0.3": "1.0.2" } // manifest not updated -- cgit From e064be0c7b3440b31b616cec8c43946097fdad7d Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 31 Dec 2018 14:10:25 -0500 Subject: fix 'unknown mod' deprecation warnings showing wrong stack trace --- docs/release-notes.md | 1 + src/SMAPI/Framework/DeprecationManager.cs | 4 ++-- src/SMAPI/Framework/DeprecationWarning.cs | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index dc729ca5..960ede7b 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -8,6 +8,7 @@ * For modders: * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. + * Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. ## 2.10.1 Released 30 December 2018 for Stardew Valley 1.3.32. diff --git a/src/SMAPI/Framework/DeprecationManager.cs b/src/SMAPI/Framework/DeprecationManager.cs index 76c2f616..8d836c8c 100644 --- a/src/SMAPI/Framework/DeprecationManager.cs +++ b/src/SMAPI/Framework/DeprecationManager.cs @@ -62,7 +62,7 @@ namespace StardewModdingAPI.Framework return; // queue warning - this.QueuedWarnings.Add(new DeprecationWarning(source, nounPhrase, version, severity)); + this.QueuedWarnings.Add(new DeprecationWarning(source, nounPhrase, version, severity, Environment.StackTrace)); } /// Print any queued messages. @@ -79,7 +79,7 @@ namespace StardewModdingAPI.Framework : $"{warning.ModName ?? "An unknown mod"} uses deprecated code ({warning.NounPhrase} is deprecated since SMAPI {warning.Version})."; #endif if (warning.ModName == null) - message += $"{Environment.NewLine}{Environment.StackTrace}"; + message += $"{Environment.NewLine}{warning.StackTrace}"; // log message switch (warning.Level) diff --git a/src/SMAPI/Framework/DeprecationWarning.cs b/src/SMAPI/Framework/DeprecationWarning.cs index 25415012..5201b06c 100644 --- a/src/SMAPI/Framework/DeprecationWarning.cs +++ b/src/SMAPI/Framework/DeprecationWarning.cs @@ -18,6 +18,9 @@ namespace StardewModdingAPI.Framework /// The deprecation level for the affected code. public DeprecationLevel Level { get; } + /// The stack trace when the deprecation warning was raised. + public string StackTrace { get; } + /********* ** Public methods @@ -27,12 +30,14 @@ namespace StardewModdingAPI.Framework /// A noun phrase describing what is deprecated. /// The SMAPI version which deprecated it. /// The deprecation level for the affected code. - public DeprecationWarning(string modName, string nounPhrase, string version, DeprecationLevel level) + /// The stack trace when the deprecation warning was raised. + public DeprecationWarning(string modName, string nounPhrase, string version, DeprecationLevel level, string stackTrace) { this.ModName = modName; this.NounPhrase = nounPhrase; this.Version = version; this.Level = level; + this.StackTrace = stackTrace; } } } -- cgit From c4a76df4b07e9b3378f51e00909e09424ba09654 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 31 Dec 2018 14:16:43 -0500 Subject: fix 'unknown mod' deprecation warnings showing stack trace in non-developer mode --- docs/release-notes.md | 1 + src/SMAPI/Framework/DeprecationManager.cs | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 960ede7b..a900150a 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -4,6 +4,7 @@ * For players: * Added mod page link to 'missing dependency' errors for the most common dependencies. * Restrict to Stardew Valley 1.3.33 or earlier (to avoid confusion when SDV 1.3.35 is released). + * Fixed 'unknown mod' deprecation warnings showing a stack trace when developers mode not enabled. * For modders: * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. diff --git a/src/SMAPI/Framework/DeprecationManager.cs b/src/SMAPI/Framework/DeprecationManager.cs index 8d836c8c..fcdf722e 100644 --- a/src/SMAPI/Framework/DeprecationManager.cs +++ b/src/SMAPI/Framework/DeprecationManager.cs @@ -78,27 +78,40 @@ namespace StardewModdingAPI.Framework ? $"{warning.ModName ?? "An unknown mod"} uses deprecated code (legacy events are deprecated since SMAPI {warning.Version})." : $"{warning.ModName ?? "An unknown mod"} uses deprecated code ({warning.NounPhrase} is deprecated since SMAPI {warning.Version})."; #endif - if (warning.ModName == null) - message += $"{Environment.NewLine}{warning.StackTrace}"; - // log message + // get log level + LogLevel level; switch (warning.Level) { case DeprecationLevel.Notice: - this.Monitor.Log(message, LogLevel.Trace); + level = LogLevel.Trace; break; case DeprecationLevel.Info: - this.Monitor.Log(message, LogLevel.Debug); + level = LogLevel.Debug; break; case DeprecationLevel.PendingRemoval: - this.Monitor.Log(message, LogLevel.Warn); + level = LogLevel.Warn; break; default: throw new NotSupportedException($"Unknown deprecation level '{warning.Level}'."); } + + // log message + if (warning.ModName != null) + this.Monitor.Log(message, level); + else + { + if (level == LogLevel.Trace) + this.Monitor.Log($"{message}\n{warning.StackTrace}", level); + else + { + this.Monitor.Log(message, level); + this.Monitor.Log(warning.StackTrace); + } + } } this.QueuedWarnings.Clear(); } -- cgit From 0f926ca1c9d5d1323ddf10ceaa0ad4e9e7d02d3c Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 31 Dec 2018 14:40:42 -0500 Subject: fix 'unknown mod' deprecation warnings when they occur in the Mod constructor --- docs/release-notes.md | 1 + src/SMAPI/Framework/ModRegistry.cs | 10 ++++++++-- src/SMAPI/Framework/SCore.cs | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index a900150a..80ce7d33 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -5,6 +5,7 @@ * Added mod page link to 'missing dependency' errors for the most common dependencies. * Restrict to Stardew Valley 1.3.33 or earlier (to avoid confusion when SDV 1.3.35 is released). * Fixed 'unknown mod' deprecation warnings showing a stack trace when developers mode not enabled. + * Fixed 'unknown mod' deprecation warnings when they occur in the Mod constructor. * For modders: * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. diff --git a/src/SMAPI/Framework/ModRegistry.cs b/src/SMAPI/Framework/ModRegistry.cs index e9ceb66e..5be33cb4 100644 --- a/src/SMAPI/Framework/ModRegistry.cs +++ b/src/SMAPI/Framework/ModRegistry.cs @@ -33,8 +33,14 @@ namespace StardewModdingAPI.Framework public void Add(IModMetadata metadata) { this.Mods.Add(metadata); - if (!metadata.IsContentPack) - this.ModNamesByAssembly[metadata.Mod.GetType().Assembly.FullName] = metadata; + } + + /// Track a mod's assembly for use via . + /// The mod metadata. + /// The mod assembly. + public void TrackAssemblies(IModMetadata metadata, Assembly modAssembly) + { + this.ModNamesByAssembly[modAssembly.FullName] = metadata; } /// Get metadata for all loaded mods. diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index 27c0c40b..46e1de8d 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -977,6 +977,7 @@ namespace StardewModdingAPI.Framework try { modAssembly = assemblyLoader.Load(mod, assemblyPath, assumeCompatible: mod.DataRecord?.Status == ModStatus.AssumeCompatible); + this.ModRegistry.TrackAssemblies(mod, modAssembly); } catch (IncompatibleInstructionException) // details already in trace logs { -- cgit From 2287aeeb6580cab125d274e604115680a9b2daea Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 3 Jan 2019 18:40:55 -0500 Subject: improve save backup error-handling, keep first backup of the day --- docs/release-notes.md | 3 ++ src/SMAPI.Mods.SaveBackup/ModEntry.cs | 60 +++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 9 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 80ce7d33..84e322fe 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -3,6 +3,9 @@ * For players: * Added mod page link to 'missing dependency' errors for the most common dependencies. + * Improved save backups: + * When compression isn't available on Linux, SMAPI now falls back to uncompressed backups. + * SMAPI now keeps the first backup created for the day, instead of the last one. * Restrict to Stardew Valley 1.3.33 or earlier (to avoid confusion when SDV 1.3.35 is released). * Fixed 'unknown mod' deprecation warnings showing a stack trace when developers mode not enabled. * Fixed 'unknown mod' deprecation warnings when they occur in the Mod constructor. diff --git a/src/SMAPI.Mods.SaveBackup/ModEntry.cs b/src/SMAPI.Mods.SaveBackup/ModEntry.cs index 56a86cd9..d10131b3 100644 --- a/src/SMAPI.Mods.SaveBackup/ModEntry.cs +++ b/src/SMAPI.Mods.SaveBackup/ModEntry.cs @@ -20,8 +20,11 @@ namespace StardewModdingAPI.Mods.SaveBackup /// The absolute path to the folder in which to store save backups. private readonly string BackupFolder = Path.Combine(Constants.ExecutionPath, "save-backups"); + /// A unique label for the save backup to create. + private readonly string BackupLabel = $"{DateTime.UtcNow:yyyy-MM-dd} - SMAPI {Constants.ApiVersion} with Stardew Valley {Game1.version}"; + /// The name of the save archive to create. - private readonly string FileName = $"{DateTime.UtcNow:yyyy-MM-dd} - SMAPI {Constants.ApiVersion} with Stardew Valley {Game1.version}.zip"; + private string FileName => $"{this.BackupLabel}.zip"; /********* @@ -59,8 +62,9 @@ namespace StardewModdingAPI.Mods.SaveBackup { // get target path FileInfo targetFile = new FileInfo(Path.Combine(backupFolder.FullName, this.FileName)); - if (targetFile.Exists) - targetFile.Delete(); //return; + DirectoryInfo fallbackDir = new DirectoryInfo(Path.Combine(backupFolder.FullName, this.BackupLabel)); + if (targetFile.Exists || fallbackDir.Exists) + return; // create zip // due to limitations with the bundled Mono on Mac, we can't reference System.IO.Compression. @@ -70,12 +74,23 @@ namespace StardewModdingAPI.Mods.SaveBackup case GamePlatform.Linux: case GamePlatform.Windows: { - Assembly coreAssembly = Assembly.Load("System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") ?? throw new InvalidOperationException("Can't load System.IO.Compression assembly."); - Assembly fsAssembly = Assembly.Load("System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") ?? throw new InvalidOperationException("Can't load System.IO.Compression assembly."); - Type compressionLevelType = coreAssembly.GetType("System.IO.Compression.CompressionLevel") ?? throw new InvalidOperationException("Can't load CompressionLevel type."); - Type zipFileType = fsAssembly.GetType("System.IO.Compression.ZipFile") ?? throw new InvalidOperationException("Can't load ZipFile type."); - MethodInfo createMethod = zipFileType.GetMethod("CreateFromDirectory", new[] { typeof(string), typeof(string), compressionLevelType, typeof(bool) }) ?? throw new InvalidOperationException("Can't load ZipFile.CreateFromDirectory method."); - createMethod.Invoke(null, new object[] { Constants.SavesPath, targetFile.FullName, CompressionLevel.Fastest, false }); + try + { + // create compressed backup + Assembly coreAssembly = Assembly.Load("System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") ?? throw new InvalidOperationException("Can't load System.IO.Compression assembly."); + Assembly fsAssembly = Assembly.Load("System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") ?? throw new InvalidOperationException("Can't load System.IO.Compression assembly."); + Type compressionLevelType = coreAssembly.GetType("System.IO.Compression.CompressionLevel") ?? throw new InvalidOperationException("Can't load CompressionLevel type."); + Type zipFileType = fsAssembly.GetType("System.IO.Compression.ZipFile") ?? throw new InvalidOperationException("Can't load ZipFile type."); + MethodInfo createMethod = zipFileType.GetMethod("CreateFromDirectory", new[] { typeof(string), typeof(string), compressionLevelType, typeof(bool) }) ?? throw new InvalidOperationException("Can't load ZipFile.CreateFromDirectory method."); + createMethod.Invoke(null, new object[] { Constants.SavesPath, targetFile.FullName, CompressionLevel.Fastest, false }); + } + 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(ex.ToString(), LogLevel.Trace); + this.RecursiveCopy(new DirectoryInfo(Constants.SavesPath), fallbackDir, copyRoot: false); + } } break; @@ -132,5 +147,32 @@ namespace StardewModdingAPI.Mods.SaveBackup this.Monitor.Log(ex.ToString(), LogLevel.Trace); } } + + /// Recursively copy a directory or file. + /// The file or folder to copy. + /// The folder to copy into. + /// Whether to copy the root folder itself, or false to only copy its contents. + /// Derived from the SMAPI installer code. + private void RecursiveCopy(FileSystemInfo source, DirectoryInfo targetFolder, bool copyRoot = true) + { + if (!targetFolder.Exists) + targetFolder.Create(); + + switch (source) + { + case FileInfo sourceFile: + sourceFile.CopyTo(Path.Combine(targetFolder.FullName, sourceFile.Name)); + break; + + case DirectoryInfo sourceDir: + DirectoryInfo targetSubfolder = copyRoot ? new DirectoryInfo(Path.Combine(targetFolder.FullName, sourceDir.Name)) : targetFolder; + foreach (var entry in sourceDir.EnumerateFileSystemInfos()) + this.RecursiveCopy(entry, targetSubfolder); + break; + + default: + throw new NotSupportedException($"Unknown filesystem info type '{source.GetType().FullName}'."); + } + } } } -- cgit From 11c080962b3eb927f61d982f910725b255b1ec77 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 3 Jan 2019 18:44:09 -0500 Subject: fix cursor position not updated in edge case --- docs/release-notes.md | 1 + src/SMAPI/Framework/Input/SInputState.cs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 84e322fe..9a6be891 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -14,6 +14,7 @@ * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. * Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. + * Fixed `e.Cursor` in input events showing wrong grab tile when player using a controller moves without moving the viewpoint. ## 2.10.1 Released 30 December 2018 for Stardew Valley 1.3.32. diff --git a/src/SMAPI/Framework/Input/SInputState.cs b/src/SMAPI/Framework/Input/SInputState.cs index 0228db0d..96a7003a 100644 --- a/src/SMAPI/Framework/Input/SInputState.cs +++ b/src/SMAPI/Framework/Input/SInputState.cs @@ -20,6 +20,9 @@ namespace StardewModdingAPI.Framework.Input /// The cursor position on the screen adjusted for the zoom level. private CursorPosition CursorPositionImpl; + /// The player's last known tile position. + private Vector2? LastPlayerTile; + /********* ** Accessors @@ -83,13 +86,14 @@ namespace StardewModdingAPI.Framework.Input MouseState realMouse = Mouse.GetState(); var activeButtons = this.DeriveStatuses(this.ActiveButtons, realKeyboard, realMouse, realController); Vector2 cursorAbsolutePos = new Vector2(realMouse.X + Game1.viewport.X, realMouse.Y + Game1.viewport.Y); + Vector2? playerTilePos = Context.IsPlayerFree ? Game1.player.getTileLocation() : (Vector2?)null; // update real states this.ActiveButtons = activeButtons; this.RealController = realController; this.RealKeyboard = realKeyboard; this.RealMouse = realMouse; - if (this.CursorPositionImpl?.AbsolutePixels != cursorAbsolutePos) + if (cursorAbsolutePos != this.CursorPositionImpl?.AbsolutePixels || playerTilePos != this.LastPlayerTile) this.CursorPositionImpl = this.GetCursorPosition(realMouse, cursorAbsolutePos); // update suppressed states -- cgit From 5d9a618bec8d65d04d3f0b554b281d68289a4499 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 5 Jan 2019 14:47:50 -0500 Subject: fix incorrect 'bypassed safety checks' for mods using LoadStageChanged event --- docs/release-notes.md | 1 + src/SMAPI/Metadata/InstructionMetadata.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 9a6be891..44fcf4dc 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -15,6 +15,7 @@ * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. * Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. * Fixed `e.Cursor` in input events showing wrong grab tile when player using a controller moves without moving the viewpoint. + * Fixed incorrect 'bypassed safety checks' warning for mods using the new `Specialised.LoadStageChanged` event in 2.10. ## 2.10.1 Released 30 December 2018 for Stardew Valley 1.3.32. diff --git a/src/SMAPI/Metadata/InstructionMetadata.cs b/src/SMAPI/Metadata/InstructionMetadata.cs index 9ff99440..272ceb09 100644 --- a/src/SMAPI/Metadata/InstructionMetadata.cs +++ b/src/SMAPI/Metadata/InstructionMetadata.cs @@ -51,7 +51,8 @@ namespace StardewModdingAPI.Metadata yield return new FieldFinder(typeof(SaveGame).FullName, nameof(SaveGame.serializer), InstructionHandleResult.DetectedSaveSerialiser); yield return new FieldFinder(typeof(SaveGame).FullName, nameof(SaveGame.farmerSerializer), InstructionHandleResult.DetectedSaveSerialiser); yield return new FieldFinder(typeof(SaveGame).FullName, nameof(SaveGame.locationSerializer), InstructionHandleResult.DetectedSaveSerialiser); - yield return new TypeFinder(typeof(ISpecialisedEvents).FullName, InstructionHandleResult.DetectedUnvalidatedUpdateTick); + yield return new EventFinder(typeof(ISpecialisedEvents).FullName, nameof(ISpecialisedEvents.UnvalidatedUpdateTicked), InstructionHandleResult.DetectedUnvalidatedUpdateTick); + yield return new EventFinder(typeof(ISpecialisedEvents).FullName, nameof(ISpecialisedEvents.UnvalidatedUpdateTicking), InstructionHandleResult.DetectedUnvalidatedUpdateTick); #if !SMAPI_3_0_STRICT yield return new EventFinder(typeof(SpecialisedEvents).FullName, nameof(SpecialisedEvents.UnvalidatedUpdateTick), InstructionHandleResult.DetectedUnvalidatedUpdateTick); #endif -- cgit From 60cca13d5322061a38067f91cbd28116096c4bb0 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 5 Jan 2019 17:59:24 -0500 Subject: update compatibility list --- docs/release-notes.md | 1 + .../wwwroot/StardewModdingAPI.metadata.json | 42 +++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 44fcf4dc..64f6368d 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -9,6 +9,7 @@ * Restrict to Stardew Valley 1.3.33 or earlier (to avoid confusion when SDV 1.3.35 is released). * Fixed 'unknown mod' deprecation warnings showing a stack trace when developers mode not enabled. * Fixed 'unknown mod' deprecation warnings when they occur in the Mod constructor. + * Updated compatibility list. * For modders: * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. diff --git a/src/SMAPI.Web/wwwroot/StardewModdingAPI.metadata.json b/src/SMAPI.Web/wwwroot/StardewModdingAPI.metadata.json index c0e48150..44edf0ca 100644 --- a/src/SMAPI.Web/wwwroot/StardewModdingAPI.metadata.json +++ b/src/SMAPI.Web/wwwroot/StardewModdingAPI.metadata.json @@ -146,6 +146,11 @@ } }, + "Always Scroll Map": { + "ID": "bcmpinc.AlwaysScrollMap", + "~0.6 | Status": "AssumeBroken" // breaks newer versions of bcmpinc mods (per bcmpinc's request) + }, + "Animal Mood Fix": { "ID": "GPeters-AnimalMoodFix", "~ | Status": "Obsolete", @@ -215,6 +220,11 @@ "MapLocalVersions": { "1.2-beta": "1.2" } }, + "Craft Counter": { + "ID": "bcmpinc.CraftCounter", + "~0.6 | Status": "AssumeBroken" // breaks newer versions of bcmpinc mods (per bcmpinc's request) + }, + "Crafting Counter": { "ID": "lolpcgaming.CraftingCounter", "MapRemoteVersions": { "1.1": "1.0" } // not updated in manifest @@ -266,6 +276,11 @@ "~1.1 | Status": "AssumeBroken" // runtime errors with Harmony 1.2.0.1 in SMAPI 2.8+ }, + "Fix Animal Tools": { + "ID": "bcmpinc.FixAnimalTools", + "~0.6 | Status": "AssumeBroken" // breaks newer versions of bcmpinc mods (per bcmpinc's request) + }, + "Fix Scythe Exp": { "ID": "bcmpinc.FixScytheExp", "~0.3 | Status": "AssumeBroken" // broke in 1.3: Exception from HarmonyInstance "bcmpinc.FixScytheExp" [...] Bad label content in ILGenerator. @@ -278,7 +293,7 @@ "Grass Growth": { "ID": "bcmpinc.GrassGrowth", - "~0.3 | Status": "AssumeBroken" // broke in 1.3.29 (runtime errors: System.IndexOutOfRangeException: Could not find instruction sequence) + "~0.6 | Status": "AssumeBroken" // breaks newer versions of bcmpinc mods (per bcmpinc's request) }, "Hunger Mod (skn)": { @@ -317,6 +332,11 @@ "~1.0.1 | Status": "AssumeBroken" // doesn't do anything as of SDV 1.2.33 (bad Harmony patch?) }, + "Movement Speed": { + "ID": "bcmpinc.MovementSpeed", + "~0.6 | Status": "AssumeBroken" // breaks newer versions of bcmpinc mods (per bcmpinc's request) + }, + "Multiple Sprites and Portraits On Rotation (File Loading)": { "ID": "FileLoading", "MapLocalVersions": { "1.1": "1.12" } @@ -413,6 +433,11 @@ "~3.0.1 | Status": "AssumeBroken" // broke in SMAPI 2.6-beta.16 due to reflection into SMAPI internals }, + "Stardew Hack": { + "ID": "bcmpinc.StardewHack", + "~0.6 | Status": "AssumeBroken" // breaks newer versions of bcmpinc mods (per bcmpinc's request) + }, + "Stardew Notification": { "ID": "stardewnotification", "Default | UpdateKey": "GitHub:monopandora/StardewNotification" @@ -430,6 +455,11 @@ "~1.0.2 | Status": "AssumeBroken" // broke in SDV 1.3 (runtime errors) }, + "Tilled Soil Decay": { + "ID": "bcmpinc.TilledSoilDecay", + "~0.6 | Status": "AssumeBroken" // breaks newer versions of bcmpinc mods (per bcmpinc's request) + }, + "Time Reminder": { "ID": "KoihimeNakamura.TimeReminder", "MapLocalVersions": { "1.0-20170314": "1.0.2" } @@ -440,11 +470,21 @@ "Default | UpdateKey": "GitHub:mralbobo/stardew-tool-charging" }, + "Tree Spread": { + "ID": "bcmpinc.TreeSpread", + "~0.6 | Status": "AssumeBroken" // breaks newer versions of bcmpinc mods (per bcmpinc's request) + }, + "Variable Grass": { "ID": "dantheman999.VariableGrass", "Default | UpdateKey": "GitHub:dantheman999301/StardewMods" }, + "Yet Another Harvest With Scythe Mod": { + "ID": "bcmpinc.HarvestWithScythe", + "~0.6 | Status": "AssumeBroken" // breaks newer versions of bcmpinc mods (per bcmpinc's request) + }, + "Zoom Out Extreme": { "ID": "RockinMods.ZoomMod", "FormerIDs": "ZoomMod", // changed circa 1.2.1 -- cgit From e3a0bd7e29e0e05bb574786268c30ff82dcc433d Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 9 Jan 2019 22:52:40 -0500 Subject: deprecate entry DLL with case-insensitive match --- docs/release-notes.md | 1 + src/SMAPI/Framework/ModLoading/ModResolver.cs | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 64f6368d..93e80266 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -17,6 +17,7 @@ * Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. * Fixed `e.Cursor` in input events showing wrong grab tile when player using a controller moves without moving the viewpoint. * Fixed incorrect 'bypassed safety checks' warning for mods using the new `Specialised.LoadStageChanged` event in 2.10. + * Deprecated `EntryDll` values whose capitalisation don't match the actual file. (This works on Windows, but causes errors for Linux/Mac players.) ## 2.10.1 Released 30 December 2018 for Stardew Valley 1.3.32. diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index 835b0a54..a8564524 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -137,12 +137,23 @@ namespace StardewModdingAPI.Framework.ModLoading } // invalid path - string assemblyPath = Path.Combine(mod.DirectoryPath, mod.Manifest.EntryDll); - if (!File.Exists(assemblyPath)) + if (!File.Exists(Path.Combine(mod.DirectoryPath, mod.Manifest.EntryDll))) { mod.SetStatus(ModMetadataStatus.Failed, $"its DLL '{mod.Manifest.EntryDll}' doesn't exist."); continue; } + + // invalid capitalisation + string actualFilename = new DirectoryInfo(mod.DirectoryPath).GetFiles(mod.Manifest.EntryDll).FirstOrDefault()?.Name; + if (actualFilename != mod.Manifest.EntryDll) + { +#if SMAPI_3_0_STRICT + mod.SetStatus(ModMetadataStatus.Failed, $"its {nameof(IManifest.EntryDll)} value '{mod.Manifest.EntryDll}' doesn't match the actual file capitalisation '{actualFilename}'. The capitalisation must match for crossplatform compatibility."); + continue; +#else + SCore.DeprecationManager.Warn(mod.DisplayName, $"{nameof(IManifest.EntryDll)} value with case-insensitive capitalisation", "2.11", DeprecationLevel.Info); +#endif + } } // validate content pack -- cgit From adac125312cc0c66a11e91b9814b104f006d8316 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 9 Jan 2019 22:54:44 -0500 Subject: update mod build package release notes in readme --- docs/mod-build-config.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md index 0c1cc10a..a97c3171 100644 --- a/docs/mod-build-config.md +++ b/docs/mod-build-config.md @@ -132,8 +132,6 @@ If you don't want to include a file in the mod folder or release zip: relative path in your mod folder, that file won't be included. ### Non-mod projects -**(upcoming in 2.1)** - You can use the package in non-mod projects too (e.g. unit tests or framework DLLs). You'll need to disable deploying the mod and creating a release zip: @@ -218,10 +216,18 @@ That error means the package couldn't find your game. You can specify the game p _[Game path](#game-path)_ above. ## Release notes -### 2.1 alpha +### 2.2 +* Added support for SMAPI 2.8+ (still compatible with earlier versions). +* Added default game paths for 32-bit Windows. +* Fixed valid manifests marked invalid in some cases. + +### 2.1 * Added support for Stardew Valley 1.3. -* Added support for unit test projects. +* Added support for non-mod projects. * Added C# analyzers to warn about implicit conversions of Netcode fields in Stardew Valley 1.3. +* Added option to ignore files by regex pattern. +* Added reference to new SMAPI DLL. +* Fixed some game paths not detected by NuGet package. ### 2.0.2 * Fixed compatibility issue on Linux. -- cgit From 3c3aac382a2f4bb79b8c5aaa87def9a2574b6361 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 13 Jan 2019 21:05:39 -0500 Subject: fix broken ModDrop links --- docs/release-notes.md | 3 +++ src/SMAPI.Web/ViewModels/ModModel.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 93e80266..0081d8cf 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -11,6 +11,9 @@ * Fixed 'unknown mod' deprecation warnings when they occur in the Mod constructor. * Updated compatibility list. +* For the web UI: + * Fixed broken ModDrop links in the compatibility list. + * For modders: * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. diff --git a/src/SMAPI.Web/ViewModels/ModModel.cs b/src/SMAPI.Web/ViewModels/ModModel.cs index f1a52f98..ae81acf5 100644 --- a/src/SMAPI.Web/ViewModels/ModModel.cs +++ b/src/SMAPI.Web/ViewModels/ModModel.cs @@ -107,7 +107,7 @@ namespace StardewModdingAPI.Web.ViewModels if (entry.ModDropID.HasValue) { anyFound = true; - yield return new ModLinkModel($"https://www.moddrop.com/sdv/mod/467243/{entry.ModDropID}", "ModDrop"); + yield return new ModLinkModel($"https://www.moddrop.com/sdv/mod/{entry.ModDropID}", "ModDrop"); } // fallback -- cgit From 782dc6f3060ce37e080e279e6c5e68b28b2b1e79 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 18 Jan 2019 20:26:08 -0500 Subject: correct readme --- docs/technical-docs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/technical-docs.md b/docs/technical-docs.md index 1d69f868..98dd3540 100644 --- a/docs/technical-docs.md +++ b/docs/technical-docs.md @@ -70,8 +70,8 @@ on the wiki for the first-time setup. ## Customisation ### Configuration file -You can customise the SMAPI behaviour by editing the `StardewModdingAPI.config.json` file in your -game folder. +You can customise the SMAPI behaviour by editing the `smapi-internal/StardewModdingAPI.config.json` +file in your game folder. Basic fields: -- cgit From 59bc63cab6cd7fa80a4f46734fdaafde80e5b351 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 20 Jan 2019 01:01:26 -0500 Subject: propagate asset changes into the save file being loaded --- docs/release-notes.md | 4 ++-- src/SMAPI/Metadata/CoreAssetPropagator.cs | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 0081d8cf..1698b1fd 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,6 +1,5 @@ # Release notes -## Upcoming - +## Upcoming release * For players: * Added mod page link to 'missing dependency' errors for the most common dependencies. * Improved save backups: @@ -15,6 +14,7 @@ * Fixed broken ModDrop links in the compatibility list. * For modders: + * Asset changes are now propagated into the parsed save being loaded if applicable. * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. * Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index d83fc748..92968271 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -677,7 +677,13 @@ namespace StardewModdingAPI.Metadata /// Get all locations in the game. private IEnumerable GetLocations() { - foreach (GameLocation location in Game1.locations) + // get available root locations + IEnumerable rootLocations = Game1.locations; + if (SaveGame.loaded?.locations != null) + rootLocations = rootLocations.Concat(SaveGame.loaded.locations); + + // yield root + child locations + foreach (GameLocation location in rootLocations) { yield return location; -- cgit From 8133d75bba1bb9ea28e3cf8c55a653e254da95e8 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 23 Jan 2019 14:11:38 -0500 Subject: tweak XNB mod message for clarity --- docs/release-notes.md | 1 + src/SMAPI.Web/Startup.cs | 3 ++- src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 1698b1fd..6abfd17f 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -8,6 +8,7 @@ * Restrict to Stardew Valley 1.3.33 or earlier (to avoid confusion when SDV 1.3.35 is released). * Fixed 'unknown mod' deprecation warnings showing a stack trace when developers mode not enabled. * Fixed 'unknown mod' deprecation warnings when they occur in the Mod constructor. + * Tweaked XNB mod message for clarity. * Updated compatibility list. * For the web UI: diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs index 91553513..a2e47482 100644 --- a/src/SMAPI.Web/Startup.cs +++ b/src/SMAPI.Web/Startup.cs @@ -161,12 +161,13 @@ namespace StardewModdingAPI.Web )); // shortcut redirects + redirects.Add(new RedirectToUrlRule(@"^/3\.0\.?$", "https://stardewvalleywiki.com/Modding:Migrate_to_SMAPI_3.0")); redirects.Add(new RedirectToUrlRule(@"^/buildmsg(?:/?(.*))$", "https://github.com/Pathoschild/SMAPI/blob/develop/docs/mod-build-config.md#$1")); redirects.Add(new RedirectToUrlRule(@"^/compat\.?$", "https://mods.smapi.io")); - redirects.Add(new RedirectToUrlRule(@"^/3\.0\.?$", "https://stardewvalleywiki.com/Modding:Migrate_to_SMAPI_3.0")); redirects.Add(new RedirectToUrlRule(@"^/docs\.?$", "https://stardewvalleywiki.com/Modding:Index")); redirects.Add(new RedirectToUrlRule(@"^/install\.?$", "https://stardewvalleywiki.com/Modding:Player_Guide/Getting_Started#Install_SMAPI")); redirects.Add(new RedirectToUrlRule(@"^/troubleshoot(.*)$", "https://stardewvalleywiki.com/Modding:Player_Guide/Troubleshooting$1")); + redirects.Add(new RedirectToUrlRule(@"^/xnb\.?$", "https://stardewvalleywiki.com/Modding:Using_XNB_mods")); // redirect legacy canimod.com URLs var wikiRedirects = new Dictionary diff --git a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs index 7624894c..0ab73d56 100644 --- a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs +++ b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs @@ -67,7 +67,7 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning if (!files.Any()) return new ModFolder(root, searchFolder, null, "it's an empty folder."); if (files.All(file => this.PotentialXnbModExtensions.Contains(file.Extension))) - return new ModFolder(root, searchFolder, null, "it's an older XNB mod which replaces game files (not run through SMAPI)."); + return new ModFolder(root, searchFolder, null, "it's not a SMAPI mod (see https://smapi.io/xnb for info)."); return new ModFolder(root, searchFolder, null, "it contains files, but none of them are manifest.json."); } -- cgit From 1556a04a5470d520970bdf0c19f786d02e51bc7f Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 25 Jan 2019 15:12:14 -0500 Subject: add beta status filter to compatibility list --- docs/release-notes.md | 1 + src/SMAPI.Web/Views/Mods/Index.cshtml | 9 +- src/SMAPI.Web/wwwroot/Content/js/mods.js | 163 ++++++++++++++----------------- 3 files changed, 77 insertions(+), 96 deletions(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 6abfd17f..e64271bc 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -12,6 +12,7 @@ * Updated compatibility list. * For the web UI: + * Added beta status filter to compatibility list. * Fixed broken ModDrop links in the compatibility list. * For modders: diff --git a/src/SMAPI.Web/Views/Mods/Index.cshtml b/src/SMAPI.Web/Views/Mods/Index.cshtml index 92637f01..a30a0048 100644 --- a/src/SMAPI.Web/Views/Mods/Index.cshtml +++ b/src/SMAPI.Web/Views/Mods/Index.cshtml @@ -4,15 +4,16 @@ ViewData["Title"] = "SMAPI mod compatibility"; } @section Head { - + - + } @@ -39,7 +40,7 @@
- {{key}}: + {{filterGroup.label}}:
diff --git a/src/SMAPI.Web/wwwroot/Content/js/mods.js b/src/SMAPI.Web/wwwroot/Content/js/mods.js index b0352d36..05114b00 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/mods.js +++ b/src/SMAPI.Web/wwwroot/Content/js/mods.js @@ -2,7 +2,7 @@ var smapi = smapi || {}; var app; -smapi.modList = function (mods) { +smapi.modList = function (mods, enableBeta) { // init data var defaultStats = { total: 0, @@ -23,101 +23,73 @@ smapi.modList = function (mods) { visibleStats: $.extend({}, defaultStats), filters: { source: { - open: { - label: "open", - id: "show-open-source", - value: true - }, - closed: { - label: "closed", - id: "show-closed-source", - value: true + value: { + open: { value: true }, + closed: { value: true } } }, status: { - ok: { - label: "ok", - id: "show-status-ok", - value: true - }, - optional: { - label: "optional", - id: "show-status-optional", - value: true - }, - unofficial: { - label: "unofficial", - id: "show-status-unofficial", - value: true - }, - workaround: { - label: "workaround", - id: "show-status-workaround", - value: true - }, - broken: { - label: "broken", - id: "show-status-broken", - value: true - }, - abandoned: { - label: "abandoned", - id: "show-status-abandoned", - value: true - }, - obsolete: { - label: "obsolete", - id: "show-status-obsolete", - value: true + label: enableBeta ? "main status" : "status", + value: { + // note: keys must match status returned by the API + ok: { value: true }, + optional: { value: true }, + unofficial: { value: true }, + workaround: { value: true }, + broken: { value: true }, + abandoned: { value: true }, + obsolete: { value: true } } }, + betaStatus: { + label: "beta status", + value: {} // cloned from status field if needed + }, download: { - chucklefish: { - label: "Chucklefish", - id: "show-chucklefish", - value: true - }, - moddrop: { - label: "ModDrop", - id: "show-moddrop", - value: true - }, - nexus: { - label: "Nexus", - id: "show-nexus", - value: true - }, - custom: { - label: "custom", - id: "show-custom", - value: true + value: { + chucklefish: { value: true, label: "Chucklefish" }, + moddrop: { value: true, label: "ModDrop" }, + nexus: { value: true, label: "Nexus" }, + custom: { value: true } } }, - "SMAPI 3.0": { - ok: { - label: "ready", - id: "show-smapi-3-ready", - value: true - }, - soon: { - label: "soon", - id: "show-smapi-3-soon", - value: true - }, - broken: { - label: "broken", - id: "show-smapi-3-broken", - value: true - }, - unknown: { - label: "unknown", - id: "show-smapi-3-unknown", - value: true + smapi3: { + label: "SMAPI 3.0", + value: { + // note: keys must match status returned by the API + ok: { value: true, label: "ready" }, + soon: { value: true }, + broken: { value: true }, + unknown: { value: true } } } }, search: "" }; + + // init filters + Object.entries(data.filters).forEach(([groupKey, filterGroup]) => { + filterGroup.label = filterGroup.label || groupKey; + Object.entries(filterGroup.value).forEach(([filterKey, filter]) => { + filter.id = ("filter_" + groupKey + "_" + filterKey).replace(/[^a-zA-Z0-9]/g, "_"); + filter.label = filter.label || filterKey; + }); + }); + + // init beta filters + if (enableBeta) { + var filterGroup = data.filters.betaStatus; + $.extend(true, filterGroup.value, data.filters.status.value); + Object.entries(filterGroup.value).forEach(([filterKey, filter]) => { + filter.id = "beta_" + filter.id; + }); + } + else + delete data.filters.betaStatus; + + window.boop = data.filters; + + // init mods for (var i = 0; i < data.mods.length; i++) { var mod = mods[i]; @@ -214,30 +186,37 @@ smapi.modList = function (mods) { var filters = data.filters; // check source - if (!filters.source.open.value && mod.SourceUrl) + if (!filters.source.value.open.value && mod.SourceUrl) return false; - if (!filters.source.closed.value && !mod.SourceUrl) + if (!filters.source.value.closed.value && !mod.SourceUrl) return false; // check status - var status = mod.LatestCompatibility.Status; - if (filters.status[status] && !filters.status[status].value) + var mainStatus = mod.Compatibility.Status; + if (filters.status.value[mainStatus] && !filters.status.value[mainStatus].value) return false; + // check beta status + if (enableBeta) { + var betaStatus = mod.LatestCompatibility.Status; + if (filters.betaStatus.value[betaStatus] && !filters.betaStatus.value[betaStatus].value) + return false; + } + // check SMAPI 3.0 compatibility - if (filters["SMAPI 3.0"][mod.Smapi3Status] && !filters["SMAPI 3.0"][mod.Smapi3Status].value) + if (filters.smapi3.value[mod.Smapi3Status] && !filters.smapi3.value[mod.Smapi3Status].value) return false; // check download sites var ignoreSites = []; - if (!filters.download.chucklefish.value) + if (!filters.download.value.chucklefish.value) ignoreSites.push("Chucklefish"); - if (!filters.download.moddrop.value) + if (!filters.download.value.moddrop.value) ignoreSites.push("ModDrop"); - if (!filters.download.nexus.value) + if (!filters.download.value.nexus.value) ignoreSites.push("Nexus"); - if (!filters.download.custom.value) + if (!filters.download.value.custom.value) ignoreSites.push("custom"); if (ignoreSites.length) { -- cgit From 6b6ccb87de4d669f66e0c1a5b9270607db16484c Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 6 Feb 2019 20:47:57 -0500 Subject: fix error with custom map tilesheets in some cases Specifically, when a custom map has a seasonal tilesheet which only exists the Content/Maps folder and already matches the current season. --- docs/release-notes.md | 1 + src/SMAPI/Framework/ModHelpers/ContentHelper.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index e64271bc..7b6ef89b 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -17,6 +17,7 @@ * For modders: * Asset changes are now propagated into the parsed save being loaded if applicable. + * Fixed error loading custom map tilesheets in some cases. * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. * Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. diff --git a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs index dac627ba..7c353003 100644 --- a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs @@ -319,7 +319,7 @@ namespace StardewModdingAPI.Framework.ModHelpers foreach (string candidateKey in new[] { imageSource, $@"Maps\{imageSource}" }) { string contentKey = candidateKey.EndsWith(".png") - ? candidateKey.Substring(0, imageSource.Length - 4) + ? candidateKey.Substring(0, candidateKey.Length - 4) : candidateKey; try -- cgit From f540d2ab29e06e7f94af927da5f56e03da20f849 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 6 Feb 2019 22:46:18 -0500 Subject: add locale to context trace logs --- docs/release-notes.md | 1 + src/SMAPI/Framework/SGame.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 7b6ef89b..e6ad4c63 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -17,6 +17,7 @@ * For modders: * Asset changes are now propagated into the parsed save being loaded if applicable. + * Added locale to context trace logs. * Fixed error loading custom map tilesheets in some cases. * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index a90e8264..9818314a 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -513,7 +513,7 @@ namespace StardewModdingAPI.Framework else if (Context.IsWorldReady && Context.LoadStage != LoadStage.Ready) { // print context - string context = $"Context: loaded saved game '{Constants.SaveFolderName}', starting {Game1.currentSeason} {Game1.dayOfMonth} Y{Game1.year}."; + string context = $"Context: loaded save '{Constants.SaveFolderName}', starting {Game1.currentSeason} {Game1.dayOfMonth} Y{Game1.year}, locale set to {this.ContentCore.Language}."; if (Context.IsMultiplayer) { int onlineCount = Game1.getOnlineFarmers().Count(); -- cgit From 215574f2b9bb18f98bd9ce208c58e741384aada6 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 8 Feb 2019 18:19:28 -0500 Subject: fix error when swapping maps mid-session for a location with interior doors --- docs/release-notes.md | 1 + src/SMAPI/Metadata/CoreAssetPropagator.cs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/release-notes.md b/docs/release-notes.md index e6ad4c63..e0bf3935 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -19,6 +19,7 @@ * Asset changes are now propagated into the parsed save being loaded if applicable. * Added locale to context trace logs. * Fixed error loading custom map tilesheets in some cases. + * Fixed error when swapping maps mid-session for a location with interior doors. * Fixed `Constants.SaveFolderName` and `CurrentSavePath` not available during early load stages when using `Specialised.LoadStageChanged` event. * Fixed `LoadStage.SaveParsed` raised before the parsed save data is available. * Fixed 'unknown mod' deprecation warnings showing the wrong stack trace. diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 53d930f5..a64dc89b 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Microsoft.Xna.Framework; +using System.Reflection; using Microsoft.Xna.Framework.Graphics; using StardewModdingAPI.Framework.Reflection; using StardewValley; @@ -99,8 +99,21 @@ namespace StardewModdingAPI.Metadata { if (!string.IsNullOrWhiteSpace(location.mapPath.Value) && this.GetNormalisedPath(location.mapPath.Value) == key) { + // reload map data this.Reflection.GetMethod(location, "reloadMap").Invoke(); this.Reflection.GetMethod(location, "updateWarps").Invoke(); + + // reload doors + { + Type interiorDoorDictType = Type.GetType($"StardewValley.InteriorDoorDictionary, {Constants.GameAssemblyName}", throwOnError: true); + ConstructorInfo constructor = interiorDoorDictType.GetConstructor(new[] { typeof(GameLocation) }); + if (constructor == null) + throw new InvalidOperationException("Can't reset location doors: constructor not found for InteriorDoorDictionary type."); + object instance = constructor.Invoke(new object[] { location }); + + this.Reflection.GetField(location, "interiorDoors").SetValue(instance); + } + anyChanged = true; } } -- cgit From 41f77f51c0203fa36c1e47cf67409244ed3c2ff2 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 8 Feb 2019 18:19:47 -0500 Subject: prepare for 2.10.2 release --- build/GlobalAssemblyInfo.cs | 4 ++-- docs/release-notes.md | 17 +++++++++-------- src/SMAPI.Mods.ConsoleCommands/manifest.json | 4 ++-- src/SMAPI.Mods.SaveBackup/manifest.json | 4 ++-- src/SMAPI/Constants.cs | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) (limited to 'docs') diff --git a/build/GlobalAssemblyInfo.cs b/build/GlobalAssemblyInfo.cs index da80f48b..3faed842 100644 --- a/build/GlobalAssemblyInfo.cs +++ b/build/GlobalAssemblyInfo.cs @@ -1,5 +1,5 @@ using System.Reflection; [assembly: AssemblyProduct("SMAPI")] -[assembly: AssemblyVersion("2.10.1")] -[assembly: AssemblyFileVersion("2.10.1")] +[assembly: AssemblyVersion("2.10.2")] +[assembly: AssemblyFileVersion("2.10.2")] diff --git a/docs/release-notes.md b/docs/release-notes.md index e0bf3935..4527b12d 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,13 +1,14 @@ # Release notes -## Upcoming release +## 2.10.2 +Released 08 January 2019 for Stardew Valley 1.3.32–33. + * For players: - * Added mod page link to 'missing dependency' errors for the most common dependencies. - * Improved save backups: - * When compression isn't available on Linux, SMAPI now falls back to uncompressed backups. - * SMAPI now keeps the first backup created for the day, instead of the last one. - * Restrict to Stardew Valley 1.3.33 or earlier (to avoid confusion when SDV 1.3.35 is released). + * SMAPI now keeps the first save backup created for the day, instead of the last one. + * Fixed save backup for some Linux/Mac players. (When compression isn't available, SMAPI will now create uncompressed backups instead.) + * Fixed some common dependencies not linking to the mod page in 'missing mod' errors. * Fixed 'unknown mod' deprecation warnings showing a stack trace when developers mode not enabled. * Fixed 'unknown mod' deprecation warnings when they occur in the Mod constructor. + * Fixed confusing error message when using SMAPI 2.10._x_ with Stardew Valley 1.3.35+. * Tweaked XNB mod message for clarity. * Updated compatibility list. @@ -28,13 +29,13 @@ * Deprecated `EntryDll` values whose capitalisation don't match the actual file. (This works on Windows, but causes errors for Linux/Mac players.) ## 2.10.1 -Released 30 December 2018 for Stardew Valley 1.3.32. +Released 30 December 2018 for Stardew Valley 1.3.32–33. * For players: * Fixed some mod integrations not working correctly in SMAPI 2.10. ## 2.10 -Released 29 December 2018 for Stardew Valley 1.3.32. +Released 29 December 2018 for Stardew Valley 1.3.32–33. * For players: * Added `world_clear` console command to remove spawned or placed entities. diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json index 0341c390..b5fd0424 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": "2.10.1", + "Version": "2.10.2", "Description": "Adds SMAPI console commands that let you manipulate the game.", "UniqueID": "SMAPI.ConsoleCommands", "EntryDll": "ConsoleCommands.dll", - "MinimumApiVersion": "2.10.1" + "MinimumApiVersion": "2.10.2" } diff --git a/src/SMAPI.Mods.SaveBackup/manifest.json b/src/SMAPI.Mods.SaveBackup/manifest.json index b2b9ad4b..7ac537ca 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": "2.10.1", + "Version": "2.10.2", "Description": "Automatically backs up all your saves once per day into its folder.", "UniqueID": "SMAPI.SaveBackup", "EntryDll": "SaveBackup.dll", - "MinimumApiVersion": "2.10.1" + "MinimumApiVersion": "2.10.2" } diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index f8d1638e..51c15269 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -20,7 +20,7 @@ namespace StardewModdingAPI ** Public ****/ /// SMAPI's current semantic version. - public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("2.10.1"); + public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("2.10.2"); /// The minimum supported version of Stardew Valley. public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.3.32"); -- cgit