using System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using SkipLaunchMode.Patches; using SkipLaunchMode.Utils; using UnityEngine; 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("SkipLaunchMode")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SkipLaunchMode")] [assembly: AssemblyTitle("SkipLaunchMode")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 SkipLaunchMode { [BepInPlugin("dev.zag.SkipLaunchMode", "SkipLaunchMode", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string modGUID = "dev.zag.SkipLaunchMode"; public const string modName = "SkipLaunchMode"; public const string modVersion = "1.0.0"; private static Harmony _harmony = new Harmony("dev.zag.SkipLaunchMode"); internal static ManualLogSource mls = Logger.CreateLogSource("dev.zag.SkipLaunchMode"); private void Awake() { mls.LogInfo((object)"Loading SkipLaunchMode"); ModConfig.allConfigs(((BaseUnityPlugin)this).Config); patchAllStuff(); } private static void patchAllStuff() { _harmony.PatchAll(typeof(PreInitSceneScriptPatch)); } } public static class PluginInfo { public const string PLUGIN_GUID = "SkipLaunchMode"; public const string PLUGIN_NAME = "SkipLaunchMode"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace SkipLaunchMode.Utils { internal class ModConfig { private static bool printConfigs = true; public static ConfigEntry startInOnlineMode; public static void allConfigs(ConfigFile cfg) { startInOnlineMode = cfg.Bind("General", "Start in Online Mode", true, (ConfigDescription)null); if (printConfigs) { printConfig(); } } private static void printConfig() { Plugin.mls.LogInfo((object)$"Start in Online Mode: {startInOnlineMode.Value}"); } } } namespace SkipLaunchMode.Patches { [HarmonyPatch(typeof(PreInitSceneScript))] internal class PreInitSceneScriptPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(PreInitSceneScript __instance) { ((MonoBehaviour)__instance).StartCoroutine(LoadSceneDelayed()); } private static IEnumerator LoadSceneDelayed() { yield return (object)new WaitForSeconds(2f); if (ModConfig.startInOnlineMode.Value) { SceneManager.LoadScene("InitScene"); } else { SceneManager.LoadScene("InitSceneLANMode"); } } [HarmonyPatch("SetLaunchPanelsEnabled")] [HarmonyPrefix] private static bool SetLaunchPanelsEnabledPatch() { return false; } } }