[+] Splash+ support

pull/75/head
Clansty 2024-10-24 01:15:55 +08:00
parent 1b47bfa2f1
commit e844164cf6
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
8 changed files with 114 additions and 95 deletions

View File

@ -48,14 +48,6 @@ public class BasicFix
return false; return false;
} }
[HarmonyPrefix]
[HarmonyPatch(typeof(GameManager), "CalcSpecialNum")]
private static bool CalcSpecialNum(ref int __result)
{
__result = 1024;
return false;
}
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(NetHttpClient), MethodType.Constructor)] [HarmonyPatch(typeof(NetHttpClient), MethodType.Constructor)]
private static void OnNetHttpClientConstructor(NetHttpClient __instance) private static void OnNetHttpClientConstructor(NetHttpClient __instance)
@ -75,4 +67,21 @@ public class BasicFix
// Unset the certificate validation callback (SSL pinning) to restore the default behavior // Unset the certificate validation callback (SSL pinning) to restore the default behavior
ServicePointManager.ServerCertificateValidationCallback = null; ServicePointManager.ServerCertificateValidationCallback = null;
} }
public static void DoCustomPatch(HarmonyLib.Harmony h)
{
if (typeof(GameManager).GetMethod("CalcSpecialNum") is null) return;
h.PatchAll(typeof(CalcSpecialNumPatch));
}
private class CalcSpecialNumPatch
{
[HarmonyPrefix]
[HarmonyPatch(typeof(GameManager), "CalcSpecialNum")]
private static bool CalcSpecialNum(ref int __result)
{
__result = 1024;
return false;
}
}
} }

View File

@ -0,0 +1,21 @@
using System.Reflection;
using MAI2System;
namespace AquaMai.Helpers;
public class GameInfo
{
public static uint GameVersion { get; } = GetGameVersion();
private static uint GetGameVersion()
{
return (uint)typeof(ConstParameter).GetField("NowGameVersion", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null);
}
public static string GameId { get; } = GetGameId();
private static string GetGameId()
{
return typeof(ConstParameter).GetField("GameIDStr", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null) as string;
}
}

View File

@ -155,11 +155,14 @@ namespace AquaMai
Patch(typeof(FixCharaCrash)); Patch(typeof(FixCharaCrash));
Patch(typeof(BasicFix)); Patch(typeof(BasicFix));
Patch(typeof(DisableReboot)); Patch(typeof(DisableReboot));
if (GameInfo.GameVersion >= 23000)
Patch(typeof(ExtendNotesPool)); Patch(typeof(ExtendNotesPool));
Patch(typeof(FixCheckAuth)); Patch(typeof(FixCheckAuth));
Patch(typeof(DebugFeature)); Patch(typeof(DebugFeature));
if (GameInfo.GameVersion >= 23000)
Patch(typeof(FixConnSlide)); Patch(typeof(FixConnSlide));
Patch(typeof(SlideAutoPlayTweak)); Patch(typeof(SlideAutoPlayTweak));
if (GameInfo.GameVersion >= 24000)
Patch(typeof(FixLevelDisplay)); Patch(typeof(FixLevelDisplay));
// UX // UX
Patch(typeof(CustomVersionString)); Patch(typeof(CustomVersionString));

View File

@ -70,7 +70,6 @@ namespace AquaMai.Resources {
/// <summary> /// <summary>
/// Looks up a localized string similar to Errors detected while loading! /// Looks up a localized string similar to Errors detected while loading!
///- Check if you have installed the wrong version of AquaMai, such as using SDEZ version on SDGA
///- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified ///- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified
///- Check for conflicting mods, or enabled incompatible options. ///- Check for conflicting mods, or enabled incompatible options.
/// </summary> /// </summary>

View File

@ -59,7 +59,6 @@
</data> </data>
<data name="LoadError" xml:space="preserve"> <data name="LoadError" xml:space="preserve">
<value>Errors detected while loading! <value>Errors detected while loading!
- Check if you have installed the wrong version of AquaMai, such as using SDEZ version on SDGA
- Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified - Are you using a modified Assembly-CSharp.dll, which will cause inconsistent functions and cannot find the functions that need to be modified
- Check for conflicting mods, or enabled incompatible options</value> - Check for conflicting mods, or enabled incompatible options</value>
</data> </data>

View File

@ -52,7 +52,6 @@
</data> </data>
<data name="LoadError" xml:space="preserve"> <data name="LoadError" xml:space="preserve">
<value>加载过程中检测到错误! <value>加载过程中检测到错误!
- 请检查你是否安装了错误的 AquaMai 版本,比如在 SDGA 上使用了 SDEZ 的版本
- 你是否正在使用魔改的 Assembly-CSharp.dll这会导致函数不一致而无法找到需要修改的函数 - 你是否正在使用魔改的 Assembly-CSharp.dll这会导致函数不一致而无法找到需要修改的函数
- 请检查是否有冲突的 Mod或者开启了不兼容的选项</value> - 请检查是否有冲突的 Mod或者开启了不兼容的选项</value>
</data> </data>

View File

@ -10,10 +10,10 @@ using Monitor;
using Process; using Process;
using UnityEngine; using UnityEngine;
namespace AquaMai.UX namespace AquaMai.UX;
public class QuickSkip
{ {
public class QuickSkip
{
private static int _keyPressFrames; private static int _keyPressFrames;
[HarmonyPrefix] [HarmonyPrefix]
@ -79,13 +79,21 @@ namespace AquaMai.UX
traverse.Method("SetRelease").GetValue(); traverse.Method("SetRelease").GetValue();
} }
if (Input.GetKey(KeyCode.Alpha7) || InputManager.GetSystemInputPush(InputManager.SystemButtonSetting.ButtonService)) if (Input.GetKey(KeyCode.Alpha7) || InputManager.GetSystemInputPush(InputManager.SystemButtonSetting.ButtonService) && GameInfo.GameVersion >= 23000)
{ {
// This is original typo in Assembly-CSharp // This is original typo in Assembly-CSharp
Singleton<GamePlayManager>.Instance.SetQuickRetryFrag(flag: true); Singleton<GamePlayManager>.Instance.SetQuickRetryFrag(flag: true);
} }
} }
public static void DoCustomPatch(HarmonyLib.Harmony h)
{
if (GameInfo.GameVersion < 23000) return;
h.PatchAll(typeof(FestivalAndLaterQuickRetryPatch));
}
private class FestivalAndLaterQuickRetryPatch
{
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(QuickRetry), "IsQuickRetryEnable")] [HarmonyPatch(typeof(QuickRetry), "IsQuickRetryEnable")]
public static bool OnQuickRetryIsQuickRetryEnable(ref bool __result) public static bool OnQuickRetryIsQuickRetryEnable(ref bool __result)

View File

@ -1,19 +0,0 @@
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using MAI2System;
namespace AquaMai.Utils;
public class GameInfo
{
public static uint GetGameVersion()
{
return (uint) typeof(ConstParameter).GetField("NowGameVersion", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null);
}
public static string GetGameId()
{
return typeof(ConstParameter).GetField("GameIDStr", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null) as string;
}
}