diff --git a/OfflineSaveLoad.cs b/OfflineSaveLoad.cs new file mode 100644 index 0000000..d2ac332 --- /dev/null +++ b/OfflineSaveLoad.cs @@ -0,0 +1,17 @@ +using HarmonyLib; + +namespace TaikoModStuff +{ + [HarmonyPatch] + public class OfflineSaveLoad + { + [HarmonyPatch(typeof(GameTitleManager), "Start")] + [HarmonyPostfix] + private static void BootManager_Postfix(GameTitleManager __instance) + { + TaikoSingletonMonoBehaviour.Instance.MyDataManager.PlayData.LoadData("x_game_save_default_container", "save_data_blob"); + TaikoSingletonMonoBehaviour.Instance.MyDataManager.PlayData.LoadData("x_game_save_default_container", "system_data_blob"); + TaikoSingletonMonoBehaviour.Instance.MySceneManager.ChangeScene("SongSelect", false); + } + } + } \ No newline at end of file diff --git a/Plugin.cs b/Plugin.cs index 5b3b4b7..ac31040 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -16,7 +16,11 @@ namespace TaikoModStuff public static ConfigEntry configCustomFramerate; public static ConfigEntry configToggleVSync; - public static ConfigEntry configEnableRecording; + public static ConfigEntry configEnableRecording; + + public static ConfigEntry configOfflineSaveLoad; + public static ConfigEntry configQuickRestart; + public static ConfigEntry configQuickQuitSong; public override void Load() { @@ -51,12 +55,36 @@ namespace TaikoModStuff true, "Enables Game Recording from the Xbox Game Bar where it was previously disabled."); + configOfflineSaveLoad = Config.Bind("General.Toggles", + "OfflineSaveLoad", + false, + "Loads local save files even when offline. Bypasses the log-in checks. Requires the FreeLocalSaves Plugin.\nEnabling this without FreeLocalSaves can and will wipe your save file."); + + configQuickRestart = Config.Bind("General.Toggles", + "QuickRestart", + false, + "Hit \"Backspace\" on your keyboard to quickly restart a song."); + + configQuickQuitSong = Config.Bind("General.Toggles", + "QuickQuitSong", + false, + "Hit \"Escape\" on your keyboard to quickly quit a song and return to Song Select."); + var instance = new Harmony(PluginInfo.PLUGIN_NAME); instance.PatchAll(typeof(FontChanger)); instance.PatchAll(typeof(CustomResolution)); - instance.PatchAll(typeof(ForceFramerate)); - instance.PatchAll(typeof(RecordingEnable)); + instance.PatchAll(typeof(ForceFramerate)); + instance.PatchAll(typeof(RecordingEnable)); + + if (Plugin.configOfflineSaveLoad.Value) + instance.PatchAll(typeof(OfflineSaveLoad)); + + if (Plugin.configQuickRestart.Value) + instance.PatchAll(typeof(QuickRestart)); + + if (Plugin.configQuickQuitSong.Value) + instance.PatchAll(typeof(QuickQuitSong)); // Plugin startup logic Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!"); diff --git a/QuickQuitSong.cs b/QuickQuitSong.cs new file mode 100644 index 0000000..76a390c --- /dev/null +++ b/QuickQuitSong.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using UnityEngine.SceneManagement; +using BepInEx; +using HarmonyLib; + +namespace TaikoModStuff +{ + [HarmonyPatch] + public class QuickQuitSong + { + [HarmonyPatch(typeof(EnsoGameManager), "ProcExecPause")] + [HarmonyPrefix] + static void customProcExecPause() + { + bool keyDown = Input.GetKeyDown(KeyCode.Escape); + if (keyDown) + { + TaikoSingletonMonoBehaviour.Instance.MySceneManager.ChangeRelayScene("SongSelect", true); + } + } + } +} \ No newline at end of file diff --git a/QuickRestart.cs b/QuickRestart.cs new file mode 100644 index 0000000..87b3049 --- /dev/null +++ b/QuickRestart.cs @@ -0,0 +1,23 @@ +using UnityEngine; +using UnityEngine.SceneManagement; +using BepInEx; +using HarmonyLib; + +namespace TaikoModStuff +{ + [HarmonyPatch] + public class QuickRestart + { + [HarmonyPatch(typeof(EnsoGameManager), "ProcExecPause")] + [HarmonyPrefix] + static void customProcExecPause() + { + bool keyDown = Input.GetKeyDown(KeyCode.Backspace); + if (keyDown) + { + //TaikoSingletonMonoBehaviour.Instance.Invoke("RestartPlay", 1); + TaikoSingletonMonoBehaviour.Instance.MySceneManager.ChangeRelayScene("Enso", true); + } + } + } +} \ No newline at end of file