1
0
mirror of synced 2024-11-24 06:20:11 +01:00
TaikoModStuff/ForceFramerate.cs

45 lines
1.2 KiB
C#
Raw Normal View History

using HarmonyLib;
using UnityEngine;
namespace TaikoModStuff
{
internal class ForceFramerate
{
2022-01-28 00:39:40 +01:00
private static readonly int VSyncFrames = Plugin.configToggleVSync.Value ? 1 : 0;
// 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
2022-01-28 00:39:40 +01:00
QualitySettings.vSyncCount = VSyncFrames;
Application.targetFrameRate = Plugin.configCustomFramerate.Value;
}
[HarmonyPatch(typeof(ForceRenderRate), "Update")]
[HarmonyPrefix]
static void customUpdate()
{
// Force vsync at all times
2022-01-28 00:39:40 +01:00
QualitySettings.vSyncCount = VSyncFrames;
Application.targetFrameRate = Plugin.configCustomFramerate.Value;
}
}
}