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
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: AquaMai
|
name: AquaMai
|
||||||
path: AquaMai\Output\AquaMai.dll
|
path: AquaMai\Output\Upload
|
||||||
|
|
||||||
- name: Send to Telegram
|
- name: Send to Telegram
|
||||||
if: github.event_name != 'pull_request'
|
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 MAI2System;
|
||||||
using Manager;
|
using Manager;
|
||||||
|
|
||||||
namespace AquaMai.Cheat
|
namespace AquaMai.Cheat
|
||||||
{
|
{
|
||||||
|
[GameVersion(24000)]
|
||||||
public class UnlockUtage
|
public class UnlockUtage
|
||||||
{
|
{
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
|
@ -15,4 +17,4 @@ namespace AquaMai.Cheat
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using AquaMai.Attributes;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using MAI2.Util;
|
using MAI2.Util;
|
||||||
using Manager;
|
using Manager;
|
||||||
|
@ -9,6 +10,7 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace AquaMai.Fix;
|
namespace AquaMai.Fix;
|
||||||
|
|
||||||
|
[GameVersion(23000)]
|
||||||
public class ExtendNotesPool
|
public class ExtendNotesPool
|
||||||
{
|
{
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using AquaMai.Attributes;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Manager;
|
using Manager;
|
||||||
using MelonLoader;
|
using MelonLoader;
|
||||||
|
@ -7,12 +8,13 @@ using Monitor;
|
||||||
|
|
||||||
namespace AquaMai.Fix;
|
namespace AquaMai.Fix;
|
||||||
|
|
||||||
|
[GameVersion(23000)]
|
||||||
public class FixConnSlide
|
public class FixConnSlide
|
||||||
{
|
{
|
||||||
/* 这个 Patch 用于修复以下 bug:
|
/* 这个 Patch 用于修复以下 bug:
|
||||||
* 非 ConnSlide 被错误解析为 ConnSlide (Fes 首日刹那旅程爆机 bug)
|
* 非 ConnSlide 被错误解析为 ConnSlide (Fes 首日刹那旅程爆机 bug)
|
||||||
* 原 method 逻辑如下:
|
* 原 method 逻辑如下:
|
||||||
*
|
*
|
||||||
* if (this.IsSlideAll(noteData1.type) && (index1 + 1 < this._note._noteData.Count ? 1 : 0) != 0)
|
* if (this.IsSlideAll(noteData1.type) && (index1 + 1 < this._note._noteData.Count ? 1 : 0) != 0)
|
||||||
* {
|
* {
|
||||||
* int targetNote = noteData1.slideData.targetNote;
|
* int targetNote = noteData1.slideData.targetNote;
|
||||||
|
@ -31,7 +33,7 @@ public class FixConnSlide
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* 修复 bug 需要把第二次调用 this.IsSlideAll() 更改为 this.IsConnectNote(), 这里使用 Transpiler 解决
|
* 修复 bug 需要把第二次调用 this.IsSlideAll() 更改为 this.IsConnectNote(), 这里使用 Transpiler 解决
|
||||||
*/
|
*/
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
|
@ -42,7 +44,7 @@ public class FixConnSlide
|
||||||
bool found = false;
|
bool found = false;
|
||||||
MethodInfo methodIsSlideAll = AccessTools.Method(typeof(NotesReader), "IsSlideAll");
|
MethodInfo methodIsSlideAll = AccessTools.Method(typeof(NotesReader), "IsSlideAll");
|
||||||
MethodInfo methodIsConnectNote = AccessTools.Method(typeof(NotesReader), "IsConnectNote");
|
MethodInfo methodIsConnectNote = AccessTools.Method(typeof(NotesReader), "IsConnectNote");
|
||||||
|
|
||||||
for (int i = 0; i < instList.Count; i++)
|
for (int i = 0; i < instList.Count; i++)
|
||||||
{
|
{
|
||||||
CodeInstruction inst = instList[i];
|
CodeInstruction inst = instList[i];
|
||||||
|
@ -61,4 +63,4 @@ public class FixConnSlide
|
||||||
}
|
}
|
||||||
return instList;
|
return instList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using HarmonyLib;
|
using AquaMai.Attributes;
|
||||||
|
using HarmonyLib;
|
||||||
using MAI2.Util;
|
using MAI2.Util;
|
||||||
using Manager;
|
using Manager;
|
||||||
using Monitor;
|
using Monitor;
|
||||||
|
@ -7,6 +8,7 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace AquaMai.Fix;
|
namespace AquaMai.Fix;
|
||||||
|
|
||||||
|
[GameVersion(24000)]
|
||||||
public class FixLevelDisplay
|
public class FixLevelDisplay
|
||||||
{
|
{
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using AquaMai.Attributes;
|
||||||
using AquaMai.Fix;
|
using AquaMai.Fix;
|
||||||
using AquaMai.Helpers;
|
using AquaMai.Helpers;
|
||||||
using AquaMai.Resources;
|
using AquaMai.Resources;
|
||||||
|
@ -29,15 +30,33 @@ namespace AquaMai
|
||||||
public static Config AppConfig { get; private set; }
|
public static Config AppConfig { get; private set; }
|
||||||
private static bool _hasErrors;
|
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}");
|
MelonLogger.Msg($"> Patching {type}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HarmonyInstance.PatchAll(type);
|
HarmonyInstance.PatchAll(type);
|
||||||
foreach (var nested in type.GetNestedTypes())
|
foreach (var nested in type.GetNestedTypes())
|
||||||
{
|
{
|
||||||
Patch(nested);
|
Patch(nested, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var customMethod = type.GetMethod("DoCustomPatch", BindingFlags.Public | BindingFlags.Static);
|
var customMethod = type.GetMethod("DoCustomPatch", BindingFlags.Public | BindingFlags.Static);
|
||||||
|
@ -143,15 +162,12 @@ 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(FixSlideAutoPlay)); // Rename: SlideAutoPlayTweak -> FixSlideAutoPlay, 不过这个应该无副作用所以不需要改配置文件
|
Patch(typeof(FixSlideAutoPlay)); // Rename: SlideAutoPlayTweak -> FixSlideAutoPlay, 不过这个应该无副作用所以不需要改配置文件
|
||||||
if (GameInfo.GameVersion >= 24000)
|
Patch(typeof(FixLevelDisplay));
|
||||||
Patch(typeof(FixLevelDisplay));
|
|
||||||
// UX
|
// UX
|
||||||
Patch(typeof(CustomVersionString));
|
Patch(typeof(CustomVersionString));
|
||||||
Patch(typeof(CustomPlaceName));
|
Patch(typeof(CustomPlaceName));
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using AquaMai.Attributes;
|
||||||
using AquaMai.Helpers;
|
using AquaMai.Helpers;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using Mai2.Mai2Cue;
|
using Mai2.Mai2Cue;
|
||||||
|
@ -86,13 +87,8 @@ public class QuickSkip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DoCustomPatch(HarmonyLib.Harmony h)
|
[GameVersion(23000)]
|
||||||
{
|
public class FestivalAndLaterQuickRetryPatch
|
||||||
if (GameInfo.GameVersion < 23000) return;
|
|
||||||
h.PatchAll(typeof(FestivalAndLaterQuickRetryPatch));
|
|
||||||
}
|
|
||||||
|
|
||||||
private class FestivalAndLaterQuickRetryPatch
|
|
||||||
{
|
{
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(QuickRetry), "IsQuickRetryEnable")]
|
[HarmonyPatch(typeof(QuickRetry), "IsQuickRetryEnable")]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using AquaMai.Attributes;
|
||||||
using AquaMai.Helpers;
|
using AquaMai.Helpers;
|
||||||
using AquaMai.Resources;
|
using AquaMai.Resources;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
@ -13,6 +14,7 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace AquaMai.Utils;
|
namespace AquaMai.Utils;
|
||||||
|
|
||||||
|
[GameVersion(23500)]
|
||||||
public class SelectionDetail
|
public class SelectionDetail
|
||||||
{
|
{
|
||||||
private static readonly Window[] window = new Window[2];
|
private static readonly Window[] window = new Window[2];
|
||||||
|
|
Loading…
Reference in New Issue