using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("No Motion Blur!")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("No Motion Blur!")]
[assembly: AssemblyTitle("No Motion Blur!")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace No_Motion_Blur_;
[BepInPlugin("com.kobbler.nomotionblur", "No More Motion Blur", "2.1.0")]
public class NoMotionBlurPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <ApplyRoutine>d__6 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public NoMotionBlurPlugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApplyRoutine>d__6(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
int num = <>1__state;
NoMotionBlurPlugin noMotionBlurPlugin = <>4__this;
switch (num)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
noMotionBlurPlugin.ApplySettings();
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 ConfigEntry<bool> DisableMotionBlur;
private ConfigEntry<bool> DisablePostProcessing;
private ConfigEntry<bool> DisableTAA;
private void Awake()
{
DisableMotionBlur = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "DisableMotionBlur", true, "Set to true to disable motion blur, false to leave it enabled.");
DisablePostProcessing = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "DisablePostProcessing", false, "Set to true to disable all post-processing effects.");
DisableTAA = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "DisableTAA", false, "Set to true to disable Temporal AA completely (If you feel any sort of ghosting or smearing, I recommend turning this on. The graphics will look sharper when enabled.)");
((BaseUnityPlugin)this).Logger.LogInfo((object)$"[NoMoreMotionBlur] Config loaded. DisableMotionBlur={DisableMotionBlur.Value}, DisablePostProcessing={DisablePostProcessing.Value}, DisableTAA={DisableTAA.Value}");
SceneManager.sceneLoaded += OnSceneLoaded;
((MonoBehaviour)this).StartCoroutine(ApplyRoutine());
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("[NoMoreMotionBlur] Scene loaded -> " + ((Scene)(ref scene)).name + ", applying settings..."));
((MonoBehaviour)this).StartCoroutine(ApplyRoutine());
}
[IteratorStateMachine(typeof(<ApplyRoutine>d__6))]
private IEnumerator ApplyRoutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApplyRoutine>d__6(0)
{
<>4__this = this
};
}
private void ApplySettings()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
string name = ((Scene)(ref activeScene)).name;
Volume[] array = Object.FindObjectsOfType<Volume>(true);
((BaseUnityPlugin)this).Logger.LogInfo((object)$"[NoMoreMotionBlur] Found {array.Length} Volume(s) in scene {name}.");
Volume[] array2 = array;
MotionBlur val2 = default(MotionBlur);
foreach (Volume val in array2)
{
if (!((Object)(object)val.profile == (Object)null))
{
if (DisableMotionBlur.Value && val.profile.TryGet<MotionBlur>(ref val2))
{
((VolumeComponent)val2).active = false;
((VolumeParameter<float>)(object)val2.intensity).Override(0f);
((BaseUnityPlugin)this).Logger.LogInfo((object)"[NoMoreMotionBlur] Motion Blur disabled.");
}
if (DisablePostProcessing.Value)
{
((Behaviour)val).enabled = false;
((BaseUnityPlugin)this).Logger.LogInfo((object)"[NoMoreMotionBlur] Post-processing disabled.");
}
}
}
Camera main = Camera.main;
UniversalAdditionalCameraData val3 = default(UniversalAdditionalCameraData);
if ((Object)(object)main != (Object)null && ((Component)main).TryGetComponent<UniversalAdditionalCameraData>(ref val3))
{
if (DisableTAA.Value)
{
val3.antialiasing = (AntialiasingMode)0;
((BaseUnityPlugin)this).Logger.LogInfo((object)"[NoMoreMotionBlur] TAA disabled.");
}
else
{
val3.antialiasing = (AntialiasingMode)3;
((BaseUnityPlugin)this).Logger.LogInfo((object)"[NoMoreMotionBlur] TAA enabled (using the game's Temporal AA).");
}
}
}
}