summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-04-15 21:17:19 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-04-15 21:17:19 -0400
commitf961a376ee5347d5ac2b830ce82b28f116889e72 (patch)
treef1f7d3506c5704cd2c253a5b948fb883f5b76b48
parentbca1e63c3e66011aef8cb9736e091ced05aa4992 (diff)
downloadSMAPI-f961a376ee5347d5ac2b830ce82b28f116889e72.tar.gz
SMAPI-f961a376ee5347d5ac2b830ce82b28f116889e72.tar.bz2
SMAPI-f961a376ee5347d5ac2b830ce82b28f116889e72.zip
log Stardew64Installer patch version if applicable (#767)
-rw-r--r--src/SMAPI/Framework/Logging/LogManager.cs37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/SMAPI/Framework/Logging/LogManager.cs b/src/SMAPI/Framework/Logging/LogManager.cs
index 0cc2da9f..804acfb3 100644
--- a/src/SMAPI/Framework/Logging/LogManager.cs
+++ b/src/SMAPI/Framework/Logging/LogManager.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
+using System.Reflection;
using System.Text.RegularExpressions;
using System.Threading;
using StardewModdingAPI.Framework.Commands;
@@ -11,6 +12,7 @@ using StardewModdingAPI.Framework.ModLoading;
using StardewModdingAPI.Internal.ConsoleWriting;
using StardewModdingAPI.Toolkit.Framework.ModData;
using StardewModdingAPI.Toolkit.Utilities;
+using StardewValley;
namespace StardewModdingAPI.Framework.Logging
{
@@ -283,16 +285,16 @@ namespace StardewModdingAPI.Framework.Logging
/// <param name="customSettings">The custom SMAPI settings.</param>
public void LogIntro(string modsPath, IDictionary<string, object> customSettings)
{
- // get platform label
- string platformLabel = EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform);
- if ((Constants.GameFramework == GameFramework.Xna) != (Constants.Platform == Platform.Windows))
- platformLabel += $" with {Constants.GameFramework}";
-#if SMAPI_FOR_WINDOWS_64BIT_HACK
- platformLabel += " 64-bit hack";
-#endif
+ // log platform & patches
+ {
+ this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)}", LogLevel.Info);
- // init logging
- this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {platformLabel}", LogLevel.Info);
+ string[] patchLabels = this.GetPatchLabels().ToArray();
+ if (patchLabels.Any())
+ this.Monitor.Log($"Detected custom version: {string.Join(", ", patchLabels)}", LogLevel.Info);
+ }
+
+ // log basic info
this.Monitor.Log($"Mods go here: {modsPath}", LogLevel.Info);
if (modsPath != Constants.DefaultModsPath)
this.Monitor.Log("(Using custom --mods-path argument.)");
@@ -409,6 +411,23 @@ namespace StardewModdingAPI.Framework.Logging
gameMonitor.Log(message, level);
}
+ /// <summary>Get human-readable labels to log for detected SMAPI and Stardew Valley customizations.</summary>
+ private IEnumerable<string> GetPatchLabels()
+ {
+ // custom game framework
+ if (EarlyConstants.IsWindows64BitHack)
+ yield return $"running 64-bit SMAPI with {Constants.GameFramework}";
+ else if ((Constants.GameFramework == GameFramework.Xna) != (Constants.Platform == Platform.Windows))
+ yield return $"running {Constants.GameFramework}";
+
+ // patched by Stardew64Installer
+ {
+ PropertyInfo patcherProperty = typeof(Game1).GetProperty("Stardew64InstallerVersion");
+ if (patcherProperty != null)
+ yield return $"patched by Stardew64Installer {patcherProperty.GetValue(null)}";
+ }
+ }
+
/// <summary>Write a summary of mod warnings to the console and log.</summary>
/// <param name="mods">The loaded mods.</param>
/// <param name="skippedMods">The mods which could not be loaded.</param>