Esempio n. 1
0
        public static HookRegistry Get()
        {
            if (_instance == null)
            {
                _instance = new HookRegistry();
                // Initialise the assembly store.
                _instance.Init();

                // Setup all hook information.
                _instance.LoadRuntimeHooks();

                // Pre-load necessary library files.
                ReferenceLoader.Load();

                try
                {
                    // Test if this code is running within the Unity Engine
                    _instance.TestInGame();
                }
                catch (SecurityException)
                {
                    // Do nothing
                }
            }
            return(_instance);
        }
Esempio n. 2
0
        public static HookRegistry Get(bool initDynamicCalls = true)
        {
            if (_instance == null)
            {
                _instance = new HookRegistry();
                // Initialise the assembly store.
                _instance.Init();

                // When loading assemblies, they are writelocked. By defering this initialisation we can still write to
                // all game assemblies while hooking.
                if (initDynamicCalls == true)
                {
                    // Load assembly data for dynamic calls
                    _instance.PrepareDynamicCalls();
                }
                // Setup all hook information
                _instance.LoadRuntimeHooks(initDynamicCalls);
            }
            return(_instance);
        }
Esempio n. 3
0
        public static HookRegistry Get()
        {
            if (_instance == null)
            {
                lock (_initLock)
                {
                    // We need a double check because hooking async methods can cause race issues.
                    if (_instance == null)
                    {
                        _instance = new HookRegistry
                        {
                            // Test if we're running inside the unity player.
                            _isWithinUnity = IsWithinUnity()
                        };

                        _instance.Init();
                    }
                }
            }

            return(_instance);
        }