using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.riskivr.MotionBlur")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MotionBlur")]
[assembly: AssemblyTitle("com.riskivr.MotionBlur")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace com.riskivr.MotionBlur
{
internal static class ConfigHelper
{
public static void SetModIcon(Sprite sprite)
{
if (LethalConfigProxy.Enabled)
{
LethalConfigProxy.SetModIcon(sprite);
}
}
public static void SetModDescription(string description)
{
if (LethalConfigProxy.Enabled)
{
LethalConfigProxy.SetModDescription(description);
}
}
public static void SkipAutoGen()
{
if (LethalConfigProxy.Enabled)
{
LethalConfigProxy.SkipAutoGen();
}
}
public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, bool requiresRestart, string description, AcceptableValueBase acceptableValues = null, Action<T> settingChanged = null, ConfigFile configFile = null)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
if (configFile == null)
{
configFile = ((BaseUnityPlugin)Mod.Instance).Config;
}
ConfigEntry<T> configEntry = ((acceptableValues == null) ? configFile.Bind<T>(section, key, defaultValue, description) : configFile.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty<object>())));
if (settingChanged != null)
{
configEntry.SettingChanged += delegate
{
settingChanged?.Invoke(configEntry.Value);
};
}
if (LethalConfigProxy.Enabled)
{
if (acceptableValues == null)
{
LethalConfigProxy.AddConfig<T>(configEntry, requiresRestart);
}
else
{
LethalConfigProxy.AddConfigSlider<T>(configEntry, requiresRestart);
}
}
return configEntry;
}
public static void AddButton(string section, string name, string description, string buttonText, Action callback)
{
if (LethalConfigProxy.Enabled)
{
LethalConfigProxy.AddButton(section, name, description, buttonText, callback);
}
}
}
internal static class LethalConfigProxy
{
public const string PLUGIN_GUID = "ainavt.lc.lethalconfig";
public static bool Enabled => Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig");
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void SetModIcon(Sprite sprite)
{
LethalConfigManager.SetModIcon(sprite);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void SetModDescription(string description)
{
LethalConfigManager.SetModDescription(description);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void SkipAutoGen()
{
LethalConfigManager.SkipAutoGen();
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void AddConfig<T>(ConfigEntry<T> configEntry, bool requiresRestart = false)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
if (!(configEntry is ConfigEntry<string> val))
{
if (!(configEntry is ConfigEntry<bool> val2))
{
if (!(configEntry is ConfigEntry<float> val3))
{
if (!(configEntry is ConfigEntry<int> val4))
{
throw new NotSupportedException($"Unsupported type: {typeof(T)}");
}
LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(val4, requiresRestart));
}
else
{
LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(val3, requiresRestart));
}
}
else
{
LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(val2, requiresRestart));
}
}
else
{
LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(val, requiresRestart));
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void AddConfigSlider<T>(ConfigEntry<T> configEntry, bool requiresRestart = false)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
if (!(configEntry is ConfigEntry<float> val))
{
if (!(configEntry is ConfigEntry<int> val2))
{
throw new NotSupportedException($"Slider not supported for type: {typeof(T)}");
}
LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(val2, requiresRestart));
}
else
{
LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(val, requiresRestart));
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void AddButton(string section, string name, string description, string buttonText, Action callback)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate
{
callback?.Invoke();
}));
}
}
[BepInPlugin("com.riskivr.MotionBlur", "MotionBlur", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class Mod : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("com.riskivr.MotionBlur");
internal static Mod Instance;
internal static ManualLogSource logger;
internal static ConfigEntry<float> Intensity;
internal static ConfigEntry<int> SampleCount;
internal static ConfigEntry<bool> Enabled;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
logger = Logger.CreateLogSource("com.riskivr.MotionBlur");
logger.LogInfo((object)"MotionBlur is awake :3");
harmony.PatchAll(typeof(StartOfRoundPatch));
ConfigHelper.SkipAutoGen();
Enabled = ConfigHelper.Bind("Motion Blur", "Enabled", defaultValue: true, requiresRestart: false, "Enable Motion Blur");
Intensity = ConfigHelper.Bind("Motion Blur", "Intensity", 1.2f, requiresRestart: false, "Larger values results in longer exposures and increases the strength of the blur effect", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 2f));
SampleCount = ConfigHelper.Bind("Motion Blur", "Sample Count", 12, requiresRestart: false, "The number of sample points will affect the quality and performance of the blur effect", (AcceptableValueBase)(object)new AcceptableValueRange<int>(8, 32));
Enabled.SettingChanged += delegate
{
StartOfRoundPatch.ApplySettings();
};
Intensity.SettingChanged += delegate
{
StartOfRoundPatch.ApplySettings();
};
SampleCount.SettingChanged += delegate
{
StartOfRoundPatch.ApplySettings();
};
}
}
[HarmonyPatch(typeof(StartOfRound))]
public class StartOfRoundPatch
{
private static Volume postprocess;
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPatch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
RenderPipelineAsset renderPipeline = QualitySettings.renderPipeline;
HDRenderPipelineAsset val = (HDRenderPipelineAsset)(object)((renderPipeline is HDRenderPipelineAsset) ? renderPipeline : null);
if (!((Object)(object)val == (Object)null))
{
RenderPipelineSettings currentPlatformRenderPipelineSettings = val.currentPlatformRenderPipelineSettings;
currentPlatformRenderPipelineSettings.supportMotionVectors = true;
val.currentPlatformRenderPipelineSettings = currentPlatformRenderPipelineSettings;
postprocess = GameObject.Find("Systems/Rendering/VolumeMain").GetComponent<Volume>();
ApplySettings();
}
}
public static void ApplySettings()
{
if (!((Object)(object)postprocess == (Object)null))
{
MotionBlur val = default(MotionBlur);
if (postprocess.profile.TryGet<MotionBlur>(ref val))
{
((VolumeParameter<float>)(object)val.intensity).value = Mod.Intensity.Value;
val.sampleCount = Mod.SampleCount.Value;
((VolumeComponent)val).active = Mod.Enabled.Value;
}
Mod.logger.LogInfo((object)"Settings Applied! :3");
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.riskivr.MotionBlur";
public const string PLUGIN_NAME = "MotionBlur";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}