From 7f62d97da3dbdc4b5b3671d486a023b55f270ca2 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 15 Mar 2023 20:43:37 -0500 Subject: [PATCH 01/27] Initial commit --- .gitattributes | 2 + .gitignore | 398 +++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE | 21 +++ 3 files changed, 421 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..426d76d --- /dev/null +++ b/.gitignore @@ -0,0 +1,398 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4480281 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 NotAKidoS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From acb44bc4a5646f37c2551422d8ecd297edf5f24d Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 15 Mar 2023 21:01:43 -0500 Subject: [PATCH 02/27] initial release --- FuckCohtml/FuckCohtml.csproj | 43 ++++++++++++++++++++ FuckCohtml/FuckCohtml.sln | 25 ++++++++++++ FuckCohtml/HarmonyPatches.cs | 57 +++++++++++++++++++++++++++ FuckCohtml/Main.cs | 32 +++++++++++++++ FuckCohtml/Properties/AssemblyInfo.cs | 31 +++++++++++++++ FuckCohtml/format.json | 24 +++++++++++ README.md | 31 +++++++++++++++ 7 files changed, 243 insertions(+) create mode 100644 FuckCohtml/FuckCohtml.csproj create mode 100644 FuckCohtml/FuckCohtml.sln create mode 100644 FuckCohtml/HarmonyPatches.cs create mode 100644 FuckCohtml/Main.cs create mode 100644 FuckCohtml/Properties/AssemblyInfo.cs create mode 100644 FuckCohtml/format.json create mode 100644 README.md diff --git a/FuckCohtml/FuckCohtml.csproj b/FuckCohtml/FuckCohtml.csproj new file mode 100644 index 0000000..cf3b530 --- /dev/null +++ b/FuckCohtml/FuckCohtml.csproj @@ -0,0 +1,43 @@ + + + + + net472 + enable + latest + false + + + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll + + + ..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll + + + ..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll + + + + + + + + + diff --git a/FuckCohtml/FuckCohtml.sln b/FuckCohtml/FuckCohtml.sln new file mode 100644 index 0000000..eb1c8a7 --- /dev/null +++ b/FuckCohtml/FuckCohtml.sln @@ -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 diff --git a/FuckCohtml/HarmonyPatches.cs b/FuckCohtml/HarmonyPatches.cs new file mode 100644 index 0000000..83a8cd7 --- /dev/null +++ b/FuckCohtml/HarmonyPatches.cs @@ -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()) 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); + } +} \ No newline at end of file diff --git a/FuckCohtml/Main.cs b/FuckCohtml/Main.cs new file mode 100644 index 0000000..b8ecbeb --- /dev/null +++ b/FuckCohtml/Main.cs @@ -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 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); + } + } +} \ No newline at end of file diff --git a/FuckCohtml/Properties/AssemblyInfo.cs b/FuckCohtml/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6cb02b9 --- /dev/null +++ b/FuckCohtml/Properties/AssemblyInfo.cs @@ -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"; +} \ No newline at end of file diff --git a/FuckCohtml/format.json b/FuckCohtml/format.json new file mode 100644 index 0000000..9af422b --- /dev/null +++ b/FuckCohtml/format.json @@ -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" +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f9b3d4b --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# FuckToes +Prevents VRIK from autodetecting toes in HalfbodyIK. + +Optionally can be applied in FBT, but toes in FBT are nice so you are a monster if so. + +![fuckthetoes](https://user-images.githubusercontent.com/37721153/216518012-ae3b1dde-17ea-419a-a875-48d57e13f3dd.png) + +--- + +Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI. +https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games + +> I am not affiliated with ABI in any official capacity, these mods are not endorsed or outright permitted by ABI and are subject to scrutiny. + +> Neither I nor these mods are in any way affiliated with Alpha Blend Interactive and/or ChilloutVR. Using these modifications might cause issues with the performance, security or stability of the game. Use at your own risk. + +> Any modifications that are not approved can get your ABI account terminated and such this modification is following the "modding guidelines" at the best it could be. +> They reserve the right to punish users using my mod. +> If you are scared of using modifications in your game do not install mods. + +> I do not affiliate ABI and the mod is not supported by ABI. + +> Me and this modification are in no affiliation with ABI and not supported by ABI. + +> This mod is not affiliated with Alpha Blend Interactive. The mod comes with no warranty. Use at your own risk, as I am not responsible for any misuse. + +> I'm not affiliated with Alpha Blend Interactive and this mod is not officially supported by the game. + +> When releasing mods to the public, it is required to state, that the mod authors and modification are in no affiliation with ABI and not supported by ABI. :trollface: + +> i ran out of places to steal disclaimers from From 34d19b992a52e3a11405a457428570e1be63ca53 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 15 Mar 2023 21:36:45 -0500 Subject: [PATCH 03/27] Update README.md --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f9b3d4b..a9d47c5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,16 @@ -# FuckToes -Prevents VRIK from autodetecting toes in HalfbodyIK. +# FuckCohtml -Optionally can be applied in FBT, but toes in FBT are nice so you are a monster if so. +This mod is designed specifically for ChilloutVR and its implementation of Cohtml. It is named to maintain consistency with my previous mod, FuckToes, and is not intended to be derogatory towards Cohtml or comment on its quality as a product. -![fuckthetoes](https://user-images.githubusercontent.com/37721153/216518012-ae3b1dde-17ea-419a-a875-48d57e13f3dd.png) +This mod disables the CohtmlView components on the menus and forces them to render intermittently when closed. This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances. + +The following clips demonstrate the difference in performance with and without the FuckCohtml mod. While not a scientifically rigorous comparison, it is clear that there is a significant performance hit when unmuted, causing Dynamic Bones to jitter, in the clip without the mod: + +https://user-images.githubusercontent.com/37721153/225494880-7e06195c-6f0d-4a21-aaa8-5f9f4ba5e9dd.mp4 + +However, with the FuckCohtml mod enabled, the performance hit when unmuted is almost negligible, as shown in the clip below: + +https://user-images.githubusercontent.com/37721153/225495141-7abcb17b-60c7-487d-9de8-ef9818cbd6eb.mp4 --- From be4b8d8d4677171088a13fe073b33a43116e952c Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 15 Mar 2023 22:03:46 -0500 Subject: [PATCH 04/27] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index a9d47c5..2a635a2 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ This mod is designed specifically for ChilloutVR and its implementation of Cohtm This mod disables the CohtmlView components on the menus and forces them to render intermittently when closed. This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances. +## Examples + The following clips demonstrate the difference in performance with and without the FuckCohtml mod. While not a scientifically rigorous comparison, it is clear that there is a significant performance hit when unmuted, causing Dynamic Bones to jitter, in the clip without the mod: https://user-images.githubusercontent.com/37721153/225494880-7e06195c-6f0d-4a21-aaa8-5f9f4ba5e9dd.mp4 @@ -12,6 +14,12 @@ However, with the FuckCohtml mod enabled, the performance hit when unmuted is al https://user-images.githubusercontent.com/37721153/225495141-7abcb17b-60c7-487d-9de8-ef9818cbd6eb.mp4 +While this mod is not directly fixing the performance hit while unmuted, it is likely freeing enough resources that unmuting does not cause a noticable performance hit while in online instances. This comes at the cost of Cohtml being a bit more fragile, as it is more likely to randomly error while disabled. + +## Relevant Feedback Posts: + +https://feedback.abinteractive.net/p/fps-drop-while-unmuted + --- Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI. From 9b769f2be971071f41f769a08b0d122c6e237208 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 15 Mar 2023 22:06:00 -0500 Subject: [PATCH 05/27] Update README.md --- README.md | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 2a635a2..031e207 100644 --- a/README.md +++ b/README.md @@ -25,22 +25,9 @@ https://feedback.abinteractive.net/p/fps-drop-while-unmuted Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI. https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games -> I am not affiliated with ABI in any official capacity, these mods are not endorsed or outright permitted by ABI and are subject to scrutiny. +> This mod is an independent creation and is not affiliated with, supported by or approved by Alpha Blend Interactive. -> Neither I nor these mods are in any way affiliated with Alpha Blend Interactive and/or ChilloutVR. Using these modifications might cause issues with the performance, security or stability of the game. Use at your own risk. +> 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. -> Any modifications that are not approved can get your ABI account terminated and such this modification is following the "modding guidelines" at the best it could be. -> They reserve the right to punish users using my mod. -> If you are scared of using modifications in your game do not install mods. +> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive. -> I do not affiliate ABI and the mod is not supported by ABI. - -> Me and this modification are in no affiliation with ABI and not supported by ABI. - -> This mod is not affiliated with Alpha Blend Interactive. The mod comes with no warranty. Use at your own risk, as I am not responsible for any misuse. - -> I'm not affiliated with Alpha Blend Interactive and this mod is not officially supported by the game. - -> When releasing mods to the public, it is required to state, that the mod authors and modification are in no affiliation with ABI and not supported by ABI. :trollface: - -> i ran out of places to steal disclaimers from From 1ce18e6aa6331438bc0496e30023f9e09121e8e3 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 15 Mar 2023 22:23:08 -0500 Subject: [PATCH 06/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 031e207..9ca58e5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This mod is designed specifically for ChilloutVR and its implementation of Cohtml. It is named to maintain consistency with my previous mod, FuckToes, and is not intended to be derogatory towards Cohtml or comment on its quality as a product. -This mod disables the CohtmlView components on the menus and forces them to render intermittently when closed. This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances. +This mod disables the CohtmlView components on the menus and forces them to render intermittently when closed. This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances. This also helps prevent VRIK from constantly stepping in place while in VR. ## Examples From a5fa241fb11253b28880b7250b0fe4273496ea76 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 01:34:46 -0500 Subject: [PATCH 07/27] Job Removal --- .gitignore | 5 ++ FuckCohtml/FuckCohtml.cs | 34 +++++++++++++ FuckCohtml/FuckCohtml.csproj | 3 +- FuckCohtml/HarmonyPatches.cs | 71 +++++++++++---------------- FuckCohtml/Main.cs | 24 +++++++-- FuckCohtml/ManagedLibs/.keep | 0 FuckCohtml/Properties/AssemblyInfo.cs | 2 +- FuckCohtml/format.json | 2 +- 8 files changed, 94 insertions(+), 47 deletions(-) create mode 100644 FuckCohtml/FuckCohtml.cs create mode 100644 FuckCohtml/ManagedLibs/.keep diff --git a/.gitignore b/.gitignore index 426d76d..7a20781 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,11 @@ ## ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore +# ManagedLibs & NStrip.exe +ManagedLibs/*.dll +ManagedLibs/*.db +NStrip + # User-specific files *.rsuser *.suo diff --git a/FuckCohtml/FuckCohtml.cs b/FuckCohtml/FuckCohtml.cs new file mode 100644 index 0000000..4d944b0 --- /dev/null +++ b/FuckCohtml/FuckCohtml.cs @@ -0,0 +1,34 @@ +using ABI_RC.Core.InteractionSystem; +using ABI_RC.Core.IO; + +namespace NAK.Melons.FuckCohtml +{ + public static class FuckCohtml + { + public static void ToggleMetrics(bool disable) + { + var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "UpdateMetrics").Job; + if (!disable && job == null) + { + SchedulerSystem.AddJob(new SchedulerSystem.Job(ViewManager.Instance.UpdateMetrics), 0f, 0.5f, -1); + } + else if (disable && job != null) + { + SchedulerSystem.RemoveJob(job); + } + } + + public static void ToggleCoreUpdates(bool disable) + { + var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "SendCoreUpdate").Job; + if (!disable && job == null) + { + SchedulerSystem.AddJob(new SchedulerSystem.Job(CVR_MenuManager.Instance.SendCoreUpdate), 0f, 0.1f, -1); + } + else if (disable && job != null) + { + SchedulerSystem.RemoveJob(job); + } + } + } +} diff --git a/FuckCohtml/FuckCohtml.csproj b/FuckCohtml/FuckCohtml.csproj index cf3b530..10c4ff7 100644 --- a/FuckCohtml/FuckCohtml.csproj +++ b/FuckCohtml/FuckCohtml.csproj @@ -6,6 +6,7 @@ enable latest false + True @@ -13,7 +14,7 @@ C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll - C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + ManagedLibs\Assembly-CSharp.dll C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll diff --git a/FuckCohtml/HarmonyPatches.cs b/FuckCohtml/HarmonyPatches.cs index 83a8cd7..759140e 100644 --- a/FuckCohtml/HarmonyPatches.cs +++ b/FuckCohtml/HarmonyPatches.cs @@ -1,57 +1,46 @@ using ABI_RC.Core.InteractionSystem; -using ABI_RC.Core.IO; -using cohtml; +using ABI_RC.Core.Player; using HarmonyLib; -using System.Reflection; -using UnityEngine; namespace NAK.Melons.FuckCohtml.HarmonyPatches; -public static class CohtmlViewPatches +class PlayerSetupPatches { - 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) + [HarmonyPostfix] + [HarmonyPatch(typeof(PlayerSetup), "Start")] + private static void Postfix_PlayerSetup_Start() { - if (!FuckCohtmlMod.EntryEnabled.Value) return; + FuckCohtml.ToggleMetrics(FuckCohtmlMod.EntryDisableMetrics.Value); + FuckCohtml.ToggleCoreUpdates(FuckCohtmlMod.EntryDisableCoreUpdates.Value); + } +} - // Don't execute if menu is open - if (cohtmlView == null || menuOpenTraverse.GetValue()) return; - - // Disable cohtmlView (opening should enable) - cohtmlView.enabled = false; - - // Death - try +class CVR_MenuManagerPatches +{ + [HarmonyPostfix] + [HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })] + private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show) + { + if (!FuckCohtmlMod.EntryDisableCoreUpdates.Value) return; + if (show) { - 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}"); + CVR_MenuManager.Instance.SendCoreUpdate(); + ViewManager.Instance.UpdateMetrics(); } } +} +class ViewManagerPatches +{ [HarmonyPostfix] - [HarmonyPatch(typeof(CVR_MenuManager), "Start")] - private static void Postfix_CVR_MenuManager_Start(ref CVR_MenuManager __instance, ref CohtmlView ___quickMenu) + [HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })] + private static void Postfix_ViewManager_UiStateToggle(bool show) { - _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); + if (!FuckCohtmlMod.EntryDisableMetrics.Value) return; + if (show) + { + CVR_MenuManager.Instance.SendCoreUpdate(); + ViewManager.Instance.UpdateMetrics(); + } } } \ No newline at end of file diff --git a/FuckCohtml/Main.cs b/FuckCohtml/Main.cs index b8ecbeb..9237b66 100644 --- a/FuckCohtml/Main.cs +++ b/FuckCohtml/Main.cs @@ -5,16 +5,34 @@ 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 EntryEnabled = - CategoryFuckCohtml.CreateEntry("Enabled", true, description: "Enable FuckCohtml. This forces Cohtml to update at intervals instead of every frame while closed."); + public static readonly MelonPreferences_Entry EntryDisableMetrics = + CategoryFuckCohtml.CreateEntry("Disable Metrics", true, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); + + public static readonly MelonPreferences_Entry EntryDisableCoreUpdates = + CategoryFuckCohtml.CreateEntry("Disable Core Updates", true, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); public override void OnInitializeMelon() { Logger = LoggerInstance; - ApplyPatches(typeof(HarmonyPatches.CohtmlViewPatches)); + EntryDisableMetrics.OnEntryValueChangedUntyped.Subscribe(OnDisableMetrics); + EntryDisableCoreUpdates.OnEntryValueChangedUntyped.Subscribe(OnDisableCoreUpdates); + ApplyPatches(typeof(HarmonyPatches.PlayerSetupPatches)); + ApplyPatches(typeof(HarmonyPatches.CVR_MenuManagerPatches)); + ApplyPatches(typeof(HarmonyPatches.ViewManagerPatches)); + } + + private void OnDisableMetrics(object arg1, object arg2) + { + FuckCohtml.ToggleMetrics(EntryDisableMetrics.Value); + } + + private void OnDisableCoreUpdates(object arg1, object arg2) + { + FuckCohtml.ToggleCoreUpdates(EntryDisableCoreUpdates.Value); } private void ApplyPatches(Type type) diff --git a/FuckCohtml/ManagedLibs/.keep b/FuckCohtml/ManagedLibs/.keep new file mode 100644 index 0000000..e69de29 diff --git a/FuckCohtml/Properties/AssemblyInfo.cs b/FuckCohtml/Properties/AssemblyInfo.cs index 6cb02b9..8878400 100644 --- a/FuckCohtml/Properties/AssemblyInfo.cs +++ b/FuckCohtml/Properties/AssemblyInfo.cs @@ -26,6 +26,6 @@ using System.Reflection; namespace NAK.Melons.FuckCohtml.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.0"; + public const string Version = "1.0.1"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/FuckCohtml/format.json b/FuckCohtml/format.json index 9af422b..966411e 100644 --- a/FuckCohtml/format.json +++ b/FuckCohtml/format.json @@ -6,7 +6,7 @@ "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.", + "description": "This mod disables the CohtmlView components on the menus and forces them to render intermittently when closed. This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances.\n\nPlease view the Github README for more info.", "searchtags": [ "cohtml", "menus", From b3418ec7996f5fe2e4ec20c55ea98e11feae5ee9 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 01:35:59 -0500 Subject: [PATCH 08/27] Update .gitignore --- .gitignore | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7a20781..4e5ad26 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,10 @@ ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore # ManagedLibs & NStrip.exe -ManagedLibs/*.dll -ManagedLibs/*.db -NStrip +*/ManagedLibs/*.dll +*/ManagedLibs/*.db +*/NStrip.exe +*/*.bat # User-specific files *.rsuser From 6355e0fbe1cde470b715c0493cafef96c437bd03 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 01:41:06 -0500 Subject: [PATCH 09/27] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 9ca58e5..66a6ebe 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # FuckCohtml -This mod is designed specifically for ChilloutVR and its implementation of Cohtml. It is named to maintain consistency with my previous mod, FuckToes, and is not intended to be derogatory towards Cohtml or comment on its quality as a product. - -This mod disables the CohtmlView components on the menus and forces them to render intermittently when closed. This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances. This also helps prevent VRIK from constantly stepping in place while in VR. +This mod disables realtime metrics and core menu updates (fps, ping, gamerule icons, ect). This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances. This also helps prevent VRIK from constantly stepping in place while in VR. ## Examples From e0ff509b49bba6628f0ce97ca7c70eba696650ad Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 01:41:15 -0500 Subject: [PATCH 10/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 66a6ebe..5da75e7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# FuckCohtml +# FuckMetrics This mod disables realtime metrics and core menu updates (fps, ping, gamerule icons, ect). This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances. This also helps prevent VRIK from constantly stepping in place while in VR. From 8c046268a8929d3bc2db60d04813627a7e27441e Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 01:44:07 -0500 Subject: [PATCH 11/27] rename mod --- FuckCohtml/{FuckCohtml.cs => FuckMetrics.cs} | 4 ++-- FuckCohtml/HarmonyPatches.cs | 10 +++++----- FuckCohtml/Main.cs | 16 ++++++++-------- FuckCohtml/Properties/AssemblyInfo.cs | 14 +++++++------- FuckCohtml/format.json | 12 ++++++------ 5 files changed, 28 insertions(+), 28 deletions(-) rename FuckCohtml/{FuckCohtml.cs => FuckMetrics.cs} (94%) diff --git a/FuckCohtml/FuckCohtml.cs b/FuckCohtml/FuckMetrics.cs similarity index 94% rename from FuckCohtml/FuckCohtml.cs rename to FuckCohtml/FuckMetrics.cs index 4d944b0..f253ea0 100644 --- a/FuckCohtml/FuckCohtml.cs +++ b/FuckCohtml/FuckMetrics.cs @@ -1,9 +1,9 @@ using ABI_RC.Core.InteractionSystem; using ABI_RC.Core.IO; -namespace NAK.Melons.FuckCohtml +namespace NAK.Melons.FuckMetrics { - public static class FuckCohtml + public static class FuckMetrics { public static void ToggleMetrics(bool disable) { diff --git a/FuckCohtml/HarmonyPatches.cs b/FuckCohtml/HarmonyPatches.cs index 759140e..282c58c 100644 --- a/FuckCohtml/HarmonyPatches.cs +++ b/FuckCohtml/HarmonyPatches.cs @@ -2,7 +2,7 @@ using ABI_RC.Core.Player; using HarmonyLib; -namespace NAK.Melons.FuckCohtml.HarmonyPatches; +namespace NAK.Melons.FuckMetrics.HarmonyPatches; class PlayerSetupPatches { @@ -10,8 +10,8 @@ class PlayerSetupPatches [HarmonyPatch(typeof(PlayerSetup), "Start")] private static void Postfix_PlayerSetup_Start() { - FuckCohtml.ToggleMetrics(FuckCohtmlMod.EntryDisableMetrics.Value); - FuckCohtml.ToggleCoreUpdates(FuckCohtmlMod.EntryDisableCoreUpdates.Value); + FuckMetrics.ToggleMetrics(FuckMetricsMod.EntryDisableMetrics.Value); + FuckMetrics.ToggleCoreUpdates(FuckMetricsMod.EntryDisableCoreUpdates.Value); } } @@ -21,7 +21,7 @@ class CVR_MenuManagerPatches [HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })] private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show) { - if (!FuckCohtmlMod.EntryDisableCoreUpdates.Value) return; + if (!FuckMetricsMod.EntryDisableCoreUpdates.Value) return; if (show) { CVR_MenuManager.Instance.SendCoreUpdate(); @@ -36,7 +36,7 @@ class ViewManagerPatches [HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })] private static void Postfix_ViewManager_UiStateToggle(bool show) { - if (!FuckCohtmlMod.EntryDisableMetrics.Value) return; + if (!FuckMetricsMod.EntryDisableMetrics.Value) return; if (show) { CVR_MenuManager.Instance.SendCoreUpdate(); diff --git a/FuckCohtml/Main.cs b/FuckCohtml/Main.cs index 9237b66..5bd8aec 100644 --- a/FuckCohtml/Main.cs +++ b/FuckCohtml/Main.cs @@ -1,19 +1,19 @@ using MelonLoader; -namespace NAK.Melons.FuckCohtml; +namespace NAK.Melons.FuckMetrics; -public class FuckCohtmlMod : MelonMod +public class FuckMetricsMod : MelonMod { public static MelonLogger.Instance Logger; - public const string SettingsCategory = "FuckCohtml"; - public static readonly MelonPreferences_Category CategoryFuckCohtml = MelonPreferences.CreateCategory(SettingsCategory); + public const string SettingsCategory = "FuckMetrics"; + public static readonly MelonPreferences_Category CategoryFuckMetrics = MelonPreferences.CreateCategory(SettingsCategory); public static readonly MelonPreferences_Entry EntryDisableMetrics = - CategoryFuckCohtml.CreateEntry("Disable Metrics", true, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); + CategoryFuckMetrics.CreateEntry("Disable Metrics", true, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); public static readonly MelonPreferences_Entry EntryDisableCoreUpdates = - CategoryFuckCohtml.CreateEntry("Disable Core Updates", true, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); + CategoryFuckMetrics.CreateEntry("Disable Core Updates", true, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); public override void OnInitializeMelon() { @@ -27,12 +27,12 @@ public class FuckCohtmlMod : MelonMod private void OnDisableMetrics(object arg1, object arg2) { - FuckCohtml.ToggleMetrics(EntryDisableMetrics.Value); + FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value); } private void OnDisableCoreUpdates(object arg1, object arg2) { - FuckCohtml.ToggleCoreUpdates(EntryDisableCoreUpdates.Value); + FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value); } private void ApplyPatches(Type type) diff --git a/FuckCohtml/Properties/AssemblyInfo.cs b/FuckCohtml/Properties/AssemblyInfo.cs index 8878400..389282b 100644 --- a/FuckCohtml/Properties/AssemblyInfo.cs +++ b/FuckCohtml/Properties/AssemblyInfo.cs @@ -1,21 +1,21 @@ using MelonLoader; -using NAK.Melons.FuckCohtml.Properties; +using NAK.Melons.FuckMetrics.Properties; using System.Reflection; [assembly: AssemblyVersion(AssemblyInfoParams.Version)] [assembly: AssemblyFileVersion(AssemblyInfoParams.Version)] [assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)] -[assembly: AssemblyTitle(nameof(NAK.Melons.FuckCohtml))] +[assembly: AssemblyTitle(nameof(NAK.Melons.FuckMetrics))] [assembly: AssemblyCompany(AssemblyInfoParams.Author)] -[assembly: AssemblyProduct(nameof(NAK.Melons.FuckCohtml))] +[assembly: AssemblyProduct(nameof(NAK.Melons.FuckMetrics))] [assembly: MelonInfo( - typeof(NAK.Melons.FuckCohtml.FuckCohtmlMod), - nameof(NAK.Melons.FuckCohtml), + typeof(NAK.Melons.FuckMetrics.FuckMetricsMod), + nameof(NAK.Melons.FuckMetrics), AssemblyInfoParams.Version, AssemblyInfoParams.Author, - downloadLink: "https://github.com/NotAKidOnSteam/FuckCohtml" + downloadLink: "https://github.com/NotAKidOnSteam/FuckMetrics" )] [assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] @@ -23,7 +23,7 @@ using System.Reflection; [assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] [assembly: HarmonyDontPatchAll] -namespace NAK.Melons.FuckCohtml.Properties; +namespace NAK.Melons.FuckMetrics.Properties; internal static class AssemblyInfoParams { public const string Version = "1.0.1"; diff --git a/FuckCohtml/format.json b/FuckCohtml/format.json index 966411e..54ce3d2 100644 --- a/FuckCohtml/format.json +++ b/FuckCohtml/format.json @@ -1,12 +1,12 @@ { "_id": -1, - "name": "FuckCohtml", - "modversion": "1.0.0", + "name": "FuckMetrics", + "modversion": "1.0.1", "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 intermittently when closed. This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances.\n\nPlease view the Github README for more info.", + "description": "This mod disables UpdateMetrics & SendCoreUpdate on the menus while closed. This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances.\n\nPlease view the Github README for more info.", "searchtags": [ "cohtml", "menus", @@ -17,8 +17,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/FuckCohtml/releases/download/v1.0.0/FuckCohtml.dll", - "sourcelink": "https://github.com/NotAKidOnSteam/FuckCohtml/", - "changelog": "- Initial Release", + "downloadlink": "https://github.com/NotAKidOnSteam/FuckMetrics/releases/download/v1.0.1/FuckMetrics.dll", + "sourcelink": "https://github.com/NotAKidOnSteam/FuckMetrics/", + "changelog": "- Initial Release\n- Renamed to FuckMetrics", "embedcolor": "#8ed6fb" } \ No newline at end of file From 28347e45a41ff319916bd84392c2a2fb7f9601ad Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 02:05:05 -0500 Subject: [PATCH 12/27] rename mod & add settings --- {FuckCohtml => FuckMetrics}/FuckMetrics.cs | 0 .../FuckMetrics.csproj | 0 .../FuckMetrics.sln | 12 ++++---- {FuckCohtml => FuckMetrics}/HarmonyPatches.cs | 28 +++++++++++++------ {FuckCohtml => FuckMetrics}/Main.cs | 19 +++++++++---- {FuckCohtml => FuckMetrics}/ManagedLibs/.keep | 0 .../Properties/AssemblyInfo.cs | 0 {FuckCohtml => FuckMetrics}/format.json | 0 8 files changed, 39 insertions(+), 20 deletions(-) rename {FuckCohtml => FuckMetrics}/FuckMetrics.cs (100%) rename FuckCohtml/FuckCohtml.csproj => FuckMetrics/FuckMetrics.csproj (100%) rename FuckCohtml/FuckCohtml.sln => FuckMetrics/FuckMetrics.sln (59%) rename {FuckCohtml => FuckMetrics}/HarmonyPatches.cs (58%) rename {FuckCohtml => FuckMetrics}/Main.cs (59%) rename {FuckCohtml => FuckMetrics}/ManagedLibs/.keep (100%) rename {FuckCohtml => FuckMetrics}/Properties/AssemblyInfo.cs (100%) rename {FuckCohtml => FuckMetrics}/format.json (100%) diff --git a/FuckCohtml/FuckMetrics.cs b/FuckMetrics/FuckMetrics.cs similarity index 100% rename from FuckCohtml/FuckMetrics.cs rename to FuckMetrics/FuckMetrics.cs diff --git a/FuckCohtml/FuckCohtml.csproj b/FuckMetrics/FuckMetrics.csproj similarity index 100% rename from FuckCohtml/FuckCohtml.csproj rename to FuckMetrics/FuckMetrics.csproj diff --git a/FuckCohtml/FuckCohtml.sln b/FuckMetrics/FuckMetrics.sln similarity index 59% rename from FuckCohtml/FuckCohtml.sln rename to FuckMetrics/FuckMetrics.sln index eb1c8a7..b6c2e37 100644 --- a/FuckCohtml/FuckCohtml.sln +++ b/FuckMetrics/FuckMetrics.sln @@ -3,7 +3,7 @@ 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}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FuckMetrics", "FuckMetrics.csproj", "{D2625DDC-48EA-4390-8B4C-69D1E4E9C5E5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,15 +11,15 @@ Global 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 + {D2625DDC-48EA-4390-8B4C-69D1E4E9C5E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2625DDC-48EA-4390-8B4C-69D1E4E9C5E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2625DDC-48EA-4390-8B4C-69D1E4E9C5E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2625DDC-48EA-4390-8B4C-69D1E4E9C5E5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A63345C7-1CD9-4EA0-B891-8CE1CEB97C8B} + SolutionGuid = {CE55D93A-682A-47F4-A971-65132B854210} EndGlobalSection EndGlobal diff --git a/FuckCohtml/HarmonyPatches.cs b/FuckMetrics/HarmonyPatches.cs similarity index 58% rename from FuckCohtml/HarmonyPatches.cs rename to FuckMetrics/HarmonyPatches.cs index 282c58c..e897efe 100644 --- a/FuckCohtml/HarmonyPatches.cs +++ b/FuckMetrics/HarmonyPatches.cs @@ -10,8 +10,8 @@ class PlayerSetupPatches [HarmonyPatch(typeof(PlayerSetup), "Start")] private static void Postfix_PlayerSetup_Start() { - FuckMetrics.ToggleMetrics(FuckMetricsMod.EntryDisableMetrics.Value); - FuckMetrics.ToggleCoreUpdates(FuckMetricsMod.EntryDisableCoreUpdates.Value); + FuckMetrics.ToggleMetrics(FuckMetricsMod.EntryDisableMetrics.Value == FuckMetricsMod.SettingState.Enabled); + FuckMetrics.ToggleCoreUpdates(FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.Enabled); } } @@ -21,11 +21,17 @@ class CVR_MenuManagerPatches [HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })] private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show) { - if (!FuckMetricsMod.EntryDisableCoreUpdates.Value) return; - if (show) + if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.Disabled) return; + + if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.MenuOnly) + { + FuckMetrics.ToggleMetrics(show); + FuckMetrics.ToggleCoreUpdates(show); + } + else if (show) { - CVR_MenuManager.Instance.SendCoreUpdate(); ViewManager.Instance.UpdateMetrics(); + CVR_MenuManager.Instance.SendCoreUpdate(); } } } @@ -36,11 +42,17 @@ class ViewManagerPatches [HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })] private static void Postfix_ViewManager_UiStateToggle(bool show) { - if (!FuckMetricsMod.EntryDisableMetrics.Value) return; - if (show) + if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.Disabled) return; + + if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.MenuOnly) + { + FuckMetrics.ToggleMetrics(show); + FuckMetrics.ToggleCoreUpdates(show); + } + else if (show) { - CVR_MenuManager.Instance.SendCoreUpdate(); ViewManager.Instance.UpdateMetrics(); + CVR_MenuManager.Instance.SendCoreUpdate(); } } } \ No newline at end of file diff --git a/FuckCohtml/Main.cs b/FuckMetrics/Main.cs similarity index 59% rename from FuckCohtml/Main.cs rename to FuckMetrics/Main.cs index 5bd8aec..47883e0 100644 --- a/FuckCohtml/Main.cs +++ b/FuckMetrics/Main.cs @@ -9,11 +9,18 @@ public class FuckMetricsMod : MelonMod public const string SettingsCategory = "FuckMetrics"; public static readonly MelonPreferences_Category CategoryFuckMetrics = MelonPreferences.CreateCategory(SettingsCategory); - public static readonly MelonPreferences_Entry EntryDisableMetrics = - CategoryFuckMetrics.CreateEntry("Disable Metrics", true, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); + public static readonly MelonPreferences_Entry EntryDisableMetrics = + CategoryFuckMetrics.CreateEntry("Menu Metrics", SettingState.MenuOnly, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); - public static readonly MelonPreferences_Entry EntryDisableCoreUpdates = - CategoryFuckMetrics.CreateEntry("Disable Core Updates", true, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); + public static readonly MelonPreferences_Entry EntryDisableCoreUpdates = + CategoryFuckMetrics.CreateEntry("Menu Core Updates", SettingState.MenuOnly, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); + + public enum SettingState + { + Enabled, + MenuOnly, + Disabled + } public override void OnInitializeMelon() { @@ -27,12 +34,12 @@ public class FuckMetricsMod : MelonMod private void OnDisableMetrics(object arg1, object arg2) { - FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value); + FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == SettingState.Enabled); } private void OnDisableCoreUpdates(object arg1, object arg2) { - FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value); + FuckMetrics.ToggleCoreUpdates(EntryDisableMetrics.Value == SettingState.Enabled); } private void ApplyPatches(Type type) diff --git a/FuckCohtml/ManagedLibs/.keep b/FuckMetrics/ManagedLibs/.keep similarity index 100% rename from FuckCohtml/ManagedLibs/.keep rename to FuckMetrics/ManagedLibs/.keep diff --git a/FuckCohtml/Properties/AssemblyInfo.cs b/FuckMetrics/Properties/AssemblyInfo.cs similarity index 100% rename from FuckCohtml/Properties/AssemblyInfo.cs rename to FuckMetrics/Properties/AssemblyInfo.cs diff --git a/FuckCohtml/format.json b/FuckMetrics/format.json similarity index 100% rename from FuckCohtml/format.json rename to FuckMetrics/format.json From 994d04fe9a161b4a751366ce3ef488ee921f6e2b Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 02:25:41 -0500 Subject: [PATCH 13/27] yeah --- FuckMetrics/FuckMetrics.cs | 12 +++++----- FuckMetrics/HarmonyPatches.cs | 44 +++++++++++++++++++---------------- FuckMetrics/Main.cs | 31 ++++++++++++++++-------- 3 files changed, 51 insertions(+), 36 deletions(-) diff --git a/FuckMetrics/FuckMetrics.cs b/FuckMetrics/FuckMetrics.cs index f253ea0..0a91127 100644 --- a/FuckMetrics/FuckMetrics.cs +++ b/FuckMetrics/FuckMetrics.cs @@ -5,27 +5,27 @@ namespace NAK.Melons.FuckMetrics { public static class FuckMetrics { - public static void ToggleMetrics(bool disable) + public static void ToggleMetrics(bool enable) { var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "UpdateMetrics").Job; - if (!disable && job == null) + if (enable && job == null) { SchedulerSystem.AddJob(new SchedulerSystem.Job(ViewManager.Instance.UpdateMetrics), 0f, 0.5f, -1); } - else if (disable && job != null) + else if (!enable && job != null) { SchedulerSystem.RemoveJob(job); } } - public static void ToggleCoreUpdates(bool disable) + public static void ToggleCoreUpdates(bool enable) { var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "SendCoreUpdate").Job; - if (!disable && job == null) + if (enable && job == null) { SchedulerSystem.AddJob(new SchedulerSystem.Job(CVR_MenuManager.Instance.SendCoreUpdate), 0f, 0.1f, -1); } - else if (disable && job != null) + else if (!enable && job != null) { SchedulerSystem.RemoveJob(job); } diff --git a/FuckMetrics/HarmonyPatches.cs b/FuckMetrics/HarmonyPatches.cs index e897efe..1cf1233 100644 --- a/FuckMetrics/HarmonyPatches.cs +++ b/FuckMetrics/HarmonyPatches.cs @@ -1,36 +1,32 @@ using ABI_RC.Core.InteractionSystem; -using ABI_RC.Core.Player; using HarmonyLib; namespace NAK.Melons.FuckMetrics.HarmonyPatches; -class PlayerSetupPatches -{ - [HarmonyPostfix] - [HarmonyPatch(typeof(PlayerSetup), "Start")] - private static void Postfix_PlayerSetup_Start() - { - FuckMetrics.ToggleMetrics(FuckMetricsMod.EntryDisableMetrics.Value == FuckMetricsMod.SettingState.Enabled); - FuckMetrics.ToggleCoreUpdates(FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.Enabled); - } -} - class CVR_MenuManagerPatches { [HarmonyPostfix] [HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })] private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show) { - if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.Disabled) return; + var disableMetrics = FuckMetricsMod.EntryDisableMetrics.Value; + var disableCoreUpdates = FuckMetricsMod.EntryDisableCoreUpdates.Value; - if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.MenuOnly) + if (disableMetrics == FuckMetricsMod.SettingState.MenuOnly) { FuckMetrics.ToggleMetrics(show); - FuckMetrics.ToggleCoreUpdates(show); } - else if (show) + else if (disableMetrics == FuckMetricsMod.SettingState.Disabled && show) { ViewManager.Instance.UpdateMetrics(); + } + + if (disableCoreUpdates == FuckMetricsMod.SettingState.MenuOnly) + { + FuckMetrics.ToggleCoreUpdates(show); + } + else if (disableCoreUpdates == FuckMetricsMod.SettingState.Disabled && show) + { CVR_MenuManager.Instance.SendCoreUpdate(); } } @@ -42,16 +38,24 @@ class ViewManagerPatches [HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })] private static void Postfix_ViewManager_UiStateToggle(bool show) { - if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.Disabled) return; + var disableMetrics = FuckMetricsMod.EntryDisableMetrics.Value; + var disableCoreUpdates = FuckMetricsMod.EntryDisableCoreUpdates.Value; - if (FuckMetricsMod.EntryDisableCoreUpdates.Value == FuckMetricsMod.SettingState.MenuOnly) + if (disableMetrics == FuckMetricsMod.SettingState.MenuOnly) { FuckMetrics.ToggleMetrics(show); - FuckMetrics.ToggleCoreUpdates(show); } - else if (show) + else if (disableMetrics == FuckMetricsMod.SettingState.Disabled && show) { ViewManager.Instance.UpdateMetrics(); + } + + if (disableCoreUpdates == FuckMetricsMod.SettingState.MenuOnly) + { + FuckMetrics.ToggleCoreUpdates(show); + } + else if (disableCoreUpdates == FuckMetricsMod.SettingState.Disabled && show) + { CVR_MenuManager.Instance.SendCoreUpdate(); } } diff --git a/FuckMetrics/Main.cs b/FuckMetrics/Main.cs index 47883e0..fa0284e 100644 --- a/FuckMetrics/Main.cs +++ b/FuckMetrics/Main.cs @@ -1,11 +1,11 @@ -using MelonLoader; +using ABI_RC.Core.Player; +using MelonLoader; +using System.Collections; namespace NAK.Melons.FuckMetrics; public class FuckMetricsMod : MelonMod { - public static MelonLogger.Instance Logger; - public const string SettingsCategory = "FuckMetrics"; public static readonly MelonPreferences_Category CategoryFuckMetrics = MelonPreferences.CreateCategory(SettingsCategory); @@ -17,29 +17,40 @@ public class FuckMetricsMod : MelonMod public enum SettingState { - Enabled, + Always, MenuOnly, Disabled } public override void OnInitializeMelon() { - Logger = LoggerInstance; EntryDisableMetrics.OnEntryValueChangedUntyped.Subscribe(OnDisableMetrics); EntryDisableCoreUpdates.OnEntryValueChangedUntyped.Subscribe(OnDisableCoreUpdates); - ApplyPatches(typeof(HarmonyPatches.PlayerSetupPatches)); ApplyPatches(typeof(HarmonyPatches.CVR_MenuManagerPatches)); ApplyPatches(typeof(HarmonyPatches.ViewManagerPatches)); + MelonCoroutines.Start(WaitForLocalPlayer()); + } + + IEnumerator WaitForLocalPlayer() + { + yield return PlayerSetup.Instance == null; + UpdateSettings(); } private void OnDisableMetrics(object arg1, object arg2) { - FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == SettingState.Enabled); + FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == SettingState.Always); } private void OnDisableCoreUpdates(object arg1, object arg2) { - FuckMetrics.ToggleCoreUpdates(EntryDisableMetrics.Value == SettingState.Enabled); + FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == SettingState.Always); + } + + private void UpdateSettings() + { + FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == SettingState.Always); + FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == SettingState.Always); } private void ApplyPatches(Type type) @@ -50,8 +61,8 @@ public class FuckMetricsMod : MelonMod } catch (Exception e) { - Logger.Msg($"Failed while patching {type.Name}!"); - Logger.Error(e); + LoggerInstance.Msg($"Failed while patching {type.Name}!"); + LoggerInstance.Error(e); } } } \ No newline at end of file From 586e20d663bb6cb9fa9936defba20f9c05d4e1e0 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 02:27:50 -0500 Subject: [PATCH 14/27] a --- FuckMetrics/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FuckMetrics/Main.cs b/FuckMetrics/Main.cs index fa0284e..b1647f8 100644 --- a/FuckMetrics/Main.cs +++ b/FuckMetrics/Main.cs @@ -33,7 +33,7 @@ public class FuckMetricsMod : MelonMod IEnumerator WaitForLocalPlayer() { - yield return PlayerSetup.Instance == null; + yield return PlayerSetup.Instance != null; UpdateSettings(); } From 6106aba2151ee37dea3ac5b93fbcdd2e402ecaff Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 02:40:29 -0500 Subject: [PATCH 15/27] Add Update Rate floats --- FuckMetrics/FuckMetrics.cs | 4 ++-- FuckMetrics/Main.cs | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/FuckMetrics/FuckMetrics.cs b/FuckMetrics/FuckMetrics.cs index 0a91127..01593e9 100644 --- a/FuckMetrics/FuckMetrics.cs +++ b/FuckMetrics/FuckMetrics.cs @@ -10,7 +10,7 @@ namespace NAK.Melons.FuckMetrics var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "UpdateMetrics").Job; if (enable && job == null) { - SchedulerSystem.AddJob(new SchedulerSystem.Job(ViewManager.Instance.UpdateMetrics), 0f, 0.5f, -1); + SchedulerSystem.AddJob(new SchedulerSystem.Job(ViewManager.Instance.UpdateMetrics), 0f, FuckMetricsMod.EntryMetricsUpdateRate.Value, -1); } else if (!enable && job != null) { @@ -23,7 +23,7 @@ namespace NAK.Melons.FuckMetrics var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "SendCoreUpdate").Job; if (enable && job == null) { - SchedulerSystem.AddJob(new SchedulerSystem.Job(CVR_MenuManager.Instance.SendCoreUpdate), 0f, 0.1f, -1); + SchedulerSystem.AddJob(new SchedulerSystem.Job(CVR_MenuManager.Instance.SendCoreUpdate), 0f, FuckMetricsMod.EntryCoreUpdateRate.Value, -1); } else if (!enable && job != null) { diff --git a/FuckMetrics/Main.cs b/FuckMetrics/Main.cs index b1647f8..457b211 100644 --- a/FuckMetrics/Main.cs +++ b/FuckMetrics/Main.cs @@ -15,6 +15,12 @@ public class FuckMetricsMod : MelonMod public static readonly MelonPreferences_Entry EntryDisableCoreUpdates = CategoryFuckMetrics.CreateEntry("Menu Core Updates", SettingState.MenuOnly, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); + public static readonly MelonPreferences_Entry EntryMetricsUpdateRate = + CategoryFuckMetrics.CreateEntry("Metrics Update Rate", 1f, description: "Sets the update rate for the menu metrics. Default is 0.5f. Recommended to be 1f or higher."); + + public static readonly MelonPreferences_Entry EntryCoreUpdateRate = + CategoryFuckMetrics.CreateEntry("Core Update Rate", 2f, description: "Sets the update rate for the menu core updates. Default is 0.1f. Recommended to be 2f or higher."); + public enum SettingState { Always, @@ -33,7 +39,8 @@ public class FuckMetricsMod : MelonMod IEnumerator WaitForLocalPlayer() { - yield return PlayerSetup.Instance != null; + while (PlayerSetup.Instance == null) + yield return null; UpdateSettings(); } From f6e2c1622a49e622e7f3395953d20958ad8f63fb Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 02:43:02 -0500 Subject: [PATCH 16/27] Update format.json --- FuckMetrics/format.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FuckMetrics/format.json b/FuckMetrics/format.json index 54ce3d2..88a2cb6 100644 --- a/FuckMetrics/format.json +++ b/FuckMetrics/format.json @@ -1,12 +1,12 @@ { - "_id": -1, + "_id": 135, "name": "FuckMetrics", "modversion": "1.0.1", "gameversion": "2022r170", "loaderversion": "0.5.7", "modtype": "Mod", "author": "NotAKidoS", - "description": "This mod disables UpdateMetrics & SendCoreUpdate on the menus while closed. This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances.\n\nPlease view the Github README for more info.", + "description": "This mod limits UpdateMetrics & SendCoreUpdate while the menus are closed. This helps to alleviate hitching and performance issues, particularly with FPS drops while unmuted in online instances and VRIK tapping in place.\n\nPlease view the Github README for more info.", "searchtags": [ "cohtml", "menus", @@ -19,6 +19,6 @@ ], "downloadlink": "https://github.com/NotAKidOnSteam/FuckMetrics/releases/download/v1.0.1/FuckMetrics.dll", "sourcelink": "https://github.com/NotAKidOnSteam/FuckMetrics/", - "changelog": "- Initial Release\n- Renamed to FuckMetrics", + "changelog": "- Initial Release\n- Renamed to FuckMetrics\n- Add Update Rate settings", "embedcolor": "#8ed6fb" } \ No newline at end of file From ee36665bc8b2354e856b65a86c76abced25e05eb Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 02:45:19 -0500 Subject: [PATCH 17/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5da75e7..6176fbc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # FuckMetrics -This mod disables realtime metrics and core menu updates (fps, ping, gamerule icons, ect). This helps to alleviate any hitching and performance issues that may arise, particularly with FPS drops while unmuted in online instances. This also helps prevent VRIK from constantly stepping in place while in VR. +This mod limits UpdateMetrics & SendCoreUpdate while the menus are closed. This helps to alleviate hitching and performance issues, particularly with FPS drops while unmuted in online instances and VRIK tapping in place. ## Examples From 87bb3fcb8959931e962c8353f8babc01521eebff Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 03:22:03 -0500 Subject: [PATCH 18/27] Add back CohtmlView disabling. --- FuckMetrics/FuckMetrics.cs | 24 ++++++++++++++++++++++++ FuckMetrics/FuckMetrics.csproj | 2 +- FuckMetrics/HarmonyPatches.cs | 28 ++++++++++++++++++++++++++++ FuckMetrics/Main.cs | 31 ++++++++++++++++++++++++++++--- 4 files changed, 81 insertions(+), 4 deletions(-) diff --git a/FuckMetrics/FuckMetrics.cs b/FuckMetrics/FuckMetrics.cs index 01593e9..d02169d 100644 --- a/FuckMetrics/FuckMetrics.cs +++ b/FuckMetrics/FuckMetrics.cs @@ -1,5 +1,8 @@ using ABI_RC.Core.InteractionSystem; using ABI_RC.Core.IO; +using cohtml; +using HarmonyLib; +using UnityEngine; namespace NAK.Melons.FuckMetrics { @@ -30,5 +33,26 @@ namespace NAK.Melons.FuckMetrics SchedulerSystem.RemoveJob(job); } } + + public static void CohtmlAdvanceView(CohtmlView cohtmlView, Traverse menuOpenTraverse) + { + if (!FuckMetricsMod.EntryDisableCohtmlViewOnIdle.Value) return; + + // Don't execute if menu is open + if (cohtmlView == null || menuOpenTraverse.GetValue()) return; + + // Disable cohtmlView (opening should enable) + cohtmlView.enabled = false; + + // Death + try + { + if (cohtmlView.m_UISystem != null) cohtmlView.View.Advance(cohtmlView.m_UISystem.Id, (double)Time.unscaledTime * 1000.0); + } + catch (Exception e) + { + FuckMetricsMod.Logger.Error($"An exception was thrown while calling CohtmlView.Advance(). Error message: {e.Message}"); + } + } } } diff --git a/FuckMetrics/FuckMetrics.csproj b/FuckMetrics/FuckMetrics.csproj index 10c4ff7..a930aa0 100644 --- a/FuckMetrics/FuckMetrics.csproj +++ b/FuckMetrics/FuckMetrics.csproj @@ -23,7 +23,7 @@ ..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll - ..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll + ManagedLibs\Cohtml.Runtime.dll C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll diff --git a/FuckMetrics/HarmonyPatches.cs b/FuckMetrics/HarmonyPatches.cs index 1cf1233..6b91273 100644 --- a/FuckMetrics/HarmonyPatches.cs +++ b/FuckMetrics/HarmonyPatches.cs @@ -1,4 +1,6 @@ using ABI_RC.Core.InteractionSystem; +using ABI_RC.Core.IO; +using cohtml; using HarmonyLib; namespace NAK.Melons.FuckMetrics.HarmonyPatches; @@ -59,4 +61,30 @@ class ViewManagerPatches CVR_MenuManager.Instance.SendCoreUpdate(); } } +} + +public static class CohtmlViewPatches +{ + private static CohtmlView _quickMenuView; + private static CohtmlView _gameMenuView; + private static Traverse _quickMenuOpenTraverse; + private static Traverse _gameMenuOpenTraverse; + + [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(() => FuckMetrics.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(() => FuckMetrics.CohtmlAdvanceView(_gameMenuView, _gameMenuOpenTraverse)), 12f, 6f, -1); + } } \ No newline at end of file diff --git a/FuckMetrics/Main.cs b/FuckMetrics/Main.cs index 457b211..31ab736 100644 --- a/FuckMetrics/Main.cs +++ b/FuckMetrics/Main.cs @@ -6,9 +6,13 @@ namespace NAK.Melons.FuckMetrics; public class FuckMetricsMod : MelonMod { + public static MelonLogger.Instance Logger; public const string SettingsCategory = "FuckMetrics"; public static readonly MelonPreferences_Category CategoryFuckMetrics = MelonPreferences.CreateCategory(SettingsCategory); + public static readonly MelonPreferences_Entry EntryDisableCohtmlViewOnIdle = + CategoryFuckMetrics.CreateEntry("Disable CohtmlView On Idle", false, description: "Disables CohtmlView on the menus when idle. This can give a huge performance boost."); + public static readonly MelonPreferences_Entry EntryDisableMetrics = CategoryFuckMetrics.CreateEntry("Menu Metrics", SettingState.MenuOnly, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); @@ -20,7 +24,6 @@ public class FuckMetricsMod : MelonMod public static readonly MelonPreferences_Entry EntryCoreUpdateRate = CategoryFuckMetrics.CreateEntry("Core Update Rate", 2f, description: "Sets the update rate for the menu core updates. Default is 0.1f. Recommended to be 2f or higher."); - public enum SettingState { Always, @@ -30,10 +33,14 @@ public class FuckMetricsMod : MelonMod public override void OnInitializeMelon() { + Logger = LoggerInstance; EntryDisableMetrics.OnEntryValueChangedUntyped.Subscribe(OnDisableMetrics); EntryDisableCoreUpdates.OnEntryValueChangedUntyped.Subscribe(OnDisableCoreUpdates); + EntryMetricsUpdateRate.OnEntryValueChangedUntyped.Subscribe(OnChangeMetricsUpdateRate); + EntryCoreUpdateRate.OnEntryValueChangedUntyped.Subscribe(OnChangeCoreUpdateRate); ApplyPatches(typeof(HarmonyPatches.CVR_MenuManagerPatches)); ApplyPatches(typeof(HarmonyPatches.ViewManagerPatches)); + ApplyPatches(typeof(HarmonyPatches.CohtmlViewPatches)); MelonCoroutines.Start(WaitForLocalPlayer()); } @@ -60,6 +67,24 @@ public class FuckMetricsMod : MelonMod FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == SettingState.Always); } + private void OnChangeMetricsUpdateRate(object arg1, object arg2) + { + if (EntryDisableMetrics.Value != SettingState.Disabled) + { + FuckMetrics.ToggleMetrics(false); + FuckMetrics.ToggleMetrics(true); + } + } + + private void OnChangeCoreUpdateRate(object arg1, object arg2) + { + if (EntryDisableCoreUpdates.Value != SettingState.Disabled) + { + FuckMetrics.ToggleCoreUpdates(false); + FuckMetrics.ToggleCoreUpdates(true); + } + } + private void ApplyPatches(Type type) { try @@ -68,8 +93,8 @@ public class FuckMetricsMod : MelonMod } catch (Exception e) { - LoggerInstance.Msg($"Failed while patching {type.Name}!"); - LoggerInstance.Error(e); + Logger.Msg($"Failed while patching {type.Name}!"); + Logger.Error(e); } } } \ No newline at end of file From c00dd57a77b1c9c74c800d5be7591d60bcff6fba Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 03:24:21 -0500 Subject: [PATCH 19/27] push --- FuckMetrics/Main.cs | 2 +- FuckMetrics/Properties/AssemblyInfo.cs | 2 +- FuckMetrics/format.json | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FuckMetrics/Main.cs b/FuckMetrics/Main.cs index 31ab736..cdc051d 100644 --- a/FuckMetrics/Main.cs +++ b/FuckMetrics/Main.cs @@ -11,7 +11,7 @@ public class FuckMetricsMod : MelonMod public static readonly MelonPreferences_Category CategoryFuckMetrics = MelonPreferences.CreateCategory(SettingsCategory); public static readonly MelonPreferences_Entry EntryDisableCohtmlViewOnIdle = - CategoryFuckMetrics.CreateEntry("Disable CohtmlView On Idle", false, description: "Disables CohtmlView on the menus when idle. This can give a huge performance boost."); + CategoryFuckMetrics.CreateEntry("Disable CohtmlView On Idle", false, description: "Disables CohtmlView on the menus when idle. Takes up to 6 seconds after menu exit. This can give a huge performance boost."); public static readonly MelonPreferences_Entry EntryDisableMetrics = CategoryFuckMetrics.CreateEntry("Menu Metrics", SettingState.MenuOnly, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); diff --git a/FuckMetrics/Properties/AssemblyInfo.cs b/FuckMetrics/Properties/AssemblyInfo.cs index 389282b..e77d921 100644 --- a/FuckMetrics/Properties/AssemblyInfo.cs +++ b/FuckMetrics/Properties/AssemblyInfo.cs @@ -26,6 +26,6 @@ using System.Reflection; namespace NAK.Melons.FuckMetrics.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.1"; + public const string Version = "1.0.2"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/FuckMetrics/format.json b/FuckMetrics/format.json index 88a2cb6..e5b314b 100644 --- a/FuckMetrics/format.json +++ b/FuckMetrics/format.json @@ -1,7 +1,7 @@ { "_id": 135, "name": "FuckMetrics", - "modversion": "1.0.1", + "modversion": "1.0.2", "gameversion": "2022r170", "loaderversion": "0.5.7", "modtype": "Mod", @@ -17,8 +17,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/FuckMetrics/releases/download/v1.0.1/FuckMetrics.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/FuckMetrics/releases/download/v1.0.2/FuckMetrics.dll", "sourcelink": "https://github.com/NotAKidOnSteam/FuckMetrics/", - "changelog": "- Initial Release\n- Renamed to FuckMetrics\n- Add Update Rate settings", + "changelog": "- Initial Release.\n- Renamed to FuckMetrics.\n- Add Update Rate settings.\n- Add back CohtmlView disabling as option.", "embedcolor": "#8ed6fb" } \ No newline at end of file From b9ae7e96cce59d486a7876c2a0e8ee506e4d609e Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 03:33:20 -0500 Subject: [PATCH 20/27] Update README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 6176fbc..a6d4b51 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,21 @@ This mod limits UpdateMetrics & SendCoreUpdate while the menus are closed. This helps to alleviate hitching and performance issues, particularly with FPS drops while unmuted in online instances and VRIK tapping in place. +## Settings + +* Disable CohtmlView On Idle + - Disables CohtmlView on the menus when idle. Takes up to 6 seconds after menu exit. This can give a huge performance boost, but is disabled by default as Cohtml can be unpredictable. +* Menu Metrics + - Menu metrics settings (FPS & Ping). Always, Menu Only, or Disabled. Updates once on menu open if disabled. +* Menu Core Updates + - Menu core update settings (Gamerule icons & download debug status). Always, Menu Only, or Disabled. Updates once on menu open if disabled. +* Metrics Update Rate + - Sets the update rate for the menu metrics. CVR default is 0.5f. Recommended to be 1f or higher. +* Core Update Rate + - Sets the update rate for the menu core updates. CVR default is 0.1f. Recommended to be 2f or higher as it is intensive. + +In general, keeping Menu Metrics & Menu Core Updates to Menu Only with a high Update Rate (in seconds), should be enough for smooth gameplay. Only turn on Disable CohtmlView On Idle if you really wanna squeeze performance, as Cohtml can sometimes freak out when disabled. + ## Examples The following clips demonstrate the difference in performance with and without the FuckCohtml mod. While not a scientifically rigorous comparison, it is clear that there is a significant performance hit when unmuted, causing Dynamic Bones to jitter, in the clip without the mod: From b9f11dbca070be578f74a16a7e73c8071c3c41b7 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 23:35:05 -0500 Subject: [PATCH 21/27] update if QM is open --- FuckMetrics/HarmonyPatches.cs | 13 +++++++++++++ FuckMetrics/Properties/AssemblyInfo.cs | 2 +- FuckMetrics/format.json | 6 +++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/FuckMetrics/HarmonyPatches.cs b/FuckMetrics/HarmonyPatches.cs index 6b91273..1918f1d 100644 --- a/FuckMetrics/HarmonyPatches.cs +++ b/FuckMetrics/HarmonyPatches.cs @@ -87,4 +87,17 @@ public static class CohtmlViewPatches _gameMenuOpenTraverse = Traverse.Create(__instance).Field("_gameMenuOpen"); SchedulerSystem.AddJob(new SchedulerSystem.Job(() => FuckMetrics.CohtmlAdvanceView(_gameMenuView, _gameMenuOpenTraverse)), 12f, 6f, -1); } + + [HarmonyPostfix] + [HarmonyPatch(typeof(ViewManager), "OnMicrophoneStatusSwitched")] + private static void Postfix_ViewManager_OnMicrophoneStatusSwitched() + { + if (_quickMenuOpenTraverse.GetValue()) + { + if (FuckMetricsMod.EntryDisableMetrics.Value != FuckMetricsMod.SettingState.Always) + { + CVR_MenuManager.Instance.SendCoreUpdate(); + } + } + } } \ No newline at end of file diff --git a/FuckMetrics/Properties/AssemblyInfo.cs b/FuckMetrics/Properties/AssemblyInfo.cs index e77d921..fb85d2c 100644 --- a/FuckMetrics/Properties/AssemblyInfo.cs +++ b/FuckMetrics/Properties/AssemblyInfo.cs @@ -26,6 +26,6 @@ using System.Reflection; namespace NAK.Melons.FuckMetrics.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.2"; + public const string Version = "1.0.3"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/FuckMetrics/format.json b/FuckMetrics/format.json index e5b314b..c42c743 100644 --- a/FuckMetrics/format.json +++ b/FuckMetrics/format.json @@ -1,7 +1,7 @@ { "_id": 135, "name": "FuckMetrics", - "modversion": "1.0.2", + "modversion": "1.0.3", "gameversion": "2022r170", "loaderversion": "0.5.7", "modtype": "Mod", @@ -17,8 +17,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/FuckMetrics/releases/download/v1.0.2/FuckMetrics.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/FuckMetrics/releases/download/v1.0.3/FuckMetrics.dll", "sourcelink": "https://github.com/NotAKidOnSteam/FuckMetrics/", - "changelog": "- Initial Release.\n- Renamed to FuckMetrics.\n- Add Update Rate settings.\n- Add back CohtmlView disabling as option.", + "changelog": "- Initial Release.\n- Renamed to FuckMetrics.\n- Add Update Rate settings.\n- Add back CohtmlView disabling as option.\n- Update CoreUpdate on mic toggle if QM is open.", "embedcolor": "#8ed6fb" } \ No newline at end of file From 453d8023c187b66d6030893f7b0f4dff1f50444e Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 16 Mar 2023 23:59:10 -0500 Subject: [PATCH 22/27] what --- FuckMetrics/FuckMetrics.cs | 37 +++++++++++ FuckMetrics/HarmonyPatches.cs | 120 ++++++++++++---------------------- FuckMetrics/Main.cs | 38 +++++------ 3 files changed, 95 insertions(+), 100 deletions(-) diff --git a/FuckMetrics/FuckMetrics.cs b/FuckMetrics/FuckMetrics.cs index d02169d..bb42b26 100644 --- a/FuckMetrics/FuckMetrics.cs +++ b/FuckMetrics/FuckMetrics.cs @@ -8,6 +8,13 @@ namespace NAK.Melons.FuckMetrics { public static class FuckMetrics { + public enum SettingState + { + Always, + MenuOnly, + Disabled + } + public static void ToggleMetrics(bool enable) { var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "UpdateMetrics").Job; @@ -34,6 +41,36 @@ namespace NAK.Melons.FuckMetrics } } + public static void ApplyMetricsSettings(bool show) + { + var disableMetrics = FuckMetricsMod.EntryDisableMetrics.Value; + if (disableMetrics == FuckMetrics.SettingState.Always) return; + + if (disableMetrics == FuckMetrics.SettingState.MenuOnly) + { + FuckMetrics.ToggleMetrics(show); + } + else if (disableMetrics == FuckMetrics.SettingState.Disabled && show) + { + ViewManager.Instance.UpdateMetrics(); + } + } + + public static void ApplyCoreUpdatesSettings(bool show) + { + var disableCoreUpdates = FuckMetricsMod.EntryDisableCoreUpdates.Value; + if (disableCoreUpdates == FuckMetrics.SettingState.Always) return; + + if (disableCoreUpdates == FuckMetrics.SettingState.MenuOnly) + { + FuckMetrics.ToggleCoreUpdates(show); + } + else if (disableCoreUpdates == FuckMetrics.SettingState.Disabled && show) + { + CVR_MenuManager.Instance.SendCoreUpdate(); + } + } + public static void CohtmlAdvanceView(CohtmlView cohtmlView, Traverse menuOpenTraverse) { if (!FuckMetricsMod.EntryDisableCohtmlViewOnIdle.Value) return; diff --git a/FuckMetrics/HarmonyPatches.cs b/FuckMetrics/HarmonyPatches.cs index 1918f1d..742c433 100644 --- a/FuckMetrics/HarmonyPatches.cs +++ b/FuckMetrics/HarmonyPatches.cs @@ -3,101 +3,63 @@ using ABI_RC.Core.IO; using cohtml; using HarmonyLib; -namespace NAK.Melons.FuckMetrics.HarmonyPatches; - -class CVR_MenuManagerPatches +namespace NAK.Melons.FuckMetrics.HarmonyPatches { - [HarmonyPostfix] - [HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })] - private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show) + public static class CVR_MenuManagerPatches { - var disableMetrics = FuckMetricsMod.EntryDisableMetrics.Value; - var disableCoreUpdates = FuckMetricsMod.EntryDisableCoreUpdates.Value; - - if (disableMetrics == FuckMetricsMod.SettingState.MenuOnly) + [HarmonyPostfix] + [HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })] + private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show) { - FuckMetrics.ToggleMetrics(show); - } - else if (disableMetrics == FuckMetricsMod.SettingState.Disabled && show) - { - ViewManager.Instance.UpdateMetrics(); - } - - if (disableCoreUpdates == FuckMetricsMod.SettingState.MenuOnly) - { - FuckMetrics.ToggleCoreUpdates(show); - } - else if (disableCoreUpdates == FuckMetricsMod.SettingState.Disabled && show) - { - CVR_MenuManager.Instance.SendCoreUpdate(); + FuckMetrics.ApplyMetricsSettings(show); + FuckMetrics.ApplyCoreUpdatesSettings(show); } } -} -class ViewManagerPatches -{ - [HarmonyPostfix] - [HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })] - private static void Postfix_ViewManager_UiStateToggle(bool show) + public static class ViewManagerPatches { - var disableMetrics = FuckMetricsMod.EntryDisableMetrics.Value; - var disableCoreUpdates = FuckMetricsMod.EntryDisableCoreUpdates.Value; - - if (disableMetrics == FuckMetricsMod.SettingState.MenuOnly) + [HarmonyPostfix] + [HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })] + private static void Postfix_ViewManager_UiStateToggle(bool show) { - FuckMetrics.ToggleMetrics(show); - } - else if (disableMetrics == FuckMetricsMod.SettingState.Disabled && show) - { - ViewManager.Instance.UpdateMetrics(); - } - - if (disableCoreUpdates == FuckMetricsMod.SettingState.MenuOnly) - { - FuckMetrics.ToggleCoreUpdates(show); - } - else if (disableCoreUpdates == FuckMetricsMod.SettingState.Disabled && show) - { - CVR_MenuManager.Instance.SendCoreUpdate(); + FuckMetrics.ApplyMetricsSettings(show); + FuckMetrics.ApplyCoreUpdatesSettings(show); } } -} -public static class CohtmlViewPatches -{ - private static CohtmlView _quickMenuView; - private static CohtmlView _gameMenuView; - private static Traverse _quickMenuOpenTraverse; - private static Traverse _gameMenuOpenTraverse; - - [HarmonyPostfix] - [HarmonyPatch(typeof(CVR_MenuManager), "Start")] - private static void Postfix_CVR_MenuManager_Start(ref CVR_MenuManager __instance, ref CohtmlView ___quickMenu) + public static class CohtmlViewPatches { - _quickMenuView = ___quickMenu; - _quickMenuOpenTraverse = Traverse.Create(__instance).Field("_quickMenuOpen"); - SchedulerSystem.AddJob(new SchedulerSystem.Job(() => FuckMetrics.CohtmlAdvanceView(_quickMenuView, _quickMenuOpenTraverse)), 15f, 6f, -1); - } + private static CohtmlView _quickMenuView; + private static CohtmlView _gameMenuView; + private static Traverse _quickMenuOpenTraverse; + private static Traverse _gameMenuOpenTraverse; - [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(() => FuckMetrics.CohtmlAdvanceView(_gameMenuView, _gameMenuOpenTraverse)), 12f, 6f, -1); - } - - [HarmonyPostfix] - [HarmonyPatch(typeof(ViewManager), "OnMicrophoneStatusSwitched")] - private static void Postfix_ViewManager_OnMicrophoneStatusSwitched() - { - if (_quickMenuOpenTraverse.GetValue()) + [HarmonyPostfix] + [HarmonyPatch(typeof(CVR_MenuManager), "Start")] + private static void Postfix_CVRMenuManager_Start(ref CohtmlView ___quickMenu) { - if (FuckMetricsMod.EntryDisableMetrics.Value != FuckMetricsMod.SettingState.Always) + _quickMenuView = ___quickMenu; + _quickMenuOpenTraverse = Traverse.Create().Field("_quickMenuOpen"); + SchedulerSystem.AddJob(() => FuckMetrics.CohtmlAdvanceView(_quickMenuView, _quickMenuOpenTraverse), 15f, 6f, -1); + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(ViewManager), "Start")] + private static void Postfix_ViewManager_Start(ref CohtmlView ___gameMenuView) + { + _gameMenuView = ___gameMenuView; + _gameMenuOpenTraverse = Traverse.Create().Field("_gameMenuOpen"); + SchedulerSystem.AddJob(() => FuckMetrics.CohtmlAdvanceView(_gameMenuView, _gameMenuOpenTraverse), 12f, 6f, -1); + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(ViewManager), "OnMicrophoneStatusSwitched")] + private static void Postfix_ViewManager_OnMicrophoneStatusSwitched() + { + if (_quickMenuOpenTraverse.GetValue()) { CVR_MenuManager.Instance.SendCoreUpdate(); } } } -} \ No newline at end of file +} diff --git a/FuckMetrics/Main.cs b/FuckMetrics/Main.cs index cdc051d..1a40a1e 100644 --- a/FuckMetrics/Main.cs +++ b/FuckMetrics/Main.cs @@ -13,63 +13,59 @@ public class FuckMetricsMod : MelonMod public static readonly MelonPreferences_Entry EntryDisableCohtmlViewOnIdle = CategoryFuckMetrics.CreateEntry("Disable CohtmlView On Idle", false, description: "Disables CohtmlView on the menus when idle. Takes up to 6 seconds after menu exit. This can give a huge performance boost."); - public static readonly MelonPreferences_Entry EntryDisableMetrics = - CategoryFuckMetrics.CreateEntry("Menu Metrics", SettingState.MenuOnly, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); + public static readonly MelonPreferences_Entry EntryDisableMetrics = + CategoryFuckMetrics.CreateEntry("Menu Metrics", FuckMetrics.SettingState.MenuOnly, description: "Disables menu metrics (FPS & Ping). Updates once on menu open if disabled."); - public static readonly MelonPreferences_Entry EntryDisableCoreUpdates = - CategoryFuckMetrics.CreateEntry("Menu Core Updates", SettingState.MenuOnly, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); + public static readonly MelonPreferences_Entry EntryDisableCoreUpdates = + CategoryFuckMetrics.CreateEntry("Menu Core Updates", FuckMetrics.SettingState.MenuOnly, description: "Disables menu core updates (Gamerule Icons & Debug Status). Updates once on menu open if disabled."); public static readonly MelonPreferences_Entry EntryMetricsUpdateRate = CategoryFuckMetrics.CreateEntry("Metrics Update Rate", 1f, description: "Sets the update rate for the menu metrics. Default is 0.5f. Recommended to be 1f or higher."); public static readonly MelonPreferences_Entry EntryCoreUpdateRate = CategoryFuckMetrics.CreateEntry("Core Update Rate", 2f, description: "Sets the update rate for the menu core updates. Default is 0.1f. Recommended to be 2f or higher."); - public enum SettingState - { - Always, - MenuOnly, - Disabled - } public override void OnInitializeMelon() { Logger = LoggerInstance; + EntryDisableMetrics.OnEntryValueChangedUntyped.Subscribe(OnDisableMetrics); EntryDisableCoreUpdates.OnEntryValueChangedUntyped.Subscribe(OnDisableCoreUpdates); EntryMetricsUpdateRate.OnEntryValueChangedUntyped.Subscribe(OnChangeMetricsUpdateRate); EntryCoreUpdateRate.OnEntryValueChangedUntyped.Subscribe(OnChangeCoreUpdateRate); + ApplyPatches(typeof(HarmonyPatches.CVR_MenuManagerPatches)); ApplyPatches(typeof(HarmonyPatches.ViewManagerPatches)); ApplyPatches(typeof(HarmonyPatches.CohtmlViewPatches)); MelonCoroutines.Start(WaitForLocalPlayer()); } - IEnumerator WaitForLocalPlayer() + private IEnumerator WaitForLocalPlayer() { while (PlayerSetup.Instance == null) yield return null; UpdateSettings(); } + private void UpdateSettings() + { + FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == FuckMetrics.SettingState.Always); + FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == FuckMetrics.SettingState.Always); + } + private void OnDisableMetrics(object arg1, object arg2) { - FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == SettingState.Always); + FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == FuckMetrics.SettingState.Always); } private void OnDisableCoreUpdates(object arg1, object arg2) { - FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == SettingState.Always); - } - - private void UpdateSettings() - { - FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == SettingState.Always); - FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == SettingState.Always); + FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == FuckMetrics.SettingState.Always); } private void OnChangeMetricsUpdateRate(object arg1, object arg2) { - if (EntryDisableMetrics.Value != SettingState.Disabled) + if (EntryDisableMetrics.Value != FuckMetrics.SettingState.Disabled) { FuckMetrics.ToggleMetrics(false); FuckMetrics.ToggleMetrics(true); @@ -78,7 +74,7 @@ public class FuckMetricsMod : MelonMod private void OnChangeCoreUpdateRate(object arg1, object arg2) { - if (EntryDisableCoreUpdates.Value != SettingState.Disabled) + if (EntryDisableCoreUpdates.Value != FuckMetrics.SettingState.Disabled) { FuckMetrics.ToggleCoreUpdates(false); FuckMetrics.ToggleCoreUpdates(true); From ea1e0da1ce4f1c7bb4d4a94ec3f8331e0a71e407 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Fri, 17 Mar 2023 00:13:46 -0500 Subject: [PATCH 23/27] braindead --- FuckMetrics/FuckMetrics.cs | 120 +++++++++++++++++----------------- FuckMetrics/HarmonyPatches.cs | 95 +++++++++++++-------------- 2 files changed, 107 insertions(+), 108 deletions(-) diff --git a/FuckMetrics/FuckMetrics.cs b/FuckMetrics/FuckMetrics.cs index bb42b26..c6010d3 100644 --- a/FuckMetrics/FuckMetrics.cs +++ b/FuckMetrics/FuckMetrics.cs @@ -4,87 +4,87 @@ using cohtml; using HarmonyLib; using UnityEngine; -namespace NAK.Melons.FuckMetrics +namespace NAK.Melons.FuckMetrics; + +public static class FuckMetrics { - public static class FuckMetrics + public enum SettingState { - public enum SettingState + Always, + MenuOnly, + Disabled + } + + public static void ToggleMetrics(bool enable) + { + var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "UpdateMetrics").Job; + if (enable && job == null) { - Always, - MenuOnly, - Disabled + SchedulerSystem.AddJob(new SchedulerSystem.Job(ViewManager.Instance.UpdateMetrics), 0f, FuckMetricsMod.EntryMetricsUpdateRate.Value, -1); } - - public static void ToggleMetrics(bool enable) + else if (!enable && job != null) { - var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "UpdateMetrics").Job; - if (enable && job == null) - { - SchedulerSystem.AddJob(new SchedulerSystem.Job(ViewManager.Instance.UpdateMetrics), 0f, FuckMetricsMod.EntryMetricsUpdateRate.Value, -1); - } - else if (!enable && job != null) - { - SchedulerSystem.RemoveJob(job); - } + SchedulerSystem.RemoveJob(job); } + } - public static void ToggleCoreUpdates(bool enable) + public static void ToggleCoreUpdates(bool enable) + { + var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "SendCoreUpdate").Job; + if (enable && job == null) { - var job = SchedulerSystem.Instance.activeJobs.FirstOrDefault(pair => pair.Job.Method.Name == "SendCoreUpdate").Job; - if (enable && job == null) - { - SchedulerSystem.AddJob(new SchedulerSystem.Job(CVR_MenuManager.Instance.SendCoreUpdate), 0f, FuckMetricsMod.EntryCoreUpdateRate.Value, -1); - } - else if (!enable && job != null) - { - SchedulerSystem.RemoveJob(job); - } + SchedulerSystem.AddJob(new SchedulerSystem.Job(CVR_MenuManager.Instance.SendCoreUpdate), 0f, FuckMetricsMod.EntryCoreUpdateRate.Value, -1); } - - public static void ApplyMetricsSettings(bool show) + else if (!enable && job != null) { - var disableMetrics = FuckMetricsMod.EntryDisableMetrics.Value; - if (disableMetrics == FuckMetrics.SettingState.Always) return; - - if (disableMetrics == FuckMetrics.SettingState.MenuOnly) - { - FuckMetrics.ToggleMetrics(show); - } - else if (disableMetrics == FuckMetrics.SettingState.Disabled && show) - { - ViewManager.Instance.UpdateMetrics(); - } + SchedulerSystem.RemoveJob(job); } + } - public static void ApplyCoreUpdatesSettings(bool show) + public static void ApplyMetricsSettings(bool show) + { + var disableMetrics = FuckMetricsMod.EntryDisableMetrics.Value; + if (disableMetrics == FuckMetrics.SettingState.Always) return; + + if (disableMetrics == FuckMetrics.SettingState.MenuOnly) { - var disableCoreUpdates = FuckMetricsMod.EntryDisableCoreUpdates.Value; - if (disableCoreUpdates == FuckMetrics.SettingState.Always) return; - - if (disableCoreUpdates == FuckMetrics.SettingState.MenuOnly) - { - FuckMetrics.ToggleCoreUpdates(show); - } - else if (disableCoreUpdates == FuckMetrics.SettingState.Disabled && show) - { - CVR_MenuManager.Instance.SendCoreUpdate(); - } + FuckMetrics.ToggleMetrics(show); } - - public static void CohtmlAdvanceView(CohtmlView cohtmlView, Traverse menuOpenTraverse) + else if (disableMetrics == FuckMetrics.SettingState.Disabled && show) { - if (!FuckMetricsMod.EntryDisableCohtmlViewOnIdle.Value) return; + ViewManager.Instance.UpdateMetrics(); + } + } - // Don't execute if menu is open - if (cohtmlView == null || menuOpenTraverse.GetValue()) return; + public static void ApplyCoreUpdatesSettings(bool show) + { + var disableCoreUpdates = FuckMetricsMod.EntryDisableCoreUpdates.Value; + if (disableCoreUpdates == FuckMetrics.SettingState.Always) return; - // Disable cohtmlView (opening should enable) + if (disableCoreUpdates == FuckMetrics.SettingState.MenuOnly) + { + FuckMetrics.ToggleCoreUpdates(show); + } + else if (disableCoreUpdates == FuckMetrics.SettingState.Disabled && show) + { + CVR_MenuManager.Instance.SendCoreUpdate(); + } + } + + public static void CohtmlAdvanceView(CohtmlView cohtmlView, Traverse menuOpenTraverse) + { + if (!FuckMetricsMod.EntryDisableCohtmlViewOnIdle.Value) return; + + FuckMetricsMod.Logger.Msg(cohtmlView != null && !menuOpenTraverse.GetValue()); + FuckMetricsMod.Logger.Msg(menuOpenTraverse.GetValue()); + + if (cohtmlView != null && !menuOpenTraverse.GetValue()) + { cohtmlView.enabled = false; - // Death try { - if (cohtmlView.m_UISystem != null) cohtmlView.View.Advance(cohtmlView.m_UISystem.Id, (double)Time.unscaledTime * 1000.0); + cohtmlView.View.Advance(cohtmlView.m_UISystem?.Id ?? 0, (double)Time.unscaledTime * 1000.0); } catch (Exception e) { diff --git a/FuckMetrics/HarmonyPatches.cs b/FuckMetrics/HarmonyPatches.cs index 742c433..476ee5b 100644 --- a/FuckMetrics/HarmonyPatches.cs +++ b/FuckMetrics/HarmonyPatches.cs @@ -3,63 +3,62 @@ using ABI_RC.Core.IO; using cohtml; using HarmonyLib; -namespace NAK.Melons.FuckMetrics.HarmonyPatches +namespace NAK.Melons.FuckMetrics.HarmonyPatches; + +public static class CVR_MenuManagerPatches { - public static class CVR_MenuManagerPatches + [HarmonyPostfix] + [HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })] + private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show) { - [HarmonyPostfix] - [HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })] - private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show) - { - FuckMetrics.ApplyMetricsSettings(show); - FuckMetrics.ApplyCoreUpdatesSettings(show); - } + FuckMetrics.ApplyMetricsSettings(show); + FuckMetrics.ApplyCoreUpdatesSettings(show); + } +} + +public static class ViewManagerPatches +{ + [HarmonyPostfix] + [HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })] + private static void Postfix_ViewManager_UiStateToggle(bool show) + { + FuckMetrics.ApplyMetricsSettings(show); + FuckMetrics.ApplyCoreUpdatesSettings(show); + } +} + +public static class CohtmlViewPatches +{ + private static CohtmlView _quickMenuView; + private static CohtmlView _gameMenuView; + private static Traverse _quickMenuOpenTraverse; + private static Traverse _gameMenuOpenTraverse; + + [HarmonyPostfix] + [HarmonyPatch(typeof(CVR_MenuManager), "Start")] + private static void Postfix_CVRMenuManager_Start(ref CVR_MenuManager __instance, ref CohtmlView ___quickMenu) + { + _quickMenuView = ___quickMenu; + _quickMenuOpenTraverse = Traverse.Create(__instance).Field("_quickMenuOpen"); + SchedulerSystem.AddJob(() => FuckMetrics.CohtmlAdvanceView(_quickMenuView, _quickMenuOpenTraverse), 15f, 6f, -1); } - public static class ViewManagerPatches + [HarmonyPostfix] + [HarmonyPatch(typeof(ViewManager), "Start")] + private static void Postfix_ViewManager_Start(ref ViewManager __instance, ref CohtmlView ___gameMenuView) { - [HarmonyPostfix] - [HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })] - private static void Postfix_ViewManager_UiStateToggle(bool show) - { - FuckMetrics.ApplyMetricsSettings(show); - FuckMetrics.ApplyCoreUpdatesSettings(show); - } + _gameMenuView = ___gameMenuView; + _gameMenuOpenTraverse = Traverse.Create(__instance).Field("_gameMenuOpen"); + SchedulerSystem.AddJob(() => FuckMetrics.CohtmlAdvanceView(_gameMenuView, _gameMenuOpenTraverse), 12f, 6f, -1); } - public static class CohtmlViewPatches + [HarmonyPostfix] + [HarmonyPatch(typeof(ViewManager), "OnMicrophoneStatusSwitched")] + private static void Postfix_ViewManager_OnMicrophoneStatusSwitched() { - private static CohtmlView _quickMenuView; - private static CohtmlView _gameMenuView; - private static Traverse _quickMenuOpenTraverse; - private static Traverse _gameMenuOpenTraverse; - - [HarmonyPostfix] - [HarmonyPatch(typeof(CVR_MenuManager), "Start")] - private static void Postfix_CVRMenuManager_Start(ref CohtmlView ___quickMenu) + if (_quickMenuOpenTraverse.GetValue()) { - _quickMenuView = ___quickMenu; - _quickMenuOpenTraverse = Traverse.Create().Field("_quickMenuOpen"); - SchedulerSystem.AddJob(() => FuckMetrics.CohtmlAdvanceView(_quickMenuView, _quickMenuOpenTraverse), 15f, 6f, -1); - } - - [HarmonyPostfix] - [HarmonyPatch(typeof(ViewManager), "Start")] - private static void Postfix_ViewManager_Start(ref CohtmlView ___gameMenuView) - { - _gameMenuView = ___gameMenuView; - _gameMenuOpenTraverse = Traverse.Create().Field("_gameMenuOpen"); - SchedulerSystem.AddJob(() => FuckMetrics.CohtmlAdvanceView(_gameMenuView, _gameMenuOpenTraverse), 12f, 6f, -1); - } - - [HarmonyPostfix] - [HarmonyPatch(typeof(ViewManager), "OnMicrophoneStatusSwitched")] - private static void Postfix_ViewManager_OnMicrophoneStatusSwitched() - { - if (_quickMenuOpenTraverse.GetValue()) - { - CVR_MenuManager.Instance.SendCoreUpdate(); - } + CVR_MenuManager.Instance.SendCoreUpdate(); } } } From ef86bebb5d4997309815634d4f50a351c16bea04 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Fri, 17 Mar 2023 00:16:23 -0500 Subject: [PATCH 24/27] bump --- FuckMetrics/Properties/AssemblyInfo.cs | 2 +- FuckMetrics/format.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FuckMetrics/Properties/AssemblyInfo.cs b/FuckMetrics/Properties/AssemblyInfo.cs index fb85d2c..241d435 100644 --- a/FuckMetrics/Properties/AssemblyInfo.cs +++ b/FuckMetrics/Properties/AssemblyInfo.cs @@ -26,6 +26,6 @@ using System.Reflection; namespace NAK.Melons.FuckMetrics.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.3"; + public const string Version = "1.0.4"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/FuckMetrics/format.json b/FuckMetrics/format.json index c42c743..e3d18e4 100644 --- a/FuckMetrics/format.json +++ b/FuckMetrics/format.json @@ -1,7 +1,7 @@ { "_id": 135, "name": "FuckMetrics", - "modversion": "1.0.3", + "modversion": "1.0.4", "gameversion": "2022r170", "loaderversion": "0.5.7", "modtype": "Mod", @@ -17,8 +17,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/FuckMetrics/releases/download/v1.0.3/FuckMetrics.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/FuckMetrics/releases/download/v1.0.4/FuckMetrics.dll", "sourcelink": "https://github.com/NotAKidOnSteam/FuckMetrics/", - "changelog": "- Initial Release.\n- Renamed to FuckMetrics.\n- Add Update Rate settings.\n- Add back CohtmlView disabling as option.\n- Update CoreUpdate on mic toggle if QM is open.", + "changelog": "- Initial Release.\n- Renamed to FuckMetrics.\n- Add Update Rate settings.\n- Add back CohtmlView disabling as option.\n- Update CoreUpdate on mic toggle if QM is open.\n- Fix Cohtml disabling not using menu instance.", "embedcolor": "#8ed6fb" } \ No newline at end of file From 6d23212d40c5fb16c4d3206858ef4b531236bcef Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Fri, 17 Mar 2023 00:21:46 -0500 Subject: [PATCH 25/27] remove logging, god damnit --- FuckMetrics/FuckMetrics.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/FuckMetrics/FuckMetrics.cs b/FuckMetrics/FuckMetrics.cs index c6010d3..a37b17c 100644 --- a/FuckMetrics/FuckMetrics.cs +++ b/FuckMetrics/FuckMetrics.cs @@ -75,9 +75,6 @@ public static class FuckMetrics { if (!FuckMetricsMod.EntryDisableCohtmlViewOnIdle.Value) return; - FuckMetricsMod.Logger.Msg(cohtmlView != null && !menuOpenTraverse.GetValue()); - FuckMetricsMod.Logger.Msg(menuOpenTraverse.GetValue()); - if (cohtmlView != null && !menuOpenTraverse.GetValue()) { cohtmlView.enabled = false; From e09a09ffc019bec04229a9f3121c822b74a3d03f Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Fri, 17 Mar 2023 00:27:02 -0500 Subject: [PATCH 26/27] fix initial setting states not worth pushing cvrmg update prolly?? --- FuckMetrics/Main.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/FuckMetrics/Main.cs b/FuckMetrics/Main.cs index 1a40a1e..f01bcdc 100644 --- a/FuckMetrics/Main.cs +++ b/FuckMetrics/Main.cs @@ -44,23 +44,25 @@ public class FuckMetricsMod : MelonMod { while (PlayerSetup.Instance == null) yield return null; - UpdateSettings(); + InitializeSettings(); } - private void UpdateSettings() + private void InitializeSettings() { + FuckMetrics.ToggleMetrics(false); + FuckMetrics.ToggleCoreUpdates(false); FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == FuckMetrics.SettingState.Always); FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == FuckMetrics.SettingState.Always); } private void OnDisableMetrics(object arg1, object arg2) { - FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value == FuckMetrics.SettingState.Always); + FuckMetrics.ToggleMetrics(EntryDisableMetrics.Value != FuckMetrics.SettingState.Disabled); } private void OnDisableCoreUpdates(object arg1, object arg2) { - FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value == FuckMetrics.SettingState.Always); + FuckMetrics.ToggleCoreUpdates(EntryDisableCoreUpdates.Value != FuckMetrics.SettingState.Disabled); } private void OnChangeMetricsUpdateRate(object arg1, object arg2) From c5ad6c307d2bf5c6e4ffe4ac75963f2594694ecf Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Fri, 17 Mar 2023 00:36:41 -0500 Subject: [PATCH 27/27] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a6d4b51..04cebc4 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ In general, keeping Menu Metrics & Menu Core Updates to Menu Only with a high Up ## Examples -The following clips demonstrate the difference in performance with and without the FuckCohtml mod. While not a scientifically rigorous comparison, it is clear that there is a significant performance hit when unmuted, causing Dynamic Bones to jitter, in the clip without the mod: +The following clips demonstrate the difference in performance with and without the FuckMetrics mod. While not a scientifically rigorous comparison, it is clear that there is a significant performance hit when unmuted, causing Dynamic Bones to jitter, in the clip without the mod: https://user-images.githubusercontent.com/37721153/225494880-7e06195c-6f0d-4a21-aaa8-5f9f4ba5e9dd.mp4 -However, with the FuckCohtml mod enabled, the performance hit when unmuted is almost negligible, as shown in the clip below: +However, with the FuckMetrics mod enabled, the performance hit when unmuted is almost negligible, as shown in the clip below: https://user-images.githubusercontent.com/37721153/225495141-7abcb17b-60c7-487d-9de8-ef9818cbd6eb.mp4