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 FastStartup v1.0.0
FastStartup.dll
Decompiled 38 minutes agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [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("FastStartup")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FastStartup")] [assembly: AssemblyTitle("FastStartup")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FastStartup { [BepInPlugin("purtzel_hd.faststartup", "FastStartup", "1.0.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; private static FieldInfo _splashState; private static MethodInfo _splashStateSet; private static bool _splashFailed; private static FieldInfo _camLerp; private static FieldInfo _camCurve; private static bool _camFailed; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0056: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("purtzel_hd.faststartup"); Patch(val, "SplashScreen", "Update", "SplashPrefix", prefix: true); Patch(val, "MenuPageMain", "Start", "MenuPostfix", prefix: false); Patch(val, "CameraMainMenu", "Update", "CameraPrefix", prefix: true); Log.LogInfo((object)"FastStartup loaded."); } private static void Patch(Harmony harmony, string typeName, string methodName, string patch, bool prefix) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown Type type = Type.GetType(typeName + ", Assembly-CSharp", throwOnError: false); MethodInfo methodInfo = ((type != null) ? AccessTools.Method(type, methodName, (Type[])null, (Type[])null) : null); if (methodInfo == null) { Log.LogWarning((object)(typeName + "." + methodName + " not found (game update?). This part of FastStartup is off.")); return; } HarmonyMethod val = new HarmonyMethod(typeof(Plugin).GetMethod(patch, BindingFlags.Static | BindingFlags.NonPublic)); if (prefix) { harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void SplashPrefix(object __instance) { if (_splashFailed) { return; } try { Type type = __instance.GetType(); if (_splashState == null) { _splashState = AccessTools.Field(type, "state"); } if (_splashStateSet == null) { _splashStateSet = AccessTools.Method(type, "StateSet", (Type[])null, (Type[])null); } if (_splashState == null || _splashStateSet == null) { _splashFailed = true; Log.LogWarning((object)"Splash screen not found as expected (game update?). It is not skipped."); return; } int num = Convert.ToInt32(_splashState.GetValue(__instance)); if (num == 1 || num == 2) { Type parameterType = _splashStateSet.GetParameters()[0].ParameterType; _splashStateSet.Invoke(__instance, new object[1] { parameterType.IsEnum ? Enum.ToObject(parameterType, 3) : ((object)3) }); } } catch (Exception ex) { _splashFailed = true; Log.LogWarning((object)("Skipping the splash screen failed, it is shown normally: " + ex.Message)); } } private static void MenuPostfix(object __instance) { //IL_0129: Unknown result type (might be due to invalid IL or missing references) MonoBehaviour val = (MonoBehaviour)((__instance is MonoBehaviour) ? __instance : null); if (val == null || !Object.op_Implicit((Object)(object)val)) { return; } try { Type type = __instance.GetType(); object obj = Get(type, "doIntroAnimation", __instance); if (!(obj is bool) || !(bool)obj) { return; } Set(type, "doIntroAnimation", __instance, false); string[] array = new string[2] { "introGroupLeft", "introGroupRight" }; foreach (string field in array) { object obj2 = Get(type, field, __instance); Object val2 = (Object)((obj2 is Object) ? obj2 : null); if (val2 != null && Object.op_Implicit(val2)) { Object.Destroy(val2); } Set(type, field, __instance, null); } object obj3 = Get(type, "menuPage", __instance); if (obj3 != null) { AccessTools.Field(obj3.GetType(), "interactionBlocked")?.SetValue(obj3, false); } array = new string[2] { "rectTransformLeft", "rectTransformRight" }; foreach (string field2 in array) { object obj4 = Get(type, field2, __instance); Transform val3 = (Transform)((obj4 is Transform) ? obj4 : null); if (val3 != null && Object.op_Implicit((Object)(object)val3)) { val3.localPosition = Vector3.zero; } } } catch (Exception ex) { Log.LogWarning((object)("Instant main menu failed, the normal intro may play: " + ex.Message)); } } private static void CameraPrefix(object __instance) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) if (_camFailed) { return; } Component val = (Component)((__instance is Component) ? __instance : null); if (val == null || !Object.op_Implicit((Object)(object)val)) { return; } try { Type type = __instance.GetType(); if (_camLerp == null) { _camLerp = AccessTools.Field(type, "introLerp"); } if (_camCurve == null) { _camCurve = AccessTools.Field(type, "introCurve"); } if (_camLerp == null || _camCurve == null) { _camFailed = true; Log.LogWarning((object)"Main menu camera not found as expected (game update?). The camera pan is not skipped."); } else if (!((float)_camLerp.GetValue(__instance) >= 1f)) { _camLerp.SetValue(__instance, 1f); object? value = _camCurve.GetValue(__instance); AnimationCurve val2 = (AnimationCurve)((value is AnimationCurve) ? value : null); float num = ((val2 != null) ? val2.Evaluate(1f) : 1f); val.transform.localEulerAngles = new Vector3(Mathf.LerpUnclamped(0f, -45f, num), 0f, 0f); } } catch (Exception ex) { _camFailed = true; Log.LogWarning((object)("Skipping the camera pan failed, it plays normally: " + ex.Message)); } } private static object Get(Type type, string field, object instance) { return AccessTools.Field(type, field)?.GetValue(instance); } private static void Set(Type type, string field, object instance, object value) { AccessTools.Field(type, field)?.SetValue(instance, value); } } }