[RF] AquaMai configuration refactor (#82)

更新了配置文件格式,原有的配置文件将被自动无缝迁移,详情请见新的配置文件中的注释(例外:`SlideJudgeTweak` 不再默认启用)
旧配置文件将被重命名备份,如果更新到此版本遇到 Bug 请联系我们

Updated configuration file schema. The old config file will be migrated automatically and seamlessly. See the comments in the new configuration file for details. (Except for `SlideJudgeTweak` is no longer enabled by default)
Your old configuration file will be renamed as a backup. If you encounter any bug with this version, please contact us.
This commit is contained in:
Menci
2024-11-25 01:25:19 +08:00
committed by GitHub
parent e9ee31b22a
commit 37044dae01
217 changed files with 6051 additions and 3040 deletions

View File

@@ -0,0 +1,52 @@
using AquaMai.Config.Attributes;
using DB;
using HarmonyLib;
using MAI2.Util;
using Manager;
using Monitor;
using Process;
using Process.Information;
namespace AquaMai.Mods.Tweaks.TimeSaving;
[ConfigSection(
en: "Directly enter the song selection screen after login.",
zh: "登录完成后直接进入选歌界面")]
public class EntryToMusicSelection
{
/*
* 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();
// Set headphone volume
for (var i = 0; i < 2; i++)
{
var userData = UserDataManager.Instance.GetUserData(i);
if (userData.IsEntry)
{
OptionHeadphonevolumeID headPhoneVolume = userData.Option.HeadPhoneVolume;
SoundManager.SetHeadPhoneVolume(i, headPhoneVolume.GetValue());
}
}
___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((m) => m.ID == userData.Detail.SelectMapID);
if (index >= 0) return;
userData.MapList.Clear();
}
}

View File

@@ -0,0 +1,19 @@
using AquaMai.Config.Attributes;
using HarmonyLib;
using Monitor;
namespace AquaMai.Mods.Tweaks.TimeSaving;
[ConfigSection(
en: "Skip the \"Do not tap or slide vigorously\" screen, immediately proceed to the next screen once data is loaded.",
zh: "跳过“不要大力拍打或滑动哦”这个界面,数据一旦加载完就立马进入下一个界面")]
public class IWontTapOrSlideVigorously
{
[HarmonyPrefix]
[HarmonyPatch(typeof(PlInformationMonitor), "IsPlayPlInfoEnd")]
public static bool Patch(ref bool __result)
{
__result = true;
return false;
}
}

View File

@@ -0,0 +1,27 @@
using System.Collections.Generic;
using AquaMai.Config.Attributes;
using HarmonyLib;
using Process;
using Process.Information;
namespace AquaMai.Mods.Tweaks.TimeSaving;
[ConfigSection(
en: "Skip possible prompts like \"New area discovered\", \"New songs added\", \"There are events\" during game login/registration.",
zh: "跳过登录 / 注册游戏时候可能的 “发现了新的区域哟” “乐曲增加” “有活动哟” 之类的提示")]
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,30 @@
using AquaMai.Config.Attributes;
using HarmonyLib;
using Monitor;
using Process;
namespace AquaMai.Mods.Tweaks.TimeSaving;
[ConfigSection(
en: "Skip the \"Goodbye\" screen at the end of the game.",
zh: "跳过游戏结束的「再见」界面")]
public class SkipGoodbyeScreen
{
[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,32 @@
using System.Diagnostics;
using AquaMai.Config.Attributes;
using HarmonyLib;
using Process;
namespace AquaMai.Mods.Tweaks.TimeSaving;
[ConfigSection(
en: "Skip useless 2s delays to speed up the game boot process.",
zh: """
在自检界面,每个屏幕结束的时候都会等两秒才进入下一个屏幕,很浪费时间
开了这个选项之后就不会等了
""")]
public class SkipStartupDelays
{
[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,31 @@
using AquaMai.Config.Attributes;
using HarmonyLib;
using Monitor;
namespace AquaMai.Mods.Tweaks.TimeSaving;
[ConfigSection(
en: "Skip SDEZ's warning screen and logo shown after the POST sequence.",
zh: "跳过 SDEZ 启动时的 WARNING 界面")]
public class SkipStartupWarning
{
/*
* 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;
}
}

View File

@@ -0,0 +1,19 @@
using AquaMai.Config.Attributes;
using HarmonyLib;
using Monitor;
namespace AquaMai.Mods.Tweaks.TimeSaving;
[ConfigSection(
en: "Skip TrackStart screen.",
zh: "跳过乐曲开始界面")]
public class SkipTrackStart
{
[HarmonyPrefix]
[HarmonyPatch(typeof (TrackStartMonitor), "IsEnd")]
public static bool IsEnd(ref bool __result)
{
__result = true;
return false;
}
}