|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Wed Jan 26, 2022 1:30 pm Post subject: Custom Input for xmm Multiplier With Two Axes |
|
|
This crashes target:
Code: | mulps xmm0,[speed_modifier] |
This does not:
Code: | mulss xmm0,[speed_modifier] |
However, mulss only modifies one axis.
FYI, this works correctly, but does not allow for custom input:
How to solve?
Thanks.
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1055 Location: 0x90
|
Posted: Wed Jan 26, 2022 2:06 pm Post subject: |
|
|
Rather than me butcher things trying to explain. I can point you in the right direction:
SSE
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Wed Jan 26, 2022 3:10 pm Post subject: |
|
|
I'd guess speed_modifier isn't aligned to 16 bytes. You also need to have 4 floats at speed_modifier.
e.g.:
Code: | alloc(newmem,4096)
label(speed_modifier)
newmem:
// your code
mulps xmm0,[speed_modifier]
jmp return
align 10 CC
speed_modifier:
dd (float)2.0 (float)2.0 (float)2.0 (float)2.0 |
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Last edited by ParkourPenguin on Fri Jan 28, 2022 2:28 pm; edited 1 time in total |
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Wed Jan 26, 2022 3:31 pm Post subject: |
|
|
LeFiXER wrote: | Rather than me butcher things trying to explain. I can point you in the right direction:
SSE | -Thanks. I have scoured so many sites already, but I am still at a loss with this one.
ParkourPenguin wrote: | Code: | align 10 CC
speed_modifier:
dd (float)2.0 (float)2.0 (float)2.0 (float)2.0 |
| -Thank you. I did not even know that this was possible.
This fixes the crashing, but the multiplier is still only applied to one axis for some reason.
I suspect that it is something really simple, but I just cannot seem to figure this one out. I have been trying to solve this one for hours already.
I really appreciate everyone's help.
EDIT:
I do not understand why this works for both axes:
Code: | fast:
addps xmm0,xmm0
originalcode_speed:
addps xmm0,[rdi+70]
movss xmm12,[rsp+30]
jmp return_speed
freeze_input:
db 0
speed_input:
db 0
dd (float)1.0 |
...but this only works for one:
Code: | fast:
mulps xmm0,[speed_modifier]
originalcode_speed:
addps xmm0,[rdi+70]
movss xmm12,[rsp+30]
jmp return_speed
freeze_input:
db 0
speed_input:
db 0
align 10 CC
speed_modifier:
dd (float)1.0 (float)1.0 (float)1.0 (float)1.0 |
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Wed Jan 26, 2022 4:38 pm Post subject: |
|
|
++METHOS wrote: | ...but this only works for one:
Code: | ...
dd (float)1.0 (float)1.0 (float)1.0 (float)1.0 |
| You're multiplying by 1. It shouldn't do anything to any of the components of the vector.
If you simply added a new address `speed_modifier` to the address list and set its value type to float, then it will only affect the first component of the vector. To get the same behaviour as addps, you would need to change all 4 floats at `speed_modifier` to 2.0.
To have one float value broadcast over the entire vector register, you can use shufps:
Code: | fast:
movss xmm12,[speed_modifier]
shufps xmm12,xmm12,0
mulps xmm0,xmm12
originalcode_speed:
addps xmm0,[rdi+70]
movss xmm12,[rsp+30]
jmp return_speed
freeze_input:
db 0
speed_input:
db 0
align 4 CC
speed_modifier:
dd (float)1.0 | The game isn't using whatever is in xmm12 there, so it's OK to use.
There is also a broadcast instruction (replaces movss / shufps), but it requires avx.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Thu Jan 27, 2022 1:04 am Post subject: |
|
|
ParkourPenguin wrote: | To get the same behaviour as addps, you would need to change all 4 floats at `speed_modifier` to 2.0.
To have one float value broadcast over the entire vector register, you can use shufps | -Awesome. This works. Thanks so much.
After spending hours with this, I knew that this was likely the problem, I just did not know how to articulate it. I need to study your code more in order to understand it better.
Thanks, again.
|
|
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
|
|