private static void HookBeforeResourcesPacking()
        {
            if (!ACTkSettings.Instance.InjectionDetectorEnabled ||
                !InjectionRoutines.IsInjectionPossible())
            {
                return;
            }

            if (EditorApplication.isPlayingOrWillChangePlaymode ||
                hookBeforeResourcesPackingExecuted ||
                hookBeforeResourcesPackingError ||
                !BuildPipeline.isBuildingPlayer)
            {
                return;
            }

            try
            {
                hookBeforeResourcesPackingExecuted = true;
                EditorApplication.LockReloadAssemblies();

                InjectionWhitelistBuilder.GenerateWhitelist();
            }
            catch (Exception e)
            {
                Debug.LogError(ACTkConstants.LogPrefix + "Error at HookBeforeResourcesPacking:\n" + e);
                hookBeforeResourcesPackingError = true;
            }
            finally
            {
                EditorApplication.UnlockReloadAssemblies();
            }
        }
Exemple #2
0
        private static void OnHierarchyChanged()
        {
            if (!injectionValidated && !ACTkSettings.Instance.DisableInjectionDetectorValidation)
            {
                var instance = InjectionDetector.Instance;
                if (instance != null)
                {
                    if (InjectionRoutines.IsInjectionPossible())
                    {
                        if (!ACTkSettings.Instance.InjectionDetectorEnabled)
                        {
                            var result = EditorUtility.DisplayDialogComplex("Anti-Cheat Toolkit Validation",
                                                                            "ACTk noticed you're using Injection Detector but you have build detection support disabled.\n" +
                                                                            "Injection Detector needs it enabled in order to work properly.\nWould you like to enable it now?",
                                                                            "Yes", "Open Settings", "No, never ask again");

                            if (result == 0)
                            {
                                ACTkSettings.Instance.InjectionDetectorEnabled = true;
                            }
                            else if (result == 1)
                            {
                                ACTkSettings.Show();
                                return;
                            }
                            else
                            {
                                ACTkSettings.Instance.DisableInjectionDetectorValidation = true;
                            }
                        }
                    }
                }
                injectionValidated = true;
            }

            if (!wallhackValidated && !ACTkSettings.Instance.DisableWallhackDetectorValidation)
            {
                var instance = WallHackDetector.Instance;
                if (instance != null && instance.CheckWireframe)
                {
                    if (!SettingsGUI.IsWallhackDetectorShaderIncluded())
                    {
                        var result = EditorUtility.DisplayDialog("Anti-Cheat Toolkit Validation",
                                                                 "ACTk noticed you're using Wallhack Detector with Wireframe option enabled but you have no required shader added" +
                                                                 " to the Always Included Shaders.\n" +
                                                                 "Would you like to exit Play Mode and open Settings to include it now?",
                                                                 "Yes", "No, never ask again");

                        if (result)
                        {
                            EditorApplication.isPlaying = false;
                            ACTkSettings.Show();
                        }
                        else
                        {
                            ACTkSettings.Instance.DisableWallhackDetectorValidation = true;
                        }
                    }
                }
                wallhackValidated = true;
            }
        }