Tutorial Types and their impact

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Boboo99

Scrub
Dank Tier VIP
Fleep Tier Donator
Feb 20, 2016
470
12,178
44
Hey guys,
as I was talking with some guy in discord a few days ago, I kind of noticed that some people aren't quite trough the types of variables and their impact on the memory,that's what it should be about today.

First off all you should know each variable has a certain size, it might differ from compiler to compiler but in general:
TypeSize in bytes
bool1
char1
short2
int4
float4
long4
double8
long long8

So the question is how can be this useful?

If you create structs which should be directly casted from the memory:
C++:
typedef struct someStruct
{
	char pad0[4]; // 4 x 1 byte = 4 bytes
	long long value; // 8 bytes
	char pad1[12]; // 12 x 1 byte = 12 bytes
	float vec[3]; //3 x 4byte = 12 bytes
	int pad2[16]; //16 x 4 bytes = 64 bytes
};

someStruct* whatever = (someStruct*)(0xFFFFF);
So you can calculate the size of the struct and apply the right padding in it.


2.Getting the adresses of variables. Imagine after a loooong time of searching you finally found the offset for the y-coord in your game. Now you have to get the x-coords and the z-coords again.

We can do it easier, as we know the coordinates are mostly stored behind each other like this:


As we know the x,y,z are usually float and they have the size of 4 bytes, this would mean that x would have to be located at the position 4 bytes before y, because x takes up 4 bytes. Z would be located 4 bytes behind y because y is a float and it takes up 4 bytes too.

In our example:


We just saved the long work of finding 2 more adresses by just using our knowledge about the size of types :FeelsGoodMan:

This should be everything for today :)

Good luck have fun and be 1337 :bicepright:
 

Traxin

Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
1,041
25,378
154
Everybody NEEDS to know this stuff. Please...

Thanks for the write-up!
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods