 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
JustHim24 How do I cheat?
Reputation: 0
Joined: 15 Jan 2024 Posts: 7
|
Posted: Sun Feb 18, 2024 2:23 pm Post subject: Value not updating when changed in memory? |
|
|
Hey so in this game Wizard With a Gun on version 1.0.1 the following instruction handles the cooldown between shooting.
| Code: | | movss [rbx + rdi + 0C],xmm3 |
I verified this by finding what addresses access this instruction and when i fired my gun an address populated, I added it to the address table and changed that value to 0, and the gun turned fully automatic. However when changing the instruction from | Code: | | movss [rbx + rdi + 0C], xmm3 | to | Code: | | mov [rbx + rdi + 0C], (double)0 | it does not have the same effect. Any thoughts why? I would be more then happy to share any necessary information.
If any screenshots are needed you can add me on discord: as my account is not eligible to post urls yet
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4719
|
Posted: Sun Feb 18, 2024 4:11 pm Post subject: |
|
|
There is no `mov r/m64,imm64` instruction (that double is a 64-bit immediate). CE automatically truncates that 64-bit immediate to a 32-bit one and assumes the destination memory address is 32 bits. This overwrites the least significant half of the double with zeros, but leaves the more significant half unchanged. Due to how doubles are encoded, this leaves the double value itself mostly the same.
There is a `mov r/m64,imm32` instruction. The 32-bit immediate gets sign-extended to 64 bits. In this specific case, because `(double)0` is just 8 zero bytes, you can use `mov qword ptr [rbx+rdi+0C],0`.
In general, you'd go through a register.
| Code: | push rax
mov rax,(double)1234.5
mov [wherever],rax
pop rax |
Alternatively, you could just zero the xmm register before the write.
| Code: | pxor xmm3,xmm3
movss [rbx+rdi+0C],xmm3 | This will also zero the other 3 floats in the xmm register, but they're probably zero anyway.
The bigger issue is whether or not that instruction accesses other addresses. You should check that. Right click it in the disassembler and select "Find out what addresses this instruction accesses".
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
JustHim24 How do I cheat?
Reputation: 0
Joined: 15 Jan 2024 Posts: 7
|
Posted: Sun Feb 18, 2024 4:36 pm Post subject: |
|
|
| ParkourPenguin wrote: | There is no `mov r/m64,imm64` instruction (that double is a 64-bit immediate). CE automatically truncates that 64-bit immediate to a 32-bit one and assumes the destination memory address is 32 bits. This overwrites the least significant half of the double with zeros, but leaves the more significant half unchanged. Due to how doubles are encoded, this leaves the double value itself mostly the same.
There is a `mov r/m64,imm32` instruction. The 32-bit immediate gets sign-extended to 64 bits. In this specific case, because `(double)0` is just 8 zero bytes, you can use `mov qword ptr [rbx+rdi+0C],0`.
In general, you'd go through a register.
| Code: | push rax
mov rax,(double)1234.5
mov [wherever],rax
pop rax |
Alternatively, you could just zero the xmm register before the write.
| Code: | pxor xmm3,xmm3
movss [rbx+rdi+0C],xmm3 | This will also zero the other 3 floats in the xmm register, but they're probably zero anyway.
The bigger issue is whether or not that instruction accesses other addresses. You should check that. Right click it in the disassembler and select "Find out what addresses this instruction accesses". |
Thanks for the feedback!! I already have checked if that instruction access other addresses and the only addresses it accesses from what i can tell is the different guns.
|
|
| Back to top |
|
 |
|
|
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
|
|