Пример #1
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());
        }
Пример #2
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();
            try
            {
                SceneManager.sceneLoaded += OnSceneLoad;
            }
            catch (Exception ex) { MelonLogger.Error($"SceneManager.sceneLoaded override failed: {ex}"); }
            try
            {
                SceneManager.sceneUnloaded += OnSceneUnload;
            }
            catch (Exception ex) { MelonLogger.Error($"SceneManager.sceneUnloaded override failed: {ex}"); }
            return(new SupportModule_To());
        }
Пример #3
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());
        }