From dcd2c4c5938f5314b73b862be1ce5c401ce6d464 Mon Sep 17 00:00:00 2001 From: WYH2004-MC <32890512+WYH2004-MC@users.noreply.github.com> Date: Fri, 4 Oct 2024 12:50:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Patch=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BuildInfo.cs | 4 ++-- Main.cs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/BuildInfo.cs b/BuildInfo.cs index 410c390..d916f03 100644 --- a/BuildInfo.cs +++ b/BuildInfo.cs @@ -1,6 +1,6 @@ namespace SinmaiAssist { public static partial class BuildInfo { - public const string CommitHash = "067448f"; - public const string BuildDate = "2024-10-04T03:01:50.9338622+08:00"; + public const string CommitHash = "6fba1e6"; + public const string BuildDate = "2024-10-04T12:49:39.1283596+08:00"; } } diff --git a/Main.cs b/Main.cs index 185c47e..76b199f 100644 --- a/Main.cs +++ b/Main.cs @@ -26,6 +26,7 @@ public static partial class BuildInfo public class SinmaiAssist : MelonMod { private MainGUI _mainGUI; + private static bool isPatchFailed = false; public static ConfigManager config; public static bool IsSDGB = false; public static string gameID = "Unknown"; @@ -174,6 +175,7 @@ public override void OnInitializeMelon() Patch(typeof(InputManager)); Patch(typeof(GameMessageManager)); + if(isPatchFailed) PatchFailedWarn(); MelonLogger.Msg("Loading completed"); } @@ -206,6 +208,7 @@ private static bool Patch(Type type) MelonLogger.Error(e.TargetSite); MelonLogger.Error(e.InnerException); MelonLogger.Error(e.StackTrace); + isPatchFailed = true; return false; } } @@ -224,5 +227,16 @@ private static void PrintLogo() $"\r\n Author: {BuildInfo.Author}"); MelonLogger.Warning("This is a cheat mod. Use at your own risk!"); } + + private static void PatchFailedWarn() + { + MelonLogger.Warning("\r\n=================================================================" + + "\r\nFailed to patch some methods." + + "\r\nPlease ensure that you are using an unmodified version of Assembly-CSharp.dll with a version greater than 1.40.0," + + "\r\nas modifications or lower versions can cause function mismatches, preventing the required functions from being found." + + "\r\nCheck for conflicting mods, or enabled incompatible options." + + "\r\nIf you believe this is an error, please report the issue to the mod author." + + "\r\n================================================================="); + } } } \ No newline at end of file