[+] Prevent accidental touch of the Test button
Build AquaMai / build (SDEZ141) (push) Has been cancelled Details
Build AquaMai / build (SDGA145) (push) Has been cancelled Details

pull/52/head
Clansty 2024-08-20 00:36:24 +08:00
parent eb72839e2b
commit cdd3c81bdc
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
5 changed files with 52 additions and 1 deletions

View File

@ -45,7 +45,7 @@ jobs:
$Uri = "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument"
$Form = @{
chat_id = "-1002231087502"
caption = "${{ github.event.commits[0].message }} `n`n For ${{ matrix.target }}"
caption = "${{ github.event.commits[0].message }} `n`nFor ${{ matrix.target }}"
document = Get-Item AquaMai\Output\AquaMai.dll
}
Invoke-RestMethod -Uri $uri -Form $Form -Method Post

View File

@ -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" />

View File

@ -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

View File

@ -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; }

View File

@ -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;
}
}