mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
[SwitchToDesktopOnSteamVRExit] Switched patch implementation because it did not work properly
This commit is contained in:
parent
b42f72d082
commit
e12da22513
2 changed files with 35 additions and 15 deletions
|
@ -18,13 +18,28 @@ public class SwitchToDesktopOnSteamVRExit : MelonMod
|
||||||
|
|
||||||
public override void OnInitializeMelon()
|
public override void OnInitializeMelon()
|
||||||
{
|
{
|
||||||
HarmonyInstance.Patch(
|
ApplyPatches(typeof(SteamVRBehaviour_Patches));
|
||||||
typeof(SteamVR_Behaviour).GetMethod("OnQuit"),
|
|
||||||
new HarmonyMethod(typeof(SwitchToDesktopOnSteamVRExit).GetMethod(nameof(Prefix_SteamVR_Behaviour_OnQuit),
|
|
||||||
BindingFlags.NonPublic | BindingFlags.Static))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ApplyPatches(Type type)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HarmonyInstance.PatchAll(type);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||||
|
LoggerInstance.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Patches
|
||||||
|
|
||||||
|
private static class SteamVRBehaviour_Patches
|
||||||
|
{
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(SteamVR_Behaviour), /*nameof(SteamVR_Behaviour.OnQuit)*/ "OnQuit")]
|
||||||
private static bool Prefix_SteamVR_Behaviour_OnQuit()
|
private static bool Prefix_SteamVR_Behaviour_OnQuit()
|
||||||
{
|
{
|
||||||
if (!EntryEnabled.Value)
|
if (!EntryEnabled.Value)
|
||||||
|
@ -38,3 +53,6 @@ public class SwitchToDesktopOnSteamVRExit : MelonMod
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Patches
|
||||||
|
}
|
|
@ -20,6 +20,8 @@ using System.Reflection;
|
||||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||||
|
[assembly: MelonColor(255, 52, 152, 219)]
|
||||||
|
[assembly: MelonAuthorColor(255, 158, 21, 32)]
|
||||||
[assembly: HarmonyDontPatchAll]
|
[assembly: HarmonyDontPatchAll]
|
||||||
|
|
||||||
namespace NAK.SwitchToDesktopOnSteamVRExit.Properties;
|
namespace NAK.SwitchToDesktopOnSteamVRExit.Properties;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue