feat: Allow toggling VSync
This commit is contained in:
parent
a569ca3dee
commit
be7049a6d9
@ -5,6 +5,8 @@ namespace TaikoModStuff
|
||||
{
|
||||
internal class ForceFramerate
|
||||
{
|
||||
private static readonly int VSyncFrames = Plugin.configToggleVSync.Value ? 1 : 0;
|
||||
|
||||
// Skip the original method, we're doing magic here
|
||||
[HarmonyPatch(typeof(ForceRenderRate), "Start")]
|
||||
[HarmonyPrefix]
|
||||
@ -26,7 +28,7 @@ namespace TaikoModStuff
|
||||
static void customStart()
|
||||
{
|
||||
// Force vsync at all times
|
||||
QualitySettings.vSyncCount = 1;
|
||||
QualitySettings.vSyncCount = VSyncFrames;
|
||||
Application.targetFrameRate = Plugin.configCustomFramerate.Value;
|
||||
}
|
||||
|
||||
@ -35,7 +37,7 @@ namespace TaikoModStuff
|
||||
static void customUpdate()
|
||||
{
|
||||
// Force vsync at all times
|
||||
QualitySettings.vSyncCount = 1;
|
||||
QualitySettings.vSyncCount = VSyncFrames;
|
||||
Application.targetFrameRate = Plugin.configCustomFramerate.Value;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace TaikoModStuff
|
||||
public static ConfigEntry<int> configCustomWindowedHeight;
|
||||
|
||||
public static ConfigEntry<int> configCustomFramerate;
|
||||
public static ConfigEntry<bool> configToggleVSync;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@ -37,6 +38,13 @@ namespace TaikoModStuff
|
||||
60,
|
||||
"Custom framerate. Use with caution");
|
||||
|
||||
configToggleVSync = Config.Bind("General.Graphics",
|
||||
"EnableVSync",
|
||||
true,
|
||||
"Enable VSync.");
|
||||
|
||||
|
||||
|
||||
var instance = new Harmony(PluginInfo.PLUGIN_NAME);
|
||||
instance.PatchAll(typeof(FontChanger));
|
||||
instance.PatchAll(typeof(CustomResolution));
|
||||
|
@ -4,7 +4,7 @@
|
||||
<TargetFramework>net46</TargetFramework>
|
||||
<AssemblyName>TaikoModStuff</AssemblyName>
|
||||
<Description>My first plugin</Description>
|
||||
<Version>1.2.0</Version>
|
||||
<Version>1.2.1</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user