Decompiled source of PerformanceBoosterMod v1.0.0

PerformanceBoosterMod.dll

Decompiled 21 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("PerformanceBoosterMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PerformanceBoosterMod")]
[assembly: AssemblyTitle("PerformanceBoosterMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class PerformanceBoosterMod : MenuMod
{
	public class FrameInterpolator : MonoBehaviour
	{
		private Vector3 lastPosition;

		private Quaternion lastRotation;

		private void OnEnable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			lastPosition = ((Component)this).transform.position;
			lastRotation = ((Component)this).transform.rotation;
		}

		private void LateUpdate()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = Vector3.Lerp(lastPosition, ((Component)this).transform.position, Time.unscaledDeltaTime * 25f);
			((Component)this).transform.rotation = Quaternion.Slerp(lastRotation, ((Component)this).transform.rotation, Time.unscaledDeltaTime * 25f);
			lastPosition = ((Component)this).transform.position;
			lastRotation = ((Component)this).transform.rotation;
		}
	}

	private static FrameInterpolator interpolator;

	private BoolSetting frameGenSetting;

	public override string ModName => "Performance Booster";

	public PerformanceBoosterMod()
	{
		((MenuMod)this).AddFloat("Shadow Level", 2f, 0f, 2f, (Action<float>)delegate(float v)
		{
			switch (Mathf.RoundToInt(v))
			{
			case 0:
				QualitySettings.shadows = (ShadowQuality)0;
				break;
			case 1:
				QualitySettings.shadows = (ShadowQuality)1;
				break;
			default:
				QualitySettings.shadows = (ShadowQuality)2;
				break;
			}
		});
		((MenuMod)this).AddFloat("Shadow Distance", 40f, 0f, 150f, (Action<float>)delegate(float v)
		{
			QualitySettings.shadowDistance = v;
		});
		((MenuMod)this).AddFloat("Texture Resolution", 0f, 0f, 2f, (Action<float>)delegate(float v)
		{
			QualitySettings.globalTextureMipmapLimit = Mathf.RoundToInt(v);
		});
		((MenuMod)this).AddFloat("Anti-Aliasing", 2f, 0f, 3f, (Action<float>)delegate(float v)
		{
			switch (Mathf.RoundToInt(v))
			{
			case 0:
				QualitySettings.antiAliasing = 0;
				break;
			case 1:
				QualitySettings.antiAliasing = 2;
				break;
			case 2:
				QualitySettings.antiAliasing = 4;
				break;
			default:
				QualitySettings.antiAliasing = 8;
				break;
			}
		});
		((MenuMod)this).AddFloat("LOD Mesh Quality", 1.2f, 0.3f, 2.5f, (Action<float>)delegate(float v)
		{
			QualitySettings.lodBias = v;
		});
		frameGenSetting = ((MenuMod)this).AddBool("Frame Generation", false, (Action<bool>)delegate(bool v)
		{
			ToggleFrameGen(v);
		});
	}

	private void ToggleFrameGen(bool enable)
	{
		Camera main = Camera.main;
		if ((Object)(object)main == (Object)null)
		{
			return;
		}
		if (enable)
		{
			if ((Object)(object)interpolator == (Object)null)
			{
				interpolator = ((Component)main).gameObject.AddComponent<FrameInterpolator>();
			}
			((Behaviour)interpolator).enabled = true;
		}
		else if ((Object)(object)interpolator != (Object)null)
		{
			((Behaviour)interpolator).enabled = false;
			Object.Destroy((Object)(object)interpolator);
			interpolator = null;
		}
	}
}