Advertisement
Guest User

MemMod.cpp

a guest
Jun 6th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h> // For Sleep & data types
  3. #include "ProcessModder.h"
  4. using namespace std;
  5.  
  6. const char windowName[] = "Brood War";
  7.  
  8. void ZeroScTimer(ProcessModder &process);
  9.  
  10. int main()
  11. {
  12. ProcessModder process;
  13.  
  14. while ( true )
  15. {
  16. cout << "Waiting for process..." << endl;
  17.  
  18. while ( !process.isOpen() ) // While process isn't open
  19. // Try to open the process
  20. {
  21. if ( process.openWithWindowName(windowName) )
  22. cout << "Process opened successfully." << endl;
  23. else
  24. Sleep(500);
  25. // Sleep a fair amount of time upon failure to prevent notable CPU usage.
  26. }
  27.  
  28. while ( process.isOpen() ) // While process is open
  29. // Do w/e you want to it
  30. {
  31. ZeroScTimer(process);
  32. }
  33.  
  34. cout << "Process closed." << endl;
  35. Sleep(1000); // Aesthetics
  36. }
  37.  
  38. return 0;
  39. }
  40.  
  41. void ZeroScTimer(ProcessModder &process)
  42. {
  43. UINT countdown = 0;
  44. if ( process.readMem<UINT>(0x0066FBFC, countdown) && countdown > 1 ) // Check if start game countdown timer > 1
  45. {
  46. if ( process.writeMem<UINT>(0x0066FBFC, 1) ) // Set it to 1 if it's above that
  47. cout << "Timer zero'd successfully." << endl;
  48. else
  49. cout << "Timer could not be zero'd." << endl;
  50. }
  51.  
  52. Sleep(1); // Sleep a little to prevent notable CPU usage
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement