1
0
mirror of synced 2024-11-27 23:40:49 +01:00

fix: Make custom framerate work now! Fixes #1

This commit is contained in:
Repflez 2022-01-27 15:21:14 -07:00
parent 7e53fc034b
commit a569ca3dee
3 changed files with 44 additions and 1 deletions

42
ForceFramerate.cs Normal file
View File

@ -0,0 +1,42 @@
using HarmonyLib;
using UnityEngine;
namespace TaikoModStuff
{
internal class ForceFramerate
{
// Skip the original method, we're doing magic here
[HarmonyPatch(typeof(ForceRenderRate), "Start")]
[HarmonyPrefix]
static bool PrefixFocus()
{
return false;
}
// Skip the original method, we're doing magic here
[HarmonyPatch(typeof(ForceRenderRate), "Update")]
[HarmonyPrefix]
static bool PrefixScreenType()
{
return false;
}
[HarmonyPatch(typeof(ForceRenderRate), "Start")]
[HarmonyPrefix]
static void customStart()
{
// Force vsync at all times
QualitySettings.vSyncCount = 1;
Application.targetFrameRate = Plugin.configCustomFramerate.Value;
}
[HarmonyPatch(typeof(ForceRenderRate), "Update")]
[HarmonyPrefix]
static void customUpdate()
{
// Force vsync at all times
QualitySettings.vSyncCount = 1;
Application.targetFrameRate = Plugin.configCustomFramerate.Value;
}
}
}

View File

@ -40,6 +40,7 @@ namespace TaikoModStuff
var instance = new Harmony(PluginInfo.PLUGIN_NAME);
instance.PatchAll(typeof(FontChanger));
instance.PatchAll(typeof(CustomResolution));
instance.PatchAll(typeof(ForceFramerate));
// Plugin startup logic
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");

View File

@ -4,7 +4,7 @@
<TargetFramework>net46</TargetFramework>
<AssemblyName>TaikoModStuff</AssemblyName>
<Description>My first plugin</Description>
<Version>1.1.1</Version>
<Version>1.2.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
</PropertyGroup>