Exemple #1
0
 private static ISupportModule_To Initialize(ISupportModule_From interface_from)
 {
     Interface = interface_from;
     UnityMappers.RegisterMappers();
     SM_Component.Create();
     return(new SupportModule_To());
 }
Exemple #2
0
        private static ISupportModule_To Initialize(ISupportModule_From interface_from)
        {
            Interface = interface_from;
            UnityMappers.RegisterMappers();

            LogSupport.RemoveAllHandlers();
            if (MelonDebug.IsEnabled())
            {
                LogSupport.InfoHandler += MelonLogger.Msg;
            }
            LogSupport.WarningHandler += MelonLogger.Warning;
            LogSupport.ErrorHandler   += MelonLogger.Error;
            if (MelonDebug.IsEnabled())
            {
                LogSupport.TraceHandler += MelonLogger.Msg;
            }

            ClassInjector.Detour = new UnhollowerDetour();
            UnityVersionHandler.Initialize(
                InternalUtils.UnityInformationHandler.EngineVersion.Major,
                InternalUtils.UnityInformationHandler.EngineVersion.Minor,
                InternalUtils.UnityInformationHandler.EngineVersion.Build);

            if (MelonLaunchOptions.Console.CleanUnityLogs)
            {
                ConsoleCleaner();
            }

            try
            {
                SceneManager.sceneLoaded = (
                    (ReferenceEquals(SceneManager.sceneLoaded, null))
                    ? new Action <Scene, LoadSceneMode>(OnSceneLoad)
                    : Il2CppSystem.Delegate.Combine(SceneManager.sceneLoaded, (UnityAction <Scene, LoadSceneMode>) new Action <Scene, LoadSceneMode>(OnSceneLoad)).Cast <UnityAction <Scene, LoadSceneMode> >()
                    );
            }
            catch (Exception ex) { MelonLogger.Error($"SceneManager.sceneLoaded override failed: {ex}"); }

            try
            {
                SceneManager.sceneUnloaded = (
                    (ReferenceEquals(SceneManager.sceneUnloaded, null))
                    ? new Action <Scene>(OnSceneUnload)
                    : Il2CppSystem.Delegate.Combine(SceneManager.sceneUnloaded, (UnityAction <Scene>) new Action <Scene>(OnSceneUnload)).Cast <UnityAction <Scene> >()
                    );
            }
            catch (Exception ex) { MelonLogger.Error($"SceneManager.sceneUnloaded override failed: {ex}"); }

            MonoEnumeratorWrapper.Register();

            ClassInjector.RegisterTypeInIl2Cpp <SM_Component>();
            SM_Component.Create();
            unhollower = new UnhollowerInterface();
            Interface.SetUnhollowerSupportInterface(unhollower);
            HarmonyLib.Public.Patching.PatchManager.ResolvePatcher += HarmonyMethodPatcher.TryResolve;

            return(new SupportModule_To());
        }
Exemple #3
0
 private static void OnSceneLoad(Scene scene, LoadSceneMode mode)
 {
     if (obj == null)
     {
         SM_Component.Create();
     }
     if (!scene.Equals(null))
     {
         Interface.OnSceneWasLoaded(scene.buildIndex, scene.name);
     }
 }
Exemple #4
0
        private static ISupportModule_To Initialize(ISupportModule_From interface_from)
        {
            Interface = interface_from;

            string game_version = ApplicationHandler.GetVersion();

            MelonLogger.Msg($"Game Version: {((game_version != null) ? game_version : "UNKNOWN")}");
            SetDefaultConsoleTitleWithGameName(game_version);

            UnityMappers.RegisterMappers();

            SM_Component.Create();
            return(new SupportModule_To());
        }
Exemple #5
0
        private static ISupportModule_To Initialize(ISupportModule_From interface_from)
        {
            Interface = interface_from;
            UnityMappers.RegisterMappers();

            if (IsUnity53OrLower())
            {
                SM_Component.Create();
            }
            else
            {
                SceneHandler.Init();
            }

            return(new SupportModule_To());
        }
