From e557f1361dedd88672a7b5169f743e08d38d4d47 Mon Sep 17 00:00:00 2001 From: Clansty Date: Tue, 17 Sep 2024 02:58:37 +0800 Subject: [PATCH] [+] Error notice --- AquaMai/Main.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/AquaMai/Main.cs b/AquaMai/Main.cs index 7bdcbc2f..891bb55e 100644 --- a/AquaMai/Main.cs +++ b/AquaMai/Main.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.InteropServices; using AquaMai.Fix; using AquaMai.Helpers; using AquaMai.UX; @@ -20,6 +21,7 @@ public static class BuildInfo public class AquaMai : MelonMod { public static Config AppConfig { get; private set; } + private static bool _hasErrors; private void Patch(Type type) { @@ -35,6 +37,7 @@ private void Patch(Type type) catch (Exception e) { MelonLogger.Error($"Failed to patch {type}: {e}"); + _hasErrors = true; } } @@ -73,8 +76,14 @@ private void ApplyPatches() } } + [DllImport("kernel32.dll", SetLastError = true)] + private static extern bool SetConsoleOutputCP(uint wCodePageID); + public override void OnInitializeMelon() { + // Prevent Chinese characters from being garbled + SetConsoleOutputCP(65001); + MelonLogger.Msg("Loading mod settings..."); // Check if AquaMai.toml exists @@ -112,6 +121,21 @@ public override void OnInitializeMelon() // Apply patches based on the settings ApplyPatches(); + if (_hasErrors) + { + MelonLogger.Warning("!!!!!=================================================================!!!!!"); + MelonLogger.Warning("加载过程中检测到错误!"); + MelonLogger.Warning("- 请检查你是否安装了错误的 AquaMai 版本,比如在 SDGA 上使用了 SDEZ 的版本"); + MelonLogger.Warning("- 你是否正在使用魔改的 Assembly-CSharp.dll,这会导致函数不一致而无法找到需要修改的函数"); + MelonLogger.Warning("- 请检查是否有冲突的 Mod,或者开启了不兼容的选项"); + MelonLogger.Warning("!!!!!=================================================================!!!!!"); + MelonLogger.Warning("Errors detected while loading!"); + MelonLogger.Warning("- Check if you have installed the wrong version of AquaMai, such as using SDEZ version on SDGA"); + MelonLogger.Warning("- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified"); + MelonLogger.Warning("- Check for conflicting mods, or enabled incompatible options"); + MelonLogger.Warning("!!!!!=================================================================!!!!!"); + } + MelonLogger.Msg("Loaded!"); } }