Skip to content

Commit

Permalink
添加 Patch失败提示
Browse files Browse the repository at this point in the history
  • Loading branch information
WYH2004-MC committed Oct 4, 2024
1 parent 6fba1e6 commit dcd2c4c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions BuildInfo.cs
Original file line number Diff line number Diff line change
@@ -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";
}
}
14 changes: 14 additions & 0 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -174,6 +175,7 @@ public override void OnInitializeMelon()
Patch(typeof(InputManager));
Patch(typeof(GameMessageManager));

if(isPatchFailed) PatchFailedWarn();
MelonLogger.Msg("Loading completed");
}

Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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=================================================================");
}
}
}

0 comments on commit dcd2c4c

Please sign in to comment.