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 


CCODE sqrtf problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Skyrimfus
Cheater
Reputation: 1

Joined: 17 Mar 2016
Posts: 42

PostPosted: Wed Sep 15, 2021 7:40 pm    Post subject: CCODE sqrtf problem Reply with quote

Code:

{$ccode p=RAX}

float* a = 0x00102ACC;//4 bytes next to the HP
float number = 16.00f;

//*a = 2.0f //this works as expected
*a=sqrtf(number);//this does not work(the float gets conveted to double and it fucks up the sqrtf call)


it produces this assembly:


It converts the float to a double, and that breaks the call, noping the 2 instructions underlined in red, fixes the call.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Sep 16, 2021 12:15 am    Post subject: Reply with quote

try defining sqrtf as a function that takes a float and returns a float

now it thinks it takes an int and returns an int


extern float sqrtf(float v);

_________________
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
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