Exemple #6
0
        private static ISupportModule_To Initialize(ISupportModule_From interface_from)
        {
            Interface = interface_from;
            UnityMappers.RegisterMappers();

            LogSupport.RemoveAllHandlers();
            if (MelonDebug.IsEnabled())
            {
                LogSupport.InfoHandler += MelonLogger.Msg;
            }
            LogSupport.WarningHandler += MelonLogger.Warning;
            LogSupport.ErrorHandler   += MelonLogger.Error;
            if (MelonDebug.IsEnabled())
            {
                LogSupport.TraceHandler += MelonLogger.Msg;
            }

            ClassInjector.Detour = new UnhollowerDetour();
            InitializeUnityVersion();

            if (MelonLaunchOptions.Console.CleanUnityLogs)
            {
                ConsoleCleaner();
            }

            try
            {
                SceneManager.sceneLoaded = (
                    (ReferenceEquals(SceneManager.sceneLoaded, null))
                    ? new Action <Scene, LoadSceneMode>(OnSceneLoad)
                    : Il2CppSystem.Delegate.Combine(SceneManager.sceneLoaded, (UnityAction <Scene, LoadSceneMode>) new Action <Scene, LoadSceneMode>(OnSceneLoad)).Cast <UnityAction <Scene, LoadSceneMode> >()
                    );
            }
            catch (Exception ex) { MelonLogger.Error($"SceneManager.sceneLoaded override failed: {ex}"); }

            try
            {
                SceneManager.sceneUnloaded = (
                    (ReferenceEquals(SceneManager.sceneUnloaded, null))
                    ? new Action <Scene>(OnSceneUnload)
                    : Il2CppSystem.Delegate.Combine(SceneManager.sceneUnloaded, (UnityAction <Scene>) new Action <Scene>(OnSceneUnload)).Cast <UnityAction <Scene> >()
                    );
            }
            catch (Exception ex) { MelonLogger.Error($"SceneManager.sceneUnloaded override failed: {ex}"); }

            /*
             * try
             * {
             *  Camera.onPostRender = (
             *      (Camera.onPostRender == null)
             *      ? new Action<Camera>(OnPostRender)
             *      : Il2CppSystem.Delegate.Combine(Camera.onPostRender, (Camera.CameraCallback)new Action<Camera>(OnPostRender)).Cast<Camera.CameraCallback>()
             *      );
             * }
             * catch (Exception ex) { MelonLogger.Error($"Camera.onPostRender override failed: {ex}"); }
             */

            MonoEnumeratorWrapper.Register();

            ClassInjector.RegisterTypeInIl2Cpp <SM_Component>();
            SM_Component.Create();
            return(new SupportModule_To());
        }
Exemple #7
0
        private static ISupportModule_To Initialize(ISupportModule_From interface_from)
        {
            Interface = interface_from;

            string game_version = ApplicationHandler.GetVersion();

            if (string.IsNullOrEmpty(game_version) || game_version.Equals("0"))
            {
                game_version = ApplicationHandler.GetBuildGUID();
            }

            MelonLogger.Msg($"Game Version: {game_version}");
            SetDefaultConsoleTitleWithGameName(game_version);
            UnityMappers.RegisterMappers();

            LogSupport.RemoveAllHandlers();
            if (MelonDebug.IsEnabled())
            {
                LogSupport.InfoHandler += MelonLogger.Msg;
            }
            LogSupport.WarningHandler += MelonLogger.Warning;
            LogSupport.ErrorHandler   += MelonLogger.Error;
            if (MelonDebug.IsEnabled())
            {
                LogSupport.TraceHandler += MelonLogger.Msg;
            }

            ClassInjector.Detour = new UnhollowerDetour();
            InitializeUnityVersion();
            ConsoleCleaner();

            try
            {
                SceneManager.sceneLoaded = (
                    (SceneManager.sceneLoaded == null)
                    ? new Action <Scene, LoadSceneMode>(OnSceneLoad)
                    : Il2CppSystem.Delegate.Combine(SceneManager.sceneLoaded, (UnityAction <Scene, LoadSceneMode>) new Action <Scene, LoadSceneMode>(OnSceneLoad)).Cast <UnityAction <Scene, LoadSceneMode> >()
                    );
            }
            catch (Exception ex) { MelonLogger.Error($"SceneManager.sceneLoaded override failed: {ex}"); }

            try
            {
                SceneManager.sceneUnloaded = (
                    (SceneManager.sceneUnloaded == null)
                    ? new Action <Scene>(OnSceneUnload)
                    : Il2CppSystem.Delegate.Combine(SceneManager.sceneUnloaded, (UnityAction <Scene>) new Action <Scene>(OnSceneUnload)).Cast <UnityAction <Scene> >()
                    );
            }
            catch (Exception ex) { MelonLogger.Error($"SceneManager.sceneUnloaded override failed: {ex}"); }

            try
            {
                Camera.onPostRender = (
                    (Camera.onPostRender == null)
                    ? new Action <Camera>(OnPostRender)
                    : Il2CppSystem.Delegate.Combine(Camera.onPostRender, (Camera.CameraCallback) new Action <Camera>(OnPostRender)).Cast <Camera.CameraCallback>()
                    );
            }
            catch (Exception ex) { MelonLogger.Error($"Camera.onPostRender override failed: {ex}"); }

            ClassInjector.RegisterTypeInIl2Cpp <SM_Component>();
            SM_Component.Create();
            return(new SupportModule_To());
        }