mirror of https://github.com/hykilpikonna/AquaDX
[+] Mark supported game versions with attributes
Build AquaMai / build (push) Has been cancelled
Details
Build AquaMai / build (push) Has been cancelled
Details
parent
6bb2685e03
commit
ff2ed50dea
|
@ -49,7 +49,7 @@ jobs:
|
|||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: AquaMai
|
||||
path: AquaMai\Output\AquaMai.dll
|
||||
path: AquaMai\Output\Upload
|
||||
|
||||
- name: Send to Telegram
|
||||
if: github.event_name != 'pull_request'
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
|
||||
namespace AquaMai.Attributes;
|
||||
|
||||
public class GameVersionAttribute(uint minVersion = 0, uint maxVersion = 0) : Attribute
|
||||
{
|
||||
public uint MinVersion { get; } = minVersion;
|
||||
public uint MaxVersion { get; } = maxVersion;
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
using HarmonyLib;
|
||||
using AquaMai.Attributes;
|
||||
using HarmonyLib;
|
||||
using MAI2System;
|
||||
using Manager;
|
||||
|
||||
namespace AquaMai.Cheat
|
||||
{
|
||||
[GameVersion(24000)]
|
||||
public class UnlockUtage
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using AquaMai.Attributes;
|
||||
using HarmonyLib;
|
||||
using MAI2.Util;
|
||||
using Manager;
|
||||
|
@ -9,6 +10,7 @@ using UnityEngine;
|
|||
|
||||
namespace AquaMai.Fix;
|
||||
|
||||
[GameVersion(23000)]
|
||||
public class ExtendNotesPool
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using AquaMai.Attributes;
|
||||
using HarmonyLib;
|
||||
using Manager;
|
||||
using MelonLoader;
|
||||
|
@ -7,6 +8,7 @@ using Monitor;
|
|||
|
||||
namespace AquaMai.Fix;
|
||||
|
||||
[GameVersion(23000)]
|
||||
public class FixConnSlide
|
||||
{
|
||||
/* 这个 Patch 用于修复以下 bug:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using HarmonyLib;
|
||||
using AquaMai.Attributes;
|
||||
using HarmonyLib;
|
||||
using MAI2.Util;
|
||||
using Manager;
|
||||
using Monitor;
|
||||
|
@ -7,6 +8,7 @@ using UnityEngine;
|
|||
|
||||
namespace AquaMai.Fix;
|
||||
|
||||
[GameVersion(24000)]
|
||||
public class FixLevelDisplay
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using AquaMai.Attributes;
|
||||
using AquaMai.Fix;
|
||||
using AquaMai.Helpers;
|
||||
using AquaMai.Resources;
|
||||
|
@ -29,15 +30,33 @@ namespace AquaMai
|
|||
public static Config AppConfig { get; private set; }
|
||||
private static bool _hasErrors;
|
||||
|
||||
private void Patch(Type type)
|
||||
private void Patch(Type type, bool isNested = false)
|
||||
{
|
||||
var versionAttr = type.GetCustomAttribute<GameVersionAttribute>();
|
||||
var compatible = true;
|
||||
if (versionAttr != null)
|
||||
{
|
||||
if (versionAttr.MinVersion > 0 && versionAttr.MinVersion > GameInfo.GameVersion) compatible = false;
|
||||
if (versionAttr.MaxVersion > 0 && versionAttr.MaxVersion < GameInfo.GameVersion) compatible = false;
|
||||
}
|
||||
|
||||
if (!compatible)
|
||||
{
|
||||
if (!isNested)
|
||||
{
|
||||
MelonLogger.Warning($"> Skipping incompatible patch: {type}");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MelonLogger.Msg($"> Patching {type}");
|
||||
try
|
||||
{
|
||||
HarmonyInstance.PatchAll(type);
|
||||
foreach (var nested in type.GetNestedTypes())
|
||||
{
|
||||
Patch(nested);
|
||||
Patch(nested, true);
|
||||
}
|
||||
|
||||
var customMethod = type.GetMethod("DoCustomPatch", BindingFlags.Public | BindingFlags.Static);
|
||||
|
@ -143,14 +162,11 @@ namespace AquaMai
|
|||
Patch(typeof(FixCharaCrash));
|
||||
Patch(typeof(BasicFix));
|
||||
Patch(typeof(DisableReboot));
|
||||
if (GameInfo.GameVersion >= 23000)
|
||||
Patch(typeof(ExtendNotesPool));
|
||||
Patch(typeof(FixCheckAuth));
|
||||
Patch(typeof(DebugFeature));
|
||||
if (GameInfo.GameVersion >= 23000)
|
||||
Patch(typeof(FixConnSlide));
|
||||
Patch(typeof(FixSlideAutoPlay)); // Rename: SlideAutoPlayTweak -> FixSlideAutoPlay, 不过这个应该无副作用所以不需要改配置文件
|
||||
if (GameInfo.GameVersion >= 24000)
|
||||
Patch(typeof(FixLevelDisplay));
|
||||
// UX
|
||||
Patch(typeof(CustomVersionString));
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using AquaMai.Attributes;
|
||||
using AquaMai.Helpers;
|
||||
using HarmonyLib;
|
||||
using Mai2.Mai2Cue;
|
||||
|
@ -86,13 +87,8 @@ public class QuickSkip
|
|||
}
|
||||
}
|
||||
|
||||
public static void DoCustomPatch(HarmonyLib.Harmony h)
|
||||
{
|
||||
if (GameInfo.GameVersion < 23000) return;
|
||||
h.PatchAll(typeof(FestivalAndLaterQuickRetryPatch));
|
||||
}
|
||||
|
||||
private class FestivalAndLaterQuickRetryPatch
|
||||
[GameVersion(23000)]
|
||||
public class FestivalAndLaterQuickRetryPatch
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuickRetry), "IsQuickRetryEnable")]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AquaMai.Attributes;
|
||||
using AquaMai.Helpers;
|
||||
using AquaMai.Resources;
|
||||
using HarmonyLib;
|
||||
|
@ -13,6 +14,7 @@ using UnityEngine;
|
|||
|
||||
namespace AquaMai.Utils;
|
||||
|
||||
[GameVersion(23500)]
|
||||
public class SelectionDetail
|
||||
{
|
||||
private static readonly Window[] window = new Window[2];
|
||||
|
|
Loading…
Reference in New Issue