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 


what is the problem with my code?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Mon Sep 20, 2010 3:18 pm    Post subject: what is the problem with my code? Reply with quote

Code:

mov ebx,[esi+58]
xor eax,eax
mov al,[ebx+2]
mov byte ptr [play],al
cmp byte ptr [play],1


At [esi +58] there is a pointer (01060804)
and at 01060806 is my value in byte.
i want to store 01060806's value to play.

am i doing something wrong.
Back to top
View user's profile Send private message Send e-mail
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25779
Location: The netherlands

PostPosted: Mon Sep 20, 2010 3:45 pm    Post subject: Reply with quote

ok to recap:
[esi+58] contains a pointer that points to a random address
2 bytes after the location it points to is a byte with a value you want to store

try this code:
Code:

push eax //save eax
mov eax,[esi+58]
mov al,[eax+2]
mov [play],al
pop eax //restore eax

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Mon Sep 20, 2010 4:21 pm    Post subject: Reply with quote

Hello DB,

[esi+58] contains a pointer that points to a 4byte value like "00 c0 01 00"
i want to store 01. in play

Thanks for your time.
Back to top
View user's profile Send private message Send e-mail
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25779
Location: The netherlands

PostPosted: Mon Sep 20, 2010 4:31 pm    Post subject: Reply with quote

the code I gave will do that yes

mov eax,[esi+58]:
eax gets the value of the pointer

mov al,[eax+2]:
al gets the value of the byte 2 bytes after the location the pointer points to

and the push and pop are just to make sure you don't mess up important registers

(starcraft2 ?)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Mon Sep 20, 2010 4:55 pm    Post subject: Reply with quote

The game is rise of nation.

The codes were correct but the data dissector was showing incorrect results .
sorry for bugging you.

anyways what was wrong in my codes:

Code:
mov ebx,[esi+58]
xor eax,eax
mov al,[ebx+2]
mov byte ptr [play],al
cmp byte ptr [play],1


i had already done push and pop instructions .
Back to top
View user's profile Send private message Send e-mail
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Mon Sep 20, 2010 5:04 pm    Post subject: Reply with quote

I have worked on the same project. The problem is that CE is logically trying to identify the values as if they are stored on 4 or 8 bytes. In some cases if a program is storing some values on 1 byte, CE will obviously miss the type and the data will be shown as pointers:

00 01 02 00 4 bytes from my unit structure
01 01 01 00 4 bytes from enemy unit structure

In this case, these bytes are shown as pointers, however they are obviously not. The first value would point to 00000100 which is of course not really possible. The fact is that the first byte is a player ID in Rise of Nations. 00 for my player, 01 for the enemy.

My question:
Can I compare structures in the dissector from byte to byte or I can use the default guessed type only?
This way I could discover suspicious values like this sooner.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25779
Location: The netherlands

PostPosted: Mon Sep 20, 2010 6:46 pm    Post subject: Reply with quote

you can make a structure that exists only out of bytes and use that to compare
You could even export it and load it back later on for other games (tip: you can save as CSX and it'll be in xml which might make it easier to make a byte only structure)

also, next ce version does not detect those 2 examples as a dword but as 2 different bytes and a word, unless there is also an address that represents that value. In which case it WILL still be picked as a pointer.

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Mon Sep 20, 2010 7:13 pm    Post subject: Reply with quote

Thanks for the hint. I will do it.
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
Freiza
Grandmaster Cheater
Reputation: 22

Joined: 28 Jun 2010
Posts: 662

PostPosted: Mon Sep 20, 2010 7:18 pm    Post subject: Reply with quote

Thanx
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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