/// <summary>Called whenever any of the CheckBoxes used to activate/deactivate cheats from the trainer gets checked or unchecked.</summary> /// <param name="sender">Object which sent the event.</param> /// <param name="e">Arguments from the event.</param> private void CheckBoxCheatToggled(object sender, RoutedEventArgs e) { if (GameMemoryIO.IsAttached()) { UpdateBitmasksInGameMemory(); } }
/// <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(); }
/// <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); } }
/// <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(); } }
/// <summary> /// Called whenever any of the CheckBoxes used to activate/deactivate cheats from the trainer gets checked or unchecked. /// </summary> /// <param name="sender">Object which sent the event.</param> /// <param name="e">Arguments from the event.</param> private void CheckBoxCheatToggled(object sender, RoutedEventArgs e) { // Retrieve information which will be used to enable or disable the cheat CheckBox chkBox = (CheckBox)e.Source; ECheat cheatID = (ECheat)chkBox.Tag; bool bEnableCheat = (chkBox.IsChecked == true); // Update the list of cheats to be enabled if (bEnableCheat) { m_enabledCheats.Add(cheatID); } else { m_enabledCheats.Remove(cheatID); } // Enable or disable the cheat in the game's memory space if (GameMemoryIO.IsAttached()) { GameMemoryInjector.SetMemoryAlterationsActive(cheatID, bEnableCheat); } }