diff options
-rw-r--r-- | docs/release-notes.md | 1 | ||||
-rw-r--r-- | docs/technical/smapi.md | 13 | ||||
-rw-r--r-- | src/SMAPI/Constants.cs | 3 | ||||
-rw-r--r-- | src/SMAPI/Framework/SCore.cs | 3 | ||||
-rw-r--r-- | src/SMAPI/SMAPI.config.json | 6 |
5 files changed, 15 insertions, 11 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md index fdae4dc5..dc26db2d 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -6,6 +6,7 @@ * For players: * SMAPI now prevents mods from crashing the game with invalid schedule data. * SMAPI now prevents load crashes due to invalid building types. + * Added support for persistent `smapi-internal/config.json` overrides (see info in the file). * Updated minimum game version (1.4 → 1.4.1). * Fixed 'collection was modified' error when returning to title in rare cases. * Fixed update-check error if a mod's Chucklefish page has no version. diff --git a/docs/technical/smapi.md b/docs/technical/smapi.md index d565aeb4..c9d5c07e 100644 --- a/docs/technical/smapi.md +++ b/docs/technical/smapi.md @@ -19,17 +19,8 @@ This document is about SMAPI itself; see also [mod build package](mod-package.md ## Customisation ### Configuration file -You can customise the SMAPI behaviour by editing the `smapi-internal/config.json` file in your game -folder. - -Basic fields: - -field | purpose ------------------ | ------- -`DeveloperMode` | Default `false` (except in _SMAPI for developers_ releases). Whether to enable features intended for mod developers (mainly more detailed console logging). -`CheckForUpdates` | Default `true`. Whether SMAPI should check for a newer version when you load the game. If a new version is available, a small message will appear in the console. This doesn't affect the load time even if your connection is offline or slow, because it happens in the background. -`VerboseLogging` | Default `false`. Whether SMAPI should log more information about the game context. -`ModData` | Internal metadata about SMAPI mods. Changing this isn't recommended and may destabilise your game. See documentation in the file. +You can customise some SMAPI behaviour by editing the `smapi-internal/config.json` file in your +game folder. See documentation in the file for more info. ### Command-line arguments The SMAPI installer recognises three command-line arguments: diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index da2ee375..d2af5de2 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -61,6 +61,9 @@ namespace StardewModdingAPI /// <summary>The file path for the SMAPI configuration file.</summary> internal static string ApiConfigPath => Path.Combine(Constants.InternalFilesPath, "config.json"); + /// <summary>The file path for the overrides file for <see cref="ApiConfigPath"/>, which is applied over it.</summary> + internal static string ApiUserConfigPath => Path.Combine(Constants.InternalFilesPath, "config.user.json"); + /// <summary>The file path for the SMAPI metadata file.</summary> internal static string ApiMetadataPath => Path.Combine(Constants.InternalFilesPath, "metadata.json"); diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index d71b5e5a..81b7c2e8 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -153,6 +153,9 @@ namespace StardewModdingAPI.Framework // init basics this.Settings = JsonConvert.DeserializeObject<SConfig>(File.ReadAllText(Constants.ApiConfigPath)); + if (File.Exists(Constants.ApiUserConfigPath)) + JsonConvert.PopulateObject(File.ReadAllText(Constants.ApiUserConfigPath), this.Settings); + this.LogFile = new LogFileManager(logPath); this.Monitor = new Monitor("SMAPI", this.ConsoleManager, this.LogFile, this.Settings.ConsoleColors, this.Settings.VerboseLogging) { diff --git a/src/SMAPI/SMAPI.config.json b/src/SMAPI/SMAPI.config.json index 824bb783..57b4f885 100644 --- a/src/SMAPI/SMAPI.config.json +++ b/src/SMAPI/SMAPI.config.json @@ -6,6 +6,12 @@ This file contains advanced configuration for SMAPI. You generally shouldn't cha The default values are mirrored in StardewModdingAPI.Framework.Models.SConfig to log custom changes. +This file is overwritten each time you update or reinstall SMAPI. To avoid losing custom settings, +create a 'config.user.json' file in the same folder with *only* the settings you want to change. +That file won't be overwritten, and any settings in it will override the default options. Don't +copy all the settings, or you may cause bugs due to overridden changes in future SMAPI versions. + + */ { |