Skip to content

Commit

Permalink
added vsync option
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xMachina committed Jun 1, 2024
1 parent 2258f05 commit b4f4530
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
13 changes: 12 additions & 1 deletion Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,21 @@ public class FrameratePatch
[HarmonyPostfix]
static void UncapFramerate()
{
Plugin.Log.LogInfo("Uncap framerate.");
if (Application.targetFrameRate != 0)
{
DefaultFrameRate = Application.targetFrameRate;

if (Plugin.enableVsync.Value)
{
Plugin.Log.LogInfo("VSync enabled.");
QualitySettings.vSyncCount = 1;
}
else
{
Plugin.Log.LogInfo("Uncap framerate.");
QualitySettings.vSyncCount = 0;
}

Application.targetFrameRate = 0;
}
}
Expand Down
14 changes: 11 additions & 3 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

namespace FFPR_Fix
{
[BepInPlugin("d3xMachina.ffpr_fix", "FFPR Fix", "1.1.0")]
[BepInPlugin("d3xMachina.ffpr_fix", "FFPR Fix", "1.1.1")]
public class Plugin : BasePlugin
{
internal static new ManualLogSource Log;

public static ConfigEntry<bool> uncapFPS;
public static ConfigEntry<bool> enableVsync;
public static ConfigEntry<bool> hideFieldMinimap;
public static ConfigEntry<bool> hideWorldMinimap;
public static ConfigEntry<bool> skipSplashscreens;
Expand All @@ -37,7 +38,7 @@ public override void Load()

private void ApplyPatches()
{
if (uncapFPS.Value)
if (uncapFPS.Value || enableVsync.Value)
{
Harmony.CreateAndPatchAll(typeof(FrameratePatch));
}
Expand Down Expand Up @@ -66,7 +67,14 @@ private void InitConfig()
"Framerate",
"Uncap",
false,
"Remove the 60 FPS limit. Use with SpecialK or Rivatuner to cap it to the intended FPS and force VSync."
"Remove the 60 FPS limit. Use with SpecialK or Rivatuner to cap it to the intended FPS for best frame pacing."
);

enableVsync = Config.Bind(
"Framerate",
"Vsync",
false,
"Enable VSync. The framerate will match your monitor refresh rate."
);

hideFieldMinimap = Config.Bind(
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]

0 comments on commit b4f4530

Please sign in to comment.