Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```csharp
- namespace ePSXe_DragonBallZ
- {
- public partial class Main : Form
- {
- //These are just variables i am establishing before proceeding with the code and functions
- private const string PROCESSNAME = "ePSXe";
- public static MemorySharp m = new MemorySharp(Process.GetProcessesByName(PROCESSNAME).First());
- bool gameRunning;
- /The main event for our program. This will initialise the form UI
- public Main()
- {
- //This initializes our form with all of our elements
- //Possibly in the past , you would have to fill this out yourself. However in 2021 this is all done with the visual form
- editor
- //Basically , never touch this.
- InitializeComponent();
- }
- //This is a timer (or thread) the code inside this timer will get executed every tick of the timer.
- //Think of tick as in a tick on a clock. You set the timer in ms. (2500ms would be every 2.5seconds there will be a tick event to execute everything within
- private void ProcessTimer_Tick(object sender, EventArgs e)
- {
- //This is what gets the handle to our process and lets read and write process memory
- Process[] ePSXe = Process.GetProcessesByName(PROCESSNAME);
- //This is an if statement, if the process is running. Remember , PROCESSNAME was defined earlier as the string "ePSXe.exe"
- if (ePSXe.Length 0)
- {
- ProcessPanel.BackColor = Color.FromArgb(0, 169, 0);
- REFLECT(); //Here we are calling one of our functions , puase here and go check it out
- gameRunning = true; //Youll notice a lot of my events have a "if (!gameRunning)" statement. This should only ever return true while the process is running
- return; //We return because we do not want to continue executing anything outside of scope, the process is running. anything else in this timer would require the process to not be running. If we dont return , we will just continue and say gameRunning = false
- }
- ProcessPanel.BackColor = Color.FromArgb(169, 0, 0);
- gameRunning = false;
- }
- private void MemoryTimer_Tick(object sender, EventArgs e)
- {
- if (!gameRunning)
- {
- return;
- }
- if (Reflect_Checkbox.Checked)
- {
- //I will share this with you after you understand what is taking place in this document
- Functions.HACK();
- }
- }
- private void REFLECT()
- {
- //Before looking to much at this , first think back to the video. Remember what the form looked like? P1 health and Ki , p2 health and ki ...
- //This is how that information is obtained , that is all we do here.
- //Lets establish some variables
- Byte P1HP = m["ePSXe.exe"].Read<byte(gData.P1_HP);
- Byte P1KI = m["ePSXe.exe"].Read<byte(gData.P1_KI);
- Byte P2HP = m["ePSXe.exe"].Read<byte(gData.P2_HP);
- Byte P2KI = m["ePSXe.exe"].Read<byte(gData.P2_KI);
- //Lets establish some labels
- Player1Health_Label.Text = "HP: " + P1HP;
- Player1Ki_Label.Text = "KI: " + P1KI;
- Player2Health_label.Text = "HP: " + P2HP;
- Player2Ki_Label.Text = "KI: " + P2KI;
- }
- }
- }
- ```
Advertisement
Add Comment
Please, Sign In to add comment