mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
LegacyContentMitigation: initial commit
manual "multipass" in legacy worlds
This commit is contained in:
parent
3d6b1bbd59
commit
94515efbe3
8 changed files with 645 additions and 0 deletions
67
LegacyContentMitigation/Main.cs
Normal file
67
LegacyContentMitigation/Main.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
using ABI_RC.Core.InteractionSystem;
|
||||
using MelonLoader;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.LegacyContentMitigation;
|
||||
|
||||
public class LegacyContentMitigationMod : MelonMod
|
||||
{
|
||||
internal static MelonLogger.Instance Logger;
|
||||
|
||||
#region Melon Preferences
|
||||
|
||||
// private static readonly MelonPreferences_Category Category =
|
||||
// MelonPreferences.CreateCategory(nameof(LegacyContentMitigationMod));
|
||||
//
|
||||
// private static readonly MelonPreferences_Entry<bool> EntryEnabled =
|
||||
// Category.CreateEntry(
|
||||
// "use_legacy_mitigation",
|
||||
// true,
|
||||
// "Enabled",
|
||||
// description: "Enable legacy content camera hack when in Legacy worlds.");
|
||||
|
||||
#endregion Melon Preferences
|
||||
|
||||
#region Melon Events
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
Logger = LoggerInstance;
|
||||
|
||||
ApplyPatches(typeof(Patches.PlayerSetup_Patches)); // add MultiPassCamera to VR camera
|
||||
ApplyPatches(typeof(Patches.SceneLoaded_Patches)); // enable / disable in legacy worlds
|
||||
ApplyPatches(typeof(Patches.CVRWorld_Patches)); // post processing shit
|
||||
ApplyPatches(typeof(Patches.CVRTools_Patches)); // prevent shader replacement when fix is active
|
||||
ApplyPatches(typeof(Patches.HeadHiderManager_Patches)); // prevent main cam triggering early head hide
|
||||
|
||||
InitializeIntegration("BTKUILib", Integrations.BtkUiAddon.Initialize); // quick menu options
|
||||
}
|
||||
|
||||
#endregion Melon Events
|
||||
|
||||
#region Melon Mod Utilities
|
||||
|
||||
private static void InitializeIntegration(string modName, Action integrationAction)
|
||||
{
|
||||
if (RegisteredMelons.All(it => it.Info.Name != modName))
|
||||
return;
|
||||
|
||||
Logger.Msg($"Initializing {modName} integration.");
|
||||
integrationAction.Invoke();
|
||||
}
|
||||
|
||||
private void ApplyPatches(Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
HarmonyInstance.PatchAll(type);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||
LoggerInstance.Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Melon Mod Utilities
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue