Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DebugMod v0.1.65
InUCS.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx.Logging; using Collider2DViewer; using InUCS; using InUCS.Addons.Collider2DViewer; using InUCS.Components; using InUCS.Logging; using InUCS.Logging.Loggers; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("InUCS")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5381bb6a6b8a97dce978d58770de099b21b43190")] [assembly: AssemblyProduct("InUCS")] [assembly: AssemblyTitle("InUCS")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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 InUCS { public static class Helpers { public static uint BoolToInt(bool val) { return Convert.ToUInt32(val); } public static bool FileNameIsValidSlow(string filename) { if (string.IsNullOrEmpty(filename)) { return false; } char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); for (int i = 0; i < filename.Length; i++) { if (Array.IndexOf(invalidFileNameChars, filename[i]) != -1) { return false; } } return true; } } public static class ReflectionHelper { private static bool HasMethodDefinition(LocalComponent comp, string method, BindingFlags flags, out MethodInfo methodInfo) { methodInfo = comp.GetType().GetMethod(method, flags); if (methodInfo != null && methodInfo.DeclaringType == methodInfo.ReflectedType) { return !methodInfo.IsAbstract; } return false; } public static bool HasOwnPrivateDefinition(this LocalComponent comp, string method, out MethodInfo methodInfo) { return HasMethodDefinition(comp, method, BindingFlags.Instance | BindingFlags.NonPublic, out methodInfo); } public static bool HasOwnPublicDefinition(this LocalComponent comp, string method, out MethodInfo methodInfo) { return HasMethodDefinition(comp, method, BindingFlags.Instance | BindingFlags.Public, out methodInfo); } public static bool HasOwnAnyDefinition(this LocalComponent comp, string method, out MethodInfo methodInfo) { return HasMethodDefinition(comp, method, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, out methodInfo); } public static Type[]? GetAllTypesOfBase<T>() where T : class { return AppDomain.CurrentDomain.GetAssemblies()?.Where((Assembly a) => !a.IsDynamic)?.SelectMany((Assembly a) => a.GetTypes())?.Where((Type t) => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(T)))?.ToArray(); } public static ConstructorInfo? FindFirstSuitableCtorWithParamMatch(Type target, object[] parameters, out string? reason) { object[] parameters2 = parameters; reason = null; ConstructorInfo[] array = target.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Where((ConstructorInfo x) => x.GetParameters()?.Length == parameters2.Length)?.ToArray(); if (array == null || array.Length == 0) { reason = "no suitable ctors found for [" + target.FullName + ": " + string.Join(',', parameters2) + "]"; return null; } ConstructorInfo constructorInfo = null; ConstructorInfo[] array2 = array; foreach (ConstructorInfo constructorInfo2 in array2) { ParameterInfo[] parameters3 = constructorInfo2.GetParameters(); int j; for (j = 0; j < parameters3.Length && parameters2[j].GetType() == parameters3[j].ParameterType; j++) { } if (j == parameters3.Length) { constructorInfo = constructorInfo2; break; } } if (constructorInfo == null) { reason = "no matching param types found for [" + target.FullName + ": " + string.Join(',', parameters2) + "]"; return null; } return constructorInfo; } public static FieldInfo[]? FetchFieldsWithAttribute<T>(Type t, BindingFlags flags) where T : Attribute { List<FieldInfo> list = null; FieldInfo[] fields = t.GetFields(flags); if (fields == null || fields.Length == 0) { return null; } list = new List<FieldInfo>(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.CustomAttributes == null) { continue; } foreach (CustomAttributeData customAttribute in fieldInfo.CustomAttributes) { if (customAttribute.AttributeType == typeof(T)) { list.Add(fieldInfo); } } } return list?.ToArray(); } public static Type? FindTypeInAssembly(string assemblyName, string fullTypeName) { string assemblyName2 = assemblyName; string fullTypeName2 = fullTypeName; return AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly x) => x.GetName().Name.Equals(assemblyName2, StringComparison.OrdinalIgnoreCase))?.GetTypes().FirstOrDefault((Type x) => x.FullName.Equals(fullTypeName2, StringComparison.Ordinal)); } public static string GetAssemblyDir() { return Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)); } public static void SetFieldByType(FieldInfo fi, string val, object instance, Action<string>? logger = null) { Type fieldType = fi.FieldType; if (fieldType.IsEnum) { if (Enum.TryParse(fieldType, val, out object result)) { fi.SetValue(instance, result); } else { Debug.Log((object)"Failed to parse"); } } else if (fieldType == typeof(bool)) { if (bool.TryParse(val, out var result2)) { fi.SetValue(instance, result2); } else if (val == "1") { fi.SetValue(instance, true); } else if (val == "0") { fi.SetValue(instance, false); } } else if (fieldType == typeof(string)) { fi.SetValue(instance, val); } else if (fieldType == typeof(byte)) { if (byte.TryParse(val, out var result3)) { fi.SetValue(instance, result3); } } else if (fieldType == typeof(sbyte)) { if (sbyte.TryParse(val, out var result4)) { fi.SetValue(instance, result4); } } else if (fieldType == typeof(short)) { if (short.TryParse(val, out var result5)) { fi.SetValue(instance, result5); } } else if (fieldType == typeof(ushort)) { if (ushort.TryParse(val, out var result6)) { fi.SetValue(instance, result6); } } else if (fieldType == typeof(int)) { if (int.TryParse(val, out var result7)) { fi.SetValue(instance, result7); } } else if (fieldType == typeof(uint)) { if (int.TryParse(val, out var result8)) { fi.SetValue(instance, result8); } } else if (fieldType == typeof(long)) { if (long.TryParse(val, out var result9)) { fi.SetValue(instance, result9); } } else if (fieldType == typeof(ulong)) { if (ulong.TryParse(val, out var result10)) { fi.SetValue(instance, result10); } } else if (fieldType == typeof(float)) { if (float.TryParse(val, out var result11)) { fi.SetValue(instance, result11); } } else if (fieldType == typeof(double)) { if (double.TryParse(val, out var result12)) { fi.SetValue(instance, result12); } } else { logger?.Invoke($"Unsupported format {fieldType}"); } } } public static class ScreenHelper { private const float BASE_WIDTH = 1920f; private const float BASE_HEIGHT = 1080f; private static float LAST_WIDTH = Screen.width; private static float LAST_HEIGHT = Screen.height; public static float WFac { get; private set; } = 1f; public static float HFac { get; private set; } = 1f; public static float HEIGHT => LAST_HEIGHT; public static float WIDTH => LAST_WIDTH; public static Matrix4x4 GUIMatrix { get; private set; } public static void UpdateScreenFactor() { //IL_0050: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (LAST_WIDTH != (float)Screen.width || LAST_HEIGHT != (float)Screen.height) { LAST_WIDTH = Screen.width; LAST_HEIGHT = Screen.height; WFac = 1920f / LAST_WIDTH; HFac = 1080f / LAST_HEIGHT; GUIMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3((float)Screen.width / 1920f, (float)Screen.height / 1080f, 1f)); } } public static bool PointWithinScreenSpace(Vector3 screenPos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0028: Unknown result type (might be due to invalid IL or missing references) if (screenPos.x > 0f && screenPos.x < (float)Screen.width && screenPos.y > 0f) { return screenPos.y < (float)Screen.height; } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Matrix4x4 CalculateMatrix(float X, float Y) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) return Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(X / 1920f, Y / 1080f, 1f)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Matrix4x4 CalculateMatrixInLine(ref Matrix4x4 matrix, float X, float Y) { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_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) return matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(X / 1920f, Y / 1080f, 1f)); } } public static class UnityExtensions { } public static class GLog { private static ILogRouter _logger = new SystemNetLogger("Global"); public static ILogRouter DefaultLogger { get { return _logger; } set { _logger = value ?? _logger; } } public static void Info(object msg) { _logger.Info(msg); } public static void Debug(object msg) { _logger.Debug(msg); } public static void Message(object msg) { _logger.Message(msg); } public static void Error(object msg) { _logger.Error(msg); } public static void Warn(object msg) { _logger.Warn(msg); } } [DefaultExecutionOrder(int.MaxValue)] public abstract class ComponentManager : MonoBehaviour { private Type[]? DiscoveredComponents = ReflectionHelper.GetAllTypesOfBase<LocalComponent>(); private readonly Dictionary<Type, LocalComponent> AllComponents = new Dictionary<Type, LocalComponent>(); private readonly List<LocalComponent> EnabledComponents = new List<LocalComponent>(); private readonly List<LocalComponent> StackOnGUI = new List<LocalComponent>(); private readonly List<LocalComponent> StackUpdate = new List<LocalComponent>(); private readonly List<LocalComponent> StackLateUpdate = new List<LocalComponent>(); private readonly List<LocalComponent> StackFixedUpdate = new List<LocalComponent>(); public ILogRouter Logger { get; protected set; } = new UnityLogger("ComponentManager"); protected string MyLogName => "[" + ((object)this).GetType().Name + "]"; protected void Awake() { Logger.Message(((object)this).GetType().Name + ": base Awake"); for (int i = 0; i < EnabledComponents.Count; i++) { EnabledComponents[i].Awake(); } } protected void Start() { Logger.Message(((object)this).GetType().Name + ": base Start"); for (int i = 0; i < EnabledComponents.Count; i++) { EnabledComponents[i].Start(); } } protected void OnEnable() { Logger.Message(((object)this).GetType().Name + ": base OnEnable"); for (int i = 0; i < EnabledComponents.Count; i++) { EnabledComponents[i].OnEnable(); } } protected void OnDisable() { Logger.Message(((object)this).GetType().Name + ": base OnDisable"); for (int i = 0; i < EnabledComponents.Count; i++) { EnabledComponents[i].OnDisable(); } } protected void OnDestroy() { for (int i = 0; i < EnabledComponents.Count; i++) { EnabledComponents[i].OnDestroy(); } OnDestroy_Self(); } protected void Update() { for (int i = 0; i < StackUpdate.Count; i++) { StackUpdate[i].Update(); } } protected void OnGUI() { for (int i = 0; i < StackOnGUI.Count; i++) { StackOnGUI[i].OnGUI(); } } protected void FixedUpdate() { for (int i = 0; i < StackFixedUpdate.Count; i++) { StackFixedUpdate[i].FixedUpdate(); } } protected void LateUpdate() { for (int i = 0; i < EnabledComponents.Count; i++) { EnabledComponents[i].LateUpdate(); } } protected virtual void SpawnComponents() { AppendAutoDiscoveredWithDefaults(); PrintEnabledComponents(); } protected virtual void AddComponent(LocalComponent comp) { Type type = comp.GetType(); if (AllComponents.ContainsKey(type)) { Logger.Error($"[{((object)this).GetType().Name}]: An attempt to add a duplicate component {type}"); comp.OnComponentDisable(); comp.OnDestroy(); return; } Logger.Message($"{MyLogName}: adding component {comp.GetType().Name} [{comp.EnabledByDefault}, {comp.Priority}]"); AllComponents[type] = comp; if (comp.EnabledByDefault) { EnableComponent(comp); } SortByPriority(); } protected virtual void EnableComponent<T>() where T : LocalComponent { if (AllComponents.TryGetValue(typeof(T), out LocalComponent value)) { EnableComponent(value); } else { Logger.Warn($"{((object)this).GetType().Name}: Failed to enable component {typeof(T)} - not found!"); } } protected virtual void DisableComponent<T>() where T : LocalComponent { LocalComponent comp = EnabledComponents.FirstOrDefault((LocalComponent x) => x.GetType() == typeof(T)); DisableComponent(comp); } protected virtual void RemoveComponent<T>() where T : LocalComponent { if (AllComponents.TryGetValue(typeof(T), out LocalComponent value)) { RemoveComponent(value); } else { Logger.Warn($"{((object)this).GetType().Name}: Failed to remove component {typeof(T)} - not found!"); } } protected virtual T? GetLocalComponent<T>() where T : LocalComponent { if (AllComponents.TryGetValue(typeof(T), out LocalComponent value)) { return value as T; } return null; } protected virtual T? GetEnabledLocalComponent<T>() where T : LocalComponent { return EnabledComponents.FirstOrDefault((LocalComponent x) => x.GetType() == typeof(T)) as T; } public virtual bool ValidateComponentStore() { for (int i = 0; i < EnabledComponents.Count; i++) { if (!AllComponents.ContainsKey(EnabledComponents[i].GetType())) { return false; } } return true; } protected virtual int ResyncEnabledComponents() { int count = AllComponents.Count; for (int i = 0; i < EnabledComponents.Count; i++) { if (!AllComponents.ContainsKey(EnabledComponents[i].GetType())) { AllComponents[EnabledComponents[i].GetType()] = EnabledComponents[i]; } } return AllComponents.Count - count; } protected virtual void SortByPriority() { EnabledComponents.Sort((LocalComponent i1, LocalComponent i2) => i2.Priority.CompareTo(i1.Priority)); StackOnGUI.Sort((LocalComponent i1, LocalComponent i2) => i2.Priority.CompareTo(i1.Priority)); StackUpdate.Sort((LocalComponent i1, LocalComponent i2) => i2.Priority.CompareTo(i1.Priority)); StackLateUpdate.Sort((LocalComponent i1, LocalComponent i2) => i2.Priority.CompareTo(i1.Priority)); StackFixedUpdate.Sort((LocalComponent i1, LocalComponent i2) => i2.Priority.CompareTo(i1.Priority)); } private void OnDestroy_Self() { Logger.Warn(MyLogName + ": Self-destruction!"); AllComponents.Clear(); EnabledComponents.Clear(); StackFixedUpdate.Clear(); StackOnGUI.Clear(); StackUpdate.Clear(); StackLateUpdate.Clear(); } private void AddComponentSpecialized(LocalComponent comp, string methodName, List<LocalComponent> specializedStack) { if (comp.HasOwnPublicDefinition(methodName, out MethodInfo _)) { Logger.Message(comp.GetType().Name + " has " + methodName); specializedStack.Add(comp); } } private void EnableComponent(LocalComponent? comp) { if (comp != null) { Logger.Message($"{MyLogName}: enabling component {comp.GetType().Name} [{comp.EnabledByDefault}, {comp.Priority}]"); comp.OnComponentEnable(); EnabledComponents.Add(comp); AddComponentSpecialized(comp, "Update", StackUpdate); AddComponentSpecialized(comp, "OnGUI", StackOnGUI); AddComponentSpecialized(comp, "FixedUpdate", StackFixedUpdate); AddComponentSpecialized(comp, "LateUpdate", StackLateUpdate); } } private void RemoveComponent(LocalComponent? comp) { if (comp != null) { DisableComponent(comp); AllComponents.Remove(comp.GetType()); } } private void DisableComponent(LocalComponent? comp) { if (comp != null) { comp.OnComponentDisable(); EnabledComponents.Remove(comp); StackUpdate.Remove(comp); StackOnGUI.Remove(comp); StackFixedUpdate.Remove(comp); StackLateUpdate.Remove(comp); } } public virtual void PrintEnabledComponents() { Logger.Message($"{MyLogName}: total enabled components: {EnabledComponents.Count}"); foreach (LocalComponent enabledComponent in EnabledComponents) { Logger.Message(string.Format("-| {0}: (autoenable: {1}, priority: {2}): {3}", enabledComponent.GetType().Name, enabledComponent.EnabledByDefault, enabledComponent.Priority, enabledComponent.isEnabled ? "enabled" : "disabled")); } } public virtual void PrintAllComponents() { Logger.Message($"{((object)this).GetType().Name}: total components: {AllComponents.Count}"); foreach (KeyValuePair<Type, LocalComponent> allComponent in AllComponents) { Logger.Message(string.Format("{0}: ({1} | {2}): {3}", allComponent.Key.GetType().Name, allComponent.Value.EnabledByDefault, allComponent.Value.Priority, allComponent.Value.isEnabled ? "enabled" : "disabled")); } } protected virtual void AddComponentByFullNameWithParams(string fullName, params object[] prms) { string fullName2 = fullName; try { Type[]? discoveredComponents = DiscoveredComponents; DiscoveredComponents = ((discoveredComponents == null || discoveredComponents.Length == 0) ? ReflectionHelper.GetAllTypesOfBase<LocalComponent>() : DiscoveredComponents); Type[]? discoveredComponents2 = DiscoveredComponents; if (discoveredComponents2 == null || discoveredComponents2.Length == 0 || prms == null || prms.Length == 0) { Logger.Error(MyLogName + ": Unable to create component - no LocalComponent types found at all or invalid parameters supplied"); return; } Type type = DiscoveredComponents?.Where((Type x) => x.FullName.Equals(fullName2))?.FirstOrDefault(); if (type == null) { Logger.Error(MyLogName + ": Unable to find component with full name " + fullName2); } else { AddComponentByTypeWithParams(type, prms); } } catch (Exception ex) { Logger.Error(string.Format("{0}: ({1}) for {2} failed: {3}", MyLogName, "AddComponentByFullNameWithParams", fullName2, ex)); } } private void AddComponentByTypeWithParams(Type lcType, params object[] prms) { LocalComponent localComponent = ConstructComponent(lcType, prms); if (localComponent != null) { AddComponent(localComponent); } else { Logger.Error($"{MyLogName}: Unable to add component {lcType} - it is NULL"); } } private LocalComponent? ConstructComponent(Type lcType, params object[] prms) { LocalComponent localComponent = null; object[] parameters = new object[1] { this }.Concat(prms).ToArray(); string reason; ConstructorInfo constructorInfo = ReflectionHelper.FindFirstSuitableCtorWithParamMatch(lcType, parameters, out reason); try { localComponent = constructorInfo?.Invoke(parameters) as LocalComponent; } catch (Exception ex) { reason = ex.ToString(); } reason = (string.IsNullOrEmpty(reason) ? "ctor failed!" : reason); if (localComponent == null) { Logger.Error(MyLogName + ": Unable to construct component - " + reason); } return localComponent; } public virtual void AppendAutoDiscoveredWithDefaults() { try { Type[]? discoveredComponents = DiscoveredComponents; DiscoveredComponents = ((discoveredComponents == null || discoveredComponents.Length == 0) ? ReflectionHelper.GetAllTypesOfBase<LocalComponent>() : DiscoveredComponents); Type[]? discoveredComponents2 = DiscoveredComponents; if (discoveredComponents2 == null || discoveredComponents2.Length == 0) { Logger.Error(MyLogName + ": Unable to continue with auto-spawn - no LocalComponent types found at all"); return; } Type[] array = DiscoveredComponents.Where((Type x) => !AllComponents.ContainsKey(x)).ToArray(); if (array == null || array.Length == 0) { Logger.Warn(MyLogName + ": Auto-spawning cancelled as no suitable types found/left to spawn"); return; } Logger.Message($"{MyLogName}: auto-spawning {array.Length} components"); Type[] array2 = array; foreach (Type type in array2) { FieldInfo[] array3 = ReflectionHelper.FetchFieldsWithAttribute<DefaultComponentValueAttribute>(type, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (array3 == null || array3.Length == 0) { Logger.Warn(string.Format("{0}: Auto-spawn for {1} skipped: no fields with {2} found", MyLogName, type, "DefaultComponentValueAttribute")); break; } object[] prms = (from x in array3 orderby x.GetCustomAttribute<DefaultComponentValueAttribute>().Order select x.GetCustomAttribute<DefaultComponentValueAttribute>().Value).ToArray(); AddComponentByTypeWithParams(type, prms); } } catch (Exception arg) { Logger.Error(string.Format("{0}: ({1}) failed: {2}", MyLogName, "AppendAutoDiscoveredWithDefaults", arg)); } } } } namespace InUCS.Manager { public class BaseSharedConfig { } public sealed class EventDispatcher { } } namespace InUCS.Logging { public interface ILogRouter { void Info(object msg); void Debug(object msg); void Message(object msg); void Error(object msg); void Warn(object msg); } public abstract class LoggerBase { protected string sourceName; protected LoggerBase(string sourceName) { this.sourceName = sourceName ?? "Global"; } } public sealed class BepinExLogger : LoggerBase, ILogRouter { private readonly ManualLogSource logger; public BepinExLogger(string sourceName) : base(sourceName) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown logger = new ManualLogSource(sourceName); Logger.Sources.Add((ILogSource)(object)logger); } public void Debug(object msg) { logger.LogDebug(msg); } public void Error(object msg) { logger.LogError(msg); } public void Info(object msg) { logger.LogInfo(msg); } public void Message(object msg) { logger.LogMessage(msg); } public void Warn(object msg) { logger.LogWarning(msg); } } public sealed class UnityLogger : LoggerBase, ILogRouter { public UnityLogger(string sourceName) : base(sourceName) { Debug.unityLogger.logEnabled = true; } public void Debug(object msg) { ILogger unityLogger = Debug.unityLogger; if (unityLogger != null) { unityLogger.Log((LogType)4, "[" + sourceName + "]", msg); } } public void Error(object msg) { ILogger unityLogger = Debug.unityLogger; if (unityLogger != null) { unityLogger.Log((LogType)0, "[" + sourceName + "]", msg); } } public void Warn(object msg) { ILogger unityLogger = Debug.unityLogger; if (unityLogger != null) { unityLogger.Log((LogType)2, "[" + sourceName + "]", msg); } } public void Info(object msg) { ILogger unityLogger = Debug.unityLogger; if (unityLogger != null) { unityLogger.Log((LogType)3, "[" + sourceName + "]", msg); } } public void Message(object msg) { ILogger unityLogger = Debug.unityLogger; if (unityLogger != null) { unityLogger.Log((LogType)3, "[" + sourceName + "]", msg); } } } } namespace InUCS.Logging.Loggers { public sealed class SystemNetLogger : LoggerBase, ILogRouter { public SystemNetLogger(string sourceName) : base(sourceName) { } public void Debug(object msg) { Console.WriteLine("[{0}]: {1}", sourceName, msg); } public void Error(object msg) { Console.WriteLine("[{0}]: {1}", sourceName, msg); } public void Info(object msg) { Console.WriteLine("[{0}]: {1}", sourceName, msg); } public void Message(object msg) { Console.WriteLine("[{0}]: {1}", sourceName, msg); } public void Warn(object msg) { Console.WriteLine("[{0}]: {1}", sourceName, msg); } } } namespace InUCS.Extensions { public static class LegacyInputHelper { public static bool NoLeftModifiers { get { if (!Input.GetKey((KeyCode)306) && !Input.GetKey((KeyCode)308)) { return !Input.GetKey((KeyCode)304); } return false; } } public static bool NoRightModifiers { get { if (!Input.GetKey((KeyCode)305) && !Input.GetKey((KeyCode)307)) { return !Input.GetKey((KeyCode)303); } return false; } } public static bool NoAnyModifiers { get { if (NoLeftModifiers) { return NoRightModifiers; } return false; } } public static bool NoAnyFromTheTripletHeld(KeyCode key1, KeyCode key2, KeyCode key3) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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) if (!Input.GetKey(key1) && !Input.GetKey(key2)) { return !Input.GetKey(key3); } return false; } } public static class NewInputHelper { public static bool NoLeftModifiers { get { if (!((ButtonControl)Keyboard.current.leftShiftKey).isPressed && !((ButtonControl)Keyboard.current.leftAltKey).isPressed) { return !((ButtonControl)Keyboard.current.leftCtrlKey).isPressed; } return false; } } public static bool NoRightModifiers { get { if (!((ButtonControl)Keyboard.current.rightShiftKey).isPressed && !((ButtonControl)Keyboard.current.rightAltKey).isPressed) { return !((ButtonControl)Keyboard.current.rightCtrlKey).isPressed; } return false; } } public static bool NoAnyModifiers { get { if (NoLeftModifiers) { return NoRightModifiers; } return false; } } } } namespace InUCS.Components { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] public sealed class DefaultComponentValueAttribute : Attribute { public object Value { get; set; } public byte Order { get; set; } public DefaultComponentValueAttribute(object v, byte order) { Value = v; Order = order; } } [AttributeUsage(AttributeTargets.Class)] public sealed class DisableAutoSpawnAttribute : Attribute { } public abstract class LocalComponent : IEquatable<LocalComponent> { public readonly bool EnabledByDefault = true; public readonly int Priority; public bool isEnabled { get; private set; } private ComponentManager Manager { get; set; } protected ILogRouter Logger => Manager.Logger; protected LocalComponent(ComponentManager manager, bool startEnabled = true, int priority = 0) { Manager = manager; EnabledByDefault = startEnabled; Priority = priority; } public virtual void OnComponentEnable() { isEnabled = true; } public virtual void OnComponentDisable() { isEnabled = false; } public virtual void Awake() { } public virtual void Start() { } public virtual void OnEnable() { } public virtual void OnDisable() { } public virtual void OnDestroy() { } public virtual void Update() { } public virtual void OnGUI() { } public virtual void FixedUpdate() { } public virtual void LateUpdate() { } public void UpdateManager(ComponentManager newManager) { Manager = newManager; } public bool Equals(LocalComponent? other) { if (other != null) { if (this != other) { return GetType() == other.GetType(); } return true; } return false; } public override bool Equals(object? obj) { if (obj is LocalComponent other) { return Equals(other); } return false; } public override int GetHashCode() { return GetHashCode(); } } [DisableAutoSpawn] public sealed class ScreenComponent : LocalComponent { private const float BASE_WIDTH = 1920f; private const float BASE_HEIGHT = 1080f; private float LAST_WIDTH = Screen.width; private float LAST_HEIGHT = Screen.height; public Matrix4x4 GuiMatrix { get; private set; } public float WFac { get; private set; } = 1f; public float HFac { get; private set; } = 1f; public bool IsNoOP { get; set; } public ScreenComponent(ComponentManager manager) : base(manager) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) GuiMatrix = CalculateMatrix(Screen.width, Screen.height); RecalibrateFactor(); } public override void Update() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (Time.frameCount % 300 == 0 && (LAST_WIDTH != (float)Screen.width || LAST_HEIGHT != (float)Screen.height)) { RecalibrateFactor(); GuiMatrix = CalculateMatrix(Screen.width, Screen.height); } } public void Set1x1() { IsNoOP = true; float wFac = (HFac = 1f); WFac = wFac; } public void RecalibrateFactor() { if (!IsNoOP) { WFac = 1920f / (float)Screen.width; HFac = 1080f / (float)Screen.height; } LAST_WIDTH = Screen.width; LAST_HEIGHT = Screen.height; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public Matrix4x4 CalculateMatrix(float X, float Y) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) return Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(X / 1920f, Y / 1080f, 1f)); } } } namespace InUCS.API { public static class UnityAPI { public static void ToggleCursor(bool enable) { Cursor.visible = enable; if (enable) { Cursor.lockState = (CursorLockMode)0; } } public static void SpawnBoxCollider2D(Vector3 pos, float height, float width, LayerMask layer, bool halfHeightPosition, string objName = "PlayerBlocker") { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_006a: 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) if (!(height < 2f) && !(width < 2f)) { GameObject val = new GameObject(objName, new Type[1] { typeof(BoxCollider2D) }); BoxCollider2D component = val.GetComponent<BoxCollider2D>(); float num = (halfHeightPosition ? (pos.y + height / 2f) : pos.y); val.transform.position = new Vector3(pos.x, num, 0f); val.layer = LayerMask.op_Implicit(layer); component.size = new Vector2(width, height); ((Collider2D)component).isTrigger = false; val.SetActive(true); } } public static void DisableGOByName(string objName, bool newState = false) { GameObject obj = GameObject.Find(objName); if (obj != null) { obj.SetActive(false); } } public static T? FetchResourceByName<T>(string objName) where T : Object { T[] array = Resources.FindObjectsOfTypeAll<T>(); foreach (T val in array) { object obj = val; if (string.Equals((obj != null) ? ((Object)obj).name : null, objName, StringComparison.OrdinalIgnoreCase)) { return val; } } return default(T); } public static GameObject? FetchGameObjectByPath(string namePath) { if (string.IsNullOrEmpty(namePath)) { GLog.Warn("Invalid GO name supplied to fetch: " + namePath); return null; } int num = namePath.IndexOf('/'); bool num2 = num > 0; string text = (num2 ? namePath.Substring(0, num) : namePath); string text2 = (num2 ? namePath.Substring(num + 1, namePath.Length - (num + 1)) : string.Empty); GameObject val = GameObject.Find(text); if (!num2) { return val; } if (val == null) { return null; } Transform transform = val.transform; if (transform == null) { return null; } Transform obj = transform.Find(text2); if (obj == null) { return null; } return ((Component)obj).gameObject; } public static bool ObjectWithinScreenSpace(Camera cam, GameObject obj) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) bool result = false; if ((Object)(object)obj != (Object)null) { result = ScreenHelper.PointWithinScreenSpace(cam.WorldToScreenPoint(obj.transform.position)); } return result; } public static bool ObjectWithinViewport(GameObject obj) { return false; } public static GUISkin? GetDefaultUIMGUISkin() { MethodInfo[] methods = typeof(GUIUtility).GetMethods(BindingFlags.Static | BindingFlags.NonPublic); MethodInfo methodInfo = null; MethodInfo[] array = methods; foreach (MethodInfo methodInfo2 in array) { if (methodInfo2.Name == "GetDefaultSkin" && methodInfo2.GetParameters().Length != 0) { methodInfo = methodInfo2; break; } } if (methodInfo == null) { return null; } object? obj = methodInfo.Invoke(null, new object[1] { 0 }); return Object.Instantiate<GUISkin>((GUISkin)((obj is GUISkin) ? obj : null)); } } } namespace InUCS.Addons { public sealed class MovingAverage { private readonly int _windowSize; private readonly Queue<long> _samples; private long _sampleAccumulator; public long GetAverage => _sampleAccumulator / _samples.Count; public float GetAverageFloat => _sampleAccumulator / _samples.Count; public MovingAverage(int windowSize = 30) { _windowSize = windowSize; _samples = new Queue<long>(_windowSize + 1); } public void Clear() { _sampleAccumulator = 0L; _samples.Clear(); } public void Sample(long newSample) { _sampleAccumulator += newSample; _samples.Enqueue(newSample); if (_samples.Count > _windowSize) { _sampleAccumulator -= _samples.Dequeue(); } } } public sealed class MutableString { public enum BaseValue { Binary = 2, Decimal = 10, Hex = 16 } public const float EPSILON = float.Epsilon; private const BaseValue DEFAULT_BASE = BaseValue.Decimal; private readonly char[] DIGITS_LUT = new char[16] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; private readonly uint MAX_DECIMALS = 2u; private readonly string zeroFloat = "0.0000000000000000"; private readonly float almostZero = 0.0001f; private readonly bool dontThrow; private char m_defaultPadChar = ' '; private int m_Pos; private string m_valueStr; public char DefaultPadChar { get { return m_defaultPadChar; } set { m_defaultPadChar = value; } } public int Capacity => m_valueStr.Length; public int Length { get { return m_Pos; } set { m_Pos = value; } } public string CurrentRaw => m_valueStr; public MutableString(int size) : this(size, '\0', ignoreOverflow: false, 2u) { } public MutableString(int size, bool ignoreOverflow) : this(size, '\0', ignoreOverflow, 2u) { } public MutableString(int size, char fillChar) : this(size, fillChar, ignoreOverflow: false, 2u) { } public MutableString(int size, char fillChar, bool ignoreOverflow, uint def_max_decimals) { if (size < 2) { throw new ArgumentException("Size cannot be 1 or less"); } m_valueStr = new string(fillChar, size); dontThrow = ignoreOverflow; MAX_DECIMALS = def_max_decimals; zeroFloat = ((MAX_DECIMALS != 0) ? ("0." + new string('0', (int)MAX_DECIMALS)) : "0"); almostZero = (float)(1.0 / Math.Pow(10.0, MAX_DECIMALS + 2)); } public string Finalize() { if (m_Pos == 0) { return string.Empty; } int num = m_valueStr.Length - m_Pos; if (num > 0) { repeatChar('\0', num); } m_Pos = 0; return m_valueStr; } public MutableString Append(bool value) { Append(value.ToString()); return this; } public MutableString Append(byte value) { Append((uint)value); return this; } public MutableString Append(sbyte value) { Append((int)value); return this; } public MutableString Append(short value) { Append((int)value); return this; } public MutableString Append(ushort value) { Append((int)value); return this; } public MutableString Append(char[] value, int indx, int count) { if (value == null) { return this; } int num = value.Length; if (count < 1 || indx < 0 || num < count + indx) { return this; } if (num > 1) { AppendInternal(value, indx, count); } else { Append(value[0]); } return this; } public MutableString Append(char[] value) { if (value == null) { return this; } int num = value.Length; if (num > 1) { AppendInternal(value, 0, num); } else { Append(value[0]); } return this; } public MutableString Append(char value) { if (m_Pos >= m_valueStr.Length) { if (dontThrow) { return this; } throw new ArgumentException("Not enough free space to accomodate element!"); } singleChar(value); m_Pos++; return this; } private void AppendInternal(char[] value, int indx, int count) { int num = m_valueStr.Length - m_Pos; if (count > num) { if (!dontThrow) { throw new ArgumentException($"Not enough free space to accomodate {count} elements!"); } } else { charCopy(value, indx, count); m_Pos += count; } } private void AppendInternal(string value, int indx, int count) { int num = m_valueStr.Length - m_Pos; if (count > num) { if (!dontThrow) { throw new ArgumentOutOfRangeException($"Not enough free space to accomodate {count} elements!"); } } else { stringCopy(value, indx, count); m_Pos += count; } } public MutableString Append(string value, int indx, int count) { if (value == null) { return this; } int length = value.Length; if (count < 1 || indx < 0 || length < count + indx) { return this; } if (length > 1) { AppendInternal(value, indx, count); } else { Append(value[0]); } return this; } public MutableString Append(string? value) { if (value == null || value.Length == 0) { return this; } int length = value.Length; if (length > 1) { AppendInternal(value, 0, length); } else { Append(value[0]); } return this; } private unsafe void AppendUINT32(uint uint_val, uint pad_base, char pad_char, bool negative) { int num = CountDigits(uint_val); int num2 = (int)((pad_base > num) ? (pad_base - num) : 0); int num3 = Convert.ToInt32(negative) + num2 + num; int num4 = m_Pos + num3; if (num4 > m_valueStr.Length) { if (!dontThrow) { throw new ArgumentOutOfRangeException($"Not enough free space to accomodate {num3} elements!"); } return; } fixed (char* ptr = m_valueStr) { char* ptr2 = ptr + num4; do { uint num5 = uint_val / 10; *(--ptr2) = (char)(48 + uint_val - num5 * 10); uint_val = num5; } while (uint_val != 0); while (num2 > 0) { *(--ptr2) = pad_char; num2--; } if (negative) { *(--ptr2) = '-'; } } m_Pos = num4; } public MutableString Append(uint uint_val) { AppendUINT32(uint_val, 0u, m_defaultPadChar, negative: false); return this; } public MutableString Append(uint uint_val, uint pad_amount) { AppendUINT32(uint_val, pad_amount, m_defaultPadChar, negative: false); return this; } public MutableString Append(uint uint_val, uint pad_amount, char pad_char) { AppendUINT32(uint_val, pad_amount, pad_char, negative: false); return this; } public MutableString Append(int int_val) { Append(int_val, 0u, m_defaultPadChar); return this; } public MutableString Append(int int_val, uint pad_amount) { Append(int_val, pad_amount, m_defaultPadChar); return this; } public MutableString Append(int int_val, uint pad_base, char pad_char) { bool isNegative; uint positiveEqv = GetPositiveEqv(int_val, out isNegative); AppendUINT32(positiveEqv, pad_base, pad_char, isNegative); return this; } private unsafe void AppendULONG(ulong ulong_val, uint pad_base, char pad_char, bool negative) { int num = CountDigits(ulong_val); int num2 = (int)((pad_base > num) ? (pad_base - num) : 0); int num3 = Convert.ToInt32(negative) + num + num2; int num4 = m_Pos + num3; if (num4 > m_valueStr.Length) { if (!dontThrow) { throw new ArgumentOutOfRangeException($"Not enough free space to accomodate {num3} elements!"); } return; } fixed (char* ptr = m_valueStr) { char* ptr2 = ptr + num4; do { ulong num5 = ulong_val / 10; *(--ptr2) = (char)(48 + ulong_val - num5 * 10); ulong_val = num5; } while (ulong_val != 0L); while (num2 > 0) { *(--ptr2) = pad_char; num2--; } if (negative) { *(--ptr2) = '-'; } } m_Pos = num4; } public MutableString Append(ulong ulong_val) { AppendULONG(ulong_val, 0u, m_defaultPadChar, negative: false); return this; } public MutableString Append(ulong ulong_val, uint pad_amount) { AppendULONG(ulong_val, pad_amount, m_defaultPadChar, negative: false); return this; } public MutableString Append(ulong ulong_val, uint pad_amount, char pad_char) { AppendULONG(ulong_val, pad_amount, pad_char, negative: false); return this; } public MutableString Append(long long_val) { Append(long_val, 0u, m_defaultPadChar); return this; } public MutableString Append(long long_val, uint pad_base) { Append(long_val, pad_base, m_defaultPadChar); return this; } public MutableString Append(long long_val, uint pad_base, char pad_char) { bool flag = long_val < 0; ulong ulong_val = (ulong)(flag ? (-1 - long_val + 1) : long_val); AppendULONG(ulong_val, pad_base, pad_char, flag); return this; } public unsafe MutableString Append(float float_val, uint decimal_places, uint pad_base, char pad_char) { decimal_places = ((decimal_places > MAX_DECIMALS) ? MAX_DECIMALS : decimal_places); bool flag = float_val < 0f; float num = 5f / (float)Math.Pow(10.0, 1 + decimal_places); float num2 = (flag ? (float_val + (0f - num)) : (float_val + num)); if (float_val == 0f || Approximately(float_val, 0f)) { int num3 = (int)(Convert.ToInt32(decimal_places != 0) * (decimal_places + 1)); AppendInternal(zeroFloat, 0, 1 + num3); return this; } if (!IsFinite(float_val)) { if (float_val != float_val) { AppendInternal("NaN", 0, 3); } else { AppendInternal(flag ? "-∞" : "+∞", 0, 2); } return this; } bool isNegative; uint positiveEqv = GetPositiveEqv((int)num2, out isNegative); if (decimal_places == 0) { AppendUINT32(positiveEqv, pad_base, pad_char, flag); return this; } int num4 = CountDigits(positiveEqv); int num5 = num4 + 1 + (int)decimal_places; int num6 = (int)((pad_base > num4) ? (pad_base - num4) : 0); int num7 = Convert.ToInt32(flag) + num6 + num5; int num8 = m_Pos + num7; if (num8 > m_valueStr.Length) { if (dontThrow) { return this; } throw new ArgumentOutOfRangeException($"Not enough free space to accomodate {num7} elements!"); } fixed (char* ptr = m_valueStr) { char* ptr2 = ptr + num8; uint num9 = (uint)(Math.Abs(num2) * (float)Math.Pow(10.0, decimal_places)); do { uint num10 = num9 / 10; *(--ptr2) = (char)(48 + num9 - num10 * 10); num9 = num10; decimal_places--; } while (decimal_places != 0); *(--ptr2) = '.'; do { uint num11 = num9 / 10; *(--ptr2) = (char)(48 + num9 - num11 * 10); num9 = num11; num4--; } while (num4 != 0); while (num6 > 0) { *(--ptr2) = pad_char; num6--; } if (flag) { *(--ptr2) = '-'; } } m_Pos = num8; return this; } public MutableString Append(float float_val) { return Append(float_val, MAX_DECIMALS, 0u, m_defaultPadChar); } public MutableString Append(float float_val, uint decimal_places) { return Append(float_val, decimal_places, 0u, m_defaultPadChar); } public MutableString Append(float float_val, uint decimal_places, uint pad_amount) { return Append(float_val, decimal_places, pad_amount, m_defaultPadChar); } public static bool Approximately(float a, float b) { return Math.Abs(b - a) < Math.Max(1E-06f * Math.Max(Math.Abs(a), Math.Abs(b)), 1.1E-44f); } private static uint GetPositiveEqv(int val, out bool isNegative) { isNegative = val < 0; if (!isNegative) { return (uint)val; } return (uint)(-1 - val + 1); } private static int CountDigits(ulong value) { int num = 1; uint num2; if (value >= 10000000) { if (value >= 100000000000000L) { num2 = (uint)(value / 100000000000000L); num += 14; } else { num2 = (uint)(value / 10000000); num += 7; } } else { num2 = (uint)value; } if (num2 >= 10) { num = ((num2 < 100) ? (num + 1) : ((num2 < 1000) ? (num + 2) : ((num2 < 10000) ? (num + 3) : ((num2 < 100000) ? (num + 4) : ((num2 >= 1000000) ? (num + 6) : (num + 5)))))); } return num; } private static int CountDigits(uint value) { int num = 1; if (value >= 100000) { value /= 100000; num += 5; } if (value >= 10) { num = ((value < 100) ? (num + 1) : ((value < 1000) ? (num + 2) : ((value >= 10000) ? (num + 4) : (num + 3)))); } return num; } private static int CountDecimalTrailingZeros(uint value, out uint valueWithoutTrailingZeros) { int num = 0; if (value != 0) { while (true) { uint num2 = value / 10; if (value != num2 * 10) { break; } value = num2; num++; } } valueWithoutTrailingZeros = value; return num; } private static uint Low32(ulong value) { return (uint)value; } private static uint High32(ulong value) { return (uint)((value & 0xFFFFFFFF00000000uL) >> 32); } private unsafe static int SingleToInt32Bits(float value) { return *(int*)(&value); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static bool IsFinite(float f) { return (SingleToInt32Bits(f) & 0x7FFFFFFF) < 2139095040; } private unsafe void stringCopy(string value, int indx, int charCount) { fixed (char* ptr = m_valueStr) { fixed (char* ptr2 = value) { wstrCpy(ptr + m_Pos, ptr2 + indx, charCount); } } } private unsafe void charCopy(char[] value, int indx, int charCount) { fixed (char* ptr = m_valueStr) { fixed (char* ptr2 = value) { wstrCpy(ptr + m_Pos, ptr2 + indx, charCount); } } } private unsafe void singleChar(char value) { fixed (char* ptr = m_valueStr) { ptr[m_Pos] = value; } } private unsafe void repeatChar(char value, int count) { int num = m_Pos + count; fixed (char* ptr = m_valueStr) { for (int i = m_Pos; i < num; i++) { ptr[i] = value; } } m_Pos = num; } private unsafe void rawCopy(char* dest, char* src, int charCount) { for (int i = 0; i < charCount; i++) { dest[i] = src[i]; } } private unsafe static void wstrCpy(char* dmem, char* smem, int charCount) { if (((uint)(int)dmem & 2u) != 0) { *dmem = *smem; dmem++; smem++; charCount--; } while (charCount >= 8) { *(int*)dmem = *(int*)smem; *(int*)(dmem + 2) = *(int*)(smem + 2); *(int*)(dmem + 4) = *(int*)(smem + 4); *(int*)(dmem + 6) = *(int*)(smem + 6); dmem += 8; smem += 8; charCount -= 8; } if (((uint)charCount & 4u) != 0) { *(int*)dmem = *(int*)smem; *(int*)(dmem + 2) = *(int*)(smem + 2); dmem += 4; smem += 4; } if (((uint)charCount & 2u) != 0) { *(int*)dmem = *(int*)smem; dmem += 2; smem += 2; } if (((uint)charCount & (true ? 1u : 0u)) != 0) { *dmem = *smem; } } } } namespace InUCS.Addons.Collider2DViewer { public class CachedPolyShapeCollider : CachedColliderBase { protected List<PolyShape> worldShapes = new List<PolyShape>(); protected static List<Vector2> localVec2Cache = new List<Vector2>(); public override bool IsEmpty { get { if (worldShapes != null) { return worldShapes.Count == 0; } return true; } } public CachedPolyShapeCollider(Collider2D collider, Color color) : base(collider, color) { }//IL_000d: Unknown result type (might be due to invalid IL or missing references) public override void RecalculateGeometry() { } public override void GL_Draw_Filled(Camera cam) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) //IL_00ce: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) //IL_0071: 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) base.GL_Draw_Filled(cam); for (int i = 0; i < worldShapes.Count; i++) { PolyShape polyShape = worldShapes[i]; List<Vector3> list = polyShape.worldPoints; if (polyShape.isConcave) { List<int>? concaveTris = polyShape.concaveTris; if (concaveTris != null && concaveTris.Count > 0) { for (int j = 0; j < polyShape.concaveTris.Count; j++) { Vector3 val = cam.WorldToScreenPoint(list[polyShape.concaveTris[j]]).UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac); GL.Vertex3(val.x, val.y, 0f); } } else { Draw_Mitered_Impl(cam, polyShape.worldPoints); } continue; } Vector3 val2 = cam.WorldToScreenPoint(list[0]).UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac); for (int k = 1; k + 1 < list.Count; k++) { Vector3 val3 = cam.WorldToScreenPoint(list[k]).UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac); Vector3 val4 = cam.WorldToScreenPoint(list[k + 1]).UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac); GL.Vertex3(val3.x, val3.y, 0f); GL.Vertex3(val4.x, val4.y, 0f); GL.Vertex3(val2.x, val2.y, 0f); } } } public override void GL_Draw_Lined(Camera cam) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_004c: Unknown result type (might be due to invalid IL or missing references) base.GL_Draw_Lined(cam); for (int i = 0; i < worldShapes.Count; i++) { List<Vector3> list = worldShapes[i].worldPoints; CachedColliderBase.globalVec2Cache.Clear(); for (int j = 0; j < list.Count; j++) { CachedColliderBase.globalVec2Cache.Add(Vector2.op_Implicit(cam.WorldToScreenPoint(list[j]).UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac))); } CachedColliderBase.Draw_Lines_Closed(CachedColliderBase.globalVec2Cache); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void Draw_Mitered_Impl(Camera cam, List<Vector3> worldPoints) { //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_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) CachedColliderBase.globalVec2Cache.Clear(); for (int i = 0; i < worldPoints.Count; i++) { CachedColliderBase.globalVec2Cache.Add(Vector2.op_Implicit(cam.WorldToScreenPoint(worldPoints[i]).UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac))); } CachedColliderBase.Draw_ClosedPolygon_Mitered(cam, CachedColliderBase.globalVec2Cache); } [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void Draw_Mitered_Impl2(Camera cam, List<Vector3> worldPoints) { CachedColliderBase.Draw_ClosedPolygon_Mitered2(cam, worldPoints); } } } namespace Collider2DViewer { public static class GLMODE { public const int LINES = 1; public const int LINE_STRIP = 2; public const int TRIANGLES = 4; public const int TRIANGLE_STRIP = 5; public const int QUADS = 7; } public enum DrawMode : byte { Filled, Mitered, Lined } public readonly struct PolyShape { public readonly bool isConcave; public readonly List<Vector3> worldPoints; public readonly List<int>? concaveTris; public PolyShape(bool isConcave, List<Vector3> worldPoints, List<int>? concaveTris) { this.isConcave = isConcave; this.worldPoints = worldPoints; this.concaveTris = concaveTris; } } public abstract class CachedColliderBase { protected static float miterWidth = 2f; protected static float hScreenFac = 1f; protected static float wScreenFac = 1f; protected static int invertY = 0; protected static int lastGLMode = 4; protected static Matrix4x4 matrix; protected static List<Vector2> globalVec2Cache = new List<Vector2>(10); protected static List<Vector3> globalVec3Cache = new List<Vector3>(10); protected Vector3 cPosition; protected Quaternion cRotation; protected Vector3 cScale; protected Bounds cBounds; protected List<Vector3> worldPoints = new List<Vector3>(); protected readonly Color ownColor = new Color(1f, 1f, 1f, 0.65f); public Transform? cTransform { get; private set; } public Collider2D? cCollider { get; private set; } public bool IsValid { get { if ((Object)(object)cTransform != (Object)null) { return (Object)(object)cCollider != (Object)null; } return false; } } public bool IsActive { get { if (((Component)cTransform).gameObject.activeSelf && ((Component)cTransform).gameObject.activeInHierarchy) { return ((Behaviour)cCollider).enabled; } return false; } } public bool IsActiveNoHierarchy { get { if (((Component)cTransform).gameObject.activeSelf) { return ((Behaviour)cCollider).enabled; } return false; } } public virtual bool IsEmpty { get { if (worldPoints != null) { return worldPoints.Count == 0; } return true; } } public static float MiterWidth { get { return miterWidth; } set { miterWidth = ((value == 0f) ? ((float)((!(miterWidth > 0f)) ? 1 : (-1))) : value); } } public static bool InvertY { get { return Convert.ToBoolean(invertY); } set { invertY = Convert.ToInt32(value); } } public static Matrix4x4 Matrix { get { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return matrix; } set { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) matrix = value; } } protected CachedColliderBase(Collider2D collider, Color color) { //IL_0020: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) //IL_006c: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) cTransform = ((Component)collider).transform; cCollider = collider; cBounds = collider.bounds; cPosition = cTransform.position; cRotation = cTransform.rotation; cScale = cTransform.lossyScale; ownColor = color; } public bool CacheIsDirty() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0049: 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) if (!(cTransform.position != cPosition) && !(cTransform.rotation != cRotation) && !(cScale != cTransform.lossyScale)) { return cBounds != cCollider.bounds; } return true; } public abstract void RecalculateGeometry(); public virtual void GL_Draw_Filled(Camera cam) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) GL.Color(ownColor); } public virtual void GL_Draw_Mitered(Camera cam) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) GL.Color(new Color(ownColor.r, ownColor.g, ownColor.b, 1f)); } public virtual void GL_Draw_Lined(Camera cam) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) GL.Color(new Color(ownColor.r, ownColor.g, ownColor.b, 1f)); } public virtual void Cleanup() { cTransform = null; cCollider = null; worldPoints.Clear(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void UpscaleForGLScreen(ref Vector3 orig) { orig.x *= wScreenFac; orig.y *= hScreenFac; } public static void UpdateScreenFactor(float w, float h) { wScreenFac = w; hScreenFac = h; } public static void UpdateGlobalMiterWidth(float width) { miterWidth = width; } public static void GL_Begin(int mode) { GL.Begin(mode); lastGLMode = mode; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void AppendByType(List<CachedColliderBase> output, Collider2D c2d, Color color) { //IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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) BoxCollider2D val = (BoxCollider2D)(object)((c2d is BoxCollider2D) ? c2d : null); if (val == null) { PolygonCollider2D val2 = (PolygonCollider2D)(object)((c2d is PolygonCollider2D) ? c2d : null); if (val2 == null) { CircleCollider2D val3 = (CircleCollider2D)(object)((c2d is CircleCollider2D) ? c2d : null); if (val3 == null) { CapsuleCollider2D val4 = (CapsuleCollider2D)(object)((c2d is CapsuleCollider2D) ? c2d : null); if (val4 == null) { EdgeCollider2D val5 = (EdgeCollider2D)(object)((c2d is EdgeCollider2D) ? c2d : null); if (val5 == null) { CompositeCollider2D val6 = (CompositeCollider2D)(object)((c2d is CompositeCollider2D) ? c2d : null); if (val6 != null) { output.Add(new CachedComposite2D(val6, color)); } } else { output.Add(new CachedEdge2D(val5, color)); } } else { output.Add(new CachedCapsule2D(val4, color)); } } else { output.Add(new CachedCircle2D(val3, color)); } } else { output.Add(new CachedPolygon2D(val2, color)); } } else { output.Add(new CachedBox2D(val, color)); } } public static void Draw(DrawMode mode, Material mat, Camera cam, List<CachedColliderBase> closedColliders, bool hierarchyCheck) { ScreenHelper.UpdateScreenFactor(); switch (mode) { case DrawMode.Filled: DrawColliders_Filled(mat, cam, closedColliders, hierarchyCheck); break; case DrawMode.Mitered: DrawColliders_Mitered(mat, cam, closedColliders, hierarchyCheck); break; case DrawMode.Lined: DrawColliders_Lined(mat, cam, closedColliders, hierarchyCheck); break; } } public static void DrawColliders_Filled(Material mat, Camera cam, List<CachedColliderBase> closedColliders, bool hierarchyCheck) { GL.PushMatrix(); mat.SetPass(0); GL.LoadPixelMatrix(); GL_Begin(4); for (int num = closedColliders.Count - 1; num >= 0; num--) { CachedColliderBase cachedColliderBase = closedColliders[num]; if (cachedColliderBase == null || !cachedColliderBase.IsValid) { closedColliders.RemoveAt(num); } else if ((hierarchyCheck ? cachedColliderBase.IsActiveNoHierarchy : cachedColliderBase.IsActive) && !cachedColliderBase.IsEmpty) { if (cachedColliderBase.CacheIsDirty()) { cachedColliderBase.RecalculateGeometry(); } cachedColliderBase.GL_Draw_Filled(cam); } } GL.End(); GL.PopMatrix(); } public static void DrawColliders_Mitered(Material mat, Camera cam, List<CachedColliderBase> closedColliders, bool hierarchyCheck) { GL.PushMatrix(); mat.SetPass(0); GL.LoadPixelMatrix(); GL_Begin(4); for (int num = closedColliders.Count - 1; num >= 0; num--) { CachedColliderBase cachedColliderBase = closedColliders[num]; if (cachedColliderBase == null || !cachedColliderBase.IsValid) { closedColliders.RemoveAt(num); } else if ((hierarchyCheck ? cachedColliderBase.IsActiveNoHierarchy : cachedColliderBase.IsActive) && !cachedColliderBase.IsEmpty) { if (cachedColliderBase.CacheIsDirty()) { cachedColliderBase.RecalculateGeometry(); } cachedColliderBase.GL_Draw_Mitered(cam); } } GL.End(); GL.PopMatrix(); } public static void DrawColliders_Lined(Material mat, Camera cam, List<CachedColliderBase> closedColliders, bool hierarchyCheck) { GL.PushMatrix(); mat.SetPass(0); GL.LoadPixelMatrix(); GL_Begin(1); for (int num = closedColliders.Count - 1; num >= 0; num--) { CachedColliderBase cachedColliderBase = closedColliders[num]; if (cachedColliderBase == null || !cachedColliderBase.IsValid) { closedColliders.RemoveAt(num); } else if ((hierarchyCheck ? cachedColliderBase.IsActiveNoHierarchy : cachedColliderBase.IsActive) && !cachedColliderBase.IsEmpty) { if (cachedColliderBase.CacheIsDirty()) { cachedColliderBase.RecalculateGeometry(); } cachedColliderBase.GL_Draw_Lined(cam); } } GL.End(); GL.PopMatrix(); } public static void Draw_ClosedPolygon_Mitered(Camera cam, IReadOnlyList<Vector2> points) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0082: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00ad: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00d5: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_0101: 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_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) //IL_0110: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_01a6: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_021c: 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) if (points.Count >= 3) { float num = miterWidth; Vector2 val6 = default(Vector2); Vector2 val7 = default(Vector2); for (int i = 0; i < points.Count; i++) { Vector2 val = points[i]; Vector2 val2 = points[((i + 1) % points.Count + points.Count) % points.Count]; Vector2 val3 = points[((i + 2) % points.Count + points.Count) % points.Count]; Vector2 val4 = points[((i + 3) % points.Count + points.Count) % points.Count]; Vector2 val5 = val - val2; Vector2 normalized = ((Vector2)(ref val5)).normalized; val5 = val2 - val3; val5 = normalized + ((Vector2)(ref val5)).normalized; Vector2 normalized2 = ((Vector2)(ref val5)).normalized; ((Vector2)(ref val6))..ctor(normalized2.y, 0f - normalized2.x); val5 = new Vector2(0f - (val2.y - val3.y), val2.x - val3.x); Vector2 normalized3 = ((Vector2)(ref val5)).normalized; float num2 = num / Vector2.Dot(val6, normalized3) * -1f; val5 = val2 - val3; Vector2 normalized4 = ((Vector2)(ref val5)).normalized; val5 = val3 - val4; val5 = normalized4 + ((Vector2)(ref val5)).normalized; Vector2 normalized5 = ((Vector2)(ref val5)).normalized; ((Vector2)(ref val7))..ctor(normalized5.y, 0f - normalized5.x); val5 = new Vector2(0f - (val3.y - val4.y), val3.x - val4.x); Vector2 normalized6 = ((Vector2)(ref val5)).normalized; float num3 = num / Vector2.Dot(val7, normalized6) * -1f; Vector2 val8 = val3 + val7 * num3; Vector2 val9 = val2 + val6 * num2; GL.Vertex3(val2.x, val2.y, 0f); GL.Vertex3(val3.x, val3.y, 0f); GL.Vertex3(val8.x, val8.y, 0f); GL.Vertex3(val8.x, val8.y, 0f); GL.Vertex3(val9.x, val9.y, 0f); GL.Vertex3(val2.x, val2.y, 0f); } } } public static void Draw_ClosedPolygon_Mitered2(Camera cam, IReadOnlyList<Vector3> points) { //IL_0019: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //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_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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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) //IL_019b: 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_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //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_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021d: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025b: 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_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) if (points.Count >= 3) { float num = miterWidth; Vector2 val6 = default(Vector2); Vector2 val7 = default(Vector2); for (int i = 0; i < points.Count; i++) { Vector2 val = Vector2.op_Implicit(points[i]); Vector2 val2 = Vector2.op_Implicit(points[((i + 1) % points.Count + points.Count) % points.Count]); Vector2 val3 = Vector2.op_Implicit(points[((i + 2) % points.Count + points.Count) % points.Count]); Vector2 val4 = Vector2.op_Implicit(points[((i + 3) % points.Count + points.Count) % points.Count]); Vector2 val5 = val - val2; Vector2 normalized = ((Vector2)(ref val5)).normalized; val5 = val2 - val3; val5 = normalized + ((Vector2)(ref val5)).normalized; Vector2 normalized2 = ((Vector2)(ref val5)).normalized; ((Vector2)(ref val6))..ctor(normalized2.y, 0f - normalized2.x); val5 = new Vector2(0f - (val2.y - val3.y), val2.x - val3.x); Vector2 normalized3 = ((Vector2)(ref val5)).normalized; float num2 = num / Vector2.Dot(val6, normalized3) * -1f; val5 = val2 - val3; Vector2 normalized4 = ((Vector2)(ref val5)).normalized; val5 = val3 - val4; val5 = normalized4 + ((Vector2)(ref val5)).normalized; Vector2 normalized5 = ((Vector2)(ref val5)).normalized; ((Vector2)(ref val7))..ctor(normalized5.y, 0f - normalized5.x); val5 = new Vector2(0f - (val3.y - val4.y), val3.x - val4.x); Vector2 normalized6 = ((Vector2)(ref val5)).normalized; float num3 = num / Vector2.Dot(val7, normalized6) * -1f; Vector3 val8 = cam.WorldToScreenPoint(Vector2.op_Implicit(new Vector2(val2.x, val2.y))).UpscaleForGLScreen(wScreenFac, hScreenFac); Vector3 val9 = cam.WorldToScreenPoint(Vector2.op_Implicit(new Vector2(val3.x, val3.y))).UpscaleForGLScreen(wScreenFac, hScreenFac); Vector3 val10 = cam.WorldToScreenPoint(Vector2.op_Implicit(new Vector2((val3 + val7 * num3).x, (val3 + val7 * num3).y))).UpscaleForGLScreen(wScreenFac, hScreenFac); Vector3 val11 = val10; Vector3 val12 = cam.WorldToScreenPoint(Vector2.op_Implicit(new Vector2((val2 + val6 * num2).x, (val2 + val6 * num2).y))).UpscaleForGLScreen(wScreenFac, hScreenFac); Vector3 val13 = val8; GL.Vertex3(val8.x, val8.y, 0f); GL.Vertex3(val9.x, val9.y, 0f); GL.Vertex3(val10.x, val10.y, 0f); GL.Vertex3(val11.x, val11.y, 0f); GL.Vertex3(val12.x, val12.y, 0f); GL.Vertex3(val13.x, val13.y, 0f); } } } private static void Draw_OpenPolygon_Mitered(List<Vector2> points) { throw new NotImplementedException("Drawing open polygons not implemented"); } public static void Draw_Lines_Open(List<Vector2> points) { //IL_000d: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) int count = points.Count; for (int i = 0; i < count; i++) { Vector2 val = points[i]; GL.Vertex3(val.x, val.y, 0f); } } public static void Draw_Lines_Closed(List<Vector2> points) { //IL_000d: 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_0019: 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_001f: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) int count = points.Count; for (int i = 0; i < count; i++) { Vector2 val = points[i]; Vector2 val2 = points[(i + 1) % count]; GL.Vertex3(val.x, val.y, 0f); GL.Vertex3(val2.x, val2.y, 0f); } } } public sealed class CachedBox2D : CachedColliderBase { public new BoxCollider2D cCollider { get; private set; } public CachedBox2D(BoxCollider2D collider, Color color) : base((Collider2D)(object)collider, color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) cCollider = collider; RecalculateGeometry(); } public override void RecalculateGeometry() { CalculateBoxWorldPoints(worldPoints, cCollider); } private static void CalculateBoxWorldPoints(List<Vector3> source, BoxCollider2D box2D) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //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_004c: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_007d: 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) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) source.Clear(); if ((Object)(object)box2D != (Object)null) { Vector2 val = box2D.size * 0.5f; Bounds bounds = ((Collider2D)box2D).bounds; Matrix4x4 val2 = Matrix4x4.TRS(((Bounds)(ref bounds)).center, ((Component)box2D).transform.rotation, ((Component)box2D).transform.lossyScale); source.Add(((Matrix4x4)(ref val2)).MultiplyPoint3x4(new Vector3(0f - val.x, 0f - val.y))); source.Add(((Matrix4x4)(ref val2)).MultiplyPoint3x4(new Vector3(val.x, 0f - val.y))); source.Add(((Matrix4x4)(ref val2)).MultiplyPoint3x4(new Vector3(val.x, val.y))); source.Add(((Matrix4x4)(ref val2)).MultiplyPoint3x4(new Vector3(0f - val.x, val.y))); } } public sealed override void GL_Draw_Filled(Camera cam) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_006e: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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) base.GL_Draw_Filled(cam); Vector3 val = cam.WorldToScreenPoint(worldPoints[0]).UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac); Vector3 val2 = cam.WorldToScreenPoint(worldPoints[1]).UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac); Vector3 val3 = cam.WorldToScreenPoint(worldPoints[2]).UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac); Vector3 val4 = val3; Vector3 val5 = cam.WorldToScreenPoint(worldPoints[3]).UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac); Vector3 val6 = val; GL.Vertex3(val.x, val.y, 0f); GL.Vertex3(val2.x, val2.y, 0f); GL.Vertex3(val3.x, val3.y, 0f); GL.Vertex3(val4.x, val4.y, 0f); GL.Vertex3(val5.x, val5.y, 0f); GL.Vertex3(val6.x, val6.y, 0f); } public sealed override void GL_Draw_Mitered(Camera cam) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) base.GL_Draw_Mitered(cam); CachedColliderBase.globalVec2Cache.Clear(); for (int i = 0; i < worldPoints.Count; i++) { CachedColliderBase.globalVec2Cache.Add(Vector2.op_Implicit(cam.WorldToScreenPoint(worldPoints[i].UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac)))); } CachedColliderBase.Draw_ClosedPolygon_Mitered(cam, CachedColliderBase.globalVec2Cache); } public sealed override void GL_Draw_Lined(Camera cam) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) base.GL_Draw_Lined(cam); CachedColliderBase.globalVec2Cache.Clear(); for (int i = 0; i < worldPoints.Count; i++) { CachedColliderBase.globalVec2Cache.Add(Vector2.op_Implicit(cam.WorldToScreenPoint(worldPoints[i].UpscaleForGLScreen(CachedColliderBase.wScreenFac, CachedColliderBase.hScreenFac)))); } CachedColliderBase.Draw_Lines_Closed(CachedColliderBase.globalVec2Cache); } } public sealed class CachedCapsule2D : CachedColliderBase { private int resolution; private float hRadius; private float hHeight; private Vector3 center; public new CapsuleCollider2D cCollider { get; private set; } public CachedCapsule2D(CapsuleCollider2D collider, Color color, int resolution = 80) : base((Collider2D)(object)collider, color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) cCollider = collider; this.resolution = resolution; RecalculateGeometry(); } public override void RecalculateGeometry() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (mi
SSDebug.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Collider2DViewer; using GlobalEnums; using HarmonyLib; using InUCS; using InUCS.API; using InUCS.Addons; using InUCS.Components; using InUCS.Extensions; using InUCS.Logging; using InUCS.Manager; using Microsoft.CodeAnalysis; using SSDebug.Components; using SSDebug.Game; using SSDebug.Model; using TeamCherry.SharedUtils; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceProviders; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SSDebug")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SSDebug")] [assembly: AssemblyTitle("SSDebug")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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 SSDebug { public delegate void ActiveSceneChanged(Scene from, Scene to); public delegate void OnTakeDamage(HealthManager hm, HitInstance hit); public delegate void OnFinishedEnteringScene(); public delegate void OnHealthManagerEnable(HealthManager hm); public delegate void OnHeroFinishedEnteringScene(); public delegate void OnDamageStackPop(DamageStack ds); public delegate bool Context(); public sealed class SSDebugManager : ComponentManager { [CompilerGenerated] private sealed class <CoRoutineAdvanceFrame>d__54 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SSDebugManager <>4__this; object? IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CoRoutineAdvanceFrame>d__54(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; SSDebugManager sSDebugManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; sSDebugManager.SharedCache.advanceFrameBusy = true; Time.timeScale = 1f; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; Time.timeScale = 0f; sSDebugManager.SharedCache.advanceFrameBusy = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Context IsContextValid; public static SSDebugManager? instance { get; private set; } public GlobalConfig SharedConfig { get; private set; } public SharedCache SharedCache { get; private set; } public InputConfig InputConfig { get; private set; } public ConfigFile? BepinConf => SSDebugPlugin.PersistentConfig; public bool ShowGUI { get; private set; } = true; public Context ContextValid { get { return IsContextValid; } set { IsContextValid = value ?? new Context(MainContextValid); } } public event ActiveSceneChanged? ActiveSceneChanged; public event OnTakeDamage? OnHealthManagerTakeDamage; public event OnFinishedEnteringScene? OnFinishedEnteringScene; public event OnHealthManagerEnable? OnHealthManagerEnable; public event OnHeroFinishedEnteringScene? OnHeroFinishedEnteringScene; public event OnDamageStackPop? OnDamageStackPop; private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) EnsureSingleton(); Constructor(); ((ComponentManager)this).SpawnComponents(); ((ComponentManager)this).Awake(); Cursor.SetCursor((Texture2D)null, Vector2.zero, (CursorMode)0); } private void Update() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(InputConfig.F1.Value)) { if (LegacyInputHelper.NoAnyModifiers) { ShowGUI = !ShowGUI; } else if (Input.GetKey(InputConfig.LCtrl.Value)) { ToggleCursor(!SharedConfig.ShowCursor); } } if (MainContextValid()) { ((ComponentManager)this).Update(); } } private void OnGUI() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) if (ShowGUI && MainContextValid()) { SharedCache.origMatrix = GUI.matrix; GUI.matrix = SharedCache.scaledMatrix; ((ComponentManager)this).OnGUI(); GUI.matrix = SharedCache.origMatrix; } } private void OnEnable() { ((ComponentManager)this).Logger.Info((object)"Manager enabled"); SceneManager.activeSceneChanged += OnActiveSceneChanged; ((ComponentManager)this).OnEnable(); } private void OnDisable() { ((ComponentManager)this).Logger.Info((object)"Manager disabled"); SceneManager.activeSceneChanged -= OnActiveSceneChanged; ((ComponentManager)this).OnDisable(); } private void OnDestroy() { ((ComponentManager)this).Logger.Info((object)"Manager destroyed"); ((ComponentManager)this).OnDestroy(); instance = null; } protected sealed override void SpawnComponents() { ((ComponentManager)this).AddComponent((LocalComponent)(object)new HPViewer(this, startEnabled: true)); ((ComponentManager)this).AddComponent((LocalComponent)(object)new SaveStates(this, startEnabled: true, 1)); ((ComponentManager)this).AddComponent((LocalComponent)(object)new FreeCam(this, startEnabled: true, 1)); ((ComponentManager)this).AddComponent((LocalComponent)(object)new ColliderView(this, startEnabled: true, 2)); ((ComponentManager)this).AddComponent((LocalComponent)(object)new DebugInfo(this, startEnabled: true, 3)); ((ComponentManager)this).AddComponent((LocalComponent)(object)new SceneSelector(this, startEnabled: true, 3)); ((ComponentManager)this).AddComponent((LocalComponent)(object)new SpeedrunTools(this, startEnabled: true, 4)); ((ComponentManager)this).AddComponent((LocalComponent)(object)new FlagEditor(this, startEnabled: true, 5)); ((ComponentManager)this).SpawnComponents(); } private void EnsureSingleton() { if ((Object)(object)instance == (Object)null) { instance = this; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)this); } if ((Object)(object)instance != (Object)(object)this) { ((ComponentManager)this).Logger.Error((object)("[" + ((object)this).GetType().Name + "] Duplicate singleton detected!")); Object.DestroyImmediate((Object)(object)this); } } private void Constructor() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) SharedConfig = new GlobalConfig(); SharedCache = new SharedCache(); ((ComponentManager)this).Logger = (ILogRouter)new BepinExLogger("SSDebugPlugin"); ContextValid = MainContextValid; ScreenHelper.CalculateMatrixInLine(ref SharedCache.scaledMatrix, (float)Screen.width, (float)Screen.height); if (BepinConf == null) { ((ComponentManager)this).Logger.Error((object)"CRITICAL FAILURE - BEPINEX CONFIG FILE UNAVAILABLE"); } else { InputConfig = new InputConfig(BepinConf); } } public void ToggleCursor(bool enable) { SharedConfig.ShowCursor = enable; UnityAPI.ToggleCursor(enable); } [IteratorStateMachine(typeof(<CoRoutineAdvanceFrame>d__54))] internal IEnumerator CoRoutineAdvanceFrame() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CoRoutineAdvanceFrame>d__54(0) { <>4__this = this }; } private void OnActiveSceneChanged(Scene from, Scene to) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) ((ComponentManager)this).Logger.Message((object)("Scene change: " + ((Scene)(ref from)).name + " -> " + ((Scene)(ref to)).name)); SharedCache.activeScene = ((Scene)(ref to)).name ?? ""; if (this.ActiveSceneChanged != null) { this.ActiveSceneChanged(from, to); } } internal void HealthManagerTakeDamage(HealthManager hm, HitInstance hit) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (this.OnHealthManagerTakeDamage != null) { this.OnHealthManagerTakeDamage(hm, hit); } } internal void FinishedEnteringScene() { if (this.OnFinishedEnteringScene != null) { this.OnFinishedEnteringScene(); } } internal void HeroFinishedEnteringScene() { if (this.OnHeroFinishedEnteringScene != null) { this.OnHeroFinishedEnteringScene(); } } internal void HealthManagerEnable(HealthManager hm) { if (this.OnHealthManagerEnable != null) { this.OnHealthManagerEnable(hm); } } internal void DamageStackPop(DamageStack ds) { if (this.OnDamageStackPop != null) { this.OnDamageStackPop(ds); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool MainContextValid() { if (Application.isPlaying && SharedCache.activeScene != string.Empty && SharedCache.activeScene != "Pre_Menu_Loader" && SharedCache.activeScene != "Pre_Menu_Intro" && SharedCache.activeScene != "Menu_Title" && SharedCache.activeScene != "Quit_To_Menu" && (Object)(object)GameAPI.GameManager != (Object)null) { return (Object)(object)GameAPI.HeroCtrl != (Object)null; } return false; } } internal static class PluginMeta { public const string NAME = "SSDebugPlugin"; public const string VERSION = "0.1.66"; public const string GUID = "com.bepin.SSDebugkz"; } [BepInPlugin("com.bepin.SSDebugkz", "SSDebugPlugin", "0.1.66")] public class SSDebugPlugin : BaseUnityPlugin { private static GameObject? CurrentObject { get; set; } private static Harmony? HarmonyPatcher { get; set; } public static ConfigFile? PersistentConfig { get; private set; } private void Awake() { //IL_0030: 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_0042: Expected O, but got Unknown PersistentConfig = ((BaseUnityPlugin)this).Config; if ((Object)(object)CurrentObject == (Object)null) { CurrentObject = new GameObject("SSDebugPlugin", new Type[1] { typeof(SSDebugManager) }) { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)(object)CurrentObject); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully created SSDebugManager"); } ApplyPatches(); } private void ApplyPatches() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown try { Harmony? harmonyPatcher = HarmonyPatcher; if (harmonyPatcher != null) { harmonyPatcher.UnpatchSelf(); } HarmonyPatcher = new Harmony("com.bepin.SSDebugkz"); HarmonyPatcher.PatchAll(Assembly.GetExecutingAssembly()); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to patch: {arg}"); } } private void OnDestroy() { ((BaseUnityPlugin)this).Logger.LogWarning((object)"BepinEx object destroyed (!)"); } } } namespace SSDebug.Patches { public static class HarmonyPatches { [HarmonyPatch(typeof(HealthManager), "TakeDamage")] public static class HealthManagerDmg { private static void Postfix(HealthManager __instance, HitInstance hitInstance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) SSDebugManager.instance.HealthManagerTakeDamage(__instance, hitInstance); } } [HarmonyPatch(typeof(HealthManager), "OnEnable")] public static class HealthManagerEnable { private static void Postfix(HealthManager __instance) { SSDebugManager.instance.HealthManagerEnable(__instance); } } [HarmonyPatch(typeof(GameManager), "FinishedEnteringScene")] public static class GameManagerEnterScene { private static void Postfix() { SSDebugManager.instance.HeroFinishedEnteringScene(); } } [HarmonyPatch(typeof(InputHandler), "SetCursorEnabled")] public static class InputHandlerCursor { private static bool Prefix(InputHandler __instance) { return !SSDebugManager.instance.SharedConfig.ShowCursor; } } [HarmonyPatch(typeof(DamageStack), "PopDamage")] public static class DamageStackPopDamage { private static void Prefix(DamageStack __instance) { SSDebugManager.instance.DamageStackPop(__instance); } } [HarmonyPatch(typeof(CameraTarget), "EnterLockZone")] public static class CameraTargetPrevent1 { private static bool Prefix() { return !SSDebugManager.instance.SharedConfig.FreeCamEnabled; } } [HarmonyPatch(typeof(CameraTarget), "PositionToStart")] public static class CameraTargetPrevent2 { private static bool Prefix() { return !SSDebugManager.instance.SharedConfig.FreeCamEnabled; } } [HarmonyPatch(typeof(HeroController), "FinishedEnteringScene")] public static class HeroControllerFinishedEnteringScene { private static void Postfix() { SSDebugManager.instance.HeroFinishedEnteringScene(); } } } } namespace SSDebug.Model { internal sealed class DamageStackProxy { public int BaseDamage; public float totalOffset; public List<float> multipliers = new List<float>(5); public void UpdateFromSource(DamageStack ds) { BaseDamage = ds.BaseDamage; totalOffset = ds.totalOffset; multipliers.Clear(); multipliers.AddRange(ds.multipliers); } } public sealed class GlobalConfig : BaseSharedConfig { public enum UIState { Off = 0, On = 1, DebugInfo = 2, SceneList = 4, Colliders = 8, Flags = 0x10, HP = 0x20 } public ConfigEntry<float> SpeedupFactor; public ConfigEntry<bool> ShowCanJump; public ConfigEntry<bool> UseFastWakeUp; public ConfigEntry<uint> FSFetchBuff; public UIState uiState { get; set; } = (UIState)3; public bool uiShowScenes => (uiState & UIState.SceneList) == UIState.SceneList; public bool uiShowFlag => (uiState & UIState.Flags) == UIState.Flags; public bool uiShowHp => (uiState & UIState.HP) == UIState.HP; public bool PlayerAutoHeal { get; set; } public bool PlayerAutoSilk { get; set; } public bool PlayerInvulnerability { get; set; } public bool ShowCursor { get; set; } = true; public bool BlockPlayerInput { get; set; } public bool FreeCamEnabled { get; set; } } public sealed class InputConfig : BaseSharedConfig { public ConfigEntry<KeyCode> F1 { get; private set; } public ConfigEntry<KeyCode> F2 { get; private set; } public ConfigEntry<KeyCode> F3 { get; private set; } public ConfigEntry<KeyCode> F4 { get; private set; } public ConfigEntry<KeyCode> F5 { get; private set; } public ConfigEntry<KeyCode> F6 { get; private set; } public ConfigEntry<KeyCode> F7 { get; private set; } public ConfigEntry<KeyCode> F8 { get; private set; } public ConfigEntry<KeyCode> F9 { get; private set; } public ConfigEntry<KeyCode> F10 { get; private set; } public ConfigEntry<KeyCode> F11 { get; private set; } public ConfigEntry<KeyCode> F12 { get; private set; } public ConfigEntry<KeyCode> LShift { get; private set; } public ConfigEntry<KeyCode> LCtrl { get; private set; } public ConfigEntry<KeyCode> LAlt { get; private set; } public ConfigEntry<KeyCode> RShift { get; private set; } public ConfigEntry<KeyCode> RCtrl { get; private set; } public ConfigEntry<KeyCode> RAlt { get; private set; } public ConfigEntry<KeyCode> ResetFlags { get; private set; } public ConfigEntry<KeyCode> DumpSaveData { get; private set; } public InputConfig(ConfigFile configFile) { F1 = configFile.Bind<KeyCode>("Input", "F1", (KeyCode)282, "Main hotkey that controls overall UI and debug pane"); F2 = configFile.Bind<KeyCode>("Input", "F2", (KeyCode)283, "Extra UI control (scene tp)"); F3 = configFile.Bind<KeyCode>("Input", "F3", (KeyCode)284, "Speedrun tools 1"); F4 = configFile.Bind<KeyCode>("Input", "F4", (KeyCode)285, "Speedrun tools 2"); F5 = configFile.Bind<KeyCode>("Input", "F5", (KeyCode)286, "Savestates"); F6 = configFile.Bind<KeyCode>("Input", "F6", (KeyCode)287, "Speedrun tools 3"); F7 = configFile.Bind<KeyCode>("Input", "F7", (KeyCode)288, "Quick in-scene teleport"); F8 = configFile.Bind<KeyCode>("Input", "F8", (KeyCode)289, "Reserved"); F9 = configFile.Bind<KeyCode>("Input", "F9", (KeyCode)290, "Onscreen viewer (hp, objects)"); F10 = configFile.Bind<KeyCode>("Input", "F10", (KeyCode)291, "Camera tools"); F11 = configFile.Bind<KeyCode>("Input", "F11", (KeyCode)292, "Collider view"); F12 = configFile.Bind<KeyCode>("Input", "F12", (KeyCode)293, "Character input recovery"); LShift = configFile.Bind<KeyCode>("Input", "LShift", (KeyCode)304, "Modifier key for: LeftShift"); LCtrl = configFile.Bind<KeyCode>("Input", "LCtrl", (KeyCode)306, "Modifier key for: LeftControl"); LAlt = configFile.Bind<KeyCode>("Input", "LAlt", (KeyCode)308, "Modifier key for: LeftAlt"); RShift = configFile.Bind<KeyCode>("Input", "RShift", (KeyCode)303, "Modifier key for: RightShift"); RCtrl = configFile.Bind<KeyCode>("Input", "RCtrl", (KeyCode)305, "Modifier key for: RightControl"); RAlt = configFile.Bind<KeyCode>("Input", "RAlt", (KeyCode)307, "Modifier key for: RightAlt"); ResetFlags = configFile.Bind<KeyCode>("Input", "ResetFlags", (KeyCode)278, "Reset boss and scene flags"); DumpSaveData = configFile.Bind<KeyCode>("Input", "DumpSaveData", (KeyCode)279, "Dump current save data"); } public bool NoLeftModifiers() { //IL_0006: 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_001c: Unknown result type (might be due to invalid IL or missing references) return LegacyInputHelper.NoAnyFromTheTripletHeld(LShift.Value, LAlt.Value, LCtrl.Value); } } public class MapEntry { public string ZoneName { get; set; } public List<string> Scenes { get; set; } public string[] Gates { get; set; } public string[] Respawns { get; set; } } public sealed class SharedCache { public Matrix4x4 origMatrix; public Matrix4x4 scaledMatrix; public string activeScene = string.Empty; public readonly Texture2D boxBG = new Texture2D(1, 1, (TextureFormat)20, false); public Camera? gameCam; public bool advanceFrameBusy; public Dictionary<string, MapEntry> mapData = new Dictionary<string, MapEntry>(10); public string[]? zoneNames; public bool queuedLoadState; } [Serializable] public sealed class SState { public int ver; public Vector3 pos; public string scene; public int silk; public int health; public bool facingRight; public bool isMaggoted; public string data; } } namespace SSDebug.Game { public sealed class CameraTargetProxy : CameraTarget { public void Update() { } public void EnterLockZone(float xLockMin_var, float xLockMax_var, float yLockMin_var, float yLockMax_var) { GLog.Message((object)"EnterLockZone"); } public void EnterLockZoneInstant(float xLockMin_var, float xLockMax_var, float yLockMin_var, float yLockMax_var) { GLog.Message((object)"EnterLockZoneInstant"); } public void ExitLockZone() { } public void PositionToStart() { GLog.Message((object)"PositionToStart"); } public void AddOffsetArea(CameraOffsetArea offsetArea) { } public void RemoveOffsetArea(CameraOffsetArea offsetArea) { } public Vector2 GetCameraOffset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return Vector2.op_Implicit(Vector3.zero); } } public static class GameAPI { public static readonly string[] ZoneRemap = new string[42] { "NONE", "TEST AREA", "MARROW", "GREYMOOR", "SHELLWOOD", "BLASTED STEPS", "THE CITADEL", "THE SLAB", "GLOOM", "SINNER'S ROAD", "BELLTOWN", "HUNTERS PATH", "BONE BOTTOM", "BONE BOTTOM", "PHARLOOM_BAY", "DEEP DOCKS", "FAR FIELDS", "WEAVER SHRINES", "BONECHURCH", "BONE BOTTOM", "VAULTS", "VERDANIA", "UNDERWORKS", "COG CORE", "MOUNTAIN FAY", "THE MIST", "WHITEWARD", "HIGH HALLS", "MEMORIUM", "CRADLE", "PILGRIMS_REST", "HALFWAY_HOUSE", "BLASTED STEPS", "MEMORY", "WORMWAYS", "WISP THICKET", "BILEWATER", "ABYSS", "PUTRIFIED DUCTS", "SURFACE", "FRONT_GATE", "SANDS OF KARAK" }; private static FieldRef<DisplayItemAmount, PlayerData> DIAplayerData = AccessTools.FieldRefAccess<DisplayItemAmount, PlayerData>("playerData"); private static MethodInfo Refresh = AccessTools.Method(typeof(DisplayItemAmount), "Refresh", (Type[])null, (Type[])null); public static GameManager? GameManager => GameManager.UnsafeInstance; public static CameraController? CamCtrl => GameManager.UnsafeInstance.cameraCtrl; public static Camera? GameCamera => GameCameras.SilentInstance.mainCamera; public static HeroController? HeroCtrl => GameManager.UnsafeInstance.hero_ctrl; public static void ChangeSceneAsTransition(string scene_name, string entryGate = "") { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)GameManager == (Object)null)) { SceneLoadInfo val = new SceneLoadInfo(); val.SceneName = scene_name; val.EntryGateName = entryGate; val.PreventCameraFadeOut = true; val.WaitForSceneTransitionCameraFade = false; val.Visualization = (SceneLoadVisualizations)0; val.AlwaysUnloadUnusedAssets = true; val.IsFirstLevelForPlayer = false; GameManager.BeginSceneTransition(val); } } public static void ReEnableHeroInput() { HeroCtrl.acceptingInput = true; HeroCtrl.move_input = 0f; HeroCtrl.vertical_input = 0f; } public static void FinishEnteringStateSlow() { AccessTools.Method(typeof(HeroController), "FinishedEnteringScene", (Type[])null, (Type[])null).Invoke(HeroCtrl, new object[2] { false, false }); } public static int GetCurrentScaleLevel(ref HitInstance hitInstance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 if (hitInstance.IsUsingNeedleDamageMult) { return PlayerData.instance.nailUpgrades; } if (Object.op_Implicit((Object)(object)hitInstance.RepresentingTool) && (int)hitInstance.RepresentingTool.Type != 3) { return PlayerData.instance.ToolKitUpgrades; } return hitInstance.DamageScalingLevel - 1; } public static void ForceEquipCrest(string crestName, PlayerData pd) { _ = pd.CurrentCrestID; List<string> list = new List<string>(); List<ToolItem> equippedToolsForCrest = ToolItemManager.GetEquippedToolsForCrest(crestName); if (equippedToolsForCrest != null && equippedToolsForCrest.Count > 0) { foreach (ToolItem item in equippedToolsForCrest) { if ((Object)(object)item != (Object)null && string.IsNullOrEmpty(item.name)) { list.Add(item.name); } } } pd.CurrentCrestID = string.Empty; ToolItemManager.SetEquippedCrest(crestName); if (list.Count > 0) { ToolItemManager.SetEquippedTools(crestName, list); } ToolItemManager.SendEquippedChangedEvent(false); HeroCtrl.ResetAllCrestState(); } public static bool HeroCanJump(HeroController hc) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 if (hc.IsInputBlocked()) { return false; } if ((int)hc.hero_state == 7 || (int)hc.hero_state == 5 || (int)hc.hero_state == 6 || hc.cState.wallSliding || hc.cState.dashing || hc.cState.isSprinting || hc.cState.backDashing || hc.cState.jumping || hc.cState.bouncing || hc.cState.shroomBouncing || hc.cState.downSpikeRecovery) { return false; } if (hc.cState.onGround) { return true; } if (hc.ledgeBufferSteps > 0 && !hc.cState.dead && !hc.cState.hazardDeath && !hc.controlReqlinquished && hc.headBumpSteps <= 0 && !hc.CheckNearRoof()) { return true; } return false; } public static void RemapScenesBetweenZones(string prefix, List<string> source, List<string> destination) { for (int num = source.Count - 1; num >= 0; num--) { if (source[num].StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) { Extensions.AddIfNotPresent<string>(destination, source[num]); source.Remove(source[num]); } } } public static void ResetNonLethalRespawn(this PlayerData pd) { pd.nonLethalRespawnMarker = null; pd.nonLethalRespawnType = 0; pd.nonLethalRespawnScene = null; } public static void RefreshDisplayItemAmountComponents() { DisplayItemAmount[] array = Object.FindObjectsByType<DisplayItemAmount>((FindObjectsInactive)1, (FindObjectsSortMode)0); if (array == null) { return; } DisplayItemAmount[] array2 = array; foreach (DisplayItemAmount val in array2) { if ((Object)(object)val != (Object)null) { DIAplayerData.Invoke(val) = GameManager.playerData; Refresh.Invoke(val, null); } } } public static bool TryRefreshInventoryCollectables() { InventoryItemCollectableManager componentInChildren = ((Component)GameCameras.SilentInstance).gameObject.GetComponentInChildren<InventoryItemCollectableManager>(true); if ((Object)(object)componentInChildren != (Object)null) { CollectableItemManager.IncrementVersion(); ((InventoryItemListManager<InventoryItemCollectable, CollectableItem>)(object)componentInChildren).UpdateList(); return true; } return false; } public static bool TryRefreshQuestList() { if ((Object)(object)(((Object)(object)GameManager != (Object)null) ? ((Component)GameManager).GetComponent<QuestManager>() : null) != (Object)null) { QuestManager.IncrementVersion(); QuestManager.GetActiveQuests(); return true; } return false; } public static List<string> GetPlayerDataDump() { List<string> list = new List<string>(); FieldInfo[] fields = typeof(HeroController).GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); list.Add("[" + "HeroController".ToUpper() + "]"); list.Add(""); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { list.Add(fieldInfo.Name + ": " + fieldInfo.GetValue(HeroCtrl)); } list.Add(""); list.Add("[" + "HeroControllerStates".ToUpper() + "]"); fields = typeof(HeroControllerStates).GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); array = fields; foreach (FieldInfo fieldInfo2 in array) { list.Add(fieldInfo2.Name + ": " + fieldInfo2.GetValue(HeroCtrl.cState)); } list.Add(""); list.Add("[" + "GameManager".ToUpper() + "]"); fields = typeof(GameManager).GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); array = fields; foreach (FieldInfo fieldInfo3 in array) { list.Add(fieldInfo3.Name + ": " + fieldInfo3.GetValue(GameManager)); } return list; } } public enum Layers { Default, TransparentFX, Ignore_Raycast, UNUSED1, Water, UI, UNUSED2, Currency_Self_Collide, Terrain, Player, Self_Collide, Enemies, Projectiles, Hero_Detector, Terrain_Detector, Enemy_Detector, Tinker, Attack, Particle, Interactive_Object, Hero_Box, Grass, Enemy_Attack, Water_Surface, Bouncer, Soft_Terrain, Corpse, Physical_Pusher, Hero_Only, ActiveRegion, Physical_Push_React, Attack_Detector } } namespace SSDebug.Components { internal sealed class ColliderView : PluginComponent { private bool uiShowCollLayers; private bool collViewOn; private bool collViewReqHierarchy; private Config Cfg = new Config(); private Vector2 layerScroll; private Material? matIntColored; private List<Collider2D> tempCache = new List<Collider2D>(4); private List<CachedColliderBase> colliderCache = new List<CachedColliderBase>(); public ColliderView(SSDebugManager manager, bool startEnabled, int priority = 0) : base(manager, startEnabled, priority) { } public override void OnComponentEnable() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown ((LocalComponent)this).OnComponentEnable(); Camera.onPostRender = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPostRender, (Delegate?)new CameraCallback(OnPostRenderCallback)); SceneManager.activeSceneChanged += OnActiveSceneChanged; } public override void OnComponentDisable() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown ((LocalComponent)this).OnComponentDisable(); SceneManager.activeSceneChanged -= OnActiveSceneChanged; Camera.onPostRender = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPostRender, (Delegate?)new CameraCallback(OnPostRenderCallback)); ClearColliderCache(); } public sealed override void Update() { //IL_000b: 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_004d: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(base.GInput.F11.Value)) { if (Input.GetKey(base.GInput.LShift.Value)) { uiShowCollLayers = !uiShowCollLayers; } else if (Input.GetKey(base.GInput.LCtrl.Value)) { collViewReqHierarchy = !collViewReqHierarchy; } else if (Input.GetKey(base.GInput.RShift.Value)) { Cfg.mode = (DrawMode)(byte)((Cfg.mode + 1) % 3); } else if (collViewOn = !collViewOn) { FullSweep(null); } } if (collViewOn) { if (Input.GetKeyDown((KeyCode)280)) { CachedColliderBase.MiterWidth += 1f; } if (Input.GetKeyDown((KeyCode)281)) { CachedColliderBase.MiterWidth -= 1f; } } } public sealed override void OnGUI() { //IL_00b6: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: 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) if (!uiShowCollLayers) { return; } GUI.skin.button.fontSize = 18; GUI.skin.button.fontStyle = (FontStyle)1; GUI.skin.button.alignment = (TextAnchor)4; GUI.skin.button.wordWrap = false; GUI.skin.label.fontSize = 18; GUI.skin.label.fontStyle = (FontStyle)1; GUI.skin.label.wordWrap = false; GUI.skin.label.alignment = (TextAnchor)3; int num = Cfg.collPreset.Length; Rect val = default(Rect); ((Rect)(ref val))..ctor(10f, 466f, 300f, 600f); GUI.DrawTexture(val, (Texture)(object)base.GCache.boxBG, (ScaleMode)0, false, 1f, new Color(0f, 0f, 0f, 0.7f), 0f, 0f); layerScroll = GUI.BeginScrollView(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width + 2f, ((Rect)(ref val)).height - 2f), layerScroll, new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 30f * (float)(num + 1)), GUIStyle.none, GUI.skin.verticalScrollbar); for (int i = 0; i < Cfg.collPreset.Length; i++) { Color color = GUI.color; CollLayer collLayer = Cfg.collPreset[i]; Rect val2 = new Rect(((Rect)(ref val)).x + 4f, ((Rect)(ref val)).y + 31f * (float)i, 220f, 30f); GUI.color = new Color(collLayer.color.r, collLayer.color.g, collLayer.color.b, 1f); GUI.Label(val2, collLayer.name); GUI.color = color; float num2 = 12f; float num3 = 40f; if (GUI.Button(new Rect(((Rect)(ref val)).x + ((Rect)(ref val)).width - (num3 + num2), ((Rect)(ref val)).y + 31f * (float)i, num3, 30f), collLayer.isEnabled ? "✘" : "")) { collLayer.isEnabled = !collLayer.isEnabled; FullSweep(null); } } GUI.EndScrollView(); } private void OnPostRenderCallback(Camera cam) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (collViewOn && !((Object)(object)matIntColored == (Object)null) && HasAnyColliders() && base.Manager.MainContextValid() && !((Object)(object)cam != (Object)(object)GameAPI.GameCamera)) { CachedColliderBase.Draw(Cfg.mode, matIntColored, cam, colliderCache, collViewReqHierarchy); } } private void OnActiveSceneChanged(Scene from, Scene to) { ClearColliderCache(); if (collViewOn && base.Manager.MainContextValid()) { FullSweep(null); } } private void FetchMaterial() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown if (!((Object)(object)matIntColored != (Object)null)) { Shader val = Shader.Find("Hidden/Internal-Colored"); if ((Object)(object)val == (Object)null) { ((ComponentManager)base.Manager).Logger.Error((object)$"[{((object)this).GetType()}] Failed to fetch required shader"); return; } matIntColored = new Material(val) { hideFlags = (HideFlags)61 }; matIntColored.SetInt("_SrcBlend", 5); matIntColored.SetInt("_DstBlend", 10); matIntColored.SetInt("_Cull", 0); } } private void FullSweep(Transform? trans) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) ClearColliderCache(); FetchMaterial(); Collider2D[] array; if ((Object)(object)trans != (Object)null) { int num = 0; for (int i = 0; i < Cfg.collPreset.Length; i++) { if (Cfg.collPreset[i].isEnabled) { num |= 1 << i; } } array = Physics2D.OverlapBoxAll(Vector2.op_Implicit(trans.position), new Vector2(300f, 300f), 0f, num); } else { array = Object.FindObjectsByType<Collider2D>((FindObjectsInactive)1, (FindObjectsSortMode)0); } for (int j = 0; j < array.Length; j++) { if (!((Object)(object)array[j] == (Object)null) && Cfg.collPreset[((Component)array[j]).gameObject.layer].isEnabled) { Color color = Cfg.collPreset[((Component)array[j]).gameObject.layer].color; CachedColliderBase.AppendByType(colliderCache, array[j], color); } } CachedColliderBase.UpdateScreenFactor(ScreenHelper.WFac, ScreenHelper.HFac); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void ClearColliderCache() { colliderCache.Clear(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool HasAnyColliders() { return colliderCache.Count > 0; } } internal sealed class Config { public DrawMode mode = (DrawMode)2; public static readonly Color defColor = new Color(1f, 1f, 1f, 0.5f); public CollLayer[] collPreset = new CollLayer[32] { new CollLayer(0, isEnabled: false, new Color(1f, 0.92f, 0.0156f, 0.3f), "Default"), new CollLayer(1, isEnabled: false, defColor, "TransparentFX"), new CollLayer(2, isEnabled: false, defColor, "Ignore_Raycast"), new CollLayer(3, isEnabled: false, new Color(0f, 0f, 0f, 0f), "UNUSED1"), new CollLayer(4, isEnabled: false, defColor, "Water"), new CollLayer(5, isEnabled: false, defColor, "UI"), new CollLayer(6, isEnabled: false, defColor, "UNUSED2"), new CollLayer(7, isEnabled: false, new Color(0f, 1f, 1f, 0.5f), "Currency_Self_Collide"), new CollLayer(8, isEnabled: true, new Color(0f, 1f, 0f, 0.5f), "Terrain"), new CollLayer(9, isEnabled: false, new Color(1f, 1f, 1f, 0.3f), "Player"), new CollLayer(10, isEnabled: false, new Color(0f, 1f, 1f, 0.6f), "Self_Collide"), new CollLayer(11, isEnabled: true, new Color(0f, 1f, 1f, 0.6f), "Enemies"), new CollLayer(12, isEnabled: false, new Color(0.1f, 0f, 1f, 0.6f), "Projectiles"), new CollLayer(13, isEnabled: false, new Color(0.2082f, 0.3725f, 0.4f, 0.94f), "Hero_Detector"), new CollLayer(14, isEnabled: true, new Color(0f, 1f, 1f, 0.5f), "Terrain_Detector"), new CollLayer(15, isEnabled: true, new Color(1f, 0.92f, 0.0156f, 0.3f), "Enemy_Detector"), new CollLayer(16, isEnabled: true, new Color(0.94f, 0.476f, 0.021f, 0.5f), "Tinker"), new CollLayer(17, isEnabled: false, new Color(1f, 0f, 0f, 0.5f), "Attack"), new CollLayer(18, isEnabled: true, new Color(1f, 1f, 1f, 0.3f), "Particle"), new CollLayer(19, isEnabled: true, new Color(0.94f, 0.476f, 0.021f, 0.5f), "Interactive_Object"), new CollLayer(20, isEnabled: true, new Color(1f, 0.92f, 0.0156f, 0.3f), "Hero_Box"), new CollLayer(21, isEnabled: false, defColor, "Grass"), new CollLayer(22, isEnabled: true, new Color(0.97f, 0f, 1f, 0.6f), "Enemy_Attack"), new CollLayer(23, isEnabled: false, defColor, "Water_Surface"), new CollLayer(24, isEnabled: true, new Color(0.1f, 0f, 1f, 0.6f), "Bouncer"), new CollLayer(25, isEnabled: true, defColor, "Soft_Terrain"), new CollLayer(26, isEnabled: false, new Color(1f, 0.921f, 0.0156f, 0.3f), "Corpse"), new CollLayer(27, isEnabled: false, new Color(0f, 1f, 0f, 0.5f), "Physical_Pusher"), new CollLayer(28, isEnabled: true, new Color(1f, 0.92f, 0.0156f, 0.3f), "Hero_Only"), new CollLayer(29, isEnabled: true, defColor, "ActiveRegion"), new CollLayer(30, isEnabled: false, defColor, "Physical_Push_React"), new CollLayer(31, isEnabled: false, defColor, "Attack_Detector") }; } internal sealed class CollLayer { public readonly int layer; public bool isEnabled; public readonly string name = "NULL"; public Color color = new Color(1f, 1f, 1f, 0.5f); public CollLayer(int layer, bool isEnabled, Color color, string name) { //IL_0020: 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_003f: 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) this.layer = layer; this.isEnabled = isEnabled; this.color = color; this.name = name; } } internal sealed class DebugInfo : PluginComponent { private readonly MutableString dInfo = new MutableString(520, true); private bool uiShowDebug = true; private bool uiShowExtra; private Rect boxPos = new Rect(10f, 10f, 300f, 490f); private string gameVer = string.Empty; private string dInfoStr = string.Empty; private string dInfoStr2 = string.Empty; private string[] hStateLUT = new string[9] { "grounded", "idle", "running", "airborne", "wall_sliding", "hard_landing", "dash_landing", "no_input", "previous" }; private string[] gStateLUT = new string[9] { "INACTIVE", "MAIN_MENU", "LOADING", "ENTERING_LEVEL", "PLAYING", "PAUSED", "EXITING_LEVEL", "CUTSCENE", "PRIMER" }; private MovingAverage playerAvgVelocity = new MovingAverage(30); private Vector3 statsLastPos; private int lastHP; private int lastMaxHP; private int lastDamage; private int prevDamage; private bool isTool; private bool isCrit; private int totalCumm; private AttackTypes lastType; private int lastID; private string lastTypeStr = string.Empty; private string lastName = string.Empty; private DamageScalingConfig lastScaleConf; private int lastScaleLvl; private DamageStackProxy dsProxy = new DamageStackProxy(); private static FieldRef<HealthManager, int> initHp = AccessTools.FieldRefAccess<HealthManager, int>("initHp"); private GameManager? GM => GameAPI.GameManager; private HeroController? GetHeroCtrl => GameAPI.HeroCtrl; public DebugInfo(SSDebugManager manager, bool startEnabled, int priority = 0) : base(manager, startEnabled, priority) { }//IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown public override void OnComponentEnable() { ((LocalComponent)this).OnComponentEnable(); base.Manager.OnHealthManagerTakeDamage += OnTakeDamage; base.Manager.OnDamageStackPop += OnDamageStackPop; base.GConf.ShowCanJump = base.Manager.BepinConf.Bind<bool>("Config", "ShowCanJump", false, "Display CanJump hero state in debug info pane? Perf.hit."); } public override void OnComponentDisable() { ((LocalComponent)this).OnComponentDisable(); base.Manager.OnDamageStackPop -= OnDamageStackPop; base.Manager.OnHealthManagerTakeDamage -= OnTakeDamage; } public sealed override void Update() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) if (Input.GetKeyDown(base.GInput.F1.Value)) { if (Input.GetKey(base.GInput.LShift.Value)) { uiShowDebug = !uiShowDebug; ClearAccumulatedStats(); } else if (Input.GetKey(base.GInput.RShift.Value)) { uiShowExtra = !uiShowExtra; } } SampleData(); } public sealed override void OnGUI() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type == 7 && (uiShowDebug || uiShowExtra)) { Color contentColor = GUI.contentColor; bool wordWrap = GUI.skin.box.wordWrap; int fontSize = GUI.skin.label.fontSize; FontStyle fontStyle = GUI.skin.label.fontStyle; TextAnchor alignment = GUI.skin.label.alignment; GUI.contentColor = Color.white; GUI.skin.label.wordWrap = false; GUI.skin.label.fontSize = 20; GUI.skin.label.fontStyle = (FontStyle)1; GUI.skin.label.alignment = (TextAnchor)0; if (uiShowDebug) { GUI.DrawTexture(boxPos, (Texture)(object)base.GCache.boxBG, (ScaleMode)0, false, 1f, new Color(0f, 0f, 0f, 0.9f), 0f, 0f); GUI.Label(boxPos, dInfoStr); } if (uiShowExtra) { Rect val = new Rect(320f, 10f, 400f, 90f); GUI.DrawTexture(val, (Texture)(object)base.GCache.boxBG, (ScaleMode)0, false, 1f, new Color(0f, 0f, 0f, 0.9f), 0f, 0f); GUI.Label(val, dInfoStr2); } GUI.skin.label.wordWrap = wordWrap; GUI.skin.label.fontSize = fontSize; GUI.skin.label.fontStyle = fontStyle; GUI.skin.label.alignment = alignment; GUI.contentColor = contentColor; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void SampleData() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Invalid comparison between Unknown and I4 //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Invalid comparison between Unknown and I4 //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) dInfo.Append("[DEBUG] <size=16>(").Append("0.1.66").Append(" | ") .Append(GameAPI.GameManager?.playerData.version) .Append(")</size>\n"); if (uiShowDebug) { GameObject gameObject = ((Component)GetHeroCtrl).gameObject; HeroController heroCtrl = GameAPI.HeroCtrl; GameManager gameManager = GameAPI.GameManager; float num = SampleVelocity(gameObject.transform); playerAvgVelocity.Sample((long)num); Vector3 position = gameObject.transform.position; dInfo.Append("Scene: ").Append(base.Manager.SharedCache.activeScene).Append("\n"); dInfo.Append("Comp%: ").Append(gameManager.playerData.completionPercentage).Append("\n"); string text = (base.GConf.PlayerAutoSilk ? "<color=red>" : "<color=white>"); string text2 = ((base.GConf.PlayerAutoHeal || base.GConf.PlayerInvulnerability) ? "<color=red>" : "<color=white>"); dInfo.Append("Stats: ").Append(text).Append(GetHeroCtrl.playerData.silk, 2u, ' ') .Append("/") .Append(GetHeroCtrl.playerData.CurrentSilkMax) .Append("</color> | ") .Append(text2) .Append(GetHeroCtrl.playerData.health, 2u, ' ') .Append("/") .Append(GetHeroCtrl.playerData.maxHealth) .Append("</color>\n"); dInfo.Append("Speed: ").Append("x:").Append(heroCtrl.current_velocity.x, 2u) .Append(" y:") .Append(heroCtrl.current_velocity.y, 2u) .Append("\n"); dInfo.Append("Pos: ").Append("x: ").Append(position.x, 2u, 2u, ' ') .Append(" y: ") .Append(position.y, 2u, 2u, ' ') .Append("\n"); if ((int)heroCtrl.hero_state > -1 && (int)heroCtrl.hero_state < 9) { dInfo.Append("HStates: ").Append(hStateLUT[heroCtrl.hero_state]).Append(" | "); } ConfigEntry<bool> showCanJump = base.GConf.ShowCanJump; if (showCanJump != null && showCanJump.Value) { dInfo.Append(Convert.ToUInt32(heroCtrl.CanJump())).Append(" | "); } dInfo.Append(Convert.ToUInt32(heroCtrl.CanWallJump(true))).Append("\n"); dInfo.Append("a j w t w s b d a h f i r t g").Append("\n"); dInfo.Append(Convert.ToUInt32(heroCtrl.cState.attacking)).Append(" ").Append(Convert.ToUInt32(heroCtrl.cState.jumping)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.wallSliding)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.touchingWall)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.wallJumping)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.isSprinting)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.isBackScuttling)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.dashing)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.airDashing)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.isBinding)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.falling)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.Invulnerable)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.recoiling)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.transitioning)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.cState.onGround)) .Append("\n"); dInfo.Append("GState: ").Append(gStateLUT[gameManager.GameState]).Append("\n"); dInfo.Append(Convert.ToUInt32(gameManager.IsInSceneTransition)).Append(" ").Append(Convert.ToUInt32(gameManager.RespawningHero)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.inputBlockers.Count)) .Append(" ") .Append(Convert.ToUInt32(heroCtrl.controlReqlinquished)) .Append(" ") .Append((sbyte)heroCtrl.HeroLockState) .Append(" | ") .Append(Convert.ToUInt32(heroCtrl.acceptingInput)) .Append(" ") .Append((sbyte)heroCtrl.move_input) .Append(" ") .Append((sbyte)heroCtrl.vertical_input) .Append("\n"); dInfo.Append("NLvl: ").Append(GameAPI.GameManager.playerData.nailUpgrades).Append(" TLvl: ") .Append(GameAPI.GameManager.playerData.ToolKitUpgrades) .Append(" NDmg: ") .Append(GameAPI.GameManager.playerData.nailDamage) .Append("\n"); dInfo.Append("LastHP: ").Append(lastHP).Append("/") .Append(lastMaxHP) .Append("\n"); dInfo.Append("LstDmg: ").Append(lastDamage).Append(" | ") .Append(dsProxy.BaseDamage) .Append(" | ") .Append(dsProxy.totalOffset, 2u) .Append("\n"); dInfo.Append("PrvDmg: ").Append(prevDamage).Append("\n"); dInfo.Append("Cummul: ").Append(totalCumm).Append("\n"); dInfo.Append("Type: ").Append(lastTypeStr).Append("\n"); dInfo.Append("Tool|Crit: ").Append(Convert.ToUInt32(isTool)).Append(" | ") .Append(Convert.ToUInt32(isCrit)) .Append("\n"); if (lastScaleConf != null) { dInfo.Append("Scaling: ").Append(lastScaleLvl).Append(" lvl") .Append("\n"); dInfo.Append(lastScaleConf.Level1Mult).Append("|").Append(lastScaleConf.Level2Mult) .Append("|") .Append(lastScaleConf.Level3Mult) .Append("|") .Append(lastScaleConf.Level4Mult) .Append("|") .Append(lastScaleConf.Level5Mult) .Append("\n"); } if (dsProxy.multipliers.Count > 0) { for (int i = 0; i < dsProxy.multipliers.Count; i++) { dInfo.Append(dsProxy.multipliers[i], 2u).Append(", "); } dInfo.Length -= 2; dInfo.Append("\n"); } } if (uiShowExtra) { dInfoStr2 = string.Format("Base: {0}\nOffset: {1}\n{2}", dsProxy.BaseDamage, dsProxy.totalOffset, string.Join(", ", dsProxy.multipliers)); } dInfoStr = dInfo.Finalize(); } private void OnTakeDamage(HealthManager hm, HitInstance hit) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_007c: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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) if ((Object)(object)((Component)hm).gameObject != (Object)(object)((Component)GameAPI.HeroCtrl).gameObject) { int num = Mathf.RoundToInt((float)hit.DamageDealt * hit.Multiplier); if (hm.damageOverride) { num = 1; } isTool = Object.op_Implicit((Object)(object)hit.RepresentingTool); isCrit = hit.CriticalHit; prevDamage = lastDamage; lastDamage = num; totalCumm += num; if (lastType != hit.AttackType || lastTypeStr == string.Empty) { lastType = hit.AttackType; lastTypeStr = ((object)(AttackTypes)(ref hit.AttackType)).ToString(); } lastHP = hm.hp; lastMaxHP = initHp.Invoke(hm); if (((Object)((Component)hm).gameObject).GetInstanceID() != lastID) { lastName = ((Object)((Component)hm).gameObject).name; lastScaleConf = hm.damageScaling; lastScaleLvl = GameAPI.GetCurrentScaleLevel(ref hit); } } } private void OnDamageStackPop(DamageStack ds) { if (uiShowDebug) { dsProxy.UpdateFromSource(ds); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private float SampleVelocity(Transform? target) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) if ((Object)(object)target == (Object)null) { return 0f; } float result = Vector3.Distance(target.position, statsLastPos) / Time.deltaTime; statsLastPos = target.position; return result; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void ClearAccumulatedStats() { playerAvgVelocity.Clear(); lastHP = (lastMaxHP = (lastDamage = (prevDamage = (totalCumm = (lastID = 0))))); lastTypeStr = (lastName = string.Empty); lastScaleConf = null; isTool = (isCrit = false); } } internal sealed class FlagEditor : PluginComponent { private bool uiShowEditor; private Type TargetType = typeof(PlayerData); private GUILayoutOption width50; private GUILayoutOption width100; private GUILayoutOption width150; private GUILayoutOption width550; private GUISkin? skin; private Texture2D boxBG; private GUIStyle style = new GUIStyle(); public List<FieldInfo> fieldList = new List<FieldInfo>(); private string[]? values; private Vector2 uiScroll; private string filter = ""; public FlagEditor(SSDebugManager manager, bool startEnabled, int priority = 0) : base(manager, startEnabled, priority) { }//IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown public override void OnComponentEnable() { ((LocalComponent)this).OnComponentEnable(); LocalConstructor(); } public override void OnComponentDisable() { ((LocalComponent)this).OnComponentDisable(); LocalDestructor(); } public sealed override void OnGUI() { if (uiShowEditor && !((Object)(object)skin == (Object)null) && GameAPI.GameManager.playerData != null && fieldList.Count >= 1 && values != null && values.Length == fieldList.Count) { DrawEditor(GameAPI.GameManager.playerData); } } public sealed override void Update() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(base.GInput.F6.Value) && base.GInput.NoLeftModifiers()) { uiShowEditor = !uiShowEditor; } } private void LocalConstructor() { GenerateSkinStyle(); FetchTypeData(); } private void LocalDestructor() { fieldList.Clear(); values = null; } private void GenerateSkinStyle() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) style = new GUIStyle(); skin = UnityAPI.GetDefaultUIMGUISkin(); boxBG = new Texture2D(1, 1, (TextureFormat)20, false); boxBG.SetPixel(1, 1, new Color(0f, 0f, 0f, 0.7f)); boxBG.Apply(); width50 = GUILayout.Width(50f); width100 = GUILayout.Width(100f); width150 = GUILayout.Width(150f); width550 = GUILayout.Width(550f); if ((Object)(object)skin != (Object)null) { skin.textField.fontSize = 20; skin.button.fontSize = 20; skin.button.fontStyle = (FontStyle)1; skin.button.margin.bottom = 4; skin.textField.wordWrap = false; skin.textField.fontStyle = (FontStyle)1; skin.textField.alignment = (TextAnchor)3; skin.label.fontSize = 20; skin.label.margin.left = 4; skin.label.wordWrap = false; skin.label.fontStyle = (FontStyle)1; } } private void FetchTypeData() { fieldList.Clear(); FieldInfo[] fields = TargetType.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType.IsPrimitive || fieldInfo.FieldType.GetType() == typeof(string) || fieldInfo.FieldType.IsEnum) { fieldList.Add(fieldInfo); } } fieldList.Sort((FieldInfo x, FieldInfo y) => x.Name.CompareTo(y.Name)); values = new string[fieldList.Count]; } private void DrawEditor(object instance) { //IL_003b: 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) //IL_008c: 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) GUISkin val = GUI.skin; GUI.skin = skin; style.normal.background = boxBG; GUILayout.BeginArea(new Rect(314f, 10f, 900f, 800f), style); GUILayout.Label(instance.GetType().Name, Array.Empty<GUILayoutOption>()); filter = GUILayout.TextField(filter, Array.Empty<GUILayoutOption>()); GUILayout.Space(8f); uiScroll = GUILayout.BeginScrollView(uiScroll, Array.Empty<GUILayoutOption>()); for (int i = 0; i < fieldList.Count; i++) { string name = fieldList[i].Name; fieldList[i].GetType(); if (filter == string.Empty || name.Contains(filter, StringComparison.OrdinalIgnoreCase)) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(name, (GUILayoutOption[])(object)new GUILayoutOption[1] { width550 }); GUILayout.Label($" {fieldList[i].GetValue(instance)} ", (GUILayoutOption[])(object)new GUILayoutOption[1] { width150 }); values[i] = GUILayout.TextField(values[i], (GUILayoutOption[])(object)new GUILayoutOption[1] { width100 }); if (GUILayout.Button("SET", (GUILayoutOption[])(object)new GUILayoutOption[1] { width50 })) { ReflectionHelper.SetFieldByType(fieldList[i], values[i], instance, (Action<string>)((LocalComponent)this).Logger.Message); } GUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); GUILayout.Space(8f); GUILayout.EndArea(); GUI.skin = val; } } internal sealed class FreeCam : PluginComponent { private bool bFollowMode; private Vector3 lastFreeCamPos; private tk2dCamera tk2dCam; private CameraTarget origTarget; private CameraTarget proxyTarget; private static FieldRef<CameraTarget, Transform> heroTransform = AccessTools.FieldRefAccess<CameraTarget, Transform>("heroTransform"); private bool isFreeCamEnabled { get { if ((Object)(object)GameAPI.CamCtrl != (Object)null) { return (Object)(object)GameAPI.CamCtrl.camTarget == (Object)(object)proxyTarget; } return false; } } public FreeCam(SSDebugManager manager, bool startEnabled, int priority = 0) : base(manager, startEnabled, priority) { } public override void OnComponentEnable() { ((LocalComponent)this).OnComponentEnable(); base.Manager.ActiveSceneChanged += ActiveSceneChanged; } public override void OnComponentDisable() { ((LocalComponent)this).OnComponentDisable(); base.Manager.ActiveSceneChanged -= ActiveSceneChanged; } public sealed override void Update() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00e1: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GameAPI.CamCtrl == (Object)null || (int)GameAPI.GameManager.GameState < 2) { return; } if (Input.GetKey(base.GInput.LCtrl.Value) && Input.GetAxis("Mouse ScrollWheel") != 0f && (Object)(object)tk2dCam != (Object)null) { tk2dCamera obj = tk2dCam; obj.ZoomFactor -= Input.GetAxis("Mouse ScrollWheel") * (1f * tk2dCam.ZoomFactor); } if ((Input.GetKeyDown((KeyCode)8) || Input.GetKeyDown((KeyCode)325)) && (Object)(object)tk2dCam != (Object)null) { tk2dCam.ZoomFactor = 1f; } if (Input.GetKeyUp(base.GInput.F10.Value) && (Object)(object)GameAPI.GameCamera != (Object)null) { if (Input.GetKey(base.GInput.LShift.Value)) { bFollowMode = !bFollowMode; GameAPI.CamCtrl.SetAllowExitingSceneBounds(bFollowMode); } else if (Input.GetKey(base.GInput.LCtrl.Value) && (Object)(object)GameAPI.HeroCtrl != (Object)null) { GameAPI.CamCtrl.PositionToHeroInstant(true); } else { ToggleFreeCam(); } } if (Input.GetKey(base.GInput.LCtrl.Value) && Input.GetKeyUp((KeyCode)323)) { SpawnAtCursor(); } if (!isFreeCamEnabled) { return; } if (bFollowMode) { Vector3 position = ((Component)GameAPI.HeroCtrl).transform.position; ((Component)proxyTarget).transform.position = new Vector3(position.x, position.y, ((Component)proxyTarget).transform.position.z); } else if (Input.GetKey(base.GInput.LAlt.Value)) { float num = Mathf.Abs(((Component)GameAPI.GameCamera).transform.position.z) + 1f; if (Input.GetKeyDown((KeyCode)323)) { Vector3 mousePosition = Input.mousePosition; lastFreeCamPos = GameAPI.GameCamera.ScreenToWorldPoint(new Vector3(mousePosition.x, mousePosition.y, num)); } if (Input.GetKey((KeyCode)323)) { Vector3 mousePosition2 = Input.mousePosition; float num2 = (Input.GetKey(base.GInput.LShift.Value) ? 30f : 15f); Vector3 val = (GameAPI.GameCamera.ScreenToWorldPoint(new Vector3(mousePosition2.x, mousePosition2.y, num)) - lastFreeCamPos) * -1f * Time.deltaTime * num2; ((Component)GameAPI.GameCamera).transform.localPosition = ((Component)GameAPI.GameCamera).transform.localPosition + val; } if (Input.GetKeyUp((KeyCode)324)) { SpawnAtCursor(); } } } private void ToggleFreeCam() { if ((Object)(object)proxyTarget == (Object)null) { proxyTarget = ((Component)GameAPI.CamCtrl).gameObject.AddComponent<CameraTarget>(); ((Behaviour)proxyTarget).enabled = false; } if ((Object)(object)origTarget == (Object)null && (Object)(object)GameAPI.CamCtrl.camTarget != (Object)(object)proxyTarget) { origTarget = GameAPI.CamCtrl.camTarget; } GameAPI.CamCtrl.camTarget = (((Object)(object)GameAPI.CamCtrl.camTarget == (Object)(object)proxyTarget) ? origTarget : proxyTarget); if (!isFreeCamEnabled && (Object)(object)GameAPI.CamCtrl != (Object)null) { GameAPI.CamCtrl.PositionToHeroInstant(true); } base.GConf.FreeCamEnabled = isFreeCamEnabled; } private void SpawnAtCursor() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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) if ((Object)(object)GameAPI.HeroCtrl == (Object)null) { return; } float num = Mathf.Abs(((Component)GameAPI.GameCamera).transform.position.z) - ((Component)GameAPI.HeroCtrl).transform.position.z; Vector3 val = GameAPI.GameCamera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, num)); if (val != Vector3.zero) { ((Component)GameAPI.HeroCtrl).gameObject.transform.position = new Vector3(val.x, val.y, ((Component)GameAPI.HeroCtrl).gameObject.transform.position.z); if (isFreeCamEnabled) { ((Component)GameAPI.GameCamera).transform.position = new Vector3(val.x, val.y, ((Component)GameAPI.CamCtrl).transform.position.z); } } } private void ActiveSceneChanged(Scene from, Scene to) { if (base.Manager.MainContextValid() && !((Object)(object)GameAPI.CamCtrl == (Object)null) && (Object)(object)tk2dCam == (Object)null) { tk2dCam = ((Component)GameAPI.CamCtrl).gameObject.GetComponent<tk2dCamera>(); } } } internal sealed class HPViewer : PluginComponent { private bool uiShowHP; private bool uiShowCocoon; private List<HealthManager> hmCache = new List<HealthManager>(20); private static FieldRef<HealthManager, int> initHp = AccessTools.FieldRefAccess<HealthManager, int>("initHp"); public HPViewer(SSDebugManager manager, bool startEnabled, int priority = 0) : base(manager, startEnabled, priority) { } public override void OnComponentEnable() { ((LocalComponent)this).OnComponentEnable(); base.Manager.ActiveSceneChanged += ActiveSceneChanged; base.Manager.OnHealthManagerEnable += OnHealthManagerEnable; } public override void OnComponentDisable() { ((LocalComponent)this).OnComponentDisable(); base.Manager.ActiveSceneChanged -= ActiveSceneChanged; base.Manager.OnHealthManagerEnable -= OnHealthManagerEnable; } public sealed override void OnGUI() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0028: 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) if ((int)Event.current.type == 7 && (int)GameAPI.GameManager.GameState > 1 && !((Object)(object)GameAPI.GameCamera == (Object)null)) { Matrix4x4 matrix = GUI.matrix; GUI.matrix = base.GCache.origMatrix; if (uiShowHP && hmCache.Count > 0) { DrawHP(); } if (uiShowCocoon && HeroCorpseMarker._activeMarkers.Count > 0) { DrawCocoons(); } GUI.matrix = matrix; } } public sealed override void Update() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyDown(base.GInput.F9.Value)) { return; } if (Input.GetKey(base.GInput.RShift.Value)) { uiShowCocoon = !uiShowCocoon; return; } uiShowHP = !uiShowHP; if (uiShowHP) { FetchCache(); } } private void ActiveSceneChanged(Scene from, Scene to) { if (base.Manager.MainContextValid()) { FetchCache(); } } private void OnHealthManagerEnable(HealthManager hm) { if (uiShowHP && !hmCache.Contains(hm)) { hmCache.Add(hm); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void DrawHP() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0030: 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_0067: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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) int fontSize = GUI.skin.box.fontSize; FontStyle fontStyle = GUI.skin.box.fontStyle; TextAnchor alignment = GUI.skin.box.alignment; Color contentColor = GUI.contentColor; GUI.skin.box.fontSize = 24; GUI.skin.box.alignment = (TextAnchor)4; GUI.skin.label.fontStyle = (FontStyle)1; GUI.contentColor = Color.yellow; for (int i = 0; i < hmCache.Count; i++) { HealthManager val = hmCache[i]; if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf && ((Component)val).gameObject.activeInHierarchy) { string text = $"{val.hp}/{initHp.Invoke(val)}"; Vector3 val2 = ((Component)val).gameObject.transform.position; float num = 0f; if ((Object)(object)val.boxCollider != (Object)null) { Bounds bounds = ((Collider2D)val.boxCollider).bounds; val2 = ((Bounds)(ref bounds)).center; bounds = ((Collider2D)val.boxCollider).bounds; num = ((Bounds)(ref bounds)).extents.y * 2f; } int num2 = text.Length * 22; Vector3 val3 = GameAPI.GameCamera.WorldToScreenPoint(new Vector3(val2.x, val2.y + num, val2.z)); GUI.Box(new Rect(val3.x - (float)num2 * 0.5f, (float)Screen.height - val3.y, (float)(text.Length * 18), 30f), text); } } GUI.skin.box.fontSize = fontSize; GUI.skin.box.fontStyle = fontStyle; GUI.skin.box.alignment = alignment; GUI.contentColor = contentColor; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void DrawCocoons() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0030: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) int fontSize = GUI.skin.box.fontSize; FontStyle fontStyle = GUI.skin.box.fontStyle; TextAnchor alignment = GUI.skin.box.alignment; Color contentColor = GUI.contentColor; GUI.skin.box.fontSize = 22; GUI.skin.box.alignment = (TextAnchor)3; GUI.skin.label.fontStyle = (FontStyle)1; GUI.contentColor = Color.white; for (int i = 0; i < HeroCorpseMarker._activeMarkers.Count; i++) { HeroCorpseMarker val = HeroCorpseMarker._activeMarkers[i]; if ((Object)(object)val != (Object)null) { Vector3 val2 = GameAPI.GameCamera.WorldToScreenPoint(Vector2.op_Implicit(val.Position)); GUI.Box(new Rect(val2.x, (float)Screen.height - val2.y, 100f, 30f), "Cocoon"); } } GUI.skin.box.fontSize = fontSize; GUI.skin.box.fontStyle = fontStyle; GUI.skin.box.alignment = alignment; GUI.contentColor = contentColor; } private void FetchCache() { hmCache.Clear(); hmCache.AddRange(Object.FindObjectsByType<HealthManager>((FindObjectsInactive)1, (FindObjectsSortMode)0)); } } public abstract class PluginComponent : LocalComponent { protected SSDebugManager Manager { get; private set; } protected SharedCache GCache => Manager.SharedCache; protected GlobalConfig GConf => Manager.SharedConfig; protected InputConfig GInput => Manager.InputConfig; protected PluginComponent(SSDebugManager manager, bool startEnabled, int priority = 0) : base((ComponentManager)(object)manager, startEnabled, priority) { Manager = manager; } } internal sealed class SaveStates : PluginComponent { private const string EXT = ".sav"; private static string saveDir = Path.Join((ReadOnlySpan<char>)ReflectionHelper.GetAssemblyDir(), (ReadOnlySpan<char>)"SSDebugStates"); private bool uiShowList; private bool uiShowInput; private Vector2 uiScroll; private string inputName = string.Empty; private List<string> stateList = new List<string>(); private SState lastUsedSState; private GameObject respawnPoint; private static FieldRef<GameManager, float> sessionPlayTimer = AccessTools.FieldRefAccess<GameManager, float>("sessionPlayTimer"); private static MethodInfo SetLoadedGameData = AccessTools.Method(typeof(GameManager), "SetLoadedGameData", new Type[2] { typeof(string), typeof(int) }, (Type[])null); private static MethodInfo PreparePlayerDataForSave = AccessTools.Method(typeof(GameManager), "PreparePlayerDataForSave", new Type[1] { typeof(int) }, (Type[])null); private static MethodInfo ResetSilkRegen = AccessTools.Method(typeof(HeroController), "ResetSilkRegen", (Type[])null, (Type[])null); public SaveStates(SSDebugManager manager, bool startEnabled, int priority = 0) : base(manager, startEnabled, priority) { } public override void OnComponentEnable() { ((LocalComponent)this).OnComponentEnable(); base.Manager.OnHeroFinishedEnteringScene += OnHeroFinishedEnteringScene; SceneManager.sceneLoaded += SceneLoaded; GlobalConfig gConf = base.GConf; ConfigFile? bepinConf = base.Manager.BepinConf; gConf.UseFastWakeUp = ((bepinConf != null) ? bepinConf.Bind<bool>("Config", "UseFastWakeUp", false, "Attempt to use fats wakeup on savestate load?") : null); GlobalConfig gConf2 = base.GConf; ConfigFile? bepinConf2 = base.Manager.BepinConf; gConf2.FSFetchBuff = ((bepinConf2 != null) ? bepinConf2.Bind<uint>("Config", "FSFetchBuff", 4000u, "Buffer for file list fetch") : null); UpdateList(); } public override void OnComponentDisable() { ((LocalComponent)this).OnComponentDisable(); base.Manager.OnHeroFinishedEnteringScene -= OnHeroFinishedEnteringScene; SceneManager.sceneLoaded -= SceneLoaded; } public sealed override void OnGUI() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0030: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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) //IL_0069: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00ee: Unknown result type (might be due to invalid IL or missing references) int fontSize = GUI.skin.button.fontSize; FontStyle fontStyle = GUI.skin.button.fontStyle; TextAnchor alignment = GUI.skin.button.alignment; Color contentColor = GUI.contentColor; int fontSize2 = GUI.skin.textField.fontSize; FontStyle fontStyle2 = GUI.skin.textField.fontStyle; TextAnchor alignment2 = GUI.skin.textField.alignment; Color contentColor2 = GUI.contentColor; if (uiShowList) { DrawFileList(); } else if (uiShowInput) { DrawInput(); } GUI.skin.button.fontSize = fontSize; GUI.skin.button.fontStyle = fontStyle; GUI.skin.button.alignment = alignment; GUI.contentColor = contentColor; GUI.skin.textField.fontSize = fontSize2; GUI.skin.textField.fontStyle = fontStyle2; GUI.skin.textField.alignment = alignment2; GUI.contentColor = contentColor2; } public sealed override void Update() { //IL_000b: 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_0057: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Invalid comparison between Unknown and I4 if (Input.GetKeyDown(base.GInput.F5.Value)) { if (Input.GetKey(base.GInput.LCtrl.Value)) { uiShowList = !uiShowList; uiShowInput = false; } else if (Input.GetKey(base.GInput.LShift.Value)) { uiShowInput = !uiShowInput; uiShowList = false; } else if (Input.GetKey(base.GInput.LAlt.Value)) { lastUsedSState = GenerateSState(); } else if (lastUsedSState != null && (int)GameAPI.GameManager.GameState == 4) { uiShowList = (uiShowInput = false); RequestSaveStateReload(lastUsedSState); } else { ((LocalComponent)this).Logger.Warn((object)"No cached last savestate available or game is paused"); } if (uiShowList || uiShowInput) { base.Manager.ToggleCursor(enable: true); } } } private void SceneLoaded(Scene scene, LoadSceneMode mode) { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0084: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00b0: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown ((LocalComponent)this).Logger.Message((object)("SceneLoaded: " + ((Scene)(ref scene)).name)); if (base.GCache.queuedLoadState && ((Scene)(ref scene)).name == lastUsedSState.scene) { if ((Object)(object)respawnPoint == (Object)null) { respawnPoint = new GameObject("SSDebugSStateRespawn", new Type[1] { typeof(RespawnMarker) }) { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)(object)respawnPoint); RespawnMarker component = respawnPoint.GetComponent<RespawnMarker>(); OverrideFloat val = new OverrideFloat(); ((OverrideValue<float>)val).Value = 0f; component.customFadeDuration = val; OverrideMapZone val2 = new OverrideMapZone(); ((OverrideValue<MapZone>)val2).Value = (MapZone)0; component.overrideMapZone = val2; component.customWakeUp = base.GConf.UseFastWakeUp?.Value ?? false; } respawnPoint.transform.position = lastUsedSState.pos; } } private void OnHeroFinishedEnteringScene() { if (base.GCache.queuedLoadState) { ((LocalComponent)this).Logger.Message((object)("Restoring hero from SState " + base.GCache.activeScene)); RestoreGameAndHeroState(lastUsedSState); base.GCache.queuedLoadState = false; } } private void UpdateList() { stateList.Clear(); if (!Directory.Exists(saveDir)) { Directory.CreateDirectory(saveDir); } int bufferSize = (int)(base.GConf.FSFetchBuff?.Value ?? 4000); string[] files = Directory.GetFiles(saveDir, "*.sav", new EnumerationOptions { MatchCasing = MatchCasing.CaseInsensitive, BufferSize = bufferSize }); ((LocalComponent)this).Logger.Message((object)$"Discovered {files.Length} files"); string[] array = files; foreach (string path in array) { stateList.Add(Path.GetFileNameWithoutExtension(path)); } stateList.Sort(); ((LocalComponent)this).Logger.Message((object)$"Populated {stateList.Count} savestates"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void DrawInput() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0104: Unknown result type (might be due to invalid IL or missing references) GUI.skin.button.fontSize = 22; GUI.skin.button.fontStyle = (FontStyle)1; GUI.skin.textField.fontSize = 22; GUI.skin.textField.fontStyle = (FontStyle)1; GUI.skin.textField.alignment = (TextAnchor)3; GUI.contentColor = Color.white; GUI.color = Color.white; inputName = GUI.TextField(new Rect(314f, 10f, 300f, 30f), inputName, 25); if (GUI.Button(new Rect(616f, 10f, 60f, 30f), "OK")) { if (Helpers.FileNameIsValidSlow(inputName)) { uiShowInput = false; WriteSaveState(inputName, addToRuntimeList: true); inputName = string.Empty; } else { inputName = "INVALID INPUT"; } } if (GUI.Button(new Rect(678f, 10f, 60f, 30f), " X ")) { uiShowInput = false; } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private void DrawFileList() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) GUI.contentColor = Color.white; GUI.color = Color.white; int count = stateList.Count; float num = 24f; Rect val = default(Rect); ((Rect)(ref val))..ctor(314f, 10f, 300f, 600f); GUI.DrawTexture(val, (Texture)(object)base.GCache.boxBG, (ScaleMode)0, false, 1f, new Color(0f, 0f, 0f, 0.8f), 0f, 0f); if (count < 1) { int fontSize = GUI.skin.label.fontSize; GUI.skin.label.fontSize = 22; GUI.Label(new Rect(((Rect)(ref val)).x + 4f, ((Rect)(ref val)).y + 4f, 280f, 300f), "No states found!\nShift+F5 to add"); GUI.skin.label.fontSize = fontSize; return; } GUI.skin.button.fontSize = (int)num - 4; uiScroll = GUI.BeginScrollView(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 2f, ((Rect)(ref val)).width - 2f, ((Rect)(ref val)).height - 6f), uiScroll, new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width - 4f, (num + 2f) * (float)count), false, false, GUIStyle.none, GUI.skin.verticalScrollbar); for (int i = 0; i < stateList.Count; i++) { float num2 = ((Rect)(ref val)).y + (num + 2f) * (float)i; if (GUI.Button(new Rect(((Rect)(ref val)).x + 4f, num2, ((Rect)(ref val)).width - 4f, num), stateList[i])) { uiShowList = false; LoadStateByName(stateList[i]); break; } } GUI.EndScrollView(true); } private void RestoreGameAndHeroState(SState state) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) ((LocalComponent)this).Logger.Message((object)"Restoring Hero State"); PlayerData playerData = GameAPI.GameManager.playerData; HeroController heroCtrl = GameAPI.HeroCtrl; heroCtrl.SetHazardRespawn(lastUsedSState.pos, true); GameAPI.ForceEquipCrest(playerData.CurrentCrestID, playerData); if (state.ver >= 2) { if (state.silk != playerData.silkMax) { heroCtrl.RefreshSilk(); playerData.silk = state.silk; GameCameras.instance.silkSpool.RefreshSilk((SilkAddSource)0, (SilkTakeSource)0); ResetSilkRegen.Invoke(heroCtrl, null); } if (state.health > 0 && state.health < playerData.maxHealth) { playerData.health = state.health; } } if (state.ver >= 4 && state.isMaggoted) { heroCtrl.SetIsMaggoted(true); } EventRegister.SendEvent(EventRegisterEvents.HealthUpdate, (GameObject)null); CurrencyCounter.ToValue(playerData.geo, (CurrencyType)0); CurrencyCounter.ToValue(playerData.ShellShards, (CurrencyType)1); GameAPI.RefreshDisplayItemAmountComponents(); GameAPI.TryRefreshInventoryCollectables(); GameAPI.TryRefreshQuestList(); } private void WriteSaveState(string? name, bool addToRuntimeList) { SState sState = GenerateSState(); name = name ?? sState.scene; string text = Path.Combine(saveDir, name + ".sav"); string contents = SaveDataUtility.SerializeSaveData<SState>(sState); File.WriteAllText(text, contents); ((LocalComponent)this).Logger.Message((object)("Writing savestate: " + text)); UpdateList(); } private void LoadStateByName(string name) { SState sState = LoadStateFromFile(name); if (sState == null || string.IsNullOrEmpty(sState.scene)) { ((LocalComponent)this).Logger.Error((object)"Loaded savestate is invalid"); } else { RequestSaveStateReload(sState); } } private SState? LoadStateFromFile(string name) { string text = Path.Combine(saveDir, name + ".sav"); if (!File.Exists(text)) { ((LocalComponent)this).Logger.Error((object)("Unable to find/read: " + text)); return null; } return SaveDataUtility.DeserializeSaveData<SState>(File.ReadAllText(text)); } private SState GenerateSState() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (base.GCache.queuedLoadState) { ((LocalComponent)this).Logger.Error((object)"Impossible state - we have savestate queued!"); } GameManager gameManager = GameAPI.GameManager; gameManager.SaveLevelState(); PreparePlayerDataForSave.Invoke(gameManager, new object[1] { gameManager.profileID }); string data = SaveDataUtility.SerializeSaveData<SaveGameData>(new SaveGameData(gameManager.playerData, gameManager.sceneData)); ((LocalComponent)this).Logger.Message((object)("Save state generated: " + base.GCache.activeScene)); return new SState { ver = 4, pos = ((Component)GameAPI.HeroCtrl).transform.position, scene = base.GCache.activeScene, data = data, health = GameAPI.HeroCtrl.playerData.health, silk = GameAPI.HeroCtrl.playerData.silk, facingRight = GameAPI.HeroCtrl.cState.facingRight, isMaggoted = GameAPI.HeroCtrl.cState.isMaggoted }; } private void RequestSaveStateReload(SState state) { if (base.GCache.queuedLoadState) { ((LocalComponent)this).Logger.Error((object)"Impossible state - we already have a savestate queued!"); return; } base.GCache.queuedLoadState = true; ((LocalComponent)this).Logger.Message((object)"Savestate load requested"); lastUsedSState = state; if (GameAPI.GameManager.playerData.health <= 0 || GameAPI.HeroCtrl.cState.dead) { ((MonoBehaviour)GameAPI.HeroCtrl).StopAllCoroutines(); ((MonoBehaviour)GameAPI.GameManager).StopAllCoroutines(); } if (GameAPI.HeroCtrl.cState.isMaggoted) { GameAPI.HeroCtrl.SetIsMaggoted(false); } SetLoadedGameData.Invoke(GameAPI.GameManager, new object[2] { state.data, GameAPI.GameManager.profileID }); GameAPI.GameManager.ResetSemiPersistentItems(); GameAPI.GameManager.RespawningHero = true; GameAPI.GameManager.playerData.ResetTempRespawn(); GameAPI.GameManager.playerData.ResetNonLethalRespawn(); GameAPI.GameManager.playerData.respawnMarkerName = "SSDebugSStateRespawn"; GameAPI.GameManager.playerData.respawnScene = state.scene; Extensions.AddIfNotPresent<string>(SceneTeleportMap.GetTeleportMap()[state.scene].RespawnPoints, "SSDebugSStateRespawn"); GameAPI.GameManager.ReadyForRespawn(false); ((LocalComponent)this).Logger.Message((object)("Loaded save state: " + base.GCache.activeScene)); } } internal sealed class SceneSelector : PluginComponent { private bool tpInProgress; private string requestedGate; private string uiSelZone = string.Empty; private Vector2 uiScroll; private Vector2 uiScroll2; private Vector2 sceneScroll; private GlobalConfig.UIState uiState { get { return base.GConf.uiState; } set { base.GConf.uiState = value; } } private bool uiShowScenes => base.GConf.uiShowScenes; private bool uiShowFlag => base.GConf.uiShowFlag; public SceneSelector(SSDebugManager manager, bool startEnabled, int priority = 0) : base(manager, startEnabled, priority) { } public override void OnComponentEnable() { ((LocalComponent)this).OnComponentEnable(); PopulateSceneList(); base.Manager.OnHeroFinishedEnteringScene += HeroFinishedEnteringScene; } public override void OnComponentDisable() { ((LocalComponent)this).OnComponentDisable(); base.Manager.OnHeroFinishedEnteringScene -= HeroFinishedEnteringScene; } private void ActiveSceneChanged(Scene from, Scene to) { } private void HeroFinishedEnteringScene() { //IL_00b4: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected I4, but got Unknown //IL_00de: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due