示例#1
0
 private void RestoreSettingsButton_Click(object sender, EventArgs e)
 {
     current = saved;
     for (int i = 0; i < Program.offsets.Count; i++)
     {
         // Booleans
         if (i == 0 || i == 2 || i == 12)
         {
             byte newValue = 0;
             newValue = (byte)current.settings[i];
             ProcAPI.WriteProcessMemory(Program.hProc, ProcAPI.FindDMAAddy(Program.hProc, Program.dynamicPtrBaseAddr, Program.offsets[i].ToArray()), newValue, 1, out _);
         }
         // Floats
         else if (i >= 6 && i <= 9)
         {
             float newValue = 0;
             newValue = (float)current.settings[i];
             ProcAPI.WriteProcessMemory(Program.hProc, ProcAPI.FindDMAAddy(Program.hProc, Program.dynamicPtrBaseAddr, Program.offsets[i].ToArray()), newValue, 4, out _);
         }
         // Integers
         else
         {
             int newValue = 0;
             newValue = (int)current.settings[i];
             ProcAPI.WriteProcessMemory(Program.hProc, ProcAPI.FindDMAAddy(Program.hProc, Program.dynamicPtrBaseAddr, Program.offsets[i].ToArray()), newValue, 4, out _);
         }
     }
 }
示例#2
0
 private void ChangeGameSettingsButton_Click(object sender, EventArgs e)
 {
     // Float values
     if (GameSettingsComboBox.SelectedIndex >= 6 && GameSettingsComboBox.SelectedIndex <= 9)
     {
         float newValue = (float)GameSettingsValue.Value;
         ProcAPI.WriteProcessMemory(Program.hProc, ProcAPI.FindDMAAddy(Program.hProc, Program.dynamicPtrBaseAddr, Program.offsets[GameSettingsComboBox.SelectedIndex].ToArray()), newValue, 4, out _);
         current.settings[GameSettingsComboBox.SelectedIndex] = newValue;
     }
     // Boolean values
     else if (GameSettingsComboBox.SelectedIndex == 0 || GameSettingsComboBox.SelectedIndex == 2 || GameSettingsComboBox.SelectedIndex == 12)
     {
         byte newValue = (byte)GameSettingsValue.Value;
         ProcAPI.WriteProcessMemory(Program.hProc, ProcAPI.FindDMAAddy(Program.hProc, Program.dynamicPtrBaseAddr, Program.offsets[GameSettingsComboBox.SelectedIndex].ToArray()), newValue, 1, out _);
         current.settings[GameSettingsComboBox.SelectedIndex] = newValue;
     }
     // Integer values
     else
     {
         int newValue = (int)GameSettingsValue.Value;
         ProcAPI.WriteProcessMemory(Program.hProc, ProcAPI.FindDMAAddy(Program.hProc, Program.dynamicPtrBaseAddr, Program.offsets[GameSettingsComboBox.SelectedIndex].ToArray()), newValue, 4, out _);
         current.settings[GameSettingsComboBox.SelectedIndex] = newValue;
     }
 }