2024-02-07 18:16:07 +08:00
|
|
|
|
using System;
|
|
|
|
|
using AquaMai.Cheat;
|
|
|
|
|
using AquaMai.Fix;
|
|
|
|
|
using AquaMai.UX;
|
2024-02-07 15:38:36 +08:00
|
|
|
|
using MelonLoader;
|
2024-02-07 17:06:58 +08:00
|
|
|
|
using Tomlet;
|
2024-02-07 13:45:47 +08:00
|
|
|
|
|
|
|
|
|
namespace AquaMai
|
|
|
|
|
{
|
|
|
|
|
public static class BuildInfo
|
|
|
|
|
{
|
|
|
|
|
public const string Name = "AquaMai";
|
|
|
|
|
public const string Description = "Mod for Sinmai";
|
|
|
|
|
public const string Author = "Aza";
|
|
|
|
|
public const string Company = null;
|
|
|
|
|
public const string Version = "1.0.0";
|
|
|
|
|
public const string DownloadLink = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class AquaMai : MelonMod
|
|
|
|
|
{
|
2024-02-07 15:38:36 +08:00
|
|
|
|
public static Config AppConfig { get; private set; }
|
2024-02-07 18:16:24 +08:00
|
|
|
|
|
2024-02-07 18:16:07 +08:00
|
|
|
|
private void Patch(Type type)
|
|
|
|
|
{
|
|
|
|
|
MelonLogger.Msg($"> Patching {type}");
|
|
|
|
|
HarmonyLib.Harmony.CreateAndPatchAll(type);
|
|
|
|
|
}
|
2024-02-07 18:20:39 +08:00
|
|
|
|
|
2024-02-07 18:16:24 +08:00
|
|
|
|
public override void OnInitializeMelon()
|
2024-02-07 13:45:47 +08:00
|
|
|
|
{
|
2024-02-07 16:53:13 +08:00
|
|
|
|
MelonLogger.Msg("Loading mod settings...");
|
2024-02-07 18:16:24 +08:00
|
|
|
|
|
2024-02-07 17:06:58 +08:00
|
|
|
|
// Check if AquaMai.toml exists
|
|
|
|
|
if (!System.IO.File.Exists("AquaMai.toml"))
|
|
|
|
|
{
|
|
|
|
|
MelonLogger.Error("AquaMai.toml not found! Please create it.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-02-07 18:16:24 +08:00
|
|
|
|
|
2024-02-07 17:06:58 +08:00
|
|
|
|
// Read AquaMai.toml to load settings
|
|
|
|
|
AppConfig = TomletMain.To<Config>(System.IO.File.ReadAllText("AquaMai.toml"));
|
2024-02-07 18:16:24 +08:00
|
|
|
|
|
2024-02-07 15:38:36 +08:00
|
|
|
|
if (AppConfig.UX.SkipWarningScreen)
|
2024-02-07 18:16:07 +08:00
|
|
|
|
Patch(typeof(SkipWarningScreen));
|
2024-02-07 18:16:24 +08:00
|
|
|
|
|
2024-02-07 16:53:13 +08:00
|
|
|
|
if (AppConfig.UX.SinglePlayer)
|
2024-02-07 18:16:07 +08:00
|
|
|
|
Patch(typeof(SinglePlayer));
|
|
|
|
|
|
|
|
|
|
if (AppConfig.Cheat.TicketUnlock)
|
|
|
|
|
Patch(typeof(TicketUnlock));
|
2024-02-07 18:20:39 +08:00
|
|
|
|
|
2024-02-07 18:16:24 +08:00
|
|
|
|
if (AppConfig.UX.SkipToMusicSelection)
|
|
|
|
|
{
|
2024-02-07 18:20:39 +08:00
|
|
|
|
Patch(typeof(SkipToMusicSelection));
|
2024-02-07 18:16:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-02-07 18:16:07 +08:00
|
|
|
|
// Fixes that does not have side effects
|
|
|
|
|
// These don't need to be configurable
|
|
|
|
|
Patch(typeof(FixCharaCrash));
|
2024-02-07 18:20:39 +08:00
|
|
|
|
|
2024-02-07 16:53:13 +08:00
|
|
|
|
MelonLogger.Msg("Loaded!");
|
2024-02-07 13:45:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-07 18:16:24 +08:00
|
|
|
|
}
|