using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ClassLibrary3")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary3")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2412f0df-5055-4d90-b4e3-06e969ccc76d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.yourname.graphicsgrab", "GraphicsGrab", "1.9.0")]
public class GraphicsGrab : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <SetParticlesSmooth>d__23 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public bool original;
public GraphicsGrab <>4__this;
private ParticleSystem[] <systems>5__2;
private float <duration>5__3;
private float <timer>5__4;
private float[] <startRates>5__5;
private float[] <endRates>5__6;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetParticlesSmooth>d__23(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<systems>5__2 = null;
<startRates>5__5 = null;
<endRates>5__6 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
GraphicsGrab graphicsGrab = <>4__this;
switch (num)
{
default:
return false;
case 0:
{
<>1__state = -1;
<systems>5__2 = Object.FindObjectsOfType<ParticleSystem>();
if (<systems>5__2.Length == 0)
{
return false;
}
<duration>5__3 = 1f;
<timer>5__4 = 0f;
<startRates>5__5 = new float[<systems>5__2.Length];
<endRates>5__6 = new float[<systems>5__2.Length];
for (int i = 0; i < <systems>5__2.Length; i++)
{
EmissionModule emission = <systems>5__2[i].emission;
float[] array = <startRates>5__5;
int num2 = i;
MinMaxCurve rateOverTime = ((EmissionModule)(ref emission)).rateOverTime;
float num3;
if ((int)((MinMaxCurve)(ref rateOverTime)).mode != 0)
{
num3 = 50f;
}
else
{
rateOverTime = ((EmissionModule)(ref emission)).rateOverTime;
num3 = ((MinMaxCurve)(ref rateOverTime)).constant;
}
array[num2] = num3;
<endRates>5__6[i] = (original ? (<startRates>5__5[i] * 5f) : (<startRates>5__5[i] * 0.2f));
}
break;
}
case 1:
<>1__state = -1;
break;
}
if (<timer>5__4 < <duration>5__3)
{
for (int j = 0; j < <systems>5__2.Length; j++)
{
EmissionModule emission2 = <systems>5__2[j].emission;
((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Lerp(<startRates>5__5[j], <endRates>5__6[j], <timer>5__4 / <duration>5__3));
}
<timer>5__4 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
for (int k = 0; k < <systems>5__2.Length; k++)
{
EmissionModule emission3 = <systems>5__2[k].emission;
((EmissionModule)(ref emission3)).rateOverTime = MinMaxCurve.op_Implicit(<endRates>5__6[k]);
}
((BaseUnityPlugin)graphicsGrab).Logger.LogInfo((object)("Particles " + (original ? "Original" : "Low") + " applied smoothly."));
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <ToggleGPUBoost>d__19 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GraphicsGrab <>4__this;
private bool <success>5__2;
private string <error>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ToggleGPUBoost>d__19(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<error>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
GraphicsGrab graphicsGrab = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
graphicsGrab.gpuCoroutineRunning = true;
graphicsGrab.gpuBoostActive = !graphicsGrab.gpuBoostActive;
graphicsGrab.gpuMessage = (graphicsGrab.gpuBoostActive ? "GPU Boost Loading..." : "GPU Boost Deactivating...");
graphicsGrab.gpuMessageTimer = float.MaxValue;
<success>5__2 = true;
<error>5__3 = "";
try
{
graphicsGrab.SetGraphicsLow();
Light[] array = Object.FindObjectsOfType<Light>();
foreach (Light val in array)
{
if ((Object)(object)val != (Object)null)
{
val.shadows = (LightShadows)((!graphicsGrab.gpuBoostActive) ? 1 : 0);
}
}
graphicsGrab.SetPostProcessing(!graphicsGrab.gpuBoostActive);
graphicsGrab.UpdateTargetValues();
}
catch (Exception ex)
{
<success>5__2 = false;
<error>5__3 = ex.Message;
((BaseUnityPlugin)graphicsGrab).Logger.LogError((object)("GPU Boost failed: " + ex));
}
<>2__current = ((MonoBehaviour)graphicsGrab).StartCoroutine(graphicsGrab.SetParticlesSmooth(!graphicsGrab.gpuBoostActive));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
graphicsGrab.gpuMessage = ((!<success>5__2) ? ("GPU Boost Error: " + <error>5__3) : (graphicsGrab.gpuBoostActive ? "GPU Boost Active!" : "GPU Boost Off!"));
graphicsGrab.gpuMessageTimer = 5f;
graphicsGrab.gpuCoroutineRunning = false;
((BaseUnityPlugin)graphicsGrab).Logger.LogInfo((object)("GPU Boost " + ((!<success>5__2) ? "Failed" : (graphicsGrab.gpuBoostActive ? "Enabled" : "Disabled"))));
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <ToggleMagic>d__18 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GraphicsGrab <>4__this;
public bool enable;
private bool <success>5__2;
private string <error>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ToggleMagic>d__18(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<error>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
GraphicsGrab graphicsGrab = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
graphicsGrab.magicCoroutineRunning = true;
graphicsGrab.magicMessage = (enable ? "Magic Loading..." : "Magic Deactivating...");
graphicsGrab.magicMessageTimer = float.MaxValue;
<success>5__2 = true;
<error>5__3 = "";
graphicsGrab.magicActive = enable;
graphicsGrab.UpdateTargetValues();
try
{
if ((Object)(object)Camera.main != (Object)null)
{
Camera.main.farClipPlane = (enable ? 750f : 1000f);
}
ParticleSystem[] array = Object.FindObjectsOfType<ParticleSystem>();
for (int i = 0; i < array.Length; i++)
{
MainModule main = array[i].main;
((MainModule)(ref main)).maxParticles = Mathf.Clamp(enable ? (((MainModule)(ref main)).maxParticles / 2) : (((MainModule)(ref main)).maxParticles * 2), 50, 50000);
}
}
catch (Exception ex)
{
<success>5__2 = false;
<error>5__3 = ex.Message;
((BaseUnityPlugin)graphicsGrab).Logger.LogError((object)("Magic failed: " + ex));
}
<>2__current = ((MonoBehaviour)graphicsGrab).StartCoroutine(graphicsGrab.SetParticlesSmooth(enable));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
graphicsGrab.magicMessage = ((!<success>5__2) ? ("Magic Error: " + <error>5__3) : (enable ? "Magic Active!" : "Magic Off!"));
graphicsGrab.magicMessageTimer = 5f;
graphicsGrab.magicCoroutineRunning = false;
((BaseUnityPlugin)graphicsGrab).Logger.LogInfo((object)("Magic " + ((!<success>5__2) ? "Failed" : (enable ? "Enabled" : "Disabled"))));
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private bool showMenu;
private bool magicActive;
private bool gpuBoostActive;
private bool magicCoroutineRunning;
private bool gpuCoroutineRunning;
private GUIStyle boxStyle;
private GUIStyle buttonStyle;
private GUIStyle hudStyle;
private string magicMessage = "";
private string gpuMessage = "";
private float magicMessageTimer;
private float gpuMessageTimer;
private float targetLODBias = 1f;
private float targetShadowDistance = 50f;
private float smoothSpeed = 2f;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"GraphicsGrab v1.9 loaded");
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)285))
{
showMenu = !showMenu;
((BaseUnityPlugin)this).Logger.LogInfo((object)("Performance Menu toggled: " + (showMenu ? "Open" : "Closed")));
}
QualitySettings.lodBias = Mathf.Lerp(QualitySettings.lodBias, targetLODBias, smoothSpeed * Time.deltaTime);
QualitySettings.shadowDistance = Mathf.Lerp(QualitySettings.shadowDistance, targetShadowDistance, smoothSpeed * Time.deltaTime);
if (magicMessageTimer > 0f)
{
magicMessageTimer -= Time.deltaTime;
}
if (gpuMessageTimer > 0f)
{
gpuMessageTimer -= Time.deltaTime;
}
}
private void OnGUI()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Expected O, but got Unknown
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Expected O, but got Unknown
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_033a: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
if (hudStyle == null)
{
GUIStyle val = new GUIStyle(GUI.skin.label)
{
fontSize = 16
};
val.normal.textColor = Color.cyan;
val.alignment = (TextAnchor)2;
hudStyle = val;
}
if (magicMessageTimer > 0f)
{
GUI.Label(new Rect((float)(Screen.width - 220), 10f, 220f, 30f), magicMessage, hudStyle);
}
if (gpuMessageTimer > 0f)
{
GUI.Label(new Rect((float)(Screen.width - 220), 40f, 220f, 30f), gpuMessage, hudStyle);
}
if (showMenu)
{
if (boxStyle == null)
{
GUIStyle val2 = new GUIStyle(GUI.skin.box)
{
fontSize = 16,
alignment = (TextAnchor)1
};
val2.normal.background = Texture2D.blackTexture;
val2.normal.textColor = Color.white;
boxStyle = val2;
}
if (buttonStyle == null)
{
GUIStyle val3 = new GUIStyle(GUI.skin.button)
{
fontSize = 14
};
val3.normal.textColor = Color.white;
val3.hover.textColor = Color.yellow;
val3.active.textColor = Color.green;
buttonStyle = val3;
}
GUI.Box(new Rect(10f, 10f, 260f, 500f), "Performance Menu v1.9", boxStyle);
if (GUI.Button(new Rect(20f, 50f, 220f, 30f), "Resolution 1920x1080", buttonStyle))
{
Screen.SetResolution(1920, 1080, Screen.fullScreen);
}
if (GUI.Button(new Rect(20f, 90f, 220f, 30f), "Resolution 1280x720", buttonStyle))
{
Screen.SetResolution(1280, 720, Screen.fullScreen);
}
if (GUI.Button(new Rect(20f, 130f, 220f, 30f), "Magic ON", buttonStyle) && !magicCoroutineRunning)
{
((MonoBehaviour)this).StartCoroutine(ToggleMagic(enable: true));
}
if (GUI.Button(new Rect(20f, 170f, 220f, 30f), "Magic OFF", buttonStyle) && !magicCoroutineRunning)
{
((MonoBehaviour)this).StartCoroutine(ToggleMagic(enable: false));
}
if (GUI.Button(new Rect(20f, 210f, 220f, 30f), "Original Graphics", buttonStyle))
{
SetGraphicsOriginal();
}
if (GUI.Button(new Rect(20f, 250f, 220f, 30f), "Low Graphics", buttonStyle))
{
SetGraphicsLow();
}
if (GUI.Button(new Rect(20f, 290f, 220f, 30f), "Particles: Original", buttonStyle))
{
((MonoBehaviour)this).StartCoroutine(SetParticlesSmooth(original: true));
}
if (GUI.Button(new Rect(20f, 330f, 220f, 30f), "Particles: Low", buttonStyle))
{
((MonoBehaviour)this).StartCoroutine(SetParticlesSmooth(original: false));
}
if (GUI.Button(new Rect(20f, 370f, 220f, 30f), "GPU Boost", buttonStyle) && !gpuCoroutineRunning)
{
((MonoBehaviour)this).StartCoroutine(ToggleGPUBoost());
}
}
}
[IteratorStateMachine(typeof(<ToggleMagic>d__18))]
private IEnumerator ToggleMagic(bool enable)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ToggleMagic>d__18(0)
{
<>4__this = this,
enable = enable
};
}
[IteratorStateMachine(typeof(<ToggleGPUBoost>d__19))]
private IEnumerator ToggleGPUBoost()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ToggleGPUBoost>d__19(0)
{
<>4__this = this
};
}
private void UpdateTargetValues()
{
targetShadowDistance = (gpuBoostActive ? 0f : 50f);
targetLODBias = (magicActive ? 0.7f : 1f);
if (gpuBoostActive && magicActive)
{
targetLODBias = 0.6f;
targetShadowDistance = 10f;
}
}
private void SetGraphicsOriginal()
{
QualitySettings.SetQualityLevel(5, true);
UpdateTargetValues();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Graphics set to Original");
}
private void SetGraphicsLow()
{
QualitySettings.SetQualityLevel(0, true);
QualitySettings.antiAliasing = 0;
QualitySettings.masterTextureLimit = 2;
UpdateTargetValues();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Graphics set to Low");
}
[IteratorStateMachine(typeof(<SetParticlesSmooth>d__23))]
private IEnumerator SetParticlesSmooth(bool original)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SetParticlesSmooth>d__23(0)
{
<>4__this = this,
original = original
};
}
private void SetPostProcessing(bool enable)
{
}
}