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

Merge pull request #6 from swigz27/main

Added new patches
This commit is contained in:
Repflez 2022-04-15 18:19:00 -06:00 committed by GitHub
commit 683b58866c
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<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()
{
@ -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!");

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);
}
}
}
}