[RF] Move some settings to TimeSavingConfig

This commit is contained in:
Clansty
2024-09-27 19:13:53 +08:00
parent 24e6808984
commit 9605264b9a
11 changed files with 131 additions and 96 deletions

View File

@@ -0,0 +1,15 @@
using HarmonyLib;
using Monitor;
namespace AquaMai.TimeSaving;
public class IWontTapOrSlideVigorously
{
[HarmonyPrefix]
[HarmonyPatch(typeof(PlInformationMonitor), "IsPlayPlInfoEnd")]
public static bool Patch(ref bool __result)
{
__result = true;
return false;
}
}

View File

@@ -0,0 +1,26 @@
using System.Diagnostics;
using HarmonyLib;
using Process;
namespace AquaMai.TimeSaving
{
public class ImproveLoadSpeed
{
[HarmonyPrefix]
[HarmonyPatch(typeof(PowerOnProcess), "OnStart")]
public static void PrePowerOnStart(ref float ____waitTime)
{
____waitTime = 0f;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(StartupProcess), "OnUpdate")]
public static void PreStartupUpdate(byte ____state, ref Stopwatch ___timer)
{
if (____state == 8)
{
Traverse.Create(___timer).Field("elapsed").SetValue(2 * 10000000L);
}
}
}
}

View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
using HarmonyLib;
using Process;
using Process.Information;
namespace AquaMai.TimeSaving
{
public class SkipEventInfo
{
[HarmonyPostfix]
[HarmonyPatch(typeof(InformationProcess), "OnStart")]
public static void InformationProcessPostStart(ref uint ____state)
{
____state = 3;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(RegionalSelectProcess), "OnStart")]
public static void RegionalSelectProcessPreStart(ref Queue<int>[] ____discoverList)
{
____discoverList = new Queue<int>[] { new Queue<int>(), new Queue<int>() };
}
}
}

View File

@@ -0,0 +1,26 @@
using HarmonyLib;
using Monitor;
using Process;
namespace AquaMai.TimeSaving;
public class SkipGameOverScreen
{
[HarmonyPrefix]
[HarmonyPatch(typeof(GameOverMonitor), "IsPlayEnd")]
public static bool GameOverMonitorPlayEnd(ref bool __result)
{
__result = true;
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(GameOverProcess), "OnUpdate")]
public static void GameOverProcessOnUpdate(ref GameOverProcess.GameOverSequence ____state)
{
if (____state == GameOverProcess.GameOverSequence.SkyChange)
{
____state = GameOverProcess.GameOverSequence.Disp;
}
}
}

View File

@@ -0,0 +1,38 @@
using HarmonyLib;
using MAI2.Util;
using Manager;
using Monitor;
using Process;
using Process.Information;
namespace AquaMai.TimeSaving
{
public class SkipToMusicSelection
{
/*
* Highly experimental, may well break some stuff
* Works by overriding the info screen (where it shows new events and stuff)
* to directly exit to the music selection screen, skipping character and
* event selection, among others
*/
[HarmonyPrefix]
[HarmonyPatch(typeof(InformationProcess), "OnUpdate")]
public static bool OnUpdate(InformationProcess __instance, ProcessDataContainer ___container)
{
GameManager.SetMaxTrack();
___container.processManager.AddProcess(new MusicSelectProcess(___container));
___container.processManager.ReleaseProcess(__instance);
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MapResultMonitor), "Initialize")]
public static void MapResultMonitorPreInitialize(int monIndex)
{
var userData = Singleton<UserDataManager>.Instance.GetUserData(monIndex);
var index = userData.MapList.FindIndex((UserMapData m) => m.ID == userData.Detail.SelectMapID);
if (index >= 0) return;
userData.MapList.Clear();
}
}
}

View File

@@ -0,0 +1,28 @@
using HarmonyLib;
using Monitor;
namespace AquaMai.TimeSaving
{
public class SkipWarningScreen
{
/*
* Patch PlayLogo to disable the warning screen
*/
[HarmonyPrefix]
[HarmonyPatch(typeof (WarningMonitor), "PlayLogo")]
public static bool PlayLogo()
{
// Return false to block the original method
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof (WarningMonitor), "IsLogoAnimationEnd")]
public static bool IsLogoAnimationEnd(ref bool __result)
{
// Always return true to indicate the animation has ended
__result = true;
return false;
}
}
}