Exemple #1
0
        private static int Initialize()
        {
            AppDomain curDomain = AppDomain.CurrentDomain;

            Fixes.UnhandledException.Install(curDomain);
            MelonUtils.Setup(curDomain);
            Assertions.LemonAssertMapping.Setup();

            if (!MonoLibrary.Setup() ||
                !MonoResolveManager.Setup())
            {
                return(1);
            }

            HarmonyInstance = new HarmonyLib.Harmony(BuildInfo.Name);

            Fixes.ForcedCultureInfo.Install();
            Fixes.InstancePatchFix.Install();
            Fixes.ProcessFix.Install();
            PatchShield.Install();

            MelonPreferences.Load();
            MelonLaunchOptions.Load();
            bHaptics.Load();

            MelonCompatibilityLayer.Setup();
            MelonCompatibilityLayer.SetupModules(MelonCompatibilityLayer.SetupType.OnPreInitialization);

            MelonHandler.LoadPlugins();
            MelonHandler.OnPreInitialization();

            return(0);
        }
Exemple #2
0
 public void SaveToFile(bool printmsg = true)
 {
     Preferences.IO.File currentfile = File;
     if (currentfile == null)
     {
         currentfile = MelonPreferences.DefaultFile;
     }
     foreach (MelonPreferences_Entry entry in Entries)
     {
         if (!(entry.DontSaveDefault && entry.GetValueAsString() == entry.GetDefaultValueAsString()) && entry.GetValueAsString() != null)
         {
             currentfile.InsertIntoDocument(Identifier, entry.Identifier, entry.Save());
         }
     }
     try
     {
         currentfile.Save();
     }
     catch (Exception ex)
     {
         MelonLogger.Error($"Error while Saving Preferences to {currentfile.FilePath}: {ex}");
         currentfile.WasError = true;
     }
     if (printmsg)
     {
         MelonLogger.Msg($"MelonPreferences Saved to {currentfile.FilePath}");
     }
     MelonHandler.OnPreferencesSaved();
 }
Exemple #3
0
        internal static int PreStart()
        {
            if (!MelonUtils.IsGameIl2Cpp())
            {
                GameVersionHandler.Setup();
            }

            MelonHandler.OnApplicationEarlyStart();

            if (MelonUtils.IsGameIl2Cpp())
            {
                if (MelonLaunchOptions.Core.EnableAssemblyGeneration)
                {
                    if (!Il2CppAssemblyGenerator.Run())
                    {
                        return(1);
                    }
                }

                HarmonyLib.Public.Patching.PatchManager.ResolvePatcher += HarmonyIl2CppMethodPatcher.TryResolve;

                GameVersionHandler.Setup();
            }

            return(0);
        }
Exemple #4
0
        internal static int Start()
        {
            if (!SupportModule.Initialize())
            {
                return(1);
            }

            AddUnityDebugLog();

            if (MelonLaunchOptions.Core.EnableBHapticsIntegration)
            {
                bHaptics.Start();
            }

            if (MelonLaunchOptions.Core.EnableCompatibilityLayers)
            {
                MelonCompatibilityLayer.SetupModules(MelonCompatibilityLayer.SetupType.OnApplicationStart);
            }

            MelonHandler.OnApplicationStart_Plugins();
            MelonHandler.LoadMods();
            MelonHandler.OnApplicationStart_Mods();

            MelonHandler.OnApplicationLateStart_Plugins();
            MelonHandler.OnApplicationLateStart_Mods();

            return(0);
        }
Exemple #5
0
        internal static void OnApplicationLateStart()
        {
            MelonHandler.OnApplicationLateStart_Plugins();
            MelonHandler.OnApplicationLateStart_Mods();

            MelonStartScreen.Finish();
        }
Exemple #6
0
        private static int Initialize()
        {
            Il2CppAssemblyGenerator.Load();
            bHaptics.Load();

            MelonHandler.LoadPlugins();
            MelonHandler.OnPreInitialization();

            return(0);
        }
