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;
using BoneLib.BoneMenu;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using QuickSuperhot;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(QuickSuperhotMod), "QuickSuperhot", "1.0.0", "nontendo", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("QuickSuperhot")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("QuickSuperhot")]
[assembly: AssemblyTitle("QuickSuperhot")]
[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 QuickSuperhot
{
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<bool> _useGlobal;
private static MelonPreferences_Entry<float> _hue;
private static MelonPreferences_Entry<float> _sat;
private static MelonPreferences_Entry<bool> _forceQB;
private static MelonPreferences_Entry<bool> _rainbow;
private static MelonPreferences_Entry<float> _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<Color?> 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<Color?> 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<bool>)array[1];
_hue = (MelonPreferences_Entry<float>)array[2];
_sat = (MelonPreferences_Entry<float>)array[3];
_forceQB = (MelonPreferences_Entry<bool>)array[4];
_rainbow = (MelonPreferences_Entry<bool>)array[5];
_rainbowSpeed = (MelonPreferences_Entry<float>)array[6];
return;
}
_cat = MelonPreferences.CreateCategory("QuickModsTheme");
_useGlobal = _cat.CreateEntry<bool>("UseGlobalTheme", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_hue = _cat.CreateEntry<float>("Hue", 200f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_sat = _cat.CreateEntry<float>("Saturation", 0.72f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_forceQB = _cat.CreateEntry<bool>("ForceQuickBeatsSync", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_rainbow = _cat.CreateEntry<bool>("RainbowMode", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_rainbowSpeed = _cat.CreateEntry<float>("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<bool>)delegate(bool v)
{
UseGlobalTheme = v;
});
obj.CreateFloat("Hue", Color.white, Hue, 5f, 0f, 360f, (Action<float>)delegate(float v)
{
Hue = v;
});
obj.CreateFloat("Saturation", Color.white, Saturation, 0.05f, 0.1f, 1f, (Action<float>)delegate(float v)
{
Saturation = v;
});
obj.CreateBool("Force QuickBeats (All Mods)", Color.magenta, ForceQuickBeatsSync, (Action<bool>)delegate(bool v)
{
ForceQuickBeatsSync = v;
});
obj.CreateBool("Rainbow Mode (All Mods)", Color.red, RainbowMode, (Action<bool>)delegate(bool v)
{
RainbowMode = v;
});
obj.CreateFloat("Rainbow Speed", Color.red, RainbowSpeed, 0.02f, 0.02f, 1f, (Action<float>)delegate(float v)
{
RainbowSpeed = v;
});
}
}
private static void Save()
{
_cat.SaveToFile(false);
}
}
public class QuickSuperhotMod : MelonMod
{
public override void OnInitializeMelon()
{
SuperhotSettings.Initialize();
QuickModsTheme.Initialize();
SetupMenu();
((MelonBase)this).LoggerInstance.Msg("QuickSuperhot loaded!");
}
public override void OnUpdate()
{
SuperhotController.Update();
}
public override void OnLateUpdate()
{
SuperhotController.ApplyTime();
}
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_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
Page orCreateQuickModsPage = GetOrCreateQuickModsPage();
QuickModsTheme.BuildMenu(orCreateQuickModsPage);
Page obj = orCreateQuickModsPage.CreatePage("QuickSuperhot", new Color(1f, 0.2f, 0.35f), 0, true);
obj.CreateBool("Enabled", new Color(1f, 0.3f, 0.4f), SuperhotSettings.Enabled, (Action<bool>)delegate(bool v)
{
SuperhotSettings.Enabled = v;
});
obj.CreateBool("Replace Slow-Mo (must hold slow-mo button!)", Color.white, SuperhotSettings.ReplaceSlowMo, (Action<bool>)delegate(bool v)
{
SuperhotSettings.ReplaceSlowMo = v;
});
obj.CreateFloat("Frozen Time Scale", Color.white, SuperhotSettings.MinScale, 0.01f, 0.01f, 0.5f, (Action<float>)delegate(float v)
{
SuperhotSettings.MinScale = v;
});
obj.CreateFloat("Sensitivity", Color.white, SuperhotSettings.Sensitivity, 0.25f, 0.5f, 8f, (Action<float>)delegate(float v)
{
SuperhotSettings.Sensitivity = v;
});
obj.CreateFloat("Hand Influence", Color.white, SuperhotSettings.HandInfluence, 0.1f, 0f, 2f, (Action<float>)delegate(float v)
{
SuperhotSettings.HandInfluence = v;
});
}
}
public static class SuperhotController
{
public static float Scale = 1f;
public static bool Active;
private static float _baseFixed;
private static bool _wasActive;
private static bool _viaSlowMo;
private static Vector3 _lastHead;
private static Vector3 _lastL;
private static Vector3 _lastR;
private static bool _hasHead;
private static bool _hasL;
private static bool _hasR;
public static void Update()
{
float unscaledDeltaTime = Time.unscaledDeltaTime;
_viaSlowMo = SuperhotSettings.ReplaceSlowMo && IsGameSlowMo();
Active = SuperhotSettings.Enabled || _viaSlowMo;
if (Active && unscaledDeltaTime > 1E-05f)
{
float num = Mathf.Clamp01(MeasureMotion(unscaledDeltaTime) / Mathf.Max(0.1f, SuperhotSettings.Sensitivity));
float num2 = Mathf.Lerp(Mathf.Clamp(SuperhotSettings.MinScale, 0.01f, 1f), 1f, num);
Scale = Mathf.Lerp(Scale, num2, Mathf.Clamp01(unscaledDeltaTime * 16f));
}
else if (!Active)
{
Scale = Mathf.MoveTowards(Scale, 1f, unscaledDeltaTime * 4f);
}
ApplyTime();
}
public static void ApplyTime()
{
try
{
if (_baseFixed <= 0f)
{
_baseFixed = Time.fixedDeltaTime;
}
if (Active)
{
Time.timeScale = Scale;
Time.fixedDeltaTime = _baseFixed * Mathf.Max(0.02f, Scale);
if (_viaSlowMo)
{
try
{
TimeManager._curTimeScale = Scale;
}
catch
{
}
}
_wasActive = true;
}
else if (_wasActive)
{
Time.timeScale = 1f;
Time.fixedDeltaTime = _baseFixed;
_wasActive = false;
}
}
catch
{
}
}
private static bool IsGameSlowMo()
{
try
{
return TimeManager.CurrentTimeScaleStep != 0;
}
catch
{
return false;
}
}
private static float MeasureMotion(float dt)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
float num = 0f;
Transform head = Player.Head;
Vector3 val;
if ((Object)(object)head != (Object)null)
{
Vector3 position = head.position;
if (_hasHead)
{
float num2 = num;
val = position - _lastHead;
num = num2 + ((Vector3)(ref val)).magnitude / dt;
}
_lastHead = position;
_hasHead = true;
}
float handInfluence = SuperhotSettings.HandInfluence;
if (handInfluence > 0f)
{
float num3 = 0f;
Hand leftHand = Player.LeftHand;
if ((Object)(object)leftHand != (Object)null)
{
Vector3 position2 = ((Component)leftHand).transform.position;
if (_hasL)
{
float num4 = num3;
val = position2 - _lastL;
num3 = Mathf.Max(num4, ((Vector3)(ref val)).magnitude / dt);
}
_lastL = position2;
_hasL = true;
}
Hand rightHand = Player.RightHand;
if ((Object)(object)rightHand != (Object)null)
{
Vector3 position3 = ((Component)rightHand).transform.position;
if (_hasR)
{
float num5 = num3;
val = position3 - _lastR;
num3 = Mathf.Max(num5, ((Vector3)(ref val)).magnitude / dt);
}
_lastR = position3;
_hasR = true;
}
num += num3 * handInfluence;
}
return num;
}
}
public static class SuperhotSettings
{
private static MelonPreferences_Category _cat;
private static MelonPreferences_Entry<bool> _enabled;
private static MelonPreferences_Entry<bool> _replace;
private static MelonPreferences_Entry<float> _minScale;
private static MelonPreferences_Entry<float> _sensitivity;
private static MelonPreferences_Entry<float> _handInfluence;
public static bool Enabled
{
get
{
return _enabled.Value;
}
set
{
_enabled.Value = value;
Save();
}
}
public static bool ReplaceSlowMo
{
get
{
return _replace.Value;
}
set
{
_replace.Value = value;
Save();
}
}
public static float MinScale
{
get
{
return _minScale.Value;
}
set
{
_minScale.Value = value;
Save();
}
}
public static float Sensitivity
{
get
{
return _sensitivity.Value;
}
set
{
_sensitivity.Value = value;
Save();
}
}
public static float HandInfluence
{
get
{
return _handInfluence.Value;
}
set
{
_handInfluence.Value = value;
Save();
}
}
public static void Initialize()
{
_cat = MelonPreferences.CreateCategory("QuickSuperhot");
_enabled = _cat.CreateEntry<bool>("Enabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_replace = _cat.CreateEntry<bool>("ReplaceSlowMo", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_minScale = _cat.CreateEntry<float>("MinScale", 0.04f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_sensitivity = _cat.CreateEntry<float>("Sensitivity", 2.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_handInfluence = _cat.CreateEntry<float>("HandInfluence", 0.6f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
}
private static void Save()
{
_cat.SaveToFile(false);
}
}
}