mirror of https://github.com/hykilpikonna/AquaDX
[+] Prevent accidental touch of the Test button
parent
eb72839e2b
commit
cdd3c81bdc
|
@ -303,6 +303,7 @@
|
|||
<Compile Include="UX\SkipEventInfo.cs" />
|
||||
<Compile Include="UX\SkipWarningScreen.cs" />
|
||||
<Compile Include="UX\SkipToMusicSelection.cs" />
|
||||
<Compile Include="UX\TestProof.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
|
|
|
@ -44,6 +44,8 @@ ExecOnEntry=""
|
|||
ExtendTimer=true
|
||||
# Save immediate after playing a song
|
||||
ImmediateSave=true
|
||||
# Prevent accidental touch of the Test button
|
||||
TestProof=false
|
||||
|
||||
[Performance]
|
||||
# Disable some useless delays to speed up the game boot process
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace AquaMai
|
|||
public bool SkipEventInfo { get; set; }
|
||||
public bool ImmediateSave { get; set; }
|
||||
public bool LoadLocalBga { get; set; }
|
||||
public bool TestProof { get; set; }
|
||||
public string CustomVersionString { get; set; }
|
||||
public string ExecOnIdle { get; set; }
|
||||
public string ExecOnEntry { get; set; }
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using Manager;
|
||||
using MelonLoader;
|
||||
|
||||
namespace AquaMai.UX;
|
||||
|
||||
public class TestProof
|
||||
{
|
||||
private static int _keyPressFrames;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(InputManager), "GetSystemInputDown")]
|
||||
public static bool GetSystemInputDown(ref bool __result, InputManager.SystemButtonSetting button, bool[] ___SystemButtonDown)
|
||||
{
|
||||
__result = ___SystemButtonDown[(int)button];
|
||||
if (button != InputManager.SystemButtonSetting.ButtonTest)
|
||||
return false;
|
||||
if (!InputManager.GetSystemInputPush(button))
|
||||
{
|
||||
_keyPressFrames = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
var stackTrace = new StackTrace(); // get call stack
|
||||
var stackFrames = stackTrace.GetFrames(); // get method calls (frames)
|
||||
|
||||
if (stackFrames.Any(it => it.GetMethod().Name == "DMD<Main.GameMainObject::Update>"))
|
||||
{
|
||||
__result = false;
|
||||
if (InputManager.GetSystemInputPush(button))
|
||||
{
|
||||
_keyPressFrames++;
|
||||
}
|
||||
|
||||
if (_keyPressFrames == 60)
|
||||
{
|
||||
__result = true;
|
||||
}
|
||||
|
||||
MelonLogger.Msg(_keyPressFrames);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue