diff --git a/ForceFramerate.cs b/ForceFramerate.cs index d860771..9066a55 100644 --- a/ForceFramerate.cs +++ b/ForceFramerate.cs @@ -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; } } diff --git a/Plugin.cs b/Plugin.cs index 13df346..13364d5 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -13,6 +13,7 @@ namespace TaikoModStuff public static ConfigEntry configCustomWindowedHeight; public static ConfigEntry configCustomFramerate; + public static ConfigEntry 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)); diff --git a/TaikoModStuff.csproj b/TaikoModStuff.csproj index 4db6a75..8684c34 100644 --- a/TaikoModStuff.csproj +++ b/TaikoModStuff.csproj @@ -4,7 +4,7 @@ net46 TaikoModStuff My first plugin - 1.2.0 + 1.2.1 true latest