mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[SwitchToDesktopOnSteamVRExit] Initial Release
This commit is contained in:
parent
ea076d4686
commit
0e617c143d
6 changed files with 118 additions and 0 deletions
|
@ -43,6 +43,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShadowCloneFallback", "Shad
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StopClosingMyMenuOnWorldLoad", "StopClosingMyMenuOnWorldLoad\StopClosingMyMenuOnWorldLoad.csproj", "{9FA83514-13F8-412C-9790-C2B750E0E7E7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SwitchToDesktopOnSteamVRExit", "SwitchToDesktopOnSteamVRExit\SwitchToDesktopOnSteamVRExit.csproj", "{F7F4B840-6FF5-46C4-AAFD-95362D1D666C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -129,6 +131,10 @@ Global
|
|||
{9FA83514-13F8-412C-9790-C2B750E0E7E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9FA83514-13F8-412C-9790-C2B750E0E7E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9FA83514-13F8-412C-9790-C2B750E0E7E7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F7F4B840-6FF5-46C4-AAFD-95362D1D666C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F7F4B840-6FF5-46C4-AAFD-95362D1D666C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F7F4B840-6FF5-46C4-AAFD-95362D1D666C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F7F4B840-6FF5-46C4-AAFD-95362D1D666C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
40
SwitchToDesktopOnSteamVRExit/Main.cs
Normal file
40
SwitchToDesktopOnSteamVRExit/Main.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System.Reflection;
|
||||
using ABI_RC.Systems.VRModeSwitch;
|
||||
using HarmonyLib;
|
||||
using MelonLoader;
|
||||
using Valve.VR;
|
||||
|
||||
namespace NAK.SwitchToDesktopOnSteamVRExit;
|
||||
|
||||
public class SwitchToDesktopOnSteamVRExit : MelonMod
|
||||
{
|
||||
private const string SettingsCategory = nameof(SwitchToDesktopOnSteamVRExit);
|
||||
|
||||
private static readonly MelonPreferences_Category Category =
|
||||
MelonPreferences.CreateCategory(SettingsCategory);
|
||||
|
||||
private static readonly MelonPreferences_Entry<bool> EntryEnabled =
|
||||
Category.CreateEntry("Enabled", true, description: "Toggle SwitchToDesktopOnSteamVRExit entirely.");
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
HarmonyInstance.Patch(
|
||||
typeof(SteamVR_Behaviour).GetMethod("OnQuit"),
|
||||
new HarmonyMethod(typeof(SwitchToDesktopOnSteamVRExit).GetMethod(nameof(Prefix_SteamVR_Behaviour_OnQuit),
|
||||
BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
}
|
||||
|
||||
private static bool Prefix_SteamVR_Behaviour_OnQuit()
|
||||
{
|
||||
if (!EntryEnabled.Value)
|
||||
return true;
|
||||
|
||||
// If we don't switch fast enough, SteamVR will force close.
|
||||
// World Transition might cause issues. Might need to override.
|
||||
if (VRModeSwitchManager.Instance != null)
|
||||
VRModeSwitchManager.Instance.AttemptSwitch();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
30
SwitchToDesktopOnSteamVRExit/Properties/AssemblyInfo.cs
Normal file
30
SwitchToDesktopOnSteamVRExit/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using NAK.SwitchToDesktopOnSteamVRExit.Properties;
|
||||
using MelonLoader;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyTitle(nameof(NAK.SwitchToDesktopOnSteamVRExit))]
|
||||
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||
[assembly: AssemblyProduct(nameof(NAK.SwitchToDesktopOnSteamVRExit))]
|
||||
|
||||
[assembly: MelonInfo(
|
||||
typeof(NAK.SwitchToDesktopOnSteamVRExit.SwitchToDesktopOnSteamVRExit),
|
||||
nameof(NAK.SwitchToDesktopOnSteamVRExit),
|
||||
AssemblyInfoParams.Version,
|
||||
AssemblyInfoParams.Author,
|
||||
downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/SwitchToDesktopOnSteamVRExit"
|
||||
)]
|
||||
|
||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||
[assembly: HarmonyDontPatchAll]
|
||||
|
||||
namespace NAK.SwitchToDesktopOnSteamVRExit.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.0";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
17
SwitchToDesktopOnSteamVRExit/README.md
Normal file
17
SwitchToDesktopOnSteamVRExit/README.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# SwitchToDesktopOnSteamVRExit
|
||||
|
||||
Simple mod that initiates a VR Switch to Desktop when SteamVR is exited. By default, this is enabled, but can be disabled in the mod settings.
|
||||
|
||||
Same behaviour the original DesktopVRSwitch mod provided before the VR Switch functionality became native.
|
||||
|
||||
---
|
||||
|
||||
Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI.
|
||||
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
|
||||
|
||||
> This mod is an independent creation not affiliated with, supported by, or approved by Alpha Blend Interactive.
|
||||
|
||||
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
|
||||
|
||||
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.
|
||||
****
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk"/>
|
23
SwitchToDesktopOnSteamVRExit/format.json
Normal file
23
SwitchToDesktopOnSteamVRExit/format.json
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"_id": -1,
|
||||
"name": "SwitchToDesktopOnSteamVRExit",
|
||||
"modversion": "1.0.0",
|
||||
"gameversion": "2024r175",
|
||||
"loaderversion": "0.6.1",
|
||||
"modtype": "Mod",
|
||||
"author": "NotAKidoS",
|
||||
"description": "Simple mod that initiates a VR Switch to Desktop when SteamVR is exited. By default, this is enabled, but can be disabled in the mod settings.",
|
||||
"searchtags": [
|
||||
"steamvr",
|
||||
"vrswitch",
|
||||
"desktopvrswitch",
|
||||
"exit"
|
||||
],
|
||||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r26/SwitchToDesktopOnSteamVRExit.dll",
|
||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/SwitchToDesktopOnSteamVRExit/",
|
||||
"changelog": "- Initial Release",
|
||||
"embedcolor": "#3498db"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue