using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BoneLib.BoneMenu; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using QuickProcessing; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(QuickProcessingMod), "QuickProcessing", "1.0.0", "nontendo", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("QuickProcessing")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("QuickProcessing")] [assembly: AssemblyTitle("QuickProcessing")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace QuickProcessing { public static class PostFX { private static GameObject? _go; private static Volume? _vol; private static ColorAdjustments? _ca; private static LiftGammaGain? _lgg; private static Tonemapping? _tm; private static WhiteBalance? _wb; private static SplitToning? _st; private static Bloom? _bloom; private static Vignette? _vig; private static FilmGrain? _grain; private static readonly Color Neutral = new Color(0.5f, 0.5f, 0.5f, 0f); private static void EnsureBuilt() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (!((Object)(object)_vol != (Object)null)) { _go = new GameObject("QuickProcessingVolume"); Object.DontDestroyOnLoad((Object)(object)_go); ((Object)_go).hideFlags = (HideFlags)61; _vol = _go.AddComponent(); _vol.isGlobal = true; _vol.priority = 1000f; VolumeProfile val = ScriptableObject.CreateInstance(); _vol.sharedProfile = val; _ca = Add(val); _lgg = Add(val); _tm = Add(val); _wb = Add(val); _st = Add(val); _bloom = Add(val); _vig = Add(val); _grain = Add(val); MelonLogger.Msg("[QuickProcessing] volume built"); } } private static T Add(VolumeProfile p) where T : VolumeComponent { T val = ScriptableObject.CreateInstance(); ((VolumeComponent)val).active = true; p.components.Add((VolumeComponent)(object)val); return val; } public static void Apply() { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) try { bool enabled = ProcessingSettings.Enabled; bool flag = ProcessingSettings.Filter != FilterPreset.None || ProcessingSettings.Temperature != 0f || ProcessingSettings.Tint != 0f || ProcessingSettings.Bloom > 0f || ProcessingSettings.Vignette > 0f || ProcessingSettings.Grain > 0f; if (!enabled && !flag) { if ((Object)(object)_vol != (Object)null) { _vol.weight = 0f; } return; } EnsureBuilt(); if (!((Object)(object)_vol == (Object)null)) { _vol.weight = 1f; float num = (enabled ? ProcessingSettings.Saturation : 0f); float v = (enabled ? ProcessingSettings.Brightness : 0f); float num2 = (enabled ? ProcessingSettings.Contrast : 0f); float num3 = (enabled ? ProcessingSettings.DarksLift : 0f); float num4 = 0f; float num5 = 0f; float num6 = 0f; float num7 = 0f; float num8 = 0f; float v2 = 0f; Color white = Color.white; Color neutral = Neutral; Color neutral2 = Neutral; switch (ProcessingSettings.Filter) { case FilterPreset.Warm: num4 = 25f; ((Color)(ref white))..ctor(1f, 0.93f, 0.82f); break; case FilterPreset.Cool: num4 = -25f; ((Color)(ref white))..ctor(0.85f, 0.93f, 1.05f); break; case FilterPreset.Sunset: num4 = 35f; num5 = 8f; ((Color)(ref neutral))..ctor(0.25f, 0.12f, 0.4f); ((Color)(ref neutral2))..ctor(1f, 0.55f, 0.2f); v2 = 10f; break; case FilterPreset.Vintage: num4 = 12f; num5 = -18f; ((Color)(ref white))..ctor(1.05f, 0.98f, 0.85f); ((Color)(ref neutral))..ctor(0.15f, 0.2f, 0.2f); ((Color)(ref neutral2))..ctor(0.9f, 0.78f, 0.5f); num6 = 0.25f; break; case FilterPreset.Noir: num5 = -200f; num8 = 12f; num6 = 0.3f; break; case FilterPreset.Sepia: num5 = -160f; ((Color)(ref white))..ctor(1.15f, 0.92f, 0.62f); break; case FilterPreset.Horror: num5 = -25f; ((Color)(ref white))..ctor(0.82f, 1f, 0.82f); ((Color)(ref neutral))..ctor(0.05f, 0.25f, 0.05f); ((Color)(ref neutral2))..ctor(0.35f, 0.45f, 0.25f); num6 = 0.4f; break; case FilterPreset.Cyberpunk: num4 = -12f; num5 = 18f; ((Color)(ref neutral))..ctor(0.1f, 0.2f, 0.55f); ((Color)(ref neutral2))..ctor(0.65f, 0.12f, 0.5f); break; case FilterPreset.Underwater: num4 = -12f; num5 = 5f; ((Color)(ref white))..ctor(0.7f, 0.95f, 1.05f); num6 = 0.2f; break; case FilterPreset.Dreamy: num4 = 8f; num5 = 6f; ((Color)(ref white))..ctor(1.04f, 0.99f, 1f); num7 = 1.4f; num8 = -8f; break; } Set((FloatParameter)(object)_ca.saturation, Mathf.Clamp(num + num5, -100f, 100f)); Set(_ca.postExposure, v); Set((FloatParameter)(object)_ca.contrast, Mathf.Clamp(num2 + num8, -100f, 100f)); Set(_ca.colorFilter, white); Set(_lgg.lift, new Vector4(1f, 1f, 1f, num3)); ((VolumeParameter)_tm.mode).overrideState = enabled && ProcessingSettings.AcesTonemap; ((VolumeParameter)(object)_tm.mode).value = (TonemappingMode)2; Set((FloatParameter)(object)_wb.temperature, Mathf.Clamp(ProcessingSettings.Temperature + num4, -100f, 100f)); Set((FloatParameter)(object)_wb.tint, Mathf.Clamp(ProcessingSettings.Tint, -100f, 100f)); Set(_st.shadows, neutral); Set(_st.highlights, neutral2); Set((FloatParameter)(object)_st.balance, v2); float num9 = ProcessingSettings.Bloom + num7; ((VolumeComponent)_bloom).active = num9 > 0.001f; if (((VolumeComponent)_bloom).active) { Set((FloatParameter)(object)_bloom.threshold, 0.9f); Set((FloatParameter)(object)_bloom.scatter, 0.7f); Set((FloatParameter)(object)_bloom.intensity, num9); } Set((FloatParameter)(object)_vig.intensity, Mathf.Clamp01(ProcessingSettings.Vignette + num6)); Set((FloatParameter)(object)_grain.intensity, Mathf.Clamp01(ProcessingSettings.Grain)); } } catch (Exception ex) { if (Time.frameCount % 300 == 0) { MelonLogger.Warning("[QuickProcessing] apply failed: " + ex.Message); } } } private static void Set(FloatParameter p, float v) { ((VolumeParameter)p).overrideState = true; ((VolumeParameter)(object)p).value = v; } private static void Set(ColorParameter p, Color v) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) ((VolumeParameter)p).overrideState = true; ((VolumeParameter)(object)p).value = v; } private static void Set(Vector4Parameter p, Vector4 v) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) ((VolumeParameter)p).overrideState = true; ((VolumeParameter)(object)p).value = v; } } public enum FilterPreset { None, Warm, Cool, Sunset, Vintage, Noir, Sepia, Horror, Cyberpunk, Underwater, Dreamy } public static class ProcessingSettings { private static MelonPreferences_Category _cat; private static MelonPreferences_Entry _enabled; private static MelonPreferences_Entry _saturation; private static MelonPreferences_Entry _brightness; private static MelonPreferences_Entry _contrast; private static MelonPreferences_Entry _darksLift; private static MelonPreferences_Entry _aces; private static MelonPreferences_Entry _filter; private static MelonPreferences_Entry _temperature; private static MelonPreferences_Entry _tint; private static MelonPreferences_Entry _bloom; private static MelonPreferences_Entry _vignette; private static MelonPreferences_Entry _grain; public static bool Enabled { get { return _enabled.Value; } set { _enabled.Value = value; Save(); } } public static float Saturation { get { return _saturation.Value; } set { _saturation.Value = value; Save(); } } public static float Brightness { get { return _brightness.Value; } set { _brightness.Value = value; Save(); } } public static float Contrast { get { return _contrast.Value; } set { _contrast.Value = value; Save(); } } public static float DarksLift { get { return _darksLift.Value; } set { _darksLift.Value = value; Save(); } } public static bool AcesTonemap { get { return _aces.Value; } set { _aces.Value = value; Save(); } } public static FilterPreset Filter { get { return (FilterPreset)_filter.Value; } set { _filter.Value = (int)value; Save(); } } public static float Temperature { get { return _temperature.Value; } set { _temperature.Value = value; Save(); } } public static float Tint { get { return _tint.Value; } set { _tint.Value = value; Save(); } } public static float Bloom { get { return _bloom.Value; } set { _bloom.Value = value; Save(); } } public static float Vignette { get { return _vignette.Value; } set { _vignette.Value = value; Save(); } } public static float Grain { get { return _grain.Value; } set { _grain.Value = value; Save(); } } public static void Initialize() { _cat = MelonPreferences.CreateCategory("QuickProcessing"); _enabled = _cat.CreateEntry("Enabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _saturation = _cat.CreateEntry("Saturation", 30f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _brightness = _cat.CreateEntry("Brightness", 0.3f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _contrast = _cat.CreateEntry("Contrast", -10f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _darksLift = _cat.CreateEntry("DarksLift", 0.12f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _aces = _cat.CreateEntry("AcesTonemap", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _filter = _cat.CreateEntry("Filter", 0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _temperature = _cat.CreateEntry("Temperature", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _tint = _cat.CreateEntry("Tint", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _bloom = _cat.CreateEntry("Bloom", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _vignette = _cat.CreateEntry("Vignette", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _grain = _cat.CreateEntry("Grain", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); } private static void Save() { _cat.SaveToFile(false); } } public static class QuickModsTheme { private const string ShareKey = "QuickMods.GlobalTheme"; private const string MenuKey = "QuickMods.GlobalThemeMenuBuilt"; private static MelonPreferences_Category _cat; private static MelonPreferences_Entry _useGlobal; private static MelonPreferences_Entry _hue; private static MelonPreferences_Entry _sat; private static MelonPreferences_Entry _forceQB; private static MelonPreferences_Entry _rainbow; private static MelonPreferences_Entry _rainbowSpeed; public static bool UseGlobalTheme { get { return _useGlobal.Value; } set { _useGlobal.Value = value; Save(); } } public static float Hue { get { return _hue.Value; } set { _hue.Value = value; Save(); } } public static float Saturation { get { return _sat.Value; } set { _sat.Value = value; Save(); } } public static bool ForceQuickBeatsSync { get { return _forceQB.Value; } set { _forceQB.Value = value; Save(); } } public static Color GlobalColor => Color.HSVToRGB(Hue / 360f, Saturation, 1f); public static bool RainbowMode { get { return _rainbow.Value; } set { _rainbow.Value = value; Save(); } } public static float RainbowSpeed { get { return _rainbowSpeed.Value; } set { _rainbowSpeed.Value = value; Save(); } } public static Color RainbowColor => Color.HSVToRGB(Time.time * RainbowSpeed % 1f, 0.85f, 1f); public static Color ResolveAccent(Color modDefault, bool modThemeToSong, Func qbGetter) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (RainbowMode) { return RainbowColor; } if (ForceQuickBeatsSync) { Color? val = SafeGet(qbGetter); if (val.HasValue) { return val.Value; } } if (UseGlobalTheme) { return GlobalColor; } if (modThemeToSong) { Color? val2 = SafeGet(qbGetter); if (val2.HasValue) { return val2.Value; } } return modDefault; } private static Color? SafeGet(Func getter) { try { return getter?.Invoke(); } catch { return null; } } public static void Initialize() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (AppDomain.CurrentDomain.GetData("QuickMods.GlobalTheme") is object[] array) { _cat = (MelonPreferences_Category)array[0]; _useGlobal = (MelonPreferences_Entry)array[1]; _hue = (MelonPreferences_Entry)array[2]; _sat = (MelonPreferences_Entry)array[3]; _forceQB = (MelonPreferences_Entry)array[4]; _rainbow = (MelonPreferences_Entry)array[5]; _rainbowSpeed = (MelonPreferences_Entry)array[6]; return; } _cat = MelonPreferences.CreateCategory("QuickModsTheme"); _useGlobal = _cat.CreateEntry("UseGlobalTheme", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _hue = _cat.CreateEntry("Hue", 200f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _sat = _cat.CreateEntry("Saturation", 0.72f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _forceQB = _cat.CreateEntry("ForceQuickBeatsSync", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _rainbow = _cat.CreateEntry("RainbowMode", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _rainbowSpeed = _cat.CreateEntry("RainbowSpeed", 0.15f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); AppDomain.CurrentDomain.SetData("QuickMods.GlobalTheme", new object[7] { _cat, _useGlobal, _hue, _sat, _forceQB, _rainbow, _rainbowSpeed }); } public static void BuildMenu(Page rootPage) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) object data = AppDomain.CurrentDomain.GetData("QuickMods.GlobalThemeMenuBuilt"); bool flag = default(bool); int num; if (data is bool) { flag = (bool)data; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) == 0) { AppDomain.CurrentDomain.SetData("QuickMods.GlobalThemeMenuBuilt", true); Page obj = rootPage.CreatePage("Global Theme", new Color(1f, 0.55f, 0.85f), 0, true); obj.CreateBool("Use Global Theme", Color.white, UseGlobalTheme, (Action)delegate(bool v) { UseGlobalTheme = v; }); obj.CreateFloat("Hue", Color.white, Hue, 5f, 0f, 360f, (Action)delegate(float v) { Hue = v; }); obj.CreateFloat("Saturation", Color.white, Saturation, 0.05f, 0.1f, 1f, (Action)delegate(float v) { Saturation = v; }); obj.CreateBool("Force QuickBeats (All Mods)", Color.magenta, ForceQuickBeatsSync, (Action)delegate(bool v) { ForceQuickBeatsSync = v; }); obj.CreateBool("Rainbow Mode (All Mods)", Color.red, RainbowMode, (Action)delegate(bool v) { RainbowMode = v; }); obj.CreateFloat("Rainbow Speed", Color.red, RainbowSpeed, 0.02f, 0.02f, 1f, (Action)delegate(float v) { RainbowSpeed = v; }); } } private static void Save() { _cat.SaveToFile(false); } } public class QuickProcessingMod : MelonMod { public override void OnInitializeMelon() { ProcessingSettings.Initialize(); QuickModsTheme.Initialize(); SetupMenu(); ((MelonBase)this).LoggerInstance.Msg("QuickProcessing loaded!"); } public override void OnUpdate() { PostFX.Apply(); } private static Page GetOrCreateQuickModsPage() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) object? data = AppDomain.CurrentDomain.GetData("QuickMods.RootPage"); Page val = (Page)((data is Page) ? data : null); if (val != null) { return val; } Page val2 = Page.Root.CreatePage("Quick Mods", new Color(0.35f, 0.27f, 0.9f), 0, true); AppDomain.CurrentDomain.SetData("QuickMods.RootPage", val2); return val2; } private static void SetupMenu() { //IL_001f: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) Page orCreateQuickModsPage = GetOrCreateQuickModsPage(); QuickModsTheme.BuildMenu(orCreateQuickModsPage); Page obj = orCreateQuickModsPage.CreatePage("QuickProcessing", new Color(1f, 0.75f, 0.2f), 0, true); obj.CreateBool("Enabled", new Color(1f, 0.85f, 0.2f), ProcessingSettings.Enabled, (Action)delegate(bool v) { ProcessingSettings.Enabled = v; }); obj.CreateFloat("Saturation", Color.white, ProcessingSettings.Saturation, 5f, 0f, 100f, (Action)delegate(float v) { ProcessingSettings.Saturation = v; }); obj.CreateFloat("Brightness", Color.white, ProcessingSettings.Brightness, 0.05f, -0.5f, 2f, (Action)delegate(float v) { ProcessingSettings.Brightness = v; }); obj.CreateFloat("Brighten Darks", new Color(0.6f, 0.8f, 1f), ProcessingSettings.DarksLift, 0.02f, 0f, 0.4f, (Action)delegate(float v) { ProcessingSettings.DarksLift = v; }); obj.CreateFloat("Contrast", Color.white, ProcessingSettings.Contrast, 5f, -50f, 30f, (Action)delegate(float v) { ProcessingSettings.Contrast = v; }); obj.CreateBool("ACES Tonemap", Color.white, ProcessingSettings.AcesTonemap, (Action)delegate(bool v) { ProcessingSettings.AcesTonemap = v; }); Page obj2 = obj.CreatePage("Filters", new Color(0.7f, 0.5f, 1f), 0, true); obj2.CreateEnum("Preset", Color.white, (Enum)ProcessingSettings.Filter, (Action)delegate(Enum v) { ProcessingSettings.Filter = (FilterPreset)(object)v; }); obj2.CreateFloat("Warm / Cool", new Color(1f, 0.7f, 0.4f), ProcessingSettings.Temperature, 5f, -100f, 100f, (Action)delegate(float v) { ProcessingSettings.Temperature = v; }); obj2.CreateFloat("Tint (G/M)", new Color(0.8f, 1f, 0.6f), ProcessingSettings.Tint, 5f, -100f, 100f, (Action)delegate(float v) { ProcessingSettings.Tint = v; }); obj2.CreateFloat("Glow / Bloom", new Color(1f, 1f, 0.7f), ProcessingSettings.Bloom, 0.1f, 0f, 5f, (Action)delegate(float v) { ProcessingSettings.Bloom = v; }); obj2.CreateFloat("Vignette", Color.white, ProcessingSettings.Vignette, 0.05f, 0f, 1f, (Action)delegate(float v) { ProcessingSettings.Vignette = v; }); obj2.CreateFloat("Film Grain", Color.white, ProcessingSettings.Grain, 0.05f, 0f, 1f, (Action)delegate(float v) { ProcessingSettings.Grain = v; }); } } }