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 


C# Memory Library
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Rolingo
How do I cheat?
Reputation: 0

Joined: 29 Jan 2013
Posts: 2

PostPosted: Tue Jan 29, 2013 2:39 pm    Post subject: Reply with quote

Hi and thanks for the memory library!

I got a questin, I'm trying to read the current amount of money from Euro truck simulator 2.
This is how I do it in CE adding a static pointer. eurotrucks2.exe+66D5EC and 24,20 as offsets. Type as 8 bytes. Works great.

When Im trying to do this in C# with KryziK memory library, I do it like this:
Code:

            Memory m = new Memory();
            if (m.OpenProcess("eurotrucks2"))
            {
                textBox1.Text = "EuroTruck process found!";

                int baseAddress = m.BaseAddress();
                int[] offsets = { 0x24, 0x20 };
                int pointer = 0x66D5EC;
     
                long currentMoney = m.ReadLong(baseAddress + pointer, offsets);
                textBox1.Text = currentMoney.ToString();
            }

This return something that is NOT the current amount of money.

I figured the value I want to read is in 8-bit so I use the method ReadLong for that.
Anybody have an idea what might be wrong?
Back to top
View user's profile Send private message
Inzann
Cheater
Reputation: 0

Joined: 03 Jan 2007
Posts: 34

PostPosted: Wed Jan 30, 2013 3:46 pm    Post subject: Reply with quote

Rolingo wrote:
Hi and thanks for the memory library!

I got a questin, I'm trying to read the current amount of money from Euro truck simulator 2.
This is how I do it in CE adding a static pointer. eurotrucks2.exe+66D5EC and 24,20 as offsets. Type as 8 bytes. Works great.

When Im trying to do this in C# with KryziK memory library, I do it like this:
Code:

            Memory m = new Memory();
            if (m.OpenProcess("eurotrucks2"))
            {
                textBox1.Text = "EuroTruck process found!";

                int baseAddress = m.BaseAddress();
                int[] offsets = { 0x24, 0x20 };
                int pointer = 0x66D5EC;
     
                long currentMoney = m.ReadLong(baseAddress + pointer, offsets);
                textBox1.Text = currentMoney.ToString();
            }

This return something that is NOT the current amount of money.

I figured the value I want to read is in 8-bit so I use the method ReadLong for that.
Anybody have an idea what might be wrong?


Don't you need to add the module base address to the pointer? I might be very wrong about what the problem is but I had a similar problem and it helped me.

I think its usually 400000 for most applications so just do 400000 + 66D5EC with hex calculator and maybe it'll work. It should be A6D5EC.
Back to top
View user's profile Send private message
Rolingo
How do I cheat?
Reputation: 0

Joined: 29 Jan 2013
Posts: 2

PostPosted: Wed Jan 30, 2013 5:16 pm    Post subject: Reply with quote

Inzann wrote:
Rolingo wrote:
Hi and thanks for the memory library!

I got a questin, I'm trying to read the current amount of money from Euro truck simulator 2.
This is how I do it in CE adding a static pointer. eurotrucks2.exe+66D5EC and 24,20 as offsets. Type as 8 bytes. Works great.

When Im trying to do this in C# with KryziK memory library, I do it like this:
Code:

            Memory m = new Memory();
            if (m.OpenProcess("eurotrucks2"))
            {
                textBox1.Text = "EuroTruck process found!";

                int baseAddress = m.BaseAddress();
                int[] offsets = { 0x24, 0x20 };
                int pointer = 0x66D5EC;
     
                long currentMoney = m.ReadLong(baseAddress + pointer, offsets);
                textBox1.Text = currentMoney.ToString();
            }

This return something that is NOT the current amount of money.

I figured the value I want to read is in 8-bit so I use the method ReadLong for that.
Anybody have an idea what might be wrong?


Don't you need to add the module base address to the pointer? I might be very wrong about what the problem is but I had a similar problem and it helped me.

I think its usually 400000 for most applications so just do 400000 + 66D5EC with hex calculator and maybe it'll work. It should be A6D5EC.


Thanks for the suggestion, the module base is 4194304 for (eurotrucks2.exe). Tried to add it with hex calulator, but still getting wrong value as return.
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
Goto page Previous  1, 2, 3
Page 3 of 3

 
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