using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Il2CppInterop.Runtime.Injection;
using MelonLoader;
using MelonLoader.Preferences;
using POGMods.BrightMod;
using POGMods.Config;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(PogBrightMelon), "POG BrightMod", "4.1.0", "largo", "")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("POGBrightMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("POGBrightMod")]
[assembly: AssemblyTitle("POGBrightMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace POGMods.BrightMod;
public class PogBrightMelon : MelonMod
{
internal static MelonPreferences_Entry<bool> PrefBright;
internal static MelonPreferences_Entry<int> PrefKey;
public override void OnInitializeMelon()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_004d: 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)
MelonPreferences_Category obj = MelonPreferences.CreateCategory("POGBrightMod");
PrefBright = obj.CreateEntry<bool>("BrightMode", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
PrefKey = obj.CreateEntry<int>("ToggleKey", 108, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
ClassInjector.RegisterTypeInIl2Cpp<BrightModBehaviour>();
GameObject val = new GameObject("POGBrightModRunner");
Object.DontDestroyOnLoad((Object)val);
((Object)val).hideFlags = (HideFlags)61;
BrightModBehaviour.Instance = val.AddComponent<BrightModBehaviour>();
BrightModBehaviour.Instance._brightMode = PrefBright.Value;
BrightModBehaviour.Instance._toggleKey = (KeyCode)PrefKey.Value;
try
{
TryRegisterConfig();
}
catch
{
}
MelonLogger.Msg("POG BrightMod 4.1.0 (MelonLoader) loaded.");
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void TryRegisterConfig()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
POGConfig.Register("POG BrightMod", new List<ConfigEntry>
{
(ConfigEntry)new ToggleEntry("Bright Mode", (Func<bool>)(() => BrightModBehaviour.Instance._brightMode), (Action<bool>)delegate(bool v)
{
BrightModBehaviour.Instance._brightMode = v;
BrightModBehaviour.Instance.Apply();
PrefBright.Value = v;
MelonPreferences.Save();
MelonLogger.Msg("BrightMode: " + (v ? "ON" : "OFF"));
}),
(ConfigEntry)new KeyEntry("Toggle Key", (Func<KeyCode>)(() => BrightModBehaviour.Instance._toggleKey), (Action<KeyCode>)delegate(KeyCode v)
{
//IL_0005: 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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected I4, but got Unknown
BrightModBehaviour.Instance._toggleKey = v;
PrefKey.Value = (int)v;
MelonPreferences.Save();
})
});
}
}
public class BrightModBehaviour : MonoBehaviour
{
internal static BrightModBehaviour Instance;
internal bool _brightMode = true;
internal KeyCode _toggleKey = (KeyCode)108;
private bool _initialized;
private Volume _overrideVolume;
private ShadowQuality _originalShadows;
public BrightModBehaviour(IntPtr ptr)
: base(ptr)
{
}//IL_000a: Unknown result type (might be due to invalid IL or missing references)
private void Update()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!_initialized)
{
Initialize();
}
else if (!POGConfig.PanelOpen && Input.GetKeyDown(_toggleKey))
{
_brightMode = !_brightMode;
Apply();
PogBrightMelon.PrefBright.Value = _brightMode;
MelonPreferences.Save();
MelonLogger.Msg("BrightMode: " + (_brightMode ? "ON" : "OFF"));
}
}
catch (Exception value)
{
MelonLogger.Error($"BrightMod Update: {value}");
}
}
private void Initialize()
{
//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_0109: Unknown result type (might be due to invalid IL or missing references)
_originalShadows = QualitySettings.shadows;
VolumeProfile val = ScriptableObject.CreateInstance<VolumeProfile>();
Exposure obj = val.Add<Exposure>(false);
((VolumeComponent)obj).active = true;
((VolumeParameter<ExposureMode>)(object)obj.mode).Override((ExposureMode)0);
((VolumeParameter<float>)(object)obj.fixedExposure).Override(-0.5f);
IndirectLightingController obj2 = val.Add<IndirectLightingController>(false);
((VolumeComponent)obj2).active = true;
((VolumeParameter<float>)(object)obj2.indirectDiffuseLightingMultiplier).Override(6f);
ColorAdjustments obj3 = val.Add<ColorAdjustments>(false);
((VolumeComponent)obj3).active = true;
((VolumeParameter<float>)(object)obj3.postExposure).Override(2f);
Fog obj4 = val.Add<Fog>(false);
((VolumeComponent)obj4).active = true;
((VolumeParameter<bool>)(object)obj4.enabled).Override(false);
Vignette obj5 = val.Add<Vignette>(false);
((VolumeComponent)obj5).active = true;
((VolumeParameter<float>)(object)obj5.intensity).Override(0f);
_overrideVolume = ((Component)this).gameObject.AddComponent<Volume>();
_overrideVolume.isGlobal = true;
_overrideVolume.priority = 9999f;
_overrideVolume.profile = val;
Apply();
_initialized = true;
MelonLogger.Msg($"[POG BrightMod] Ready. Toggle key: {_toggleKey}");
}
internal void Apply()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_overrideVolume != (Object)null)
{
((Behaviour)_overrideVolume).enabled = _brightMode;
}
QualitySettings.shadows = (ShadowQuality)((!_brightMode) ? ((int)_originalShadows) : 0);
}
}