/// <summary>Called when the trainer needs to be detached from the game's process.</summary>
        private void DetachFromGame()
        {
            // Detach from the target process
            if (GameMemoryIO.IsAttached())
            {
                // If the game's process is still running, all cheats must be disabled
                if (GameMemoryIO.TargetProcess.HasExited == false)
                {
                    foreach (ECheat curCheat in Enum.GetValues(typeof(ECheat)))
                    {
                        SetCheatEnabled(curCheat, false);
                    }
                }

                // Release injected memory, cleanup and detach
                GameMemoryInjector.ResetAllocatedMemoryData();
                GameMemoryIO.DetachFromProcess();
            }

            // Reset all of the values of the DependencyProperty objects which represent injected variables
            foreach (KeyValuePair <DependencyProperty, EVariable> curPair in sm_dependencyPropertyToInjectedVariable)
            {
                // Retrieve the initial value of the injected variable
                DependencyProperty varDepProp = curPair.Key;
                EVariable          varID      = curPair.Value;

                FieldInfo enumeratorInfo           = typeof(EVariable).GetField(varID.ToString());
                VariableDefinitionAttribute varDef = enumeratorInfo.GetCustomAttribute <VariableDefinitionAttribute>();

                // Reset the variable back to its initial value
                this.SetValue(varDepProp, varDef.InitialValue);
            }
        }
Example #2
0
        /// <summary>Called when the trainer needs to be detached from the game's process.</summary>
        private void DetachFromGame()
        {
            // Detach from the target process
            if (GameMemoryIO.IsAttached())
            {
                // If the game's process is still running, all cheats must be disabled
                if (GameMemoryIO.TargetProcess.HasExited == false)
                {
                    foreach (ECheat curCheat in Enum.GetValues(typeof(ECheat)))
                    {
                        GameMemoryInjector.SetMemoryAlterationsActive(curCheat, false);
                    }
                }

                // Disable any manually-activated Memory Alteration
                DisableManuallyActivatedMemoryAlterations();

                // Release injected memory, cleanup and detach
                GameMemoryInjector.ResetAllocatedMemoryData();
                GameMemoryIO.DetachFromProcess();
            }

            // Restart the timer which looks for the game's process
            StartLookingForGameProcess();
        }
Example #3
0
        /// <summary>Called when the trainer needs to be detached from the game's process.</summary>
        private void DetachFromGame()
        {
            // Detach from the target process
            if (GameMemoryIO.IsAttached())
            {
                // If the game's process is still running, all cheats must be disabled
                if (GameMemoryIO.TargetProcess.HasExited == false)
                {
                    foreach (ECheat curCheat in Enum.GetValues(typeof(ECheat)))
                    {
                        GameMemoryInjector.SetMemoryAlterationsActive(curCheat, false);
                    }

                    m_memAlterationHPAddressTracker.SetEnabled(GameMemoryInjector, false);
                }

                // Release injected memory, cleanup and detach
                GameMemoryInjector.ResetAllocatedMemoryData();
                GameMemoryIO.DetachFromProcess();
            }
        }