Skip to content

Commit

Permalink
Remove unused cinemachine dependency. Add automatic physics update ra…
Browse files Browse the repository at this point in the history
…te setting to hopefully help address #8.
  • Loading branch information
Lyall committed Jul 28, 2022
1 parent d26302f commit e0049bd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
31 changes: 19 additions & 12 deletions RF5Fix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
using BepInEx.IL2CPP;
using BepInEx.Logging;
using HarmonyLib;

using System;

using UnityEngine;
using UnityEngine.UI;

Expand Down Expand Up @@ -52,9 +54,9 @@ public override void Load()

fUpdateRate = Config.Bind("Physics Update Rate",
"PhysicsUpdateRate",
(float)240, // Default = 50
new ConfigDescription("Set desired update rate. Default = 50. (You can raise this to improve camera smoothness for example.)",
new AcceptableValueRange<float>(1f,9999f)));
(float)0f, // 0 = Auto (Set to refresh rate) || Default = 50
new ConfigDescription("Set desired update rate. This will improve camera smoothness in particular. \n 0 = Auto (Set to refresh rate). Game default = 50",
new AcceptableValueRange<float>(0f,5000f)));

bIntroSkip = Config.Bind("Intro Skip",
"IntroSkip",
Expand All @@ -70,7 +72,7 @@ public override void Load()

fFOVAdjust = Config.Bind("FOV Adjustment",
"FOV.Value",
(float)50,
(float)50f,
new ConfigDescription("Set desired FOV.",
new AcceptableValueRange<float>(1f,180f)));

Expand Down Expand Up @@ -179,14 +181,6 @@ public override void Load()
// Run MiscellaneousPatch
Harmony.CreateAndPatchAll(typeof(MiscellaneousPatch));

// Unity update rate
// TODO: Replace this with camera movement interpolation?
if (fUpdateRate.Value > 50)
{
Time.fixedDeltaTime = (float)1 / fUpdateRate.Value;
Log.LogInfo($"fixedDeltaTime set to {Time.fixedDeltaTime}");
}

}

[HarmonyPatch]
Expand Down Expand Up @@ -455,6 +449,19 @@ public static void GameSettingsOverride(BootSystem __instance)
Log.LogInfo($"NPC Distance set to {NpcSetting.ShowDistance}");
}

// Unity update rate
// TODO: Replace this with camera movement interpolation?
if (fUpdateRate.Value == 0) // Set update rate to screen refresh rate
{
Time.fixedDeltaTime = (float)1 / Screen.currentResolution.refreshRate;
Log.LogInfo($"fixedDeltaTime set to {(float)1} / {Screen.currentResolution.refreshRate} = {Time.fixedDeltaTime}");
}
else if (fUpdateRate.Value > 50)
{
Time.fixedDeltaTime = (float)1 / fUpdateRate.Value;
Log.LogInfo($"fixedDeltaTime set to {(float)1} / {fUpdateRate.Value} = {Time.fixedDeltaTime}");
}

}

// Sun & Moon | Shadow Resolution
Expand Down
3 changes: 0 additions & 3 deletions RF5Fix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
<Reference Include="Assembly-CSharp">
<HintPath>libs\Assembly-CSharp.stripped.dll</HintPath>
</Reference>
<Reference Include="Cinemachine">
<HintPath>libs\Cinemachine.stripped.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>libs\Il2Cppmscorlib.stripped.dll</HintPath>
</Reference>
Expand Down
Binary file removed libs/Cinemachine.stripped.dll
Binary file not shown.

0 comments on commit e0049bd

Please sign in to comment.