Advertisement
Guest User

Untitled

a guest
Jun 24th, 2015
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.45 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Diagnostics;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using Binarysharp.MemoryManagement;
  12. using Binarysharp.MemoryManagement.Helpers;
  13. using System.Runtime.InteropServices;
  14.  
  15. namespace WindowsFormsApplication1
  16. {
  17.  
  18.     public partial class Form1 : Form
  19.     {
  20.  
  21.         public Form1()
  22.         {
  23.             InitializeComponent();
  24.         }
  25.  
  26.  
  27.         private void Form1_Load(object sender, EventArgs e)
  28.         {
  29.             txtNetWorth.Text = GetMoney().ToString();
  30.         }
  31.  
  32.         public int GetMoney()
  33.         {
  34.             string gameName = "South Park - The Stick of Truth";
  35.             using (var m = new MemorySharp(ApplicationFinder.FromProcessName(gameName).FirstOrDefault()))
  36.             {
  37.  
  38.                 var moneyPtr = new IntPtr(0x01B71110);
  39.                 int[] offsets = { 0x0, 0x14, 0x14, 0x218 };
  40.                 moneyPtr = m[moneyPtr].Read<IntPtr>();
  41.                 moneyPtr = m[moneyPtr + offsets[0], false].Read<IntPtr>();
  42.                 moneyPtr = m[moneyPtr + offsets[1], false].Read<IntPtr>();
  43.                 moneyPtr = m[moneyPtr + offsets[2], false].Read<IntPtr>();
  44.                 int Money = m[moneyPtr + offsets[3], false].Read<int>();
  45.                 return Money;
  46.             }
  47.         }
  48.  
  49.         public bool SetMoney(int money)
  50.         {
  51.             string gameName = "South Park - The Stick of Truth";
  52.             using (var m = new MemorySharp(ApplicationFinder.FromProcessName(gameName).FirstOrDefault()))
  53.             {
  54.  
  55.                 var moneyPtr = new IntPtr(0x01B71110);
  56.                 int[] offsets = { 0x0, 0x14, 0x14, 0x218 };
  57.                 moneyPtr = m[moneyPtr].Read<IntPtr>();
  58.                 moneyPtr = m[moneyPtr + offsets[0], false].Read<IntPtr>();
  59.                 moneyPtr = m[moneyPtr + offsets[1], false].Read<IntPtr>();
  60.                 moneyPtr = m[moneyPtr + offsets[2], false].Read<IntPtr>();
  61.                 m.Write<int>(m[moneyPtr + offsets[3], false].Read<IntPtr>(), money, false);
  62.                 return true;
  63.             }
  64.         }
  65.  
  66.  
  67.         private void btnSubmit_Click(object sender, EventArgs e)
  68.         {
  69.             SetMoney(Convert.ToInt32(txtNetWorth.Text));
  70.         }
  71.  
  72.         private void txtNetWorth_TextChanged(object sender, EventArgs e)
  73.         {
  74.  
  75.         }
  76.  
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement