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 


noob help: adding two singles, 1 in pointer, 1 in hexstring

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

Joined: 28 Feb 2025
Posts: 4

PostPosted: Wed Mar 19, 2025 1:02 pm    Post subject: noob help: adding two singles, 1 in pointer, 1 in hexstring Reply with quote

I would like to add a single float coming from a pointer to an other single float, that is mine (injected)
Vanilla code:
Code:
mov r12d,DWORD PTR [rcx+0xb4]

I would like to add 55.0 to this value. Is this assembly correct?
Code:
movss xmm0,DWORD PTR [rcx+0xb4]
mov r12d,0x425C0000
movd xmm7,r12d
addss xmm0,xmm7
movd r12d,xmm0
I injected this, the game has changed, because the object is not visible on the screen (world position changed, this is what i want), but it should be only partially moved, be still somewhat visible on screen. I would first like to know if i wrote the assembly correct, before i get into the lengthy process of understanding what world coordinates the game expects.
Is it the endianness what is the problem? It did not work with 0x00005C42 either. Thanks!
Back to top
View user's profile Send private message  
ParkourPenguin
I post too much
Reputation: 150

Joined: 06 Jul 2014
Posts: 4659

PostPosted: Wed Mar 19, 2025 1:39 pm    Post subject: Reply with quote

Writing the immediate as `0xC25C0000` is weird. Use `(float)-55` instead

There's nothing wrong with using `movd` to move data between xmm registers and general-purpose registers, but normally you wouldn't do that. You'd store the immediate in memory and access that.
Code:
alloc(newmem,2048,my_injection_point)
alloc(myOffset,4,my_injection_point)

newmem:
  movss xmm0,[rcx+B4]
  addss xmm0,[myOffset]
  ...
  jmp return

myOffset:
  dd (float)-55

...


moleeater wrote:
... it should be only partially moved, be still somewhat visible on screen.
If you're injecting code, then this code will run every time the game would've run the code at the injection point. Writing the value back into [rcx+B4] would cause a problem. e.g. 100 -> 45 -> -10 -> -65 -> -120 -> ...
_________________
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  
moleeater
How do I cheat?
Reputation: 0

Joined: 28 Feb 2025
Posts: 4

PostPosted: Wed Mar 19, 2025 1:47 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Writing the immediate as `0xC25C0000` is weird. Use `(float)-55` instead. There's nothing wrong with using `movd` to move data between xmm registers and general-purpose registers, but normally you wouldn't do that. You'd store the immediate in memory and access that.


Edit: nevermind, i did what you told, it works! Thank you!

Original post: I know, the reason i am doing this, because i want to minimize the number of point where problems can occur. It is already hard to debug, what is happening, if i write the value in direct assembly, then i can just paste it directly into the ram in Memory Viewer, etc.
So, the question is, am i using all the mov* things properly?

ParkourPenguin wrote:
If you're injecting code, then this code will run every time the game would've run the code at the injection point. Writing the value back into [rcx+B4] would cause a problem. e.g. 100 -> 45 -> -10 -> -65 -> -120 -> ...


I think, it's not a problem, because it runs only at object creation, and value resets every time:

Code:

void __fastcall Builder::BuildStructure(Builder *this) {
...
  z = this->build_position.z;          <-- inject here
...
      v85 = this->build_position.z - v77->transform.cached_position.z;
...
      z = this->build_position.z;
...
      nearest_platform_pos.z = this->build_position.z;
...
}
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