1
0
mirror of synced 2024-11-23 22:10:57 +01:00

Added new patches

Adds a Quick Restart and Quick exit to Select Song patch
as well as a patch to load saves offline.

and of course, credit to Lukino for that offline saving patch.
This commit is contained in:
Cainan 2022-04-14 02:00:58 +01:00 committed by GitHub
parent e34d5e1836
commit 33306c9f5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 93 additions and 3 deletions

17
OfflineSaveLoad.cs Normal file
View File

@ -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<CommonObjects>.Instance.MyDataManager.PlayData.LoadData("x_game_save_default_container", "save_data_blob");
TaikoSingletonMonoBehaviour<CommonObjects>.Instance.MyDataManager.PlayData.LoadData("x_game_save_default_container", "system_data_blob");
TaikoSingletonMonoBehaviour<CommonObjects>.Instance.MySceneManager.ChangeScene("SongSelect", false);
}
}
}

View File

@ -16,7 +16,11 @@ namespace TaikoModStuff
public static ConfigEntry<int> configCustomFramerate; public static ConfigEntry<int> configCustomFramerate;
public static ConfigEntry<bool> configToggleVSync; public static ConfigEntry<bool> configToggleVSync;
public static ConfigEntry<bool> configEnableRecording; public static ConfigEntry<bool> configEnableRecording;
public static ConfigEntry<bool> configOfflineSaveLoad;
public static ConfigEntry<bool> configQuickRestart;
public static ConfigEntry<bool> configQuickQuitSong;
public override void Load() public override void Load()
{ {
@ -51,12 +55,36 @@ namespace TaikoModStuff
true, true,
"Enables Game Recording from the Xbox Game Bar where it was previously disabled."); "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); var instance = new Harmony(PluginInfo.PLUGIN_NAME);
instance.PatchAll(typeof(FontChanger)); instance.PatchAll(typeof(FontChanger));
instance.PatchAll(typeof(CustomResolution)); instance.PatchAll(typeof(CustomResolution));
instance.PatchAll(typeof(ForceFramerate)); instance.PatchAll(typeof(ForceFramerate));
instance.PatchAll(typeof(RecordingEnable)); 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 // Plugin startup logic
Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!"); Log.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");

22
QuickQuitSong.cs Normal file
View File

@ -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<CommonObjects>.Instance.MySceneManager.ChangeRelayScene("SongSelect", true);
}
}
}
}

23
QuickRestart.cs Normal file
View File

@ -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<EnsoGameManager>.Instance.Invoke("RestartPlay", 1);
TaikoSingletonMonoBehaviour<CommonObjects>.Instance.MySceneManager.ChangeRelayScene("Enso", true);
}
}
}
}