Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Can't translate base address

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Beginner
How do I cheat?
Reputation: 0

Joined: 07 May 2017
Posts: 3

PostPosted: Sun May 07, 2017 7:38 am    Post subject: Can't translate base address Reply with quote

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
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sun May 07, 2017 8:08 am    Post subject: Reply with quote

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
View user's profile Send private message
Beginner
How do I cheat?
Reputation: 0

Joined: 07 May 2017
Posts: 3

PostPosted: Sun May 07, 2017 10:46 am    Post subject: Reply with quote

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
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sun May 07, 2017 11:17 am    Post subject: Reply with quote

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
View user's profile Send private message
Beginner
How do I cheat?
Reputation: 0

Joined: 07 May 2017
Posts: 3

PostPosted: Sun May 07, 2017 11:43 am    Post subject: Reply with quote

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
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sun May 07, 2017 12:32 pm    Post subject: Reply with quote

Glad to hear it Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites