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 


Comapre ID problems

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
sjl002
Master Cheater
Reputation: 0

Joined: 31 Aug 2013
Posts: 305

PostPosted: Mon Jul 25, 2016 8:46 am    Post subject: Comapre ID problems Reply with quote

Hi

I find wood , stone , ... ID in Strong Hold2.That is this :

Wood ID : cmp [esp+4],00000001
Stone ID : cmp [esp+4],00000002
,
.
.
.

Now if we want compare this two with others ID and move this tow(Wood and stone) 99. only stone and wood change to 99

for example :

Code:
[ENABLE]

alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)

newmem:
cmp [esp+4],00000001 //Wood ID
jne originalcode
cmp [esp+4],00000002//Stone ID
jne originalcode
mov [ecx+eax*4+00000C00],(int)99

originalcode:
mov eax,[ecx+eax*4+00000C00]

exit:
jmp returnhere

"Stronghold2.exe"+7975:
jmp newmem
nop
nop
returnhere:


 
 
[DISABLE]

dealloc(newmem)
"Stronghold2.exe"+7975:
mov eax,[ecx+eax*4+00000C00]
//Alt: db 8B 84 81 00 0C 00 00



can you help me!?
Back to top
View user's profile Send private message
PinPoint
Expert Cheater
Reputation: 10

Joined: 07 Apr 2016
Posts: 223
Location: Scotland

PostPosted: Mon Jul 25, 2016 9:04 am    Post subject: Reply with quote

Should us AOB.
Does esp have the address for the ID's when the instruction called?
You never had a jump to the exit/return in your script under newmem either so it will alwyas write the originalcode section.

I would have built it something like this

Code:
[ENABLE]
aobscan(INJECT,8B 84 81 00 0C 00 00)
alloc(newmem,2048)
label(returnhere)
label(code)

newmem:
cmp [esp+4],00000001 //Wood ID
je code
cmp [esp+4],00000002//Stone ID
je code
mov eax,[ecx+eax*4+00000C00]
jmp returnhere

code:
mov [ecx+eax*4+00000C00],63
mov eax,[ecx+eax*4+00000C00]
jmp returnhere

INJECT:
jmp newmem
nop
nop

returnhere:
registersymbol(INJECT)
 
[DISABLE]

INJECT:
mov eax,[ecx+eax*4+00000C00]
//Alt: db 8B 84 81 00 0C 00 00

dealloc(newmem)
unregistersymbol(INJECT)



Last edited by PinPoint on Mon Jul 25, 2016 10:55 am; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4299

PostPosted: Mon Jul 25, 2016 9:22 am    Post subject: Reply with quote

Your logic is flawed. If the ID isn't 1, it will execute the original code (that's what you wrote). If the ID is 1, it will execute the original code (1 isn't equal to 2). No matter what you do, it will never move 99 into that address.

One way to solve this would be to check if it's above 2 first then if it's equal to 0. Jump to originalcode upon either condition.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Jul 25, 2016 5:07 pm    Post subject: Reply with quote

Code:
newmem:
cmp [esp+4],00000001 //Wood ID
je @f
cmp [esp+4],00000002//Stone ID
je @f
jmp originalcode

@@:
mov [ecx+eax*4+00000C00],(int)99

originalcode:
mov eax,[ecx+eax*4+00000C00]
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Mon Jul 25, 2016 10:14 pm    Post subject: Reply with quote

Why are you using @f and @@ here? a quick google explained what it means, but you arent getting the benefit described in this link
http://www.asmcommunity.net/forums/topic/?id=28731
Is it just a lazy way of labeling or do you have some other benefit?
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Jul 26, 2016 7:53 am    Post subject: Reply with quote

It's just quick since you don't have to assign any labels.
Back to top
View user's profile Send private message
STN
I post too much
Reputation: 42

Joined: 09 Nov 2005
Posts: 2672

PostPosted: Tue Jul 26, 2016 9:50 am    Post subject: Reply with quote

Reading this thread reminds me of the phrase blind leading the blind Laughing

Just an addendum to @@ thing, if you have label before @@ - @F will jump to that label e.g

je @F // jumps to somelabel instead of @@ below
mov bla
somelabel:
cmp bla
@@:
inc bla

It is very useful when you're lazy and don't feel like defining labels but can get confusing if your script is huge and you're jumping all over the place

_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
sjl002
Master Cheater
Reputation: 0

Joined: 31 Aug 2013
Posts: 305

PostPosted: Tue Jul 26, 2016 11:06 pm    Post subject: Reply with quote

Thanks for your helps.

Now i put "mov [ebp-78],(int)100" to script but game crash.Why?
I wanted that wood and stone go to "mov [ebp-78],(int)100" and "mov [ecx+eax*4+00000C00],(int)100".

Code:

newmem:
cmp [esp+4],00000001 //Wood ID
je @f
cmp [esp+4],00000002//Stone ID
je @f
jmp originalcode

@@:
mov [ebp-78],(int)100 // Really resource (when i add this game crashed)
mov [ecx+eax*4+00000C00],(int)100//Virtual(Visual) resource
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Tue Jul 26, 2016 11:17 pm    Post subject: Reply with quote

because "ebp-78" isnt what you thought it was. Odds are you are writing over something important instead of the value you wanted to.
Back to top
View user's profile Send private message
STN
I post too much
Reputation: 42

Joined: 09 Nov 2005
Posts: 2672

PostPosted: Wed Jul 27, 2016 11:38 am    Post subject: Reply with quote

Curious to know where did this mov [ebp-78] came from?
_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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