using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BetterSpeed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterSpeed")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d532d4a9-18dd-4074-8193-2d2906d9c980")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BetterSpeed;
[BepInPlugin("com.lordlakens.betterspeed", "BetterSpeed", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private float currentSpeed = 2f;
private bool isSpeedUpActive = false;
private KeyCode speedUpKey = (KeyCode)122;
private bool showUI = false;
private Rect windowRect = new Rect(20f, 20f, 260f, 220f);
private bool isRebinding = false;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"BetterSpeed loaded successfully!");
}
private void Update()
{
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_003e: Invalid comparison between Unknown and I4
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Invalid comparison between Unknown and I4
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Invalid comparison between Unknown and I4
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
if (isRebinding)
{
foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
{
if (Input.GetKeyDown(value) && (int)value > 0 && (int)value != 323 && (int)value != 324)
{
speedUpKey = value;
isRebinding = false;
break;
}
}
return;
}
if (Input.GetKeyDown((KeyCode)287))
{
showUI = !showUI;
}
if (Input.GetKeyDown(speedUpKey))
{
isSpeedUpActive = !isSpeedUpActive;
if (!isSpeedUpActive)
{
Time.timeScale = 1f;
}
}
if (isSpeedUpActive && Time.timeScale >= 1f)
{
Time.timeScale = currentSpeed;
}
}
private void OnGUI()
{
//IL_000e: 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)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
if (showUI)
{
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y);
if (((Rect)(ref windowRect)).Contains(val))
{
Input.ResetInputAxes();
}
windowRect = GUILayout.Window(9876, windowRect, new WindowFunction(DrawWindow), "BetterSpeed Menu", Array.Empty<GUILayoutOption>());
}
}
private void DrawWindow(int windowID)
{
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
GUILayout.Space(5f);
GUILayout.Label("Status: " + (isSpeedUpActive ? "<color=green>ACTIVE</color>" : "<color=red>INACTIVE</color>"), Array.Empty<GUILayoutOption>());
GUILayout.Space(5f);
GUILayout.Label($"Speed: {currentSpeed:F1}x", Array.Empty<GUILayoutOption>());
float num = GUILayout.HorizontalSlider(currentSpeed, 1f, 10f, Array.Empty<GUILayoutOption>());
if (num != currentSpeed)
{
currentSpeed = num;
if (isSpeedUpActive && Time.timeScale >= 1f)
{
Time.timeScale = currentSpeed;
}
}
GUILayout.Space(10f);
string text = (isRebinding ? "Press Any Key..." : $"Hotkey: [{speedUpKey}]");
if (GUILayout.Button(text, Array.Empty<GUILayoutOption>()))
{
isRebinding = true;
}
GUILayout.Space(5f);
if (GUILayout.Button("Reset Speed (1.0x)", Array.Empty<GUILayoutOption>()))
{
currentSpeed = 1f;
isSpeedUpActive = false;
Time.timeScale = 1f;
}
GUI.DragWindow();
}
}