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 


Conditional Nop

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Renard10177
Newbie cheater
Reputation: 0

Joined: 19 Jun 2013
Posts: 12

PostPosted: Tue Oct 08, 2013 9:13 pm    Post subject: Conditional Nop Reply with quote

I wanted to make a code that nop's a certain address if the value is greater than or equal to 100, problem is, it nop's it no matter what
Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
label(nopit)

newmem: //this is allocated memory, you have read,write,execute access
//place your code here
cmp [10353754],0064
jge nopit
jmp originalcode
nopit:
nop
nop
nop
nop
nop
nop
jmp exit


originalcode:
fstp dword ptr [eax+00000160]

exit:
jmp returnhere

"hl.dll"+184D5:
jmp newmem
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"hl.dll"+184D5:
fstp dword ptr [eax+00000160]
//Alt: db D9 98 60 01 00 00

I think the problem is that it's checking the 4-byte value of the address, but I need it to check the float value, how do i do this? (the code is for half-life: blue shift, btw)
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Oct 10, 2013 11:41 am    Post subject: Reply with quote

original code is:
fstp dword ptr [eax+00000160]

You can not just nop FPU commands, commands that changes stack state.
So, all FSTP, FISTP, FDIVP, FDIVRP, FMULP, FADDP, etc. can not be just nopped.


Another thing, this address: 10353754, will be only valid until you shutdown HL. After you launch game again, HP will be at different address.


Lastly. Half-Life game stores HP as single floating-point value (single, float). For those you have to use:
- FPU compare
- or SSE compare
- or MMX compare



Or, if values are always bigger or equal to zero, you can use this:

cmp [address],(float)100.0
or
cmp [address],42C80000


(0x42C80000 == 100.0 float)

_________________
Back to top
View user's profile Send private message MSN Messenger
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