add 'strict mode' release with deprecated APIs stripped out
This commit is contained in:
parent
42ff20cd92
commit
9a15da5a17
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
## Upcoming release
|
## Upcoming release
|
||||||
* For players:
|
* For players:
|
||||||
|
* You can now download SMAPI 'strict mode' from the [Nexus optional files](https://www.nexusmods.com/stardewvalley/mods/2400/). This removes all deprecated APIs, which may significantly improve performance. However mods which still show deprecation warnings won't work.
|
||||||
* The SMAPI installer now also detects game folders listed in Steam's `.vdf` library data on Windows (thanks to pizzaoverhead!).
|
* The SMAPI installer now also detects game folders listed in Steam's `.vdf` library data on Windows (thanks to pizzaoverhead!).
|
||||||
* SMAPI now prevents mods from enabling Harmony debug mode, which impacts performance and creates a file on your desktop.
|
* SMAPI now prevents mods from enabling Harmony debug mode, which impacts performance and creates a file on your desktop.
|
||||||
_You can allow debug mode by editing `smapi-internal/config.json` in your game folder._
|
_You can allow debug mode by editing `smapi-internal/config.json` in your game folder._
|
||||||
|
|
|
@ -199,8 +199,15 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
|
||||||
log.ApiVersion = match.Groups["apiVersion"].Value;
|
log.ApiVersion = match.Groups["apiVersion"].Value;
|
||||||
log.GameVersion = match.Groups["gameVersion"].Value;
|
log.GameVersion = match.Groups["gameVersion"].Value;
|
||||||
log.OperatingSystem = match.Groups["os"].Value;
|
log.OperatingSystem = match.Groups["os"].Value;
|
||||||
smapiMod.OverrideVersion(log.ApiVersion);
|
|
||||||
|
|
||||||
|
const string strictModeSuffix = " (strict mode)";
|
||||||
|
if (log.ApiVersion.EndsWith(strictModeSuffix))
|
||||||
|
{
|
||||||
|
log.IsStrictMode = true;
|
||||||
|
log.ApiVersion = log.ApiVersion[..^strictModeSuffix.Length];
|
||||||
|
}
|
||||||
|
|
||||||
|
smapiMod.OverrideVersion(log.ApiVersion);
|
||||||
log.ApiVersionParsed = smapiMod.GetParsedVersion();
|
log.ApiVersionParsed = smapiMod.GetParsedVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,9 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models
|
||||||
/****
|
/****
|
||||||
** Log data
|
** Log data
|
||||||
****/
|
****/
|
||||||
|
/// <summary>Whether SMAPI is running in strict mode, which disables all deprecated APIs.</summary>
|
||||||
|
public bool IsStrictMode { get; set; }
|
||||||
|
|
||||||
/// <summary>The SMAPI version.</summary>
|
/// <summary>The SMAPI version.</summary>
|
||||||
public string? ApiVersion { get; set; }
|
public string? ApiVersion { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
}
|
}
|
||||||
<link rel="stylesheet" href="~/Content/css/file-upload.css" />
|
<link rel="stylesheet" href="~/Content/css/file-upload.css" />
|
||||||
<link rel="stylesheet" href="~/Content/css/log-parser.css" />
|
<link rel="stylesheet" href="~/Content/css/log-parser.css?r=20221009" />
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tabbyjs@12.0.3/dist/css/tabby-ui-vertical.min.css" />
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tabbyjs@12.0.3/dist/css/tabby-ui-vertical.min.css" />
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/tabbyjs@12.0.3" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/tabbyjs@12.0.3" crossorigin="anonymous"></script>
|
||||||
|
@ -243,7 +243,7 @@ else if (log?.IsValid == true)
|
||||||
@if (log?.IsValid == true)
|
@if (log?.IsValid == true)
|
||||||
{
|
{
|
||||||
<div id="output">
|
<div id="output">
|
||||||
@if (outdatedMods.Any() || errorHandler is null || hasOlderErrorHandler || isPyTkCompatibilityMode)
|
@if (outdatedMods.Any() || errorHandler is null || hasOlderErrorHandler || isPyTkCompatibilityMode || log.IsStrictMode)
|
||||||
{
|
{
|
||||||
<h2>Suggested fixes</h2>
|
<h2>Suggested fixes</h2>
|
||||||
<ul id="fix-list">
|
<ul id="fix-list">
|
||||||
|
@ -256,9 +256,16 @@ else if (log?.IsValid == true)
|
||||||
<li>Your <strong>Error Handler</strong> mod is older than SMAPI. You may be missing some game/mod error fixes. You can <a href="https://stardewvalleywiki.com/Modding:Player_Guide#Install_SMAPI">reinstall SMAPI</a> to update it.</li>
|
<li>Your <strong>Error Handler</strong> mod is older than SMAPI. You may be missing some game/mod error fixes. You can <a href="https://stardewvalleywiki.com/Modding:Player_Guide#Install_SMAPI">reinstall SMAPI</a> to update it.</li>
|
||||||
}
|
}
|
||||||
@if (isPyTkCompatibilityMode)
|
@if (isPyTkCompatibilityMode)
|
||||||
|
{
|
||||||
|
if (log.IsStrictMode)
|
||||||
|
{
|
||||||
|
<li>PyTK's image scaling isn't compatible with SMAPI strict mode.</li>
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
<li>PyTK 1.23.* or earlier isn't compatible with newer SMAPI performance optimizations. This may increase loading times or in-game lag.</li>
|
<li>PyTK 1.23.* or earlier isn't compatible with newer SMAPI performance optimizations. This may increase loading times or in-game lag.</li>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@if (outdatedMods.Any())
|
@if (outdatedMods.Any())
|
||||||
{
|
{
|
||||||
<li>
|
<li>
|
||||||
|
@ -307,6 +314,10 @@ else if (log?.IsValid == true)
|
||||||
</table>
|
</table>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
@if (log.IsStrictMode)
|
||||||
|
{
|
||||||
|
<li class="notice">SMAPI is running in 'strict mode', which removes all deprecated APIs. This can significantly improve performance, but some mods may not work. You can <a href="https://stardewvalleywiki.com/Modding:Player_Guide#Install_SMAPI">reinstall SMAPI</a> to disable it if you run into problems.</li>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +340,13 @@ else if (log?.IsValid == true)
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>SMAPI:</th>
|
<th>SMAPI:</th>
|
||||||
<td v-pre>@log.ApiVersion</td>
|
<td v-pre>
|
||||||
|
@log.ApiVersion
|
||||||
|
@if (log.IsStrictMode)
|
||||||
|
{
|
||||||
|
<strong>(strict mode)</strong>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Folder:</th>
|
<th>Folder:</th>
|
||||||
|
|
|
@ -73,6 +73,11 @@ table caption {
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#fix-list li.notice {
|
||||||
|
background: #EEFFEE;
|
||||||
|
border-color: #080;
|
||||||
|
}
|
||||||
|
|
||||||
#fix-list li.important {
|
#fix-list li.important {
|
||||||
background: #FCC;
|
background: #FCC;
|
||||||
border-color: #800;
|
border-color: #800;
|
||||||
|
|
|
@ -269,7 +269,11 @@ namespace StardewModdingAPI.Framework.Logging
|
||||||
public void LogIntro(string modsPath, IDictionary<string, object?> customSettings)
|
public void LogIntro(string modsPath, IDictionary<string, object?> customSettings)
|
||||||
{
|
{
|
||||||
// log platform
|
// log platform
|
||||||
this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} (build {Constants.GetBuildVersionLabel()}) on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info);
|
this.Monitor.Log($"SMAPI {Constants.ApiVersion} "
|
||||||
|
#if !SMAPI_DEPRECATED
|
||||||
|
+ "(strict mode) "
|
||||||
|
#endif
|
||||||
|
+ $"with Stardew Valley {Constants.GameVersion} (build {Constants.GetBuildVersionLabel()}) on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info);
|
||||||
|
|
||||||
// log basic info
|
// log basic info
|
||||||
this.Monitor.Log($"Mods go here: {modsPath}", LogLevel.Info);
|
this.Monitor.Log($"Mods go here: {modsPath}", LogLevel.Info);
|
||||||
|
@ -280,6 +284,10 @@ namespace StardewModdingAPI.Framework.Logging
|
||||||
// log custom settings
|
// log custom settings
|
||||||
if (customSettings.Any())
|
if (customSettings.Any())
|
||||||
this.Monitor.Log($"Loaded with custom settings: {string.Join(", ", customSettings.OrderBy(p => p.Key).Select(p => $"{p.Key}: {p.Value}"))}");
|
this.Monitor.Log($"Loaded with custom settings: {string.Join(", ", customSettings.OrderBy(p => p.Key).Select(p => $"{p.Key}: {p.Value}"))}");
|
||||||
|
|
||||||
|
#if !SMAPI_DEPRECATED
|
||||||
|
this.Monitor.Log("SMAPI is running in 'strict mode', which removes all deprecated APIs. This can significantly improve performance, but some mods may not work. You can reinstall SMAPI to disable it if you run into problems.", LogLevel.Info);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Log details for settings that don't match the default.</summary>
|
/// <summary>Log details for settings that don't match the default.</summary>
|
||||||
|
|
|
@ -1681,15 +1681,18 @@ namespace StardewModdingAPI.Framework
|
||||||
// initialize translations
|
// initialize translations
|
||||||
this.ReloadTranslations(loaded);
|
this.ReloadTranslations(loaded);
|
||||||
|
|
||||||
#if SMAPI_DEPRECATED
|
|
||||||
// set temporary PyTK compatibility mode
|
// set temporary PyTK compatibility mode
|
||||||
// This is part of a three-part fix for PyTK 1.23.* and earlier. When removing this,
|
// This is part of a three-part fix for PyTK 1.23.* and earlier. When removing this,
|
||||||
// search 'Platonymous.Toolkit' to find the other part in SMAPI and Content Patcher.
|
// search 'Platonymous.Toolkit' to find the other part in SMAPI and Content Patcher.
|
||||||
{
|
{
|
||||||
IModInfo? pyTk = this.ModRegistry.Get("Platonymous.Toolkit");
|
IModInfo? pyTk = this.ModRegistry.Get("Platonymous.Toolkit");
|
||||||
ModContentManager.EnablePyTkLegacyMode = pyTk is not null && pyTk.Manifest.Version.IsOlderThan("1.24.0");
|
if (pyTk is not null && pyTk.Manifest.Version.IsOlderThan("1.24.0"))
|
||||||
}
|
#if SMAPI_DEPRECATED
|
||||||
|
ModContentManager.EnablePyTkLegacyMode = true;
|
||||||
|
#else
|
||||||
|
this.Monitor.Log("PyTK's image scaling is not compatible with SMAPI strict mode.", LogLevel.Warn);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// initialize loaded non-content-pack mods
|
// initialize loaded non-content-pack mods
|
||||||
this.Monitor.Log("Launching mods...", LogLevel.Debug);
|
this.Monitor.Log("Launching mods...", LogLevel.Debug);
|
||||||
|
|
Loading…
Reference in New Issue