add update alerts for Stardew64Installer (#767)
This commit is contained in:
parent
13a3c8fbdd
commit
665c6806d3
|
@ -11,7 +11,7 @@
|
||||||
* For players:
|
* For players:
|
||||||
* When many mods fail to load, root dependencies are now listed in their own group so it's easier to see which ones you should try updating first.
|
* When many mods fail to load, root dependencies are now listed in their own group so it's easier to see which ones you should try updating first.
|
||||||
* On macOS, the `StardewModdingAPI.bin.osx` file is no longer overwritten if it's identical to avoid resetting file permissions (thanks to 007wayne!).
|
* On macOS, the `StardewModdingAPI.bin.osx` file is no longer overwritten if it's identical to avoid resetting file permissions (thanks to 007wayne!).
|
||||||
* Added SMAPI version and bitness to the console title before startup to simplify troubleshooting.
|
* Added update checks for Stardew64Installer if it patched the game.
|
||||||
* Fixed error for non-English players after returning to title, reloading, and entering town with a completed movie theater.
|
* Fixed error for non-English players after returning to title, reloading, and entering town with a completed movie theater.
|
||||||
* Fixed `world_clear` console command not removing resource clumps outside the farm and secret woods.
|
* Fixed `world_clear` console command not removing resource clumps outside the farm and secret woods.
|
||||||
* Fixed inconsistent spelling/style for 'macOS'.
|
* Fixed inconsistent spelling/style for 'macOS'.
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
* For modders:
|
* For modders:
|
||||||
* Added asset propagation for `Data\Concessions`.
|
* Added asset propagation for `Data\Concessions`.
|
||||||
|
* Added SMAPI version and bitness to the console title before startup to simplify troubleshooting.
|
||||||
* Improved error-handling during asset propagation.
|
* Improved error-handling during asset propagation.
|
||||||
* Fixed `Context.IsMainPlayer` returning true for a farmhand in split-screen mode before the screen is initialized.
|
* Fixed `Context.IsMainPlayer` returning true for a farmhand in split-screen mode before the screen is initialized.
|
||||||
* Fixed error when editing bundle data while a split-screen player is joining.
|
* Fixed error when editing bundle data while a split-screen player is joining.
|
||||||
|
|
|
@ -300,6 +300,21 @@ namespace StardewModdingAPI
|
||||||
return new PlatformAssemblyMap(targetPlatform, removeAssemblyReferences.ToArray(), targetAssemblies.ToArray());
|
return new PlatformAssemblyMap(targetPlatform, removeAssemblyReferences.ToArray(), targetAssemblies.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Get whether the game assembly was patched by Stardew64Installer.</summary>
|
||||||
|
/// <param name="version">The version of Stardew64Installer which was applied to the game assembly, if any.</param>
|
||||||
|
internal static bool IsPatchedByStardew64Installer(out ISemanticVersion version)
|
||||||
|
{
|
||||||
|
PropertyInfo property = typeof(Game1).GetProperty("Stardew64InstallerVersion");
|
||||||
|
if (property == null)
|
||||||
|
{
|
||||||
|
version = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
version = new SemanticVersion((string)property.GetValue(null));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********
|
/*********
|
||||||
** Private methods
|
** Private methods
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using StardewModdingAPI.Framework.Commands;
|
using StardewModdingAPI.Framework.Commands;
|
||||||
|
@ -12,7 +11,6 @@ using StardewModdingAPI.Framework.ModLoading;
|
||||||
using StardewModdingAPI.Internal.ConsoleWriting;
|
using StardewModdingAPI.Internal.ConsoleWriting;
|
||||||
using StardewModdingAPI.Toolkit.Framework.ModData;
|
using StardewModdingAPI.Toolkit.Framework.ModData;
|
||||||
using StardewModdingAPI.Toolkit.Utilities;
|
using StardewModdingAPI.Toolkit.Utilities;
|
||||||
using StardewValley;
|
|
||||||
|
|
||||||
namespace StardewModdingAPI.Framework.Logging
|
namespace StardewModdingAPI.Framework.Logging
|
||||||
{
|
{
|
||||||
|
@ -421,11 +419,8 @@ namespace StardewModdingAPI.Framework.Logging
|
||||||
yield return $"running {Constants.GameFramework}";
|
yield return $"running {Constants.GameFramework}";
|
||||||
|
|
||||||
// patched by Stardew64Installer
|
// patched by Stardew64Installer
|
||||||
{
|
if (Constants.IsPatchedByStardew64Installer(out ISemanticVersion patchedByVersion))
|
||||||
PropertyInfo patcherProperty = typeof(Game1).GetProperty("Stardew64InstallerVersion");
|
yield return $"patched by Stardew64Installer {patchedByVersion}";
|
||||||
if (patcherProperty != null)
|
|
||||||
yield return $"patched by Stardew64Installer {patcherProperty.GetValue(null)}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Write a summary of mod warnings to the console and log.</summary>
|
/// <summary>Write a summary of mod warnings to the console and log.</summary>
|
||||||
|
|
|
@ -52,6 +52,9 @@ namespace StardewModdingAPI.Framework.Models
|
||||||
/// <summary>SMAPI's GitHub project name, used to perform update checks.</summary>
|
/// <summary>SMAPI's GitHub project name, used to perform update checks.</summary>
|
||||||
public string GitHubProjectName { get; set; }
|
public string GitHubProjectName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>Stardew64Installer's GitHub project name, used to perform update checks.</summary>
|
||||||
|
public string Stardew64InstallerGitHubProjectName { get; set; }
|
||||||
|
|
||||||
/// <summary>The base URL for SMAPI's web API, used to perform update checks.</summary>
|
/// <summary>The base URL for SMAPI's web API, used to perform update checks.</summary>
|
||||||
public string WebApiBaseUrl { get; set; }
|
public string WebApiBaseUrl { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -1302,6 +1302,41 @@ namespace StardewModdingAPI.Framework
|
||||||
this.LogManager.WriteUpdateMarker(updateFound.ToString(), updateUrl);
|
this.LogManager.WriteUpdateMarker(updateFound.ToString(), updateUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check Stardew64Installer version
|
||||||
|
if (Constants.IsPatchedByStardew64Installer(out ISemanticVersion patchedByVersion))
|
||||||
|
{
|
||||||
|
ISemanticVersion updateFound = null;
|
||||||
|
string updateUrl = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// fetch update check
|
||||||
|
ModEntryModel response = client.GetModInfo(new[] { new ModSearchEntryModel("Steviegt6.Stardew64Installer", patchedByVersion, new[] { $"GitHub:{this.Settings.Stardew64InstallerGitHubProjectName}" }) }, apiVersion: Constants.ApiVersion, gameVersion: Constants.GameVersion, platform: Constants.Platform).Single().Value;
|
||||||
|
updateFound = response.SuggestedUpdate?.Version;
|
||||||
|
updateUrl = response.SuggestedUpdate?.Url ?? Constants.HomePageUrl;
|
||||||
|
|
||||||
|
// log message
|
||||||
|
if (updateFound != null)
|
||||||
|
this.Monitor.Log($"You can update Stardew64Installer to {updateFound}: {updateUrl}", LogLevel.Alert);
|
||||||
|
else
|
||||||
|
this.Monitor.Log(" Stardew64Installer okay.");
|
||||||
|
|
||||||
|
// show errors
|
||||||
|
if (response.Errors.Any())
|
||||||
|
{
|
||||||
|
this.Monitor.Log("Couldn't check for a new version of Stardew64Installer. This won't affect your game, but you may not be notified of new versions if this keeps happening.", LogLevel.Warn);
|
||||||
|
this.Monitor.Log($"Error: {string.Join("\n", response.Errors)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
this.Monitor.Log("Couldn't check for a new version of Stardew64Installer. This won't affect your game, but you won't be notified of new versions if this keeps happening.", LogLevel.Warn);
|
||||||
|
this.Monitor.Log(ex is WebException && ex.InnerException == null
|
||||||
|
? $"Error: {ex.Message}"
|
||||||
|
: $"Error: {ex.GetLogSummary()}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check mod versions
|
// check mod versions
|
||||||
if (mods.Any())
|
if (mods.Any())
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,11 @@ copy all the settings, or you may cause bugs due to overridden changes in future
|
||||||
*/
|
*/
|
||||||
"GitHubProjectName": "Pathoschild/SMAPI",
|
"GitHubProjectName": "Pathoschild/SMAPI",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stardew64Installer's GitHub project name, used to perform update checks.
|
||||||
|
*/
|
||||||
|
"Stardew64InstallerGitHubProjectName": "Steviegt6/Stardew64Installer",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base URL for SMAPI's web API, used to perform update checks.
|
* The base URL for SMAPI's web API, used to perform update checks.
|
||||||
* Note: the protocol will be changed to http:// on Linux/macOS due to OpenSSL issues with the
|
* Note: the protocol will be changed to http:// on Linux/macOS due to OpenSSL issues with the
|
||||||
|
|
Loading…
Reference in New Issue