using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreGraphics")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreGraphics")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b8fe07aa-c40e-4a05-a730-db7f2a42a6c1")]
[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 MoreGraphics;
[BepInPlugin("com.lordlakens.moregraphics", "MoreGraphics", "2.0.0")]
public class Plugin : BaseUnityPlugin
{
private PostProcessVolume customVolume;
private PostProcessProfile customProfile;
private ColorGrading colorGradingModule;
private Grain sharpenModule;
private AmbientOcclusion ambientOcclusionModule;
private Bloom bloomModule;
private Vignette vignetteModule;
private ScreenSpaceReflections ssrModule;
private float scanTimer = 0f;
private float scanInterval = 2f;
private bool isModEnabled = true;
private string notificationText = "";
private float notificationAlpha = 0f;
private float notificationTimer = 0f;
private const float NOTIFICATION_DURATION = 1.5f;
private const float FADE_SPEED = 2f;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"=========================================");
((BaseUnityPlugin)this).Logger.LogInfo((object)" MoreGraphics: TABS Crisp Light Edition ");
((BaseUnityPlugin)this).Logger.LogInfo((object)" Sharp & Defined Particle Glow Fix ");
((BaseUnityPlugin)this).Logger.LogInfo((object)"=========================================");
ApplyEngineQualityEnhancements();
ShowNotification("MoreGraphics Ultra Loaded!");
}
private void Update()
{
HandleHotkeys();
HandleScanning();
UpdateNotificationAlpha();
}
private void HandleHotkeys()
{
if (Input.GetKeyDown((KeyCode)287))
{
isModEnabled = !isModEnabled;
if ((Object)(object)customVolume != (Object)null)
{
((Behaviour)customVolume).enabled = isModEnabled;
}
string text = (isModEnabled ? "MoreGraphics : Enable" : "MoreGraphics : Disable");
((BaseUnityPlugin)this).Logger.LogInfo((object)text);
ShowNotification(text);
}
}
private void HandleScanning()
{
if (isModEnabled)
{
scanTimer += Time.deltaTime;
if (scanTimer >= scanInterval)
{
scanTimer = 0f;
InjectTABSGraphics();
}
}
}
private void ApplyEngineQualityEnhancements()
{
QualitySettings.masterTextureLimit = 0;
QualitySettings.anisotropicFiltering = (AnisotropicFiltering)2;
QualitySettings.pixelLightCount = 32;
QualitySettings.shadows = (ShadowQuality)2;
QualitySettings.shadowResolution = (ShadowResolution)3;
QualitySettings.shadowProjection = (ShadowProjection)1;
QualitySettings.shadowCascades = 4;
QualitySettings.shadowDistance = 300f;
QualitySettings.softVegetation = true;
QualitySettings.realtimeReflectionProbes = true;
}
private void InjectTABSGraphics()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
Camera main = Camera.main;
if ((Object)(object)main != (Object)null)
{
main.depthTextureMode = (DepthTextureMode)(main.depthTextureMode | 3);
PostProcessLayer val = ((Component)main).GetComponent<PostProcessLayer>();
if ((Object)(object)val == (Object)null)
{
val = ((Component)main).gameObject.AddComponent<PostProcessLayer>();
}
val.volumeTrigger = ((Component)main).transform;
val.volumeLayer = LayerMask.op_Implicit(-1);
val.antialiasingMode = (Antialiasing)2;
val.subpixelMorphologicalAntialiasing.quality = (Quality)2;
if ((Object)(object)customVolume == (Object)null)
{
CreateCustomVolume(main);
}
}
InjectGlossToMaterials();
EnhanceLights();
}
private void CreateCustomVolume(Camera parentCam)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("MoreGraphics_CustomVolume");
val.transform.SetParent(((Component)parentCam).transform);
customVolume = val.AddComponent<PostProcessVolume>();
customVolume.isGlobal = true;
customVolume.priority = 99999f;
customProfile = ScriptableObject.CreateInstance<PostProcessProfile>();
colorGradingModule = customProfile.AddSettings<ColorGrading>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)colorGradingModule).enabled).value = true;
((ParameterOverride<Tonemapper>)(object)colorGradingModule.tonemapper).value = (Tonemapper)2;
((ParameterOverride<float>)(object)colorGradingModule.postExposure).value = 0.25f;
((ParameterOverride<float>)(object)colorGradingModule.saturation).value = 28f;
((ParameterOverride<float>)(object)colorGradingModule.contrast).value = 20f;
bloomModule = customProfile.AddSettings<Bloom>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)bloomModule).enabled).value = true;
((ParameterOverride<float>)(object)bloomModule.intensity).value = 2.4f;
((ParameterOverride<float>)(object)bloomModule.threshold).value = 0.65f;
((ParameterOverride<float>)(object)bloomModule.softKnee).value = 0.3f;
((ParameterOverride<float>)(object)bloomModule.diffusion).value = 4.2f;
((ParameterOverride<float>)(object)bloomModule.clamp).value = 8f;
ssrModule = customProfile.AddSettings<ScreenSpaceReflections>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)ssrModule).enabled).value = true;
((ParameterOverride<ScreenSpaceReflectionPreset>)(object)ssrModule.preset).value = (ScreenSpaceReflectionPreset)3;
ambientOcclusionModule = customProfile.AddSettings<AmbientOcclusion>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)ambientOcclusionModule).enabled).value = true;
((ParameterOverride<float>)(object)ambientOcclusionModule.intensity).value = 0.9f;
((ParameterOverride<float>)(object)ambientOcclusionModule.radius).value = 0.5f;
vignetteModule = customProfile.AddSettings<Vignette>();
((ParameterOverride<bool>)(object)((PostProcessEffectSettings)vignetteModule).enabled).value = true;
((ParameterOverride<float>)(object)vignetteModule.intensity).value = 0.1f;
customVolume.profile = customProfile;
}
private void InjectGlossToMaterials()
{
Renderer[] array = Object.FindObjectsOfType<Renderer>();
if (array == null)
{
return;
}
Renderer[] array2 = array;
foreach (Renderer val in array2)
{
if ((Object)(object)val == (Object)null)
{
continue;
}
val.shadowCastingMode = (ShadowCastingMode)1;
val.receiveShadows = true;
Material[] materials = val.materials;
foreach (Material val2 in materials)
{
if (!((Object)(object)val2 == (Object)null))
{
if (val2.HasProperty("_Glossiness"))
{
val2.SetFloat("_Glossiness", 0.65f);
}
if (val2.HasProperty("_Smoothness"))
{
val2.SetFloat("_Smoothness", 0.65f);
}
if (val2.HasProperty("_SpecularHighlights"))
{
val2.SetFloat("_SpecularHighlights", 1f);
}
}
}
}
}
private void EnhanceLights()
{
Light[] array = Object.FindObjectsOfType<Light>();
if (array == null)
{
return;
}
Light[] array2 = array;
foreach (Light val in array2)
{
if (!((Object)(object)val == (Object)null))
{
val.renderMode = (LightRenderMode)1;
val.shadows = (LightShadows)2;
val.shadowStrength = 0.9f;
}
}
}
private void ShowNotification(string text)
{
notificationText = text;
notificationAlpha = 1f;
notificationTimer = 1.5f;
}
private void UpdateNotificationAlpha()
{
if (notificationAlpha > 0f)
{
notificationTimer -= Time.deltaTime;
if (notificationTimer <= 0f)
{
notificationAlpha = Mathf.MoveTowards(notificationAlpha, 0f, Time.deltaTime * 2f);
}
}
}
private void OnGUI()
{
//IL_002b: 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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
if (notificationAlpha > 0f)
{
GUI.color = new Color(1f, 1f, 1f, notificationAlpha);
GUIStyle val = new GUIStyle(GUI.skin.label)
{
fontSize = 16,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)4
};
float num = 350f;
float num2 = 35f;
float num3 = ((float)Screen.width - num) / 2f;
float num4 = 20f;
GUI.Box(new Rect(num3 - 5f, num4 - 5f, num + 10f, num2 + 10f), "", GUI.skin.box);
GUI.Label(new Rect(num3, num4, num, num2), notificationText, val);
}
}
}