mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
initial release
This commit is contained in:
parent
7f62d97da3
commit
acb44bc4a5
7 changed files with 243 additions and 0 deletions
43
FuckCohtml/FuckCohtml.csproj
Normal file
43
FuckCohtml/FuckCohtml.csproj
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp-firstpass">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="cohtml.Net">
|
||||
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cohtml.Runtime">
|
||||
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MelonLoader">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.InputLegacyModule">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Deploy" AfterTargets="Build">
|
||||
<Copy SourceFiles="$(TargetPath)" DestinationFolder="C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\" />
|
||||
<Message Text="Copied $(TargetPath) to C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\" Importance="high" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
25
FuckCohtml/FuckCohtml.sln
Normal file
25
FuckCohtml/FuckCohtml.sln
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32630.192
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FuckCohtml", "FuckCohtml.csproj", "{D3BA0B4E-9DE9-4AD4-91E2-0A18D0283754}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D3BA0B4E-9DE9-4AD4-91E2-0A18D0283754}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D3BA0B4E-9DE9-4AD4-91E2-0A18D0283754}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D3BA0B4E-9DE9-4AD4-91E2-0A18D0283754}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D3BA0B4E-9DE9-4AD4-91E2-0A18D0283754}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A63345C7-1CD9-4EA0-B891-8CE1CEB97C8B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
57
FuckCohtml/HarmonyPatches.cs
Normal file
57
FuckCohtml/HarmonyPatches.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
using ABI_RC.Core.InteractionSystem;
|
||||
using ABI_RC.Core.IO;
|
||||
using cohtml;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.Melons.FuckCohtml.HarmonyPatches;
|
||||
|
||||
public static class CohtmlViewPatches
|
||||
{
|
||||
private static CohtmlView _quickMenuView;
|
||||
private static CohtmlView _gameMenuView;
|
||||
private static Traverse _quickMenuOpenTraverse;
|
||||
private static Traverse _gameMenuOpenTraverse;
|
||||
private static readonly FieldInfo m_UISystemFieldInfo = AccessTools.Field(typeof(CohtmlView), "m_UISystem");
|
||||
|
||||
private static void CohtmlAdvanceView(CohtmlView cohtmlView, Traverse menuOpenTraverse)
|
||||
{
|
||||
if (!FuckCohtmlMod.EntryEnabled.Value) return;
|
||||
|
||||
// Don't execute if menu is open
|
||||
if (cohtmlView == null || menuOpenTraverse.GetValue<bool>()) return;
|
||||
|
||||
// Disable cohtmlView (opening should enable)
|
||||
cohtmlView.enabled = false;
|
||||
|
||||
// Death
|
||||
try
|
||||
{
|
||||
CohtmlUISystem cohtmlUISystem = (CohtmlUISystem)m_UISystemFieldInfo.GetValue(cohtmlView);
|
||||
if (cohtmlUISystem != null) cohtmlView.View.Advance(cohtmlUISystem.Id, (double)Time.unscaledTime * 1000.0);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FuckCohtmlMod.Logger.Error($"An exception was thrown while calling CohtmlView.Advance(). Error message: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CVR_MenuManager), "Start")]
|
||||
private static void Postfix_CVR_MenuManager_Start(ref CVR_MenuManager __instance, ref CohtmlView ___quickMenu)
|
||||
{
|
||||
_quickMenuView = ___quickMenu;
|
||||
_quickMenuOpenTraverse = Traverse.Create(__instance).Field("_quickMenuOpen");
|
||||
SchedulerSystem.AddJob(new SchedulerSystem.Job(() => CohtmlAdvanceView(_quickMenuView, _quickMenuOpenTraverse)), 15f, 6f, -1);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ViewManager), "Start")]
|
||||
private static void Postfix_ViewManager_Start(ref ViewManager __instance, ref CohtmlView ___gameMenuView)
|
||||
{
|
||||
_gameMenuView = ___gameMenuView;
|
||||
_gameMenuOpenTraverse = Traverse.Create(__instance).Field("_gameMenuOpen");
|
||||
SchedulerSystem.AddJob(new SchedulerSystem.Job(() => CohtmlAdvanceView(_gameMenuView, _gameMenuOpenTraverse)), 12f, 6f, -1);
|
||||
}
|
||||
}
|
32
FuckCohtml/Main.cs
Normal file
32
FuckCohtml/Main.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using MelonLoader;
|
||||
|
||||
namespace NAK.Melons.FuckCohtml;
|
||||
|
||||
public class FuckCohtmlMod : MelonMod
|
||||
{
|
||||
public static MelonLogger.Instance Logger;
|
||||
public const string SettingsCategory = "FuckCohtml";
|
||||
public static readonly MelonPreferences_Category CategoryFuckCohtml = MelonPreferences.CreateCategory(SettingsCategory);
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryEnabled =
|
||||
CategoryFuckCohtml.CreateEntry("Enabled", true, description: "Enable FuckCohtml. This forces Cohtml to update at intervals instead of every frame while closed.");
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
Logger = LoggerInstance;
|
||||
ApplyPatches(typeof(HarmonyPatches.CohtmlViewPatches));
|
||||
}
|
||||
|
||||
private void ApplyPatches(Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
HarmonyInstance.PatchAll(type);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Msg($"Failed while patching {type.Name}!");
|
||||
Logger.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
31
FuckCohtml/Properties/AssemblyInfo.cs
Normal file
31
FuckCohtml/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using MelonLoader;
|
||||
using NAK.Melons.FuckCohtml.Properties;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyTitle(nameof(NAK.Melons.FuckCohtml))]
|
||||
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||
[assembly: AssemblyProduct(nameof(NAK.Melons.FuckCohtml))]
|
||||
|
||||
[assembly: MelonInfo(
|
||||
typeof(NAK.Melons.FuckCohtml.FuckCohtmlMod),
|
||||
nameof(NAK.Melons.FuckCohtml),
|
||||
AssemblyInfoParams.Version,
|
||||
AssemblyInfoParams.Author,
|
||||
downloadLink: "https://github.com/NotAKidOnSteam/FuckCohtml"
|
||||
)]
|
||||
|
||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||
[assembly: HarmonyDontPatchAll]
|
||||
|
||||
namespace NAK.Melons.FuckCohtml.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.0";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
24
FuckCohtml/format.json
Normal file
24
FuckCohtml/format.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"_id": -1,
|
||||
"name": "FuckCohtml",
|
||||
"modversion": "1.0.0",
|
||||
"gameversion": "2022r170",
|
||||
"loaderversion": "0.5.7",
|
||||
"modtype": "Mod",
|
||||
"author": "NotAKidoS",
|
||||
"description": "This mod disables the CohtmlView components on the menus and forces them to render at an interval while closed, helping alleviate hitching and performance issues.\n\nHelps with FPS drop while unmuted in online instances.",
|
||||
"searchtags": [
|
||||
"cohtml",
|
||||
"menus",
|
||||
"quick",
|
||||
"fps",
|
||||
"performance"
|
||||
],
|
||||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/FuckCohtml/releases/download/v1.0.0/FuckCohtml.dll",
|
||||
"sourcelink": "https://github.com/NotAKidOnSteam/FuckCohtml/",
|
||||
"changelog": "- Initial Release",
|
||||
"embedcolor": "#8ed6fb"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue