Decompiled source of QuestBoost v1.1.2

QuestBoost.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib.BoneMenu;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Preferences;
using QuestBoost;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "QuestBoost", "1.1.0", "jorink", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("QuestBoost")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("QuestBoost")]
[assembly: AssemblyTitle("QuestBoost")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace QuestBoost;

[HarmonyPatch]
public class Core : MelonMod
{
	private MelonPreferences_Entry<bool> entry;

	private MelonPreferences_Entry<bool> streamingMipmapsEntry;

	private MelonPreferences_Entry<int> vSyncEntry;

	private MelonPreferences_Entry<int> masterTextureLimitEntry;

	private MelonPreferences_Entry<float> maximumLODLevelEntry;

	private MelonPreferences_Entry<int> DeltaTimeEntry;

	private MelonPreferences_Entry<bool> FogEntry;

	private MelonPreferences_Category category;

	public override void OnInitializeMelon()
	{
		try
		{
			((MelonBase)this).LoggerInstance.Msg("Initialized.");
			((MelonBase)this).HarmonyInstance.PatchAll();
		}
		catch (Exception ex)
		{
			MelonLogger.Error((object)ex);
		}
		MelonPrefs();
		BoneMenus();
	}

	private void BoneMenus()
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		Page obj = Page.Root.CreatePage("QuestBoost", Color.green, 0, true);
		obj.CreateBool("Enabled (Needs Restart)", Color.green, entry.Value, (Action<bool>)delegate(bool a)
		{
			entry.Value = a;
		});
		obj.CreateInt("vSync", Color.red, vSyncEntry.Value, 1, 0, 1, (Action<int>)delegate(int value)
		{
			vSyncEntry.Value = value;
			if (entry.Value)
			{
				QualitySettings.vSyncCount = value;
			}
		});
		obj.CreateBool("Texture Streaming", Color.magenta, streamingMipmapsEntry.Value, (Action<bool>)delegate(bool value)
		{
			streamingMipmapsEntry.Value = value;
			if (entry.Value)
			{
				QualitySettings.streamingMipmapsActive = value;
			}
		});
		obj.CreateInt("DeltaTime (FPS)", Color.yellow, DeltaTimeEntry.Value, 10, 60, 90, (Action<int>)delegate(int value)
		{
			DeltaTimeEntry.Value = value;
			if (entry.Value)
			{
				Time.fixedDeltaTime = 1f / (float)value;
			}
		});
		obj.CreateInt("Textures (Higher=Lower Quality)", Color.cyan, masterTextureLimitEntry.Value, 1, 0, 3, (Action<int>)delegate(int value)
		{
			masterTextureLimitEntry.Value = value;
			if (entry.Value)
			{
				QualitySettings.masterTextureLimit = value;
			}
		});
		obj.CreateFloat("LOD (Higher = Lower Quality)", Color.blue, maximumLODLevelEntry.Value, 0.5f, 0f, 1.5f, (Action<float>)delegate(float value)
		{
			maximumLODLevelEntry.Value = value;
			if (entry.Value)
			{
				QualitySettings.maximumLODLevel = (int)value;
			}
		});
		obj.CreateBool("Fog", Color.gray, FogEntry.Value, (Action<bool>)delegate(bool value)
		{
			FogEntry.Value = value;
			if (entry.Value)
			{
				RenderSettings.fog = value;
			}
		});
	}

	private void MelonPrefs()
	{
		category = MelonPreferences.CreateCategory("QuestBoost");
		entry = category.CreateEntry<bool>("QuestBoost Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		vSyncEntry = category.CreateEntry<int>("vSync", 0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		streamingMipmapsEntry = category.CreateEntry<bool>("Texture Streaming", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		masterTextureLimitEntry = category.CreateEntry<int>("Master Texture Limit", 1, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		maximumLODLevelEntry = category.CreateEntry<float>("Maximum LOD Level", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		DeltaTimeEntry = category.CreateEntry<int>("DeltaTime (FPS)", 90, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		FogEntry = category.CreateEntry<bool>("Fog", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		MelonPreferences.Save();
		category.SaveToFile(true);
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
		if (entry != null && entry.Value)
		{
			RenderSettings.fog = FogEntry.Value;
			RenderSettings.defaultReflectionMode = (DefaultReflectionMode)1;
			RenderSettings.defaultReflectionResolution = 16;
			RenderSettings.customReflection = null;
			Camera.main.allowMSAA = false;
			QualitySettings.anisotropicFiltering = (AnisotropicFiltering)0;
			QualitySettings.shadowDistance = 0f;
			QualitySettings.antiAliasing = 0;
			QualitySettings.billboardsFaceCameraPosition = false;
			QualitySettings.lodBias = 1.25f;
			QualitySettings.maximumLODLevel = (int)maximumLODLevelEntry.Value;
			QualitySettings.pixelLightCount = 0;
			QualitySettings.realtimeReflectionProbes = false;
			QualitySettings.shadowmaskMode = (ShadowmaskMode)0;
			QualitySettings.shadowResolution = (ShadowResolution)0;
			QualitySettings.shadows = (ShadowQuality)0;
			QualitySettings.softParticles = false;
			QualitySettings.softVegetation = false;
			QualitySettings.vSyncCount = vSyncEntry.Value;
			QualitySettings.masterTextureLimit = masterTextureLimitEntry.Value;
			QualitySettings.particleRaycastBudget = 0;
			QualitySettings.streamingMipmapsActive = streamingMipmapsEntry.Value;
			Physics.solverIterationCount = 1;
			Physics.solverVelocityIterationCount = 1;
			Physics.sleepThreshold = 0.04f;
			Physics.sleepVelocity = 0.04f;
			Physics.sleepAngularVelocity = 0.04f;
			Physics.queriesHitBackfaces = false;
			Physics.queriesHitTriggers = false;
			Physics.defaultContactOffset = 0.01f;
			Time.fixedDeltaTime = 1f / (float)DeltaTimeEntry.Value;
			DynamicGI.updateThreshold = 0f;
		}
	}
}