Decompiled source of ContentWarningFPSBoost v1.0.0

plugins/FPSBoost.dll

Decompiled 2 months ago
using System;
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;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FPSBooster")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FPSBooster")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ec7920d0-ce08-4da4-868c-7255d7e18850")]
[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")]
[BepInPlugin("com.yourname.fpsbooster", "FPS Booster", "1.1.0")]
public class FPSBooster : BaseUnityPlugin
{
	private ConfigEntry<float> configFOV;

	private ConfigEntry<bool> configDisableShadows;

	private ConfigEntry<bool> configDisablePostProcessing;

	private void Awake()
	{
		configFOV = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "FOV", 90f, "Field of View value (60-120)");
		configDisableShadows = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "DisableShadows", true, "Disable shadows for better performance");
		configDisablePostProcessing = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "DisablePostProcessing", true, "Disable post-processing effects");
		SceneManager.sceneLoaded += OnSceneLoaded;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"FPS Booster mod loaded successfully!");
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		ApplyModSettings();
	}

	private void ApplyModSettings()
	{
		try
		{
			Camera.main.fieldOfView = configFOV.Value;
			if (configDisableShadows.Value)
			{
				QualitySettings.shadows = (ShadowQuality)0;
				QualitySettings.shadowDistance = 0f;
			}
			if (configDisablePostProcessing.Value && (Object)(object)GraphicsSettings.renderPipelineAsset != (Object)null)
			{
				GraphicsSettings.renderPipelineAsset = null;
			}
			QualitySettings.anisotropicFiltering = (AnisotropicFiltering)0;
			QualitySettings.masterTextureLimit = 1;
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Error applying settings: " + ex.Message));
		}
	}

	private void Update()
	{
		if ((Object)(object)Camera.main != (Object)null && Camera.main.fieldOfView != configFOV.Value)
		{
			Camera.main.fieldOfView = configFOV.Value;
		}
	}
}