C# Memory - Tutorial
C# Memory Tutorial
Learn how to make a cheat/trainer using the power of c#!
Why use C# language to create a cheat like this?
The joys of C# is that it is easy to understand. It's like of like C# is the big brother for Visual Basic.Most cheats tend to use SDK and C++ to create cheats but I'd recommend getting use the the C language in general! If you have experience in coding then the process of learning C# will be smooth.
You have a greater chance of learning c# quicker if you have experience of java or javascript. If your like me, who was all for visual basic then it can take a while!
Why no use C++ like everyone else is using?
It's all down to how you like the language, I don't mind C++ but Reverse Engineering doesn't seem to work for me with C++. I've retried different methods of getting C++ to work but it seems that C++ isn't working for me, so you're stuck with me in C#. :)
C++ or C#? What do you recommend?
What ever your comfortable coding with really. You can create external cheats with both but when it comes to internal, C++ takes the trophy for it. C# sadly doesn't have the library usage to make a working .dll. It can be possible with C#, but it will take years of learning C# inside out!
LET'S START!
Please note that this just explains the logical way of seeing how this cheat works, in order for you to learn it, you need to code it yourself.
Address - How do I lay them out?!
First of all you'll need to learn the basics of an address... My tutorial gives most of the information away but here is some details you'll need to understand to work this the logical way.
Public [Static/Const] [Data_Type]:
Don't panic! Lets take it brick by brick:
Static is used when it's a value changes more than once. For example it can be used for the incrosshair variable. Since the game updates very few ticks, we need to let the cheat know what state the variable is in, if not then your gun will keep shooting or not shoot at all when executing the programme. Things like Health, Gun Ammo, Team ID will require you to use static.
Const means constant. This is used when you know the value will never change. Const will be used for the offset class since the offset will never change while in game, it is fixed.
For Data_Type, You can use String (Text), Boolean (True or False), Int/Int32(Number) and Float(10.000)
For the offset class it's best to go for the Int32 since it's a hex number, you can just use int but it comes handy! (Lets say offset is CS.exe+4E90, the offset will be 0x4E90)
Okay, thanks for that... but, How do I code it?
It's simple, first make sure you see the video on how to make the memory hook onto the game and see how the memory class hooks a DllAdressImage (Client.dll or Server.dll)
Let's say you've found your static value for health. It's "JamesIsCool.exe"+5940. Since the module is their (The exe is the base main) it will always be the correct value until the RAM changes the address to this info.
So let's now add it to our custom class file!
Static Const Int32 healthoffset= 0x5940; <- This would be in your offset file, but its on here for an visual example.
You would declare your mem attach process and modules (client.dll) for this example lets just say the it's a client module!
Static void LetsRektThemWithMachineCode()
{
int MyHealth = mem.ReadInt(Client + healthoffset);
Debug.Writeline("Hey, your health is: " & MyHealth); <- need to be using System.Diagnostics for this to work!
}
Output: Hey, your health is: 100
YES! Thank you, but my EntityLoop address has an extra offset on top of that, help?
Ah, you mean a Pointer Address? No panic, it is simpler than it looks!
Yes, it looks scary, but this is the nearest best to explaining it without going full logical!
Okay, good to know. Uhm, what next?
Firstly, Take that heavy bag of coding books off your head! I never knew it was on your head the whole time! You're out of the radar now, you're freeeeeee!
That's most of the parts of the video I have not went into full detail. All you need to do is learn how thread works and away you go!
I am planning to make more videos on C# in general, so stay tuned for more!
~ James