Decompiled source of Ultrakill64 v1.0.1

plugins/Ultrakill64.dll

Decompiled 8 months ago
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.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Ultrakill64")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("N64 Texture filtering enabler")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+deb1fd0718a4df19d4305aaa926916e65408ce5a")]
[assembly: AssemblyProduct("Ultrakill64")]
[assembly: AssemblyTitle("Ultrakill64")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 Ultrakill64
{
	[HarmonyPatch]
	[BepInPlugin("Hydraxous.ULTRAKILL.Ultrakill64", "Ultrakill64", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony harmony;

		private static ConfigEntry<bool> enableFiltering;

		public const string NAME = "Ultrakill64";

		public const string VERSION = "1.0.1";

		public const string GUID = "Hydraxous.ULTRAKILL.Ultrakill64";

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmony = new Harmony("Hydraxous.ULTRAKILL.Ultrakill64");
			harmony.PatchAll();
			enableFiltering = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable N64 texture filtering");
			enableFiltering.SettingChanged += delegate
			{
				SetEffect(enableFiltering.Value);
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Ultrakill64 is loaded!");
		}

		[HarmonyPatch(typeof(PostProcessV2_Handler), "Fooled")]
		[HarmonyPrefix]
		private static bool OnFooled(PostProcessV2_Handler __instance)
		{
			SetEffect(enableFiltering.Value);
			return false;
		}

		private static void SetEffect(bool enabled)
		{
			if (enabled)
			{
				Shader.EnableKeyword("Fooled");
			}
			else
			{
				Shader.DisableKeyword("Fooled");
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Ultrakill64";

		public const string PLUGIN_NAME = "Ultrakill64";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}