using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PluginConfig.API; using PluginConfig.API.Fields; using StylePixelator.patches; using UnityEngine; [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("StylePixelator")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("StylePixelator")] [assembly: AssemblyTitle("StylePixelator")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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; } } } namespace StylePixelator { public enum Difficulty { Easy, Normal, Hard, Extreme, ScreenMustDie } public enum Style { D, C, B, A, S, SS, SSS, ULTRAKILL } public enum PixelationLevel { OhGod = 6, ReallyHeavy = 5, Heavy = 4, Mid = 3, LessMid = 2, Lean = 1, NoPixelation = 0 } public static class DifficultyTable { public static readonly Dictionary> Table = new Dictionary> { { Difficulty.Easy, new Dictionary { { Style.D, PixelationLevel.ReallyHeavy }, { Style.C, PixelationLevel.Heavy }, { Style.B, PixelationLevel.Mid }, { Style.A, PixelationLevel.LessMid }, { Style.S, PixelationLevel.LessMid }, { Style.SS, PixelationLevel.Lean }, { Style.SSS, PixelationLevel.NoPixelation }, { Style.ULTRAKILL, PixelationLevel.NoPixelation } } }, { Difficulty.Normal, new Dictionary { { Style.D, PixelationLevel.OhGod }, { Style.C, PixelationLevel.ReallyHeavy }, { Style.B, PixelationLevel.Heavy }, { Style.A, PixelationLevel.Heavy }, { Style.S, PixelationLevel.Mid }, { Style.SS, PixelationLevel.LessMid }, { Style.SSS, PixelationLevel.Lean }, { Style.ULTRAKILL, PixelationLevel.NoPixelation } } }, { Difficulty.Hard, new Dictionary { { Style.D, PixelationLevel.OhGod }, { Style.C, PixelationLevel.OhGod }, { Style.B, PixelationLevel.ReallyHeavy }, { Style.A, PixelationLevel.Heavy }, { Style.S, PixelationLevel.Heavy }, { Style.SS, PixelationLevel.Mid }, { Style.SSS, PixelationLevel.LessMid }, { Style.ULTRAKILL, PixelationLevel.Lean } } }, { Difficulty.Extreme, new Dictionary { { Style.D, PixelationLevel.OhGod }, { Style.C, PixelationLevel.OhGod }, { Style.B, PixelationLevel.OhGod }, { Style.A, PixelationLevel.ReallyHeavy }, { Style.S, PixelationLevel.ReallyHeavy }, { Style.SS, PixelationLevel.Heavy }, { Style.SSS, PixelationLevel.Mid }, { Style.ULTRAKILL, PixelationLevel.LessMid } } }, { Difficulty.ScreenMustDie, new Dictionary { { Style.D, PixelationLevel.OhGod }, { Style.C, PixelationLevel.OhGod }, { Style.B, PixelationLevel.OhGod }, { Style.A, PixelationLevel.OhGod }, { Style.S, PixelationLevel.OhGod }, { Style.SS, PixelationLevel.OhGod }, { Style.SSS, PixelationLevel.ReallyHeavy }, { Style.ULTRAKILL, PixelationLevel.LessMid } } } }; } [BepInPlugin("com.d4navi0.StylePixelator", "Style Pixelator", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class StylePixelator : BaseUnityPlugin { internal class StylePixelatorInfo { internal const string NAME = "Style Pixelator"; internal const string GUID = "com.d4navi0.StylePixelator"; internal const string VERSION = "1.0.0"; } internal static ManualLogSource Logger; private readonly Harmony harmony = new Harmony("com.d4navi0.StylePixelator"); internal static PluginConfigurator config; private void Awake() { //IL_00cf: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0093: 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) Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"youre gonna have a bad time"); harmony.PatchAll(); config = PluginConfigurator.Create("Style Pixelator", "com.d4navi0.StylePixelator"); string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "hesD.png"); if (File.Exists(path)) { byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { Sprite image = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); config.image = image; } } BoolField val2 = new BoolField(config.rootPanel, "Mod enabled", "enabled", true); StyleHUD_Update_Patch.enabled = val2.value; ConfigDivision mainPanel = new ConfigDivision(config.rootPanel, "division"); val2.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e) { ((ConfigField)mainPanel).interactable = e.value; StyleHUD_Update_Patch.enabled = e.value; }; EnumField obj = new EnumField(config.rootPanel, "Difficulty", "difficulty", Difficulty.Normal); obj.SetEnumDisplayName(Difficulty.Extreme, "i wouldnt pick this if i were you"); obj.SetEnumDisplayName(Difficulty.ScreenMustDie, "Screen Resolution Must Die"); StyleHUD_Update_Patch.difficulty = obj.value; obj.onValueChange += delegate(EnumValueChangeEvent e) { StyleHUD_Update_Patch.difficulty = e.value; }; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "StylePixelator"; public const string PLUGIN_NAME = "StylePixelator"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace StylePixelator.patches { [HarmonyPatch(typeof(StyleHUD), "Update")] public class StyleHUD_Update_Patch { private static int lastRank = -1; public static Difficulty difficulty = Difficulty.ScreenMustDie; public static bool enabled = false; private static bool lastEnabled = false; [HarmonyPostfix] private static void Postfix(StyleHUD __instance) { if ((Object)(object)__instance == (Object)null) { return; } if (!enabled) { if (!lastEnabled) { return; } lastEnabled = enabled; int num = MonoSingleton.Instance.GetInt("pixelization", 0); Traverse.Create((object)MonoSingleton.Instance).Method("SetPixelization", new object[1] { num }).GetValue(); } lastEnabled = enabled; ApplyDynamicDownscale(__instance.rankIndex); } private static void ApplyDynamicDownscale(int rank) { PixelationLevel pixelationLevel = DifficultyTable.Table[difficulty][(Style)rank]; Traverse.Create((object)MonoSingleton.Instance).Method("SetPixelization", new object[1] { (int)pixelationLevel }).GetValue(); } } }