mirror of https://github.com/hykilpikonna/AquaDX
[O] Auto detect if DebugFeature is need to be patched
parent
a2db465825
commit
c1c7788cd3
|
@ -284,12 +284,12 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Cheat\DebugFeature.cs" />
|
||||
<Compile Include="Cheat\MapUnlock.cs" />
|
||||
<Compile Include="Cheat\TicketUnlock.cs" />
|
||||
<Compile Include="Cheat\UnlockUtage.cs" />
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="Fix\BasicFix.cs" />
|
||||
<Compile Include="Fix\DebugFeature.cs" />
|
||||
<Compile Include="Fix\DisableReboot.cs" />
|
||||
<Compile Include="Fix\ExtendNotesPool.cs" />
|
||||
<Compile Include="Fix\FixCharaCrash.cs" />
|
||||
|
|
|
@ -8,8 +8,6 @@ TicketUnlock=true
|
|||
MapUnlock=true
|
||||
# Unlock Utage without the need of DXRating 10000
|
||||
UnlockUtage=true
|
||||
# Restore AutoPlay(Home) and Pause(Enter) for SDGA
|
||||
DebugFeature=true
|
||||
|
||||
# ===================================
|
||||
# UX: User Experience Improvements
|
||||
|
|
|
@ -11,8 +11,6 @@ TicketUnlock=true
|
|||
MapUnlock=true
|
||||
# 不需要万分也可以进宴会场
|
||||
UnlockUtage=true
|
||||
# 恢复 SDGA 的自动播放(Home)和暂停(Enter)按键
|
||||
DebugFeature=true
|
||||
|
||||
# ===================================
|
||||
# 用户体验改进
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace AquaMai
|
|||
public bool TicketUnlock { get; set; }
|
||||
public bool MapUnlock { get; set; }
|
||||
public bool UnlockUtage { get; set; }
|
||||
public bool DebugFeature { get; set; }
|
||||
}
|
||||
|
||||
public class UXConfig
|
||||
|
|
|
@ -1,22 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
using MAI2.Util;
|
||||
using Manager;
|
||||
using MelonLoader;
|
||||
using Monitor;
|
||||
using Process;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AquaMai.Cheat;
|
||||
namespace AquaMai.Fix;
|
||||
|
||||
[HarmonyPatch]
|
||||
public class DebugFeature
|
||||
{
|
||||
# if SDGA145
|
||||
public static bool IsPatchingSkipped { get; private set; }
|
||||
private static bool isPause;
|
||||
private static double timer;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GameProcess), "OnUpdate")]
|
||||
public static void PostGameProcessUpdate(GameProcess __instance, byte ____sequence, MovieController ____gameMovie, GameMonitor[] ____monitors)
|
||||
public static IEnumerable<MethodBase> TargetMethods()
|
||||
{
|
||||
var original = typeof(GameProcess).GetField("debugFeature", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (original is not null)
|
||||
{
|
||||
MelonLogger.Msg("[DebugFeature] Skipped because already included");
|
||||
IsPatchingSkipped = true;
|
||||
return [];
|
||||
}
|
||||
|
||||
return [AccessTools.Method(typeof(GameProcess), "OnUpdate")];
|
||||
}
|
||||
|
||||
public static void Postfix(GameProcess __instance, byte ____sequence, MovieController ____gameMovie, GameMonitor[] ____monitors)
|
||||
{
|
||||
if (____sequence != 4) return;
|
||||
// GameSequence.Play
|
||||
|
@ -24,6 +39,7 @@ public class DebugFeature
|
|||
{
|
||||
timer += GameManager.GetGameMSecAddD();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Home))
|
||||
{
|
||||
GameManager.AutoPlay = (GameManager.AutoPlayMode)((int)(GameManager.AutoPlay + 1) % Enum.GetNames(typeof(GameManager.AutoPlayMode)).Length);
|
||||
|
@ -42,10 +58,12 @@ public class DebugFeature
|
|||
{
|
||||
num23 = -1000;
|
||||
}
|
||||
|
||||
if (DebugInput.GetKeyDown(KeyCode.RightArrow))
|
||||
{
|
||||
num23 = 1000;
|
||||
}
|
||||
|
||||
int addMsec = ((!DebugInput.GetKey(KeyCode.LeftShift) && !DebugInput.GetKey(KeyCode.RightShift)) ? ((!DebugInput.GetKey(KeyCode.LeftControl) && !DebugInput.GetKey(KeyCode.RightControl)) ? num23 : (num23 * 10)) : (num23 * 5));
|
||||
Singleton<GamePlayManager>.Instance.Initialize();
|
||||
DebugTimeSkip(addMsec);
|
||||
|
@ -66,12 +84,14 @@ public class DebugFeature
|
|||
{
|
||||
timer = timer + addMsec >= 0.0 ? timer + addMsec : 0.0;
|
||||
}
|
||||
|
||||
____gameMovie.SetSeekFrame(timer);
|
||||
SoundManager.SeekMusic((int)timer);
|
||||
for (int i = 0; i < ____monitors.Length; i++)
|
||||
{
|
||||
____monitors[i].Seek((int)timer);
|
||||
}
|
||||
|
||||
// magic number, dont know why
|
||||
NotesManager.StartPlay((int)timer + 91);
|
||||
NotesManager.Pause(isPause);
|
||||
|
@ -84,8 +104,8 @@ public class DebugFeature
|
|||
{
|
||||
____gameMovie.Pause(pauseFlag: true);
|
||||
}
|
||||
|
||||
__instance.UpdateNotes();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
|
@ -129,6 +129,7 @@ namespace AquaMai
|
|||
Patch(typeof(DisableReboot));
|
||||
Patch(typeof(ExtendNotesPool));
|
||||
Patch(typeof(FixCheckAuth));
|
||||
Patch(typeof(DebugFeature));
|
||||
// UX
|
||||
Patch(typeof(CustomVersionString));
|
||||
Patch(typeof(CustomPlaceName));
|
||||
|
|
Loading…
Reference in New Issue