Exemple #7
0
        private static int PreStart()
        {
            if (!MelonUtils.IsGameIl2Cpp())
            {
                GameVersionHandler.Setup();
            }

            MelonHandler.OnApplicationEarlyStart();

            return(MelonStartScreen.LoadAndRun(Il2CppGameSetup));
        }
Exemple #8
0
        internal static void Quit()
        {
            MelonHandler.OnApplicationQuit();
            MelonPreferences.Save();

            HarmonyInstance.UnpatchAll();
            bHaptics.Quit();

            MelonLogger.Flush();
            Fixes.QuitFix.Run();
        }
Exemple #9
0
 internal static void Quit()
 {
     MelonHandler.OnApplicationQuit();
     try { MelonPreferences.Save(); } catch (Exception ex) { MelonLogger.Error("MelonPreferences.Save Exception: " + ex.ToString()); MelonPreferences.WasError = true; }
     Harmony.HarmonyInstance.UnpatchAllInstances();
     try { bHaptics.Quit(); } catch (Exception ex) { MelonLogger.Error("bHaptics.Quit Exception: " + ex.ToString()); bHaptics.WasError = true; }
     MelonLogger.Flush();
     if (QuitFix())
     {
         System.Diagnostics.Process.GetCurrentProcess().Kill();
     }
 }
 public static void SaveConfig()
 {
     foreach (KeyValuePair <string, Dictionary <string, MelonPreference> > prefsInSection in prefs)
     {
         foreach (KeyValuePair <string, MelonPreference> pref in prefsInSection.Value)
         {
             pref.Value.Value = pref.Value.ValueEdited;
             ConfigFile.SetString(prefsInSection.Key, pref.Key, pref.Value.Value);
         }
     }
     MelonHandler.OnModSettingsApplied();
     MelonLogger.Log("Config Saved!");
 }
Exemple #11
0
 private static void Start()
 {
     if (!SupportModule.Initialize())
     {
         return;
     }
     AddUnityDebugLog();
     try { bHaptics.Start(); } catch (Exception ex) { MelonLogger.Error("bHaptics.Start Exception: " + ex.ToString()); bHaptics.WasError = true; }
     MelonHandler.OnApplicationStart_Plugins();
     MelonHandler.LoadMods();
     Main.LegacySupport();
     MelonHandler.OnApplicationStart_Mods();
 }
Exemple #12
0
        internal static void Quit()
        {
            MelonHandler.OnApplicationQuit();
            MelonPreferences.Save();

            HarmonyInstance.UnpatchAll();

            if (MelonLaunchOptions.Core.EnableBHapticsIntegration)
            {
                bHaptics.Quit();
            }

            Fixes.QuitFix.Run();
        }
Exemple #13
0
        internal static void Quit()
        {
            MelonHandler.OnApplicationQuit();
            MelonPreferences.Save();

            HarmonyInstance.UnpatchSelf();
            bHaptics.Quit();

            MelonLogger.Flush();

            if (MelonLaunchOptions.Core.QuitFix)
            {
                Process.GetCurrentProcess().Kill();
            }
        }
Exemple #14
0
        internal static int Initialize(ConfigFile configFile)
        {
            AppDomain curDomain = AppDomain.CurrentDomain;

            HarmonyInstance = new HarmonyLib.Harmony(BuildInfo.Name);

            if (MelonLaunchOptions.Core.EnableFixes)
            {
                Fixes.UnhandledException.Run(curDomain);
                Fixes.InvariantCurrentCulture.Install();
            }

            try { MelonUtils.Setup(); } catch (Exception ex) { MelonLogger.Error($"MelonUtils.Setup Exception: {ex}"); throw; }

            if (MelonLaunchOptions.Core.EnableFixes)
            {
                Fixes.ApplicationBase.Run(curDomain);
                Fixes.ExtraCleanup.Run();
            }

            MelonPreferences.Load();
            MelonLaunchOptions.Load(configFile);

            if (MelonLaunchOptions.Core.EnableCompatibilityLayers)
            {
                MelonCompatibilityLayer.Setup();
            }

            if (MelonLaunchOptions.Core.EnablePatchShield)
            {
                PatchShield.Install();
            }

            if (MelonLaunchOptions.Core.EnableBHapticsIntegration)
            {
                bHaptics.Load();
            }

            if (MelonLaunchOptions.Core.EnableCompatibilityLayers)
            {
                MelonCompatibilityLayer.SetupModules(MelonCompatibilityLayer.SetupType.OnPreInitialization);
            }

            MelonHandler.LoadPlugins();
            MelonHandler.OnPreInitialization();

            return(0);
        }
