using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using TMPro;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.SceneManagement;
using UnityEngine.UIElements.Collections;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("Loomeh")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("QOL improvements for BRC speedrunning.")]
[assembly: AssemblyFileVersion("1.5.3.0")]
[assembly: AssemblyInformationalVersion("1.5.3+378ad08ee0470b842937a16a1335b4d4542fcdec")]
[assembly: AssemblyProduct("SpeedrunUtils")]
[assembly: AssemblyTitle("SpeedrunUtils")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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;
}
}
}
public class SettingsManager
{
public static void CheckAndAddSetting(string filePath, string settingName, string defaultValue)
{
if (!File.Exists(filePath))
{
File.WriteAllText(filePath, "");
}
List<string> list = File.ReadAllLines(filePath).ToList();
if (list.FirstOrDefault((string l) => l.StartsWith(settingName + ",")) == null)
{
list.Add(settingName + "," + defaultValue);
File.WriteAllLines(filePath, list);
}
}
public static string GetSetting(string filePath, string settingName, string defaultValue)
{
if (!File.Exists(filePath))
{
return defaultValue;
}
string text = File.ReadAllLines(filePath).FirstOrDefault((string l) => l.StartsWith(settingName + ","));
if (text != null)
{
string[] array = text.Split(new char[1] { ',' });
if (array.Length >= 2)
{
return array[1];
}
}
return defaultValue;
}
}
namespace SpeedrunUtils
{
public class ConfigUi : MonoBehaviour
{
private LiveSplitControl lsCon;
public bool open;
private Rect winRect = new Rect(20f, 20f, 300f, 245f);
private Rect debugRect = new Rect(20f, 40f, 275f, 175f);
public string fpsCapStr = "";
public int fpsCapInt = -1;
public bool limiting;
public bool uncapped;
public KeyCode limitKey = (KeyCode)111;
public KeyCode uncapKey = (KeyCode)112;
public KeyCode autoMashKey = (KeyCode)116;
public KeyCode openKey = (KeyCode)277;
private GUIStyle currentStyle;
private TextManager textManager;
public static string configFolder = Paths.ConfigPath + "\\SpeedrunUtils\\";
private string filePath = Path.Combine(configFolder, "FPS.txt");
private string keyConfigPath = Path.Combine(configFolder, "Keys.txt");
private readonly string SplitsPath = Path.Combine(configFolder, "splits.txt");
private readonly string fpsDisplayPath = Path.Combine(configFolder, "Settings.txt");
private bool shouldFPSDisplay = true;
private int fpsSize = 30;
private int fpsXPos = 10;
private int fpsYPos = 5;
private bool uncappedFPSinLoading;
private bool uncapKeyCheck;
private float accum;
private int frames;
private float timeleft;
private float updateInterval = 0.5f;
private int fps;
private bool autoMashState = true;
private const float showAutoMashLengthMax = 2f;
private float showAutoMashLength = 2f;
private Rect splitsWinRect = new Rect(320f, 20f, 200f, 450f);
private bool splitsOpen;
private Rect creditsWinRect = new Rect(320f, 20f, 450f, 200f);
private bool creditsOpen;
private bool[] tempSplitsArray;
public void configureKeys()
{
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
SettingsManager.CheckAndAddSetting(keyConfigPath, "Open Menu", "Insert");
SettingsManager.CheckAndAddSetting(keyConfigPath, "Limit framerate", "O");
SettingsManager.CheckAndAddSetting(keyConfigPath, "Uncap framerate", "P");
SettingsManager.CheckAndAddSetting(keyConfigPath, "AutoMash Toggle", "T");
openKey = (KeyCode)Enum.Parse(typeof(KeyCode), SettingsManager.GetSetting(keyConfigPath, "Open Menu", "Insert"), ignoreCase: true);
limitKey = (KeyCode)Enum.Parse(typeof(KeyCode), SettingsManager.GetSetting(keyConfigPath, "Limit framerate", "O"), ignoreCase: true);
uncapKey = (KeyCode)Enum.Parse(typeof(KeyCode), SettingsManager.GetSetting(keyConfigPath, "Uncap framerate", "P"), ignoreCase: true);
autoMashKey = (KeyCode)Enum.Parse(typeof(KeyCode), SettingsManager.GetSetting(keyConfigPath, "AutoMash Toggle", "T"), ignoreCase: true);
}
public void configFPSDisplay()
{
SettingsManager.CheckAndAddSetting(fpsDisplayPath, "Display FPS", "true");
SettingsManager.CheckAndAddSetting(fpsDisplayPath, "FPS Size", "30");
SettingsManager.CheckAndAddSetting(fpsDisplayPath, "FPS X Pos", "10");
SettingsManager.CheckAndAddSetting(fpsDisplayPath, "FPS Y Pos", "5");
SettingsManager.CheckAndAddSetting(fpsDisplayPath, "AutoMash Starts Enabled", "true");
SettingsManager.CheckAndAddSetting(fpsDisplayPath, "Unlock FPS in loading screens", "false");
shouldFPSDisplay = bool.Parse(SettingsManager.GetSetting(fpsDisplayPath, "Display FPS", "true"));
fpsSize = int.Parse(SettingsManager.GetSetting(fpsDisplayPath, "FPS Size", "30"));
fpsXPos = int.Parse(SettingsManager.GetSetting(fpsDisplayPath, "FPS X Pos", "10"));
fpsYPos = int.Parse(SettingsManager.GetSetting(fpsDisplayPath, "FPS Y Pos", "5"));
DoAutoMash.Instance.autoMash = bool.Parse(SettingsManager.GetSetting(fpsDisplayPath, "AutoMash Starts Enabled", "true"));
autoMashState = DoAutoMash.Instance.autoMash;
uncappedFPSinLoading = bool.Parse(SettingsManager.GetSetting(fpsDisplayPath, "Unlock FPS in loading screens", "false"));
}
public void Start()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
currentStyle = new GUIStyle();
if (!Directory.Exists(configFolder))
{
Directory.CreateDirectory(configFolder);
}
SettingsManager.CheckAndAddSetting(filePath, "FPSCap", "300");
ReadFPSFile();
if (!File.Exists(SplitsPath))
{
string contents = "-- Any%\n";
File.WriteAllText(SplitsPath, contents);
SettingsManager.CheckAndAddSetting(SplitsPath, "Prologue End", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Early Mataan (Splits when you enter Millenium Square)", "false");
SettingsManager.CheckAndAddSetting(SplitsPath, "Versum Hill Start", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Dream Sequence 1 Start", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Chapter 1 End", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Brink Terminal Start", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Dream Sequence 2 Start", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Chapter 2 End", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Millenium Mall Start", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Dream Sequence 3 Start", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Chapter 3 End", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Flesh Prince Versum End", "false");
SettingsManager.CheckAndAddSetting(SplitsPath, "Flesh Prince Millenium End", "false");
SettingsManager.CheckAndAddSetting(SplitsPath, "Flesh Prince Brink End", "false");
SettingsManager.CheckAndAddSetting(SplitsPath, "Pyramid Island Start", "false");
SettingsManager.CheckAndAddSetting(SplitsPath, "Dream Sequence 4 Start", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Chapter 4 End", "true");
SettingsManager.CheckAndAddSetting(SplitsPath, "Final Boss Defeated", "true");
}
SettingsManager.CheckAndAddSetting(fpsDisplayPath, "Mouse Menu Fix", "true");
configureKeys();
configFPSDisplay();
lsCon = Object.FindObjectOfType<LiveSplitControl>();
textManager = Object.FindObjectOfType<TextManager>();
if ((Object)(object)lsCon != (Object)null)
{
lsCon.ConnectToLiveSplit();
}
else
{
Debug.LogError((object)"LiveSplitControl component not found.");
}
if ((Object)(object)textManager == (Object)null)
{
Debug.LogError((object)"TextManager component not found.");
}
}
private void ReadFPSFile()
{
fpsCapStr = SettingsManager.GetSetting(filePath, "FPSCap", "300");
if (int.TryParse(fpsCapStr, out var result) && result >= 30)
{
fpsCapInt = result;
return;
}
fpsCapInt = 300;
fpsCapStr = "300";
SettingsManager.CheckAndAddSetting(filePath, "FPSCap", "300");
}
private void handleFPSCounter()
{
timeleft -= Time.deltaTime;
accum += Time.timeScale / Time.deltaTime;
frames++;
if (timeleft <= 0f)
{
fps = Mathf.RoundToInt(accum / (float)frames);
timeleft = updateInterval;
accum = 0f;
frames = 0;
}
}
public void OnGUI()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
//IL_00a1: 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_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Expected O, but got Unknown
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_030a: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Expected O, but got Unknown
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
if (open)
{
GUI.color = new Color(0f, 0f, 0f, 1f);
winRect = GUI.Window(0, winRect, new WindowFunction(WinProc), "SpeedrunUtils 1.5.3");
}
if (splitsOpen && open)
{
GUI.color = new Color(0f, 0f, 0f, 1f);
splitsWinRect = GUI.Window(1, splitsWinRect, new WindowFunction(SplitsWinProc), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Splits", (string)null));
}
if (creditsOpen && open)
{
GUI.color = new Color(0f, 0f, 0f, 1f);
creditsWinRect = GUI.Window(2, creditsWinRect, new WindowFunction(CreditsWinProc), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Credits", (string)null));
}
if (shouldFPSDisplay)
{
GUI.color = new Color(0f, 0f, 0f, 0f);
CreateText(fpsXPos, fpsYPos, 600, 600, new Color(1f, 1f, 1f, 0.5f), $"{fps}");
}
if (DoAutoMash.Instance.autoMash)
{
if (!autoMashState)
{
showAutoMashLength = 0f;
}
if (showAutoMashLength < 2f)
{
GUI.color = new Color(0f, 0f, 0f, 0f);
CreateText(20, Screen.height - 40, 600, 600, new Color(0.2f, 1f, 0.2f, 0.5f), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "AutoMash Enabled", (string)null));
autoMashState = true;
showAutoMashLength += Core.dt;
}
}
else if (!DoAutoMash.Instance.autoMash)
{
if (autoMashState)
{
showAutoMashLength = 0f;
}
if (showAutoMashLength < 2f)
{
GUI.color = new Color(0f, 0f, 0f, 0f);
CreateText(20, Screen.height - 40, 600, 600, new Color(1f, 0.2f, 0.2f, 0.5f), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "AutoMash Disabled", (string)null));
autoMashState = false;
showAutoMashLength += Core.dt;
}
}
if (lsCon.debug)
{
GUI.color = new Color(0f, 0f, 0f, 1f);
debugRect = GUI.Window(1, debugRect, new WindowFunction(DebugWinProc), "SpeedrunUtils Debug Mode");
}
}
private void WinProc(int id)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
float num = 15f;
float num2 = 18f;
float num3 = ((Rect)(ref winRect)).width - 30f;
GUI.Label(new Rect(num, num2, num3, 20f), $"FPS: {fps}");
num2 += 15f;
GUI.Label(new Rect(num, num2, num3, 20f), string.Format("{0} ({1}): {2}", DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "FPS Limit", (string)null), limitKey, limiting ? ("<color=green>" + DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "On", (string)null) + "</color>") : ("<color=red>" + DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Off", (string)null) + "</color>")));
num2 += 15f;
GUI.Label(new Rect(num, num2, num3, 20f), string.Format("{0} ({1}): {2}", DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Uncapped", (string)null), uncapKey, uncapped ? ("<color=green>" + DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "On", (string)null) + "</color>") : ("<color=red>" + DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Off", (string)null) + "</color>")));
num2 += 20f;
GUI.Label(new Rect(num, num2, num3, 20f), (lsCon.IsConnectedToLivesplit ? ("<color=green>" + DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Connected to LiveSplit", (string)null) + "</color>") : ("<color=red>" + DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Not connected to LiveSplit", (string)null) + "</color>")) ?? "");
num2 += 20f;
fpsCapStr = GUI.TextField(new Rect(num, num2, num3, 20f), fpsCapStr, 4);
num2 += 20f;
if (GUI.Button(new Rect(num, num2, num3, 20f), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Set FPS", (string)null)))
{
if (int.TryParse(fpsCapStr, out var result) && int.Parse(fpsCapStr) >= 30)
{
fpsCapInt = result;
}
else
{
ReadFPSFile();
}
if (File.Exists(filePath))
{
File.Delete(filePath);
}
using FileStream fileStream = File.Create(filePath);
byte[] bytes = new UTF8Encoding(encoderShouldEmitUTF8Identifier: true).GetBytes(fpsCapStr);
fileStream.Write(bytes, 0, fpsCapStr.Length);
}
num2 += 20f;
if (GUI.Button(new Rect(num, num2, num3, 20f), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Connect to LiveSplit", (string)null)))
{
lsCon.ConnectToLiveSplit();
}
num2 += 20f;
if (GUI.Button(new Rect(num, num2, num3, 20f), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Splits", (string)null)))
{
tempSplitsArray = lsCon.SplitArray;
splitsOpen = !splitsOpen;
}
num2 += 25f;
GUI.Label(new Rect(num, num2, num3, 20f), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Report any issues in #technical-help", (string)null));
num2 += 20f;
GUI.Label(new Rect(num, num2, num3, 20f), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Developed by", (string)null) + " <color=purple>Loomeh</color>");
num2 += 25f;
if (GUI.Button(new Rect(num, num2, num3, 20f), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Credits", (string)null)))
{
creditsOpen = !creditsOpen;
}
num2 += 15f;
GUI.DragWindow();
}
private void CreateText(int x, int y, int width, int height, Color color, string text, bool backdrop = true)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
currentStyle = new GUIStyle(GUI.skin.label);
currentStyle.fontSize = fpsSize;
currentStyle.fontStyle = (FontStyle)1;
currentStyle.alignment = (TextAnchor)0;
if (backdrop)
{
GUI.color = new Color(0f, 0f, 0f, color.a);
GUI.Label(new Rect((float)(x + 2), (float)(y + 2), (float)width, (float)height), text, currentStyle);
}
GUI.color = color;
GUI.Label(new Rect((float)x, (float)y, (float)width, (float)height), text, currentStyle);
}
private void SplitsWinProc(int id)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02de: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_039b: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Unknown result type (might be due to invalid IL or missing references)
//IL_0458: Unknown result type (might be due to invalid IL or missing references)
//IL_0481: Unknown result type (might be due to invalid IL or missing references)
//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
float num = 0f;
float num2 = ((Rect)(ref splitsWinRect)).width - 30f;
tempSplitsArray[0] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[0], "Prologue");
num += 20f;
tempSplitsArray[1] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[1], "Early Mataan");
num += 20f;
tempSplitsArray[2] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[2], "Versum Hill Start");
num += 20f;
tempSplitsArray[3] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[3], "Dream Sequence 1 Start");
num += 20f;
tempSplitsArray[4] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[4], "Chapter 1 End");
num += 20f;
tempSplitsArray[5] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[5], "Brink Terminal Start");
num += 20f;
tempSplitsArray[6] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[6], "Dream Sequence 2 Start");
num += 20f;
tempSplitsArray[7] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[7], "Chapter 2 End");
num += 20f;
tempSplitsArray[8] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[8], "Millenium Mall Start");
num += 20f;
tempSplitsArray[9] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[9], "Dream Sequence 3 Start");
num += 20f;
tempSplitsArray[10] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[10], "Chapter 3 End");
num += 20f;
tempSplitsArray[11] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[11], "Flesh Prince Versum End");
num += 20f;
tempSplitsArray[12] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[12], "Flesh Prince Millenium End");
num += 20f;
tempSplitsArray[13] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[13], "Flesh Prince Brink End");
num += 20f;
tempSplitsArray[14] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[14], "Pyramid Island Start");
num += 20f;
tempSplitsArray[15] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[15], "Dream Sequence 4 Start");
num += 20f;
tempSplitsArray[16] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[16], "Chapter 4 End");
num += 20f;
tempSplitsArray[17] = GUI.Toggle(new Rect(15f, num + 26f, 200f, 21f), tempSplitsArray[17], "Final Boss Defeated");
num += 50f;
if (GUI.Button(new Rect(15f, num, num2, 20f), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Save Splits", (string)null)))
{
lsCon.ReplaceBoolArrayInFile(SplitsPath, tempSplitsArray);
}
num += 20f;
if (GUI.Button(new Rect(15f, num, num2, 20f), DictionaryExtensions.Get<string, string>((IDictionary<string, string>)textManager.guiText, "Close", (string)null)))
{
splitsOpen = false;
}
GUI.DragWindow();
}
private void CreditsWinProc(int id)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: 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)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
float num = 15f;
string text = "Ninja Cookie - Research, Code Contributions, Automash";
float num2 = Mathf.Max(((Rect)(ref splitsWinRect)).width - 30f, GUI.skin.textArea.CalcSize(new GUIContent(text)).x + 30f);
GUI.Label(new Rect(15f, num, num2, 20f), text);
num += 20f;
GUI.Label(new Rect(15f, num, num2, 20f), "Jomoko - Research, Code Contributions");
num += 20f;
GUI.Label(new Rect(15f, num, num2, 20f), "Erisrine - Italian translation");
num += 20f;
GUI.Label(new Rect(15f, num, num2, 20f), "Judah Caruso - JudahsSpeedUtils");
num += 20f;
GUI.Label(new Rect(15f, num, num2, 20f), "Storied - Beta testing");
num += 20f;
GUI.Label(new Rect(15f, num, num2, 20f), "ItzBytez - Beta testing");
num += 20f;
GUI.Label(new Rect(15f, num, num2, 20f), "ness - Bug reports");
num += 20f;
num += 20f;
if (GUI.Button(new Rect(15f, num, num2, 20f), "Close"))
{
creditsOpen = false;
}
GUI.DragWindow();
}
private void DebugWinProc(int id)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
float num = 30f;
float num2 = ((Rect)(ref debugRect)).width - 30f;
GUI.Label(new Rect(15f, num, num2, 20f), $"Current stage: {lsCon.currentStage}");
num += 15f;
GUI.Label(new Rect(15f, num, num2, 20f), $"Previous stage: {lsCon.prevStage}");
num += 15f;
GUI.Label(new Rect(15f, num, num2, 20f), $"Current objective: {lsCon.objective}");
num += 15f;
GUI.Label(new Rect(15f, num, num2, 20f), $"Previous objective: {lsCon.prevObjective}");
num += 15f;
GUI.Label(new Rect(15f, num, num2, 20f), "Cutscene ID: " + lsCon.sequenceName);
num += 15f;
GUI.Label(new Rect(15f, num, num2, 20f), $"Loading: {lsCon.IsLoading}");
num += 15f;
GUI.DragWindow();
}
public void Update()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
handleFPSCounter();
if (uncappedFPSinLoading)
{
if (lsCon.IsLoading)
{
uncapped = true;
}
else if (!lsCon.IsLoading && !uncapKeyCheck)
{
uncapped = false;
}
}
if (Input.GetKeyDown(openKey))
{
open = !open;
}
if (Input.GetKeyDown(limitKey))
{
limiting = !limiting;
uncapKeyCheck = false;
if (limiting)
{
uncapped = false;
}
}
if (Input.GetKeyDown(uncapKey))
{
uncapKeyCheck = !uncapKeyCheck;
uncapped = !uncapped;
if (uncapped)
{
limiting = false;
}
}
if (Input.GetKeyDown(autoMashKey))
{
DoAutoMash.Instance.autoMash = !DoAutoMash.Instance.autoMash;
}
if (QualitySettings.vSyncCount > 0)
{
QualitySettings.vSyncCount = 0;
}
if (limiting)
{
Application.targetFrameRate = 30;
}
else
{
Application.targetFrameRate = (uncapped ? (-1) : fpsCapInt);
}
}
}
internal class DoAutoMash : MonoBehaviour
{
public static DoAutoMash Instance;
private SequenceHandler seqHandler;
private SequenceState sequenceState;
private UIManager uiManager;
private DialogueUI dialogueUI;
private WorldHandler worldHandler;
private Player player;
private bool disabledExit;
private AudioManager audioManager;
private MethodInfo PlaySfxUI;
private TextMeshProUGUI textLabel;
private DialogueBehaviour currentDialogue;
private bool fastForwardTypewriter;
public bool autoMash = true;
public DoAutoMash()
{
Instance = this;
}
private void Update()
{
//IL_0085: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Expected O, but got Unknown
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Expected O, but got Unknown
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Expected O, but got Unknown
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Expected O, but got Unknown
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Expected O, but got Unknown
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Expected O, but got Unknown
//IL_0333: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Expected O, but got Unknown
//IL_033a: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Invalid comparison between Unknown and I4
if (!((Object)(object)Core.Instance != (Object)null))
{
return;
}
if ((Object)(object)worldHandler == (Object)null)
{
worldHandler = WorldHandler.instance;
}
if ((Object)(object)player == (Object)null && (Object)(object)worldHandler != (Object)null)
{
player = WorldHandler.instance.GetCurrentPlayer();
}
if ((Object)(object)player != (Object)null)
{
sequenceState = (SequenceState)typeof(Player).GetField("sequenceState", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(player);
}
if ((Object)(object)seqHandler == (Object)null && (Object)(object)worldHandler != (Object)null)
{
seqHandler = (SequenceHandler)typeof(WorldHandler).GetField("sequenceHandler", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(worldHandler);
}
if ((Object)(object)uiManager == (Object)null && (Object)(object)seqHandler != (Object)null)
{
uiManager = (UIManager)typeof(SequenceHandler).GetField("uIManager", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(seqHandler);
}
if ((Object)(object)dialogueUI == (Object)null && (Object)(object)uiManager != (Object)null)
{
dialogueUI = (DialogueUI)typeof(UIManager).GetField("dialogueUI", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(uiManager);
}
if ((Object)(object)dialogueUI != (Object)null)
{
textLabel = (TextMeshProUGUI)typeof(DialogueUI).GetField("textLabel", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(dialogueUI);
}
if ((Object)(object)dialogueUI != (Object)null)
{
currentDialogue = (DialogueBehaviour)typeof(DialogueUI).GetField("currentDialogue", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(dialogueUI);
}
if ((Object)(object)dialogueUI != (Object)null)
{
fastForwardTypewriter = (bool)typeof(DialogueUI).GetField("fastForwardTypewriter", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(dialogueUI);
}
if (audioManager == null && (Object)(object)seqHandler != (Object)null)
{
audioManager = (AudioManager)typeof(SequenceHandler).GetField("audioManager", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(seqHandler);
}
if (PlaySfxUI == null && audioManager != null)
{
PlaySfxUI = typeof(AudioManager).GetMethod("PlaySfxUI", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[3]
{
typeof(SfxCollectionID),
typeof(AudioClipID),
typeof(float)
}, null);
}
if (!((Object)(object)seqHandler != (Object)null) || !((Object)(object)dialogueUI != (Object)null) || audioManager == null || !((Object)(object)worldHandler != (Object)null) || !((Object)(object)textLabel != (Object)null) || !autoMash)
{
return;
}
SceneObjectsRegister val = (SceneObjectsRegister)typeof(WorldHandler).GetField("sceneObjectsRegister", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(worldHandler);
if ((int)sequenceState != 1 || val == null)
{
return;
}
FieldInfo field = typeof(SequenceHandler).GetField("skipTextActiveState", BindingFlags.Instance | BindingFlags.NonPublic);
disabledExit = (bool)typeof(SequenceHandler).GetField("disabledExit", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).GetValue(seqHandler);
if (!((AMenuController)seqHandler).IsEnabled || disabledExit || !(field.GetValue(seqHandler).ToString() == "NOT_SKIPPABLE") || !dialogueUI.CanBeSkipped || dialogueUI.isYesNoPromptEnabled)
{
return;
}
if (currentDialogue != null && dialogueUI.ReadyToResume)
{
seqHandler.ResumeSequence();
if (dialogueUI.IsShowingDialogue() && PlaySfxUI != null)
{
PlaySfxUI.Invoke(audioManager, new object[3]
{
(object)(SfxCollectionID)23,
(object)(AudioClipID)922,
0f
});
}
dialogueUI.EndDialogue();
}
else if (currentDialogue != null && ((TMP_Text)textLabel).maxVisibleCharacters > 1 && ((TMP_Text)textLabel).textInfo.characterCount != ((TMP_Text)textLabel).maxVisibleCharacters && !fastForwardTypewriter)
{
typeof(SequenceHandler).GetMethod("FastForwardTypewriter", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(seqHandler, new object[0]);
}
}
}
public class LiveSplitControl : MonoBehaviour
{
private static readonly string ConfigPath = Paths.ConfigPath + "\\SpeedrunUtils\\";
private readonly string SplitsPath = Path.Combine(ConfigPath, "splits.txt");
public bool debug;
public BaseModule BaseModule;
public bool IsLoading;
private bool prevIsLoading;
public ObjectiveID objective = (ObjectiveID)(-1);
public ObjectiveID prevObjective = (ObjectiveID)(-1);
public Stage currentStage = (Stage)(-1);
public Stage prevStage = (Stage)(-1);
public SequenceState sequenceState = (SequenceState)4;
public SequenceHandler sequenceHandler;
public PlayableDirector sequence;
public string sequenceName;
public SaveSlotData saveSlotData;
public WorldHandler worldHandler;
public Player player;
public GameObject finalBossGO;
public bool finalBossHit;
public bool prevFinalBossHit;
public bool isboostlocked;
public bool inCutscene;
public bool IsLoadingNoExtend;
public bool prevIsLoadingNoExtend;
public bool IsConnectedToLivesplit;
public bool newGame;
public bool[] SplitArray;
private string IpAddress = "127.0.0.1";
private int Port = 16834;
private bool HasSentPauseCommand;
private TcpClient Client;
private NetworkStream Stream;
public void Awake()
{
if (!Directory.Exists(ConfigPath))
{
Directory.CreateDirectory(ConfigPath);
}
}
public void ConnectToLiveSplit()
{
try
{
if (!IsConnectedToLivesplit)
{
byte[] array = new byte[256];
_ = string.Empty;
Client = new TcpClient(IpAddress, Port);
Stream = Client.GetStream();
Stream.Write(Encoding.UTF8.GetBytes("getcurrenttimerphase\r\n"), 0, Encoding.UTF8.GetBytes("getcurrenttimerphase\r\n").Length);
int count = Stream.Read(array, 0, array.Length);
if (Encoding.ASCII.GetString(array, 0, count) != string.Empty)
{
Stream.Write(Encoding.UTF8.GetBytes("initgametime\r\n"), 0, Encoding.UTF8.GetBytes("initgametime\r\n").Length);
IsConnectedToLivesplit = true;
}
}
}
catch (SocketException ex)
{
Debug.LogError((object)("Error connecting to LiveSplit: " + ex.Message));
IsConnectedToLivesplit = false;
}
catch (Exception ex2)
{
Debug.LogError((object)("An unexpected error occurred: " + ex2.Message));
IsConnectedToLivesplit = false;
}
}
private void UpdateFields()
{
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Expected O, but got Unknown
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Invalid comparison between Unknown and I4
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Expected O, but got Unknown
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Invalid comparison between Unknown and I4
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Invalid comparison between Unknown and I4
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Invalid comparison between Unknown and I4
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Core.Instance != (Object)null))
{
return;
}
if ((Object)(object)BaseModule == (Object)null)
{
BaseModule = Core.Instance.BaseModule;
}
if ((Object)(object)worldHandler == (Object)null)
{
worldHandler = WorldHandler.instance;
}
if ((Object)(object)BaseModule != (Object)null)
{
if (BaseModule.StageManager != null)
{
prevIsLoading = IsLoading;
IsLoading = BaseModule.IsLoading || BaseModule.StageManager.IsExtendingLoadingScreen;
}
else
{
IsLoading = BaseModule.IsLoading;
}
prevIsLoadingNoExtend = IsLoadingNoExtend;
IsLoadingNoExtend = BaseModule.IsLoading;
prevStage = currentStage;
currentStage = BaseModule.CurrentStage;
}
if (prevIsLoadingNoExtend && !IsLoadingNoExtend && Core.Instance.SaveManager != null && Core.Instance.SaveManager.CurrentSaveSlot != null && !Core.Instance.SaveManager.CurrentSaveSlot.fortuneAppLocked)
{
newGame = true;
}
if ((Object)(object)player == (Object)null && (Object)(object)worldHandler != (Object)null)
{
player = worldHandler.GetCurrentPlayer();
}
if ((Object)(object)player != (Object)null)
{
inCutscene = player.IsBusyWithSequence();
sequenceState = (SequenceState)typeof(Player).GetField("sequenceState", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(player);
}
if ((Object)(object)sequenceHandler == (Object)null && (Object)(object)worldHandler != (Object)null)
{
sequenceHandler = (SequenceHandler)typeof(WorldHandler).GetField("sequenceHandler", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(worldHandler);
}
if ((Object)(object)sequenceHandler != (Object)null && inCutscene && sequenceName == "")
{
sequence = (PlayableDirector)typeof(SequenceHandler).GetField("sequence", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(sequenceHandler);
sequenceName = ((Object)sequence).name;
}
else if (!inCutscene)
{
sequenceName = "";
}
if (finalBossHit && (int)currentStage != 7)
{
finalBossHit = false;
}
if ((Object)(object)finalBossGO == (Object)null && (int)currentStage == 7 && ((int)objective == 11 || (int)objective == 13))
{
finalBossGO = GameObject.FindGameObjectWithTag("SnakebossHead");
}
if ((Object)(object)finalBossGO != (Object)null)
{
prevFinalBossHit = finalBossHit;
finalBossHit = ((Component)finalBossGO.transform).GetComponent<SnakeBossChestImpactReceiver>().WasHit;
}
if (Core.Instance.SaveManager != null && Core.Instance.SaveManager.CurrentSaveSlot != null)
{
prevObjective = objective;
objective = Core.Instance.SaveManager.CurrentSaveSlot.CurrentStoryObjective;
}
}
public void UpdateAutosplitter()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Invalid comparison between Unknown and I4
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Invalid comparison between Unknown and I4
//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)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Invalid comparison between Unknown and I4
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Invalid comparison between Unknown and I4
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Invalid comparison between Unknown and I4
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02de: Invalid comparison between Unknown and I4
//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_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_0348: Invalid comparison between Unknown and I4
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_030e: Invalid comparison between Unknown and I4
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_062d: Unknown result type (might be due to invalid IL or missing references)
//IL_0633: Invalid comparison between Unknown and I4
//IL_0369: Unknown result type (might be due to invalid IL or missing references)
//IL_036f: Invalid comparison between Unknown and I4
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_0351: Invalid comparison between Unknown and I4
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Invalid comparison between Unknown and I4
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Invalid comparison between Unknown and I4
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_0398: Invalid comparison between Unknown and I4
//IL_0372: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Invalid comparison between Unknown and I4
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Invalid comparison between Unknown and I4
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_03c2: Invalid comparison between Unknown and I4
//IL_039b: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Invalid comparison between Unknown and I4
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_0381: Invalid comparison between Unknown and I4
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0332: Invalid comparison between Unknown and I4
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03ea: Invalid comparison between Unknown and I4
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Invalid comparison between Unknown and I4
//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Invalid comparison between Unknown and I4
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_040d: Unknown result type (might be due to invalid IL or missing references)
//IL_0413: Invalid comparison between Unknown and I4
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Invalid comparison between Unknown and I4
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03d4: Invalid comparison between Unknown and I4
//IL_0436: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Invalid comparison between Unknown and I4
//IL_0416: Unknown result type (might be due to invalid IL or missing references)
//IL_041d: Invalid comparison between Unknown and I4
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_03fd: Invalid comparison between Unknown and I4
//IL_045f: Unknown result type (might be due to invalid IL or missing references)
//IL_0465: Invalid comparison between Unknown and I4
//IL_043f: Unknown result type (might be due to invalid IL or missing references)
//IL_0445: Invalid comparison between Unknown and I4
//IL_0420: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Invalid comparison between Unknown and I4
//IL_0489: Unknown result type (might be due to invalid IL or missing references)
//IL_048f: Invalid comparison between Unknown and I4
//IL_0468: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Invalid comparison between Unknown and I4
//IL_0448: Unknown result type (might be due to invalid IL or missing references)
//IL_044e: Invalid comparison between Unknown and I4
//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
//IL_04bb: Invalid comparison between Unknown and I4
//IL_0492: Unknown result type (might be due to invalid IL or missing references)
//IL_0499: Invalid comparison between Unknown and I4
//IL_0471: Unknown result type (might be due to invalid IL or missing references)
//IL_0478: Invalid comparison between Unknown and I4
//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
//IL_04e7: Invalid comparison between Unknown and I4
//IL_04be: Unknown result type (might be due to invalid IL or missing references)
//IL_04c5: Invalid comparison between Unknown and I4
//IL_049c: Unknown result type (might be due to invalid IL or missing references)
//IL_04a3: Invalid comparison between Unknown and I4
//IL_050c: Unknown result type (might be due to invalid IL or missing references)
//IL_0512: Invalid comparison between Unknown and I4
//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
//IL_04f1: Invalid comparison between Unknown and I4
//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
//IL_04cf: Invalid comparison between Unknown and I4
//IL_0536: Unknown result type (might be due to invalid IL or missing references)
//IL_053d: Invalid comparison between Unknown and I4
//IL_0515: Unknown result type (might be due to invalid IL or missing references)
//IL_051b: Invalid comparison between Unknown and I4
//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
//IL_04fb: Invalid comparison between Unknown and I4
//IL_056c: Unknown result type (might be due to invalid IL or missing references)
//IL_0573: Invalid comparison between Unknown and I4
//IL_0540: Unknown result type (might be due to invalid IL or missing references)
//IL_0547: Invalid comparison between Unknown and I4
//IL_051e: Unknown result type (might be due to invalid IL or missing references)
//IL_0525: Invalid comparison between Unknown and I4
//IL_0598: Unknown result type (might be due to invalid IL or missing references)
//IL_059f: Invalid comparison between Unknown and I4
//IL_0576: Unknown result type (might be due to invalid IL or missing references)
//IL_057d: Invalid comparison between Unknown and I4
//IL_054a: Unknown result type (might be due to invalid IL or missing references)
//IL_0551: Invalid comparison between Unknown and I4
//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
//IL_05c7: Invalid comparison between Unknown and I4
//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
//IL_05a9: Invalid comparison between Unknown and I4
//IL_0580: Unknown result type (might be due to invalid IL or missing references)
//IL_0587: Invalid comparison between Unknown and I4
//IL_0554: Unknown result type (might be due to invalid IL or missing references)
//IL_055b: Invalid comparison between Unknown and I4
//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
//IL_05ef: Invalid comparison between Unknown and I4
//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
//IL_05d1: Invalid comparison between Unknown and I4
//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
//IL_05b3: Invalid comparison between Unknown and I4
//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
//IL_05fc: Invalid comparison between Unknown and I4
//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
//IL_05db: Invalid comparison between Unknown and I4
//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0606: Invalid comparison between Unknown and I4
if (!IsConnectedToLivesplit && !debug)
{
return;
}
UpdateFields();
if ((int)currentStage == 8 && newGame && !IsLoading)
{
try
{
Stream.Write(Encoding.UTF8.GetBytes("reset\r\n"), 0, Encoding.UTF8.GetBytes("reset\r\n").Length);
Stream.Write(Encoding.UTF8.GetBytes("starttimer\r\n"), 0, Encoding.UTF8.GetBytes("starttimer\r\n").Length);
newGame = false;
}
catch (SocketException ex)
{
Debug.LogError((object)("Error connecting to LiveSplit: " + ex.Message));
IsConnectedToLivesplit = false;
}
catch (Exception ex2)
{
Debug.LogError((object)("An unexpected error occurred: " + ex2.Message));
IsConnectedToLivesplit = false;
}
}
if (!IsLoading)
{
Scene activeScene = SceneManager.GetActiveScene();
if (!(((Scene)(ref activeScene)).name == "intro"))
{
activeScene = SceneManager.GetActiveScene();
if (!(((Scene)(ref activeScene)).name == "Bootstrap"))
{
activeScene = SceneManager.GetActiveScene();
if (!(((Scene)(ref activeScene)).name == "Core"))
{
if (HasSentPauseCommand && !IsLoading)
{
activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != "intro")
{
activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != "Bootstrap")
{
activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != "Core")
{
try
{
Debug.Log((object)"Unpausing game time!");
Stream.Write(Encoding.UTF8.GetBytes("unpausegametime\r\n"), 0, Encoding.UTF8.GetBytes("unpausegametime\r\n").Length);
HasSentPauseCommand = false;
}
catch (SocketException ex3)
{
Debug.LogError((object)("Error connecting to LiveSplit: " + ex3.Message));
IsConnectedToLivesplit = false;
}
catch (Exception ex4)
{
Debug.LogError((object)("An unexpected error occurred: " + ex4.Message));
IsConnectedToLivesplit = false;
}
}
}
}
}
goto IL_02ae;
}
}
}
}
if (!HasSentPauseCommand)
{
try
{
Debug.Log((object)"Pausing game time!");
Stream.Write(Encoding.UTF8.GetBytes("pausegametime\r\n"), 0, Encoding.UTF8.GetBytes("pausegametime\r\n").Length);
HasSentPauseCommand = true;
}
catch (SocketException ex5)
{
Debug.LogError((object)("Error connecting to LiveSplit: " + ex5.Message));
IsConnectedToLivesplit = false;
}
catch (Exception ex6)
{
Debug.LogError((object)("An unexpected error occurred: " + ex6.Message));
IsConnectedToLivesplit = false;
}
}
goto IL_02ae;
IL_02ae:
if ((((int)currentStage == 5 && (int)prevStage == 8 && SplitArray[0]) || ((int)currentStage == 11 && (int)prevStage == 7 && ((int)objective == 0 || (int)objective == 1) && SplitArray[1]) || ((int)currentStage == 4 && ((int)prevStage == 5 || (int)prevStage == 11) && ((int)objective == 0 || (int)objective == 1 || (int)objective == 2) && SplitArray[2]) || ((int)objective == 3 && ((int)prevObjective == 2 || (int)prevObjective == 0) && SplitArray[3]) || ((int)currentStage == 5 && (int)prevStage == 4 && (int)objective == 4 && SplitArray[4]) || ((int)currentStage == 12 && (int)prevStage == 11 && (int)objective == 5 && SplitArray[5]) || ((int)currentStage == 12 && (int)objective == 6 && (int)prevObjective == 5 && SplitArray[6]) || ((int)currentStage == 5 && (int)prevStage == 12 && (int)objective == 7 && SplitArray[7]) || ((int)currentStage == 6 && (int)prevStage == 11 && (int)objective == 7 && SplitArray[8]) || ((int)currentStage == 6 && (int)objective == 8 && (int)prevObjective == 7 && SplitArray[9]) || ((int)currentStage == 5 && (int)prevStage == 6 && (int)objective == 15 && SplitArray[10]) || ((int)currentStage == 4 && (int)objective == 16 && (int)prevObjective == 15 && SplitArray[11]) || ((int)currentStage == 11 && (int)objective == 17 && (int)prevObjective == 16 && SplitArray[12]) || ((int)currentStage == 12 && (int)objective == 18 && (int)prevObjective == 17 && SplitArray[13]) || ((int)currentStage == 5 && (int)prevStage == 7 && (int)objective == 9 && SplitArray[14]) || ((int)currentStage == 9 && (int)prevStage == 11 && ((int)objective == 15 || (int)objective == 9) && SplitArray[14]) || ((int)currentStage == 9 && (int)objective == 10 && (int)prevObjective == 9 && SplitArray[15]) || ((int)currentStage == 9 && (int)objective == 10 && (int)prevObjective == 15 && SplitArray[15]) || ((int)currentStage == 5 && (int)prevStage == 9 && (int)objective == 11 && SplitArray[16]) || ((int)currentStage == 7 && ((int)objective == 11 || (int)objective == 13) && finalBossHit && !prevFinalBossHit && SplitArray[17])) && (int)currentStage != -1)
{
try
{
Stream.Write(Encoding.UTF8.GetBytes("split\r\n"), 0, Encoding.UTF8.GetBytes("split\r\n").Length);
}
catch (SocketException ex7)
{
Debug.LogError((object)("Error connecting to LiveSplit: " + ex7.Message));
IsConnectedToLivesplit = false;
}
catch (Exception ex8)
{
Debug.LogError((object)("An unexpected error occurred: " + ex8.Message));
IsConnectedToLivesplit = false;
}
}
}
public void ReplaceBoolArrayInFile(string filePath, bool[] newBoolArray)
{
if (!File.Exists(filePath))
{
return;
}
string[] array = File.ReadAllLines(filePath);
List<string> list = new List<string>();
for (int i = 1; i < array.Length; i++)
{
if (!string.IsNullOrWhiteSpace(array[i]) && Enumerable.Contains(array[i], ','))
{
string[] array2 = array[i].Split(new char[1] { ',' });
if (array2.Length >= 2)
{
array2[1] = newBoolArray[i - 1].ToString();
list.Add(string.Join(",", array2));
}
}
}
File.WriteAllLines(filePath, new string[1] { array[0] }.Concat(list).ToArray());
}
public void Update()
{
if (IsConnectedToLivesplit || debug)
{
UpdateAutosplitter();
}
if (!File.Exists(SplitsPath) || SplitArray != null)
{
return;
}
string[] array = File.ReadAllLines(SplitsPath);
List<bool> list = new List<bool>();
string[] array2 = array;
foreach (string text in array2)
{
if (!string.IsNullOrWhiteSpace(text) && Enumerable.Contains(text, ','))
{
string[] array3 = text.Split(new char[1] { ',' });
if (array3.Length >= 2)
{
list.Add(bool.Parse(array3[1]));
}
}
}
SplitArray = list.ToArray();
}
public void OnApplicationQuit()
{
if (IsConnectedToLivesplit)
{
try
{
Stream.Write(Encoding.UTF8.GetBytes("pausegametime\r\n"), 0, Encoding.UTF8.GetBytes("pausegametime\r\n").Length);
}
catch (SocketException ex)
{
Debug.LogError((object)("Error connecting to LiveSplit: " + ex.Message));
IsConnectedToLivesplit = false;
}
catch (Exception ex2)
{
Debug.LogError((object)("An unexpected error occurred: " + ex2.Message));
IsConnectedToLivesplit = false;
}
}
}
}
[HarmonyPatch]
internal class MouseMenuFix
{
public static readonly string settingsPath;
private static bool isMouseMenuFixEnabled;
static MouseMenuFix()
{
settingsPath = Paths.ConfigPath + "\\SpeedrunUtils\\Settings.txt";
isMouseMenuFixEnabled = bool.Parse(SettingsManager.GetSetting(settingsPath, "Mouse Menu Fix", "true"));
}
[HarmonyPatch(typeof(TextMeshProMenuButton), "OnPointerEnter")]
[HarmonyPrefix]
public static bool OnPointerEnter_Prefix()
{
if (isMouseMenuFixEnabled)
{
return Cursor.visible;
}
return true;
}
[HarmonyPatch(typeof(TextMeshProMenuButton), "OnPointerExit")]
[HarmonyPrefix]
public static bool OnPointerExit_Prefix()
{
if (isMouseMenuFixEnabled)
{
return Cursor.visible;
}
return true;
}
}
[BepInPlugin("brc.loomeh.speedrunutils", "SpeedrunUtils", "1.5.3")]
public class Plugin : BaseUnityPlugin
{
private GameObject _mod;
private void Awake()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
_mod = new GameObject();
_mod.AddComponent<TextManager>();
_mod.AddComponent<LiveSplitControl>();
_mod.AddComponent<DoAutoMash>();
_mod.AddComponent<ConfigUi>();
_mod.AddComponent<Tools>();
Object.DontDestroyOnLoad((Object)(object)_mod);
new Harmony("brc.loomeh.speedrunutils").PatchAll();
}
}
public class TextManager : MonoBehaviour
{
public static string langPath = Paths.ConfigPath + "\\SpeedrunUtils\\LANG.txt";
public string lang = "EN";
public Dictionary<string, string> guiText = new Dictionary<string, string>(16);
private void SetLanguage()
{
string text = lang;
if (!(text == "EN"))
{
if (text == "IT")
{
guiText.Add("Splits", "Parziali");
guiText.Add("Credits", "Crediti");
guiText.Add("Automash Enabled", "AutoMash Abilitato");
guiText.Add("Automash Disabled", "AutoMash Disabilitato");
guiText.Add("FPS", "FPS");
guiText.Add("FPS Limit", "Limite FPS");
guiText.Add("On", "Su");
guiText.Add("Off", "Spento");
guiText.Add("Uncapped", "Senza limiti");
guiText.Add("Connected to LiveSplit", "Connesso a LiveSplit");
guiText.Add("Not connected to LiveSplit", "Non connesso a LiveSplit");
guiText.Add("Set FPS", "Imposta Limite FPS");
guiText.Add("Connect to LiveSplit", "Connetti a LiveSplit");
guiText.Add("Report any issues in #technical-help", "Segnala eventuali problemi in #technical-help");
guiText.Add("Developed by", "Sviluppato da");
guiText.Add("Save Splits", "Salva i parziali");
guiText.Add("Close", "Chiudi");
}
else
{
guiText.Add("Splits", "Splits");
guiText.Add("Credits", "Credits");
guiText.Add("Automash Enabled", "Automash Enabled");
guiText.Add("Automash Disabled", "Automash Disabled");
guiText.Add("FPS", "FPS");
guiText.Add("FPS Limit", "FPS Limit");
guiText.Add("On", "On");
guiText.Add("Off", "Off");
guiText.Add("Connected to LiveSplit", "Connected to LiveSplit");
guiText.Add("Not connected to LiveSplit", "Not connected to LiveSplit");
guiText.Add("Set FPS", "Set FPS");
guiText.Add("Connect to LiveSplit", "Connect to LiveSplit");
guiText.Add("Report any issues in #technical-help", "Report any issues in #technical-help");
guiText.Add("Developed by", "Developed by");
guiText.Add("Save Splits", "Save Splits");
guiText.Add("Close", "Close");
}
}
else
{
guiText.Add("Splits", "Splits");
guiText.Add("Credits", "Credits");
guiText.Add("Automash Enabled", "Automash Enabled");
guiText.Add("Automash Disabled", "Automash Disabled");
guiText.Add("FPS", "FPS");
guiText.Add("FPS Limit", "FPS Limit");
guiText.Add("On", "On");
guiText.Add("Off", "Off");
guiText.Add("Uncapped", "Uncapped");
guiText.Add("Connected to LiveSplit", "Connected to LiveSplit");
guiText.Add("Not connected to LiveSplit", "Not connected to LiveSplit");
guiText.Add("Set FPS", "Set FPS");
guiText.Add("Connect to LiveSplit", "Connect to LiveSplit");
guiText.Add("Report any issues in #technical-help", "Report any issues in #technical-help");
guiText.Add("Developed by", "Developed by");
guiText.Add("Save Splits", "Save Splits");
guiText.Add("Close", "Close");
}
}
private void Awake()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
if (!File.Exists(langPath))
{
SystemLanguage systemLanguage = Application.systemLanguage;
if ((int)systemLanguage != 10)
{
if ((int)systemLanguage == 21)
{
SettingsManager.CheckAndAddSetting(langPath, "LANG", "IT");
lang = "IT";
}
else
{
SettingsManager.CheckAndAddSetting(langPath, "LANG", "EN");
lang = "EN";
}
}
else
{
SettingsManager.CheckAndAddSetting(langPath, "LANG", "EN");
lang = "EN";
}
SetLanguage();
}
else
{
lang = SettingsManager.GetSetting(langPath, "LANG", "EN");
SetLanguage();
}
}
}
public class Tools : MonoBehaviour
{
public static Tools Instance;
private Core core;
private WorldHandler world;
public bool coreHasBeenSetup;
public Tools()
{
Instance = this;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "SpeedrunUtils";
public const string PLUGIN_NAME = "SpeedrunUtils";
public const string PLUGIN_VERSION = "1.5.3";
}
}