fix: Make custom framerate work now! Fixes #1
This commit is contained in:
parent
7e53fc034b
commit
a569ca3dee
42
ForceFramerate.cs
Normal file
42
ForceFramerate.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -40,6 +40,7 @@ namespace TaikoModStuff
|
|||||||
var instance = new Harmony(PluginInfo.PLUGIN_NAME);
|
var instance = new Harmony(PluginInfo.PLUGIN_NAME);
|
||||||
instance.PatchAll(typeof(FontChanger));
|
instance.PatchAll(typeof(FontChanger));
|
||||||
instance.PatchAll(typeof(CustomResolution));
|
instance.PatchAll(typeof(CustomResolution));
|
||||||
|
instance.PatchAll(typeof(ForceFramerate));
|
||||||
|
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
|
Logger.LogInfo($"Plugin {PluginInfo.PLUGIN_GUID} is loaded!");
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net46</TargetFramework>
|
<TargetFramework>net46</TargetFramework>
|
||||||
<AssemblyName>TaikoModStuff</AssemblyName>
|
<AssemblyName>TaikoModStuff</AssemblyName>
|
||||||
<Description>My first plugin</Description>
|
<Description>My first plugin</Description>
|
||||||
<Version>1.1.1</Version>
|
<Version>1.2.0</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user