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 


Compare float / conditional jump (Auto Assembler)

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

Joined: 26 Oct 2014
Posts: 1

PostPosted: Sun Oct 26, 2014 3:13 pm    Post subject: Compare float / conditional jump (Auto Assembler) Reply with quote

Hi there,
I want to prevent falling below a certain height.
I found the function which increases y-coordinate when falling (2D). Now I want to check if y is bigger than 3700, and if so, skip one instruction.

Code:

[...]
newmem:
mov xmm0,(float)3700
fld dword ptr [esi+2C]
fcomp ??
jg originalcode

fstp dword ptr [esi+2C] //original instruction to overwrite y, skip this if too low, if nop'd Mario jumps but does not fall down again :)
originalcode:
fld dword ptr [esi+18]

exit:
jmp returnhere

"MARIO.exe"+F773:
jmp newmem
nop
returnhere:


How do I do the float comparison and the conditional jump? Game is Mega Mario ( sourceforge.net/projects/mmario ).
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: Fri Oct 31, 2014 1:50 pm    Post subject: Reply with quote

Code:
[ENABLE]
alloc(newmem,$1000)

label(code)
label(return)
label(original)
label(value)
label(boost)

newmem:

value:
dd (float)3900

boost:
dd (float)250

code:
  fcom dword ptr [value]
  fnstsw ax
  sahf

  jb original // go to original if it is smaller than 3900 (jb = jump if below)

  fsub dword ptr [boost]

original:
  fstp dword ptr [esi+2C]  //original
  fld dword ptr [esi+18]   //original
  jmp return



"MARIO.exe"+F773:
  jmp code
  nop
return:

[DISABLE]
"MARIO.exe"+F773:
db D9 5E 2C D9 46 18
// fstp dword ptr [esi+2C]
// fld dword ptr [esi+18]

dealloc(newmem)

_________________
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