Exemple #15
0
        private static int PreStart()
        {
            MelonHandler.OnApplicationEarlyStart();

            if (!Il2CppAssemblyGenerator.Run())
            {
                return(1);
            }

            if (MelonUtils.IsGameIl2Cpp())
            {
                HarmonyLib.Public.Patching.PatchManager.ResolvePatcher += HarmonyIl2CppMethodPatcher.TryResolve;
            }

            return(0);
        }
Exemple #16
0
        private static int Start()
        {
            if (!SupportModule.Setup())
            {
                return(1);
            }

            AddUnityDebugLog();
            bHaptics.Start();

            MelonCompatibilityLayer.SetupModules(MelonCompatibilityLayer.SetupType.OnApplicationStart);
            MelonHandler.OnApplicationStart_Plugins();
            MelonHandler.LoadMods();
            MelonStartScreen.DisplayModLoadIssuesIfNeeded();

            MelonHandler.OnApplicationStart_Mods();

            return(0);
        }
Exemple #17
0
        private static int Start()
        {
            if (!SupportModule.Initialize())
            {
                return(1);
            }

            AddUnityDebugLog();
            bHaptics.Start();

            MelonHandler.OnApplicationStart_Plugins();

            MelonHandler.LoadMods();
            MelonHandler.OnApplicationStart_Mods();

            MelonHandler.OnApplicationLateStart_Plugins();
            MelonHandler.OnApplicationLateStart_Mods();

            return(0);
        }
Exemple #18
0
        private static int Start()
        {
            bHaptics.Start();

            MelonHandler.OnApplicationStart_Plugins();
            MelonHandler.LoadMods();
            MelonHandler.OnPreSupportModule();

            if (!SupportModule.Setup())
            {
                return(1);
            }

            if (MelonUtils.IsGameIl2Cpp())
            {
                HarmonyLib.Public.Patching.PatchManager.ResolvePatcher += HarmonyIl2CppMethodPatcher.TryResolve;
            }
            MelonCompatibilityLayer.SetupModules(MelonCompatibilityLayer.SetupType.OnApplicationStart);
            AddUnityDebugLog();
            MelonHandler.OnApplicationStart_Mods();
            //MelonStartScreen.DisplayModLoadIssuesIfNeeded();

            return(0);
        }
Exemple #19
0
 private static int PreStart()
 {
     MelonHandler.OnApplicationEarlyStart();
     return(MelonStartScreen.LoadAndRun(Il2CppGameSetup));
 }
Exemple #20
0
 private static void Initialize()
 {
     MelonHandler.LoadPlugins();
     Main.LegacySupport();
     MelonHandler.OnPreInitialization();
 }
Exemple #21
0
 public void VRChat_OnUiManagerInit() => MelonHandler.VRChat_OnUiManagerInit();
 public void OnSceneWasUnloaded(int buildIndex, string sceneName) => MelonHandler.OnSceneWasUnloaded(buildIndex, sceneName);
 public void OnSceneWasInitialized(int buildIndex, string sceneName) => MelonHandler.OnSceneWasInitialized(buildIndex, sceneName);
 public void BONEWORKS_OnLoadingScreen() => MelonHandler.BONEWORKS_OnLoadingScreen();
 public void OnGUI() => MelonHandler.OnGUI();
 public void LateUpdate() => MelonHandler.OnLateUpdate();
 public void FixedUpdate() => MelonHandler.OnFixedUpdate();
 public void Update() => MelonHandler.OnUpdate();