Decompiled source of REPO HD v1.0.0

REPO_HD.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("REPO_HD")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("REPO_HD")]
[assembly: AssemblyTitle("REPO_HD")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace REPO_HD;

[BepInPlugin("com.darkangel.repohd", "REPO_HD", "1.0.0")]
public class GraphicsMod : BaseUnityPlugin
{
	private ConfigEntry<float> resolutionScale;

	private ConfigEntry<int> textureQuality;

	private ConfigEntry<int> antiAliasing;

	private ConfigEntry<bool> enableVSync;

	private ConfigEntry<int> shadowQuality;

	private ConfigEntry<int> shadowResolution;

	private ConfigEntry<float> shadowDistance;

	private ConfigEntry<int> anisotropicFiltering;

	private ConfigEntry<bool> softParticles;

	private ConfigEntry<bool> realtimeReflectionProbes;

	private ConfigEntry<bool> billboardsFaceCamera;

	private void Awake()
	{
		resolutionScale = ((BaseUnityPlugin)this).Config.Bind<float>("Graphics", "Resolution Scale", 0.1f, "Scales the render resolution (0.5 to 2.0).");
		textureQuality = ((BaseUnityPlugin)this).Config.Bind<int>("Graphics", "Texture Quality", 0, "Texture quality level (0 = Low, 1 = Medium, 2 = High).");
		antiAliasing = ((BaseUnityPlugin)this).Config.Bind<int>("Graphics", "Anti-Aliasing", 0, "Anti-aliasing level (0 = Off, 1 = 2x, 2 = 4x, 3 = 8x).");
		enableVSync = ((BaseUnityPlugin)this).Config.Bind<bool>("Graphics", "Enable VSync", false, "Enable or disable VSync.");
		shadowQuality = ((BaseUnityPlugin)this).Config.Bind<int>("Shadows", "Shadow Quality", 0, "Shadow quality level (0 = Disabled, 1 = Hard Only, 2 = Hard and Soft).");
		shadowResolution = ((BaseUnityPlugin)this).Config.Bind<int>("Shadows", "Shadow Resolution", 0, "Shadow resolution level (0 = Low, 1 = Medium, 2 = High, 3 = Very High).");
		shadowDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Shadows", "Shadow Distance", 0f, "Maximum shadow drawing distance.");
		anisotropicFiltering = ((BaseUnityPlugin)this).Config.Bind<int>("Textures", "Anisotropic Filtering", 0, "Anisotropic filtering level (0 = Disabled, 1 = Enabled, 2 = Force Enable).");
		softParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Soft Particles", false, "Enable or disable soft particles.");
		realtimeReflectionProbes = ((BaseUnityPlugin)this).Config.Bind<bool>("Lighting", "Realtime Reflection Probes", false, "Enable or disable realtime reflection probes.");
		billboardsFaceCamera = ((BaseUnityPlugin)this).Config.Bind<bool>("Rendering", "Billboards Face Camera", false, "Enable or disable billboards facing the camera.");
		ApplyGraphicsSettings();
	}

	private void ApplyGraphicsSettings()
	{
		int num = 768;
		Screen.SetResolution((int)(1366f * resolutionScale.Value), (int)((float)num * resolutionScale.Value), Screen.fullScreen);
		QualitySettings.globalTextureMipmapLimit = 3 - textureQuality.Value;
		QualitySettings.antiAliasing = antiAliasing.Value switch
		{
			0 => 0, 
			1 => 2, 
			2 => 4, 
			3 => 8, 
			_ => 2, 
		};
		QualitySettings.vSyncCount = (enableVSync.Value ? 1 : 0);
		QualitySettings.shadows = (ShadowQuality)shadowQuality.Value;
		QualitySettings.shadowResolution = (ShadowResolution)shadowResolution.Value;
		QualitySettings.shadowDistance = shadowDistance.Value;
		QualitySettings.anisotropicFiltering = (AnisotropicFiltering)anisotropicFiltering.Value;
		QualitySettings.softParticles = softParticles.Value;
		QualitySettings.realtimeReflectionProbes = realtimeReflectionProbes.Value;
		QualitySettings.billboardsFaceCameraPosition = billboardsFaceCamera.Value;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Graphics settings applied!");
	}
}