using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("ShaderMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShaderMod")] [assembly: AssemblyTitle("ShaderMod")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } } [BepInPlugin("com.liamgaming.shadermod", "ShaderMod", "1.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ShaderModPlugin : BaseUnityPlugin { private static GameObject filterCanvas; private static Image filterImage; private ConfigEntry activeFilter; private ConfigEntry cycleFilterKey; private readonly string[] filters = new string[7] { "NONE", "VAPORWAVE", "MATRIX", "GOLD", "TOXIC", "SEPIA", "NOIR" }; private void Awake() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ModRegistry.Register(new ModEntry { ModName = "ShaderMod", ModType = ((object)this).GetType() }); activeFilter = ((BaseUnityPlugin)this).Config.Bind("General", "Active Filter", "NONE", "Active visual screen filter. Options: NONE, VAPORWAVE, MATRIX, GOLD, TOXIC, SEPIA, NOIR."); cycleFilterKey = ((BaseUnityPlugin)this).Config.Bind("Hotkeys", "Cycle Filter Hotkey", (KeyCode)288, "Hotkey to cycle through screen filters."); activeFilter.SettingChanged += delegate { ApplyFilter(); }; } private void Start() { EnsureFilterUI(); ApplyFilter(); } private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (InputHelper.GetKeyDown(cycleFilterKey.Value)) { CycleFilter(); } } private void CycleFilter() { int num = Array.IndexOf(filters, activeFilter.Value.ToUpper()); if (num == -1) { num = 0; } int num2 = (num + 1) % filters.Length; activeFilter.Value = filters[num2]; } private void ApplyFilter() { //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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) if ((Object)(object)filterImage == (Object)null) { EnsureFilterUI(); } if (!((Object)(object)filterImage == (Object)null)) { string text = activeFilter.Value.ToUpper(); switch (text) { case "NONE": ((Graphic)filterImage).color = Color.clear; filterCanvas.SetActive(false); break; case "VAPORWAVE": ((Graphic)filterImage).color = new Color(0.9f, 0.1f, 0.6f, 0.15f); filterCanvas.SetActive(true); break; case "MATRIX": ((Graphic)filterImage).color = new Color(0f, 1f, 0.2f, 0.12f); filterCanvas.SetActive(true); break; case "GOLD": ((Graphic)filterImage).color = new Color(1f, 0.7f, 0f, 0.12f); filterCanvas.SetActive(true); break; case "TOXIC": ((Graphic)filterImage).color = new Color(0.7f, 1f, 0f, 0.14f); filterCanvas.SetActive(true); break; case "SEPIA": ((Graphic)filterImage).color = new Color(0.45f, 0.32f, 0.15f, 0.22f); filterCanvas.SetActive(true); break; case "NOIR": ((Graphic)filterImage).color = new Color(0.02f, 0.02f, 0.04f, 0.45f); filterCanvas.SetActive(true); break; default: ((Graphic)filterImage).color = Color.clear; filterCanvas.SetActive(false); break; } Debug.Log((object)("[ShaderMod] Applied screen filter: " + text)); } } private void EnsureFilterUI() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)filterCanvas != (Object)null)) { filterCanvas = new GameObject("ShaderFilterCanvas"); Object.DontDestroyOnLoad((Object)(object)filterCanvas); Canvas val = filterCanvas.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 9998; CanvasScaler val2 = filterCanvas.AddComponent(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.screenMatchMode = (ScreenMatchMode)0; val2.matchWidthOrHeight = 0.5f; GameObject val3 = new GameObject("FilterImage"); val3.transform.SetParent(filterCanvas.transform, false); filterImage = val3.AddComponent(); ((Graphic)filterImage).color = Color.clear; ((Graphic)filterImage).raycastTarget = false; RectTransform component = val3.GetComponent(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; component.anchoredPosition = Vector2.zero; } } } public static class InputHelper { public static bool GetKeyDown(KeyCode key) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references) try { if (Keyboard.current != null) { Key inputSystemKey = GetInputSystemKey(key); if ((int)inputSystemKey != 0 && ((ButtonControl)Keyboard.current[inputSystemKey]).wasPressedThisFrame) { return true; } } } catch { } try { if (Input.GetKeyDown(key)) { return true; } } catch { } return false; } public static bool GetKey(KeyCode key) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references) try { if (Keyboard.current != null) { Key inputSystemKey = GetInputSystemKey(key); if ((int)inputSystemKey != 0 && ((ButtonControl)Keyboard.current[inputSystemKey]).isPressed) { return true; } } } catch { } try { if (Input.GetKey(key)) { return true; } } catch { } return false; } private static Key GetInputSystemKey(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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) //IL_0008: Invalid comparison between Unknown and I4 //IL_00b9: 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) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0065: Expected I4, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if ((int)key != 45) { if ((int)key != 61) { return (Key)((key - 278) switch { 4 => 94, 5 => 95, 6 => 96, 7 => 97, 8 => 98, 9 => 99, 10 => 100, 11 => 101, 12 => 102, 13 => 103, 14 => 104, 15 => 105, 0 => 68, 2 => 67, 3 => 66, _ => 0, }); } return (Key)14; } return (Key)13; } }