View previous topic :: View next topic |
Author |
Message |
Beginner How do I cheat? Reputation: 0
Joined: 07 May 2017 Posts: 3
|
Posted: Sun May 07, 2017 7:38 am Post subject: Can't translate base address |
|
|
Hello, I can't find a way to get my pointer in C#
This is what I have in CheatEngine :
URL to image (not allowed to post URL yet) [WWW] puu.sh / vIsDE / 2a2214916a.png
This is my code for now :
Code: |
//Getting process base address
IntPtr baseAddress = Processes[0].MainModule.BaseAddress;
long offAdd = 0x01348828;
long offset = 0x12C201E8160180;
long p = Memory.BaseModule.ToInt64() + offAdd + offset;
Console.WriteLine(p.ToString("X")); |
'p' is different from my pointer address in CE.
I'm a complete beginner in this kind of stuff.
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sun May 07, 2017 8:08 am Post subject: |
|
|
That's because you can't just concatenate all of the offsets together into one, each time you add an offset you have to read the address at that location and then use that when adding the next (that's why [1E5895468C8+180] is 1E5895E9A98 instead of 1E589546A48). Note I don't know C# so I'll just write some pseudo-code
eg.
Code: | address = readPointer(readPointer(readPointer(readPointer(readPointer(baseAddress+0x01348828)+180)+160)+1E8)+20)+12C
value = readCorrectType(address) |
Typically you'd have an array and a function to calculate the address based on the base address and that array using a loop, but the basic array/loop idea is something like this:
Code: | offsets = [ 0x01348828, 180, 160, 1E8, 20, 12C ]
address = baseAddress
for (int i = 0; i < offsets.length - 1; i++) { // skip the last
address = readPointer(address + offsets[i])
}
address += offsets[offsets.length - 1] // add the last offset
// now read the value from address as necessary (int32, int64, float etc.)
|
|
|
Back to top |
|
|
Beginner How do I cheat? Reputation: 0
Joined: 07 May 2017 Posts: 3
|
Posted: Sun May 07, 2017 10:46 am Post subject: |
|
|
Thanks for the help ! Much appreciated ! But yet, it doesn't work.
This is my code now :
Code: |
long[] offsets = { 0x01348828, 0x180, 0x160, 0x1E8, 0x20, 0x12C };
long address = Memory.BaseModule.ToInt64();
for (int i = 0; i < offsets.Length - 1; i++)
address = Memory.ReadInt64(address + offsets[i]);
address += offsets[offsets.Length - 1]; // add the last offset
//now read the value from address as necessary (int32, int64, float etc.)
Console.WriteLine(Memory.ReadInt64(address));
Console.ReadLine();
|
The returned value is still wrong :/
EDIT: Did you checked the image ? I'm not sure if my offsets in the post are correct.
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sun May 07, 2017 11:17 am Post subject: |
|
|
Well your value is a 4 byte value in the image but you're reading 8 bytes with Console.WriteLine(Memory.ReadInt64(address)); Use a ReadInt32 if you have one, if you're still getting the wrong value... all I can suggest is to double check that you're getting the right addresses in the loop by printing the address out and comparing to what CE shows.
|
|
Back to top |
|
|
Beginner How do I cheat? Reputation: 0
Joined: 07 May 2017 Posts: 3
|
Posted: Sun May 07, 2017 11:43 am Post subject: |
|
|
FreeER wrote: | Well your value is a 4 byte value in the image but you're reading 8 bytes with Console.WriteLine(Memory.ReadInt64(address)); Use a ReadInt32 if you have one, if you're still getting the wrong value... all I can suggest is to double check that you're getting the right addresses in the loop by printing the address out and comparing to what CE shows. |
I'm god damn stupid ! I thank you so f*cking much ! It worked just fine !!
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sun May 07, 2017 12:32 pm Post subject: |
|
|
Glad to hear it
|
|
Back to top |
|
|
|