using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using UnityEngine;
using UnityEngine.Rendering;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("FPS_Booster")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FPS_Booster")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8bdaa737-7670-4e66-836b-f880aabac8f7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FPS_Booster
{
[BepInPlugin("com.repo.fpsbooster", "FPS Booster", "1.1.0")]
public class FPSBooster : BaseUnityPlugin
{
public static ConfigEntry<bool> disableVSync;
public static ConfigEntry<int> targetFPS;
public static ConfigEntry<bool> disableShadows;
public static ConfigEntry<bool> disableFog;
public static ConfigEntry<bool> disableAmbientLight;
public static ConfigEntry<bool> lowRes;
public static ConfigEntry<float> lodBias;
public static ConfigEntry<int> textureLimit;
public static ConfigEntry<bool> forceBilinearFiltering;
public static ConfigEntry<bool> disableLights;
public static ConfigEntry<bool> simplifySkybox;
public static ConfigEntry<bool> forceForwardRendering;
public static ConfigEntry<bool> disablePostProcessing;
public static ConfigEntry<bool> reduceLODFade;
public static ConfigEntry<bool> disableParticles;
public static ConfigEntry<bool> reducePhysicsRate;
public void Awake()
{
disableVSync = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisableVSync", true, "Disables vertical sync to prevent FPS capping.");
targetFPS = ((BaseUnityPlugin)this).Config.Bind<int>("General", "TargetFPS", 300, "Sets target framerate.");
disableShadows = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "DisableShadows", true, "Disables shadows.");
disableFog = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "DisableFog", true, "Disables fog.");
disableAmbientLight = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "DisableAmbientLight", true, "Forces flat ambient lighting.");
lodBias = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "LODBias", 0.5f, "LOD Bias.");
textureLimit = ((BaseUnityPlugin)this).Config.Bind<int>("Visuals", "TextureLimit", 2, "Texture resolution limit.");
lowRes = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "LowResMode", false, "Reduces render scale.");
forceBilinearFiltering = ((BaseUnityPlugin)this).Config.Bind<bool>("Extreme", "ForceBilinearFiltering", true, "Forces bilinear filtering.");
disableLights = ((BaseUnityPlugin)this).Config.Bind<bool>("Extreme", "DisableLights", true, "Disables all scene lights.");
simplifySkybox = ((BaseUnityPlugin)this).Config.Bind<bool>("Extreme", "SimplifySkybox", true, "Removes skybox and reflections.");
forceForwardRendering = ((BaseUnityPlugin)this).Config.Bind<bool>("Extreme", "ForceForwardRendering", true, "Enforces forward rendering.");
disablePostProcessing = ((BaseUnityPlugin)this).Config.Bind<bool>("Extreme", "DisablePostProcessing", true, "Disables post-processing.");
reduceLODFade = ((BaseUnityPlugin)this).Config.Bind<bool>("Extreme", "ReduceLODFade", true, "Disables LOD fading.");
disableParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("Extreme", "DisableParticles", true, "Stops particle systems.");
reducePhysicsRate = ((BaseUnityPlugin)this).Config.Bind<bool>("Extreme", "ReducePhysicsRate", true, "Lowers physics rate.");
ApplySettings();
}
public void OnEnable()
{
ApplySettings();
}
private void ApplySettings()
{
ConfigEntry<bool> obj = disableVSync;
if (obj != null && obj.Value)
{
QualitySettings.vSyncCount = 0;
}
Application.targetFrameRate = targetFPS?.Value ?? 60;
ConfigEntry<bool> obj2 = disableShadows;
if (obj2 != null && obj2.Value)
{
QualitySettings.shadows = (ShadowQuality)0;
QualitySettings.shadowDistance = 0f;
}
ConfigEntry<bool> obj3 = disableFog;
if (obj3 != null && obj3.Value)
{
RenderSettings.fog = false;
}
ConfigEntry<bool> obj4 = disableAmbientLight;
if (obj4 != null && obj4.Value)
{
RenderSettings.ambientMode = (AmbientMode)3;
}
if (lodBias != null)
{
QualitySettings.lodBias = lodBias.Value;
}
if (textureLimit != null)
{
QualitySettings.masterTextureLimit = textureLimit.Value;
}
ConfigEntry<bool> obj5 = lowRes;
if (obj5 != null && obj5.Value)
{
if ((Object)(object)Camera.main != (Object)null)
{
Camera.main.allowDynamicResolution = false;
Camera.main.targetTexture = null;
Camera.main.renderingPath = (RenderingPath)1;
}
QualitySettings.resolutionScalingFixedDPIFactor = 0.25f;
}
else if ((Object)(object)Camera.main != (Object)null)
{
Camera.main.allowDynamicResolution = true;
}
ConfigEntry<bool> obj6 = forceBilinearFiltering;
if (obj6 != null && obj6.Value)
{
Texture[] array = Resources.FindObjectsOfTypeAll<Texture>();
foreach (Texture obj7 in array)
{
Texture2D val = (Texture2D)(object)((obj7 is Texture2D) ? obj7 : null);
if (val != null)
{
((Texture)val).anisoLevel = 0;
}
obj7.filterMode = (FilterMode)1;
}
}
ConfigEntry<bool> obj8 = disableLights;
if (obj8 != null && obj8.Value)
{
Light[] array2 = Object.FindObjectsOfType<Light>();
for (int i = 0; i < array2.Length; i++)
{
((Behaviour)array2[i]).enabled = false;
}
LightmapSettings.lightProbes = null;
}
ConfigEntry<bool> obj9 = simplifySkybox;
if (obj9 != null && obj9.Value)
{
RenderSettings.skybox = null;
RenderSettings.defaultReflectionMode = (DefaultReflectionMode)1;
RenderSettings.reflectionIntensity = 0f;
}
ConfigEntry<bool> obj10 = forceForwardRendering;
if (obj10 != null && obj10.Value)
{
Camera[] allCameras = Camera.allCameras;
for (int i = 0; i < allCameras.Length; i++)
{
allCameras[i].renderingPath = (RenderingPath)1;
}
}
ConfigEntry<bool> obj11 = disablePostProcessing;
if (obj11 != null && obj11.Value)
{
Behaviour[] array3 = Object.FindObjectsOfType<Behaviour>();
foreach (Behaviour val2 in array3)
{
if (!((Object)(object)val2 == (Object)null) && val2.enabled)
{
string text = ((object)val2).GetType().Name.ToLower();
if (text.Contains("bloom") || text.Contains("motion") || text.Contains("vignette") || text.Contains("dof") || text.Contains("chromatic") || text.Contains("ambient") || text.Contains("ssao") || text.Contains("post"))
{
val2.enabled = false;
}
}
}
}
ConfigEntry<bool> obj12 = reduceLODFade;
if (obj12 != null && obj12.Value)
{
LODGroup[] array4 = Object.FindObjectsOfType<LODGroup>();
for (int i = 0; i < array4.Length; i++)
{
array4[i].fadeMode = (LODFadeMode)0;
}
}
ConfigEntry<bool> obj13 = disableParticles;
if (obj13 != null && obj13.Value)
{
ParticleSystem[] array5 = Object.FindObjectsOfType<ParticleSystem>();
for (int i = 0; i < array5.Length; i++)
{
array5[i].Stop(true, (ParticleSystemStopBehavior)0);
}
}
ConfigEntry<bool> obj14 = reducePhysicsRate;
if (obj14 != null && obj14.Value)
{
Time.fixedDeltaTime = 0.05f;
}
else
{
Time.fixedDeltaTime = 0.02f;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"FPS Booster settings applied.");
}
}
}
namespace FPS_Booster.VSyncSettings
{
public class VSyncSettings
{
public void ApplyVSyncSetting()
{
if (FPSBooster.disableVSync.Value)
{
QualitySettings.vSyncCount = 0;
}
}
}
}
namespace FPS_Booster.TextureLimitSettings
{
internal class TextureLimitSettings
{
public void ApplyTextureLimitSetting()
{
if (FPSBooster.textureLimit != null)
{
QualitySettings.masterTextureLimit = FPSBooster.textureLimit.Value;
}
}
}
}
namespace FPS_Booster.TargetFPS
{
internal class TargetFPS
{
public void ApplyTargetFPS()
{
Application.targetFrameRate = FPSBooster.targetFPS?.Value ?? 60;
}
}
}
namespace FPS_Booster.SkyboxSettings
{
internal class SkyboxSettings
{
public void ApplySkyboxSettings()
{
ConfigEntry<bool> simplifySkybox = FPSBooster.simplifySkybox;
if (simplifySkybox != null && simplifySkybox.Value)
{
RenderSettings.skybox = null;
RenderSettings.defaultReflectionMode = (DefaultReflectionMode)1;
RenderSettings.reflectionIntensity = 0f;
}
}
}
}
namespace FPS_Booster.ShadowSettings
{
internal class ShadowSettings
{
public void ApplyShadowSetting()
{
ConfigEntry<bool> disableShadows = FPSBooster.disableShadows;
if (disableShadows != null && disableShadows.Value)
{
QualitySettings.shadows = (ShadowQuality)0;
QualitySettings.shadowDistance = 0f;
}
}
}
}
namespace FPS_Booster.ResolutionSettings
{
internal class ResolutionSettings
{
public void ApplyResolutionSettings()
{
ConfigEntry<bool> lowRes = FPSBooster.lowRes;
if (lowRes != null && lowRes.Value)
{
if ((Object)(object)Camera.main != (Object)null)
{
Camera.main.allowDynamicResolution = false;
Camera.main.targetTexture = null;
Camera.main.renderingPath = (RenderingPath)1;
}
QualitySettings.resolutionScalingFixedDPIFactor = 0.25f;
}
else if ((Object)(object)Camera.main != (Object)null)
{
Camera.main.allowDynamicResolution = true;
}
}
}
}
namespace FPS_Booster.PostProcessingSettings
{
internal class PostProcessingSettings
{
public void DisablePostProcessingEffects()
{
ConfigEntry<bool> disablePostProcessing = FPSBooster.disablePostProcessing;
if (disablePostProcessing == null || !disablePostProcessing.Value)
{
return;
}
Behaviour[] array = Object.FindObjectsOfType<Behaviour>();
foreach (Behaviour val in array)
{
if ((Object)(object)val != (Object)null && val.enabled)
{
string text = ((object)val).GetType().Name.ToLower();
if (text.Contains("bloom") || text.Contains("motion") || text.Contains("vignette") || text.Contains("dof") || text.Contains("chromatic") || text.Contains("ambient") || text.Contains("ssao") || text.Contains("post"))
{
val.enabled = false;
}
}
}
}
}
}
namespace FPS_Booster.PhysicsRateSettings
{
internal class PhysicsRateSettings
{
public void AdjustPhysicsRate()
{
ConfigEntry<bool> reducePhysicsRate = FPSBooster.reducePhysicsRate;
Time.fixedDeltaTime = ((reducePhysicsRate != null && reducePhysicsRate.Value) ? 0.05f : 0.02f);
}
}
}
namespace FPS_Booster.LODFadeSettings
{
internal class LODFadeSettings
{
public void ApplyLODFadeSetting()
{
ConfigEntry<bool> reduceLODFade = FPSBooster.reduceLODFade;
if (reduceLODFade != null && reduceLODFade.Value)
{
LODGroup[] array = Object.FindObjectsOfType<LODGroup>();
for (int i = 0; i < array.Length; i++)
{
array[i].fadeMode = (LODFadeMode)0;
}
}
}
}
}
namespace FPS_Booster.LODBiasSettings
{
internal class LODBiasSettings
{
public void ApplyLODBiasSetting()
{
if (FPSBooster.lodBias != null)
{
QualitySettings.lodBias = FPSBooster.lodBias.Value;
}
}
}
}
namespace FPS_Booster.LightingSettings
{
internal class LightingSettings
{
public void ApplyLightSettings()
{
ConfigEntry<bool> disableLights = FPSBooster.disableLights;
if (disableLights != null && disableLights.Value)
{
Light[] array = Object.FindObjectsOfType<Light>();
for (int i = 0; i < array.Length; i++)
{
((Behaviour)array[i]).enabled = false;
}
LightmapSettings.lightProbes = null;
}
}
}
}
namespace FPS_Booster.ForwardRenderingSettings
{
internal class ForwardRenderingSettings
{
public void ApplyForwardRenderingSetting()
{
ConfigEntry<bool> forceForwardRendering = FPSBooster.forceForwardRendering;
if (forceForwardRendering != null && forceForwardRendering.Value)
{
Camera[] allCameras = Camera.allCameras;
for (int i = 0; i < allCameras.Length; i++)
{
allCameras[i].renderingPath = (RenderingPath)1;
}
}
}
}
}
namespace FPS_Booster.FogSettings
{
internal class FogSettings
{
public void ApplyFogSetting()
{
ConfigEntry<bool> disableFog = FPSBooster.disableFog;
if (disableFog != null && disableFog.Value)
{
RenderSettings.fog = false;
}
}
}
}
namespace FPS_Booster.DisableParticles
{
internal class DisableParticles
{
public void Disable()
{
ConfigEntry<bool> disableParticles = FPSBooster.disableParticles;
if (disableParticles != null && disableParticles.Value)
{
ParticleSystem[] array = Object.FindObjectsOfType<ParticleSystem>();
for (int i = 0; i < array.Length; i++)
{
array[i].Stop(true, (ParticleSystemStopBehavior)0);
}
}
}
}
}
namespace FPS_Booster.BilinearFiltering
{
internal class BilinearFiltering
{
public void ApplyBilinearFiltering()
{
ConfigEntry<bool> forceBilinearFiltering = FPSBooster.forceBilinearFiltering;
if (forceBilinearFiltering == null || !forceBilinearFiltering.Value)
{
return;
}
Texture[] array = Resources.FindObjectsOfTypeAll<Texture>();
foreach (Texture obj in array)
{
Texture2D val = (Texture2D)(object)((obj is Texture2D) ? obj : null);
if (val != null)
{
((Texture)val).anisoLevel = 0;
}
obj.filterMode = (FilterMode)1;
}
}
}
}
namespace FPS_Booster.AmbientLightSettings
{
internal class AmbientLightSettings
{
public void ApplyAmbientLightSetting()
{
ConfigEntry<bool> disableAmbientLight = FPSBooster.disableAmbientLight;
if (disableAmbientLight != null && disableAmbientLight.Value)
{
RenderSettings.ambientMode = (AmbientMode)3;
}
}
}
}