diff --git a/AquaMai/AquaMai.csproj b/AquaMai/AquaMai.csproj
index 5dc03c43..452e1630 100644
--- a/AquaMai/AquaMai.csproj
+++ b/AquaMai/AquaMai.csproj
@@ -266,6 +266,7 @@
+
diff --git a/AquaMai/AquaMai.toml b/AquaMai/AquaMai.toml
index 331473a6..4e3816fe 100644
--- a/AquaMai/AquaMai.toml
+++ b/AquaMai/AquaMai.toml
@@ -15,4 +15,9 @@ SinglePlayer=true
# !!EXPERIMENTAL!! Skip from the card-scanning screen directly to music selection screen
SkipToMusicSelection=false
# Set the version string displayed at the top-right corner of the screen
-CustomVersionString=""
\ No newline at end of file
+CustomVersionString=""
+
+[Performance]
+# Disable some useless checks and delays to speed up the game boot process
+# !! Known issue: The game may crash if DX Pass scanning is enabled
+ImproveLoadSpeed=false
\ No newline at end of file
diff --git a/AquaMai/Config.cs b/AquaMai/Config.cs
index f1a97d58..3a4d39fc 100644
--- a/AquaMai/Config.cs
+++ b/AquaMai/Config.cs
@@ -7,6 +7,7 @@ namespace AquaMai
{
public UXConfig UX { get; set; }
public CheatConfig Cheat { get; set; }
+ public PerformanceConfig Performance { get; set; }
public class CheatConfig
{
@@ -20,5 +21,10 @@ namespace AquaMai
public bool SkipToMusicSelection { get; set; }
public string CustomVersionString { get; set; }
}
+
+ public class PerformanceConfig
+ {
+ public bool ImproveLoadSpeed { get; set; }
+ }
}
}
diff --git a/AquaMai/Performance/ImproveLoadSpeed.cs b/AquaMai/Performance/ImproveLoadSpeed.cs
new file mode 100644
index 00000000..1e659adc
--- /dev/null
+++ b/AquaMai/Performance/ImproveLoadSpeed.cs
@@ -0,0 +1,57 @@
+using System.Diagnostics;
+using HarmonyLib;
+using MelonLoader;
+using Process;
+
+namespace AquaMai.Performance
+{
+ public class ImproveLoadSpeed
+ {
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(PowerOnProcess), "OnUpdate")]
+ public static bool PrePowerOnUpdate(PowerOnProcess __instance)
+ {
+ var traverse = Traverse.Create(__instance);
+ var state = traverse.Field("_state").GetValue();
+ switch (state)
+ {
+ case 3:
+ traverse.Field("_state").SetValue((byte)4);
+ break;
+ case 5:
+ traverse.Field("_state").SetValue((byte)8);
+ break;
+ case 9:
+ traverse.Field("_state").SetValue((byte)10);
+ break;
+ }
+
+ return true;
+ }
+
+ [HarmonyPrefix]
+ [HarmonyPatch(typeof(StartupProcess), "OnUpdate")]
+ public static bool PreStartupUpdate(StartupProcess __instance)
+ {
+ var traverse = Traverse.Create(__instance);
+ var state = traverse.Field("_state").GetValue();
+ switch (state)
+ {
+ case 0:
+ case 1:
+ case 2:
+ traverse.Field("_state").SetValue((byte)3);
+ break;
+ case 4:
+ traverse.Field("_state").SetValue((byte)5);
+ break;
+ case 8:
+ var timer = traverse.Field("timer").GetValue();
+ Traverse.Create(timer).Field("elapsed").SetValue(2 * 10000000L);
+ break;
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file