theashmaster How do I cheat? Reputation: 0
Joined: 15 Mar 2021 Posts: 3
|
Posted: Sat Mar 27, 2021 8:00 am Post subject: Float values in c++ assembly |
|
|
Hey, guys!
Thanks to @ParkourPenguin, I was able to get the X and Y coords of the mobs, which are both stored in xmm0 register. I was using this code to get the coords in Delphi, and it works like a charm:
Code: |
asm
mov edx, [chrPointer]
mov ecx, [edx]
push mobID
add ecx,04
mov eax,[ecx]
call dword ptr [eax+$08]
mov ecx,eax
call getCoordsCall
movaps xmm5,xmm0
movss x,xmm0
shufps xmm5,xmm5,85
movss y,xmm5
end; |
Now I want to use c++ assembly to get the same values, but this exact same function just crashes the game when I try it in c++. I have lots of other functions written in Delphi assembly that I'm using in c++ with no issues, but when it comes to get float values the game keeps crashing.
Does the above code have any incompatibility with c++? How do I retrieve values stored in xmm0 register in c++ assembly?
ps: this is the code I'm using in c++ assembly, which is actually the same one shown above:
Code: |
_asm {
mov eax, [Pointers::chrPointer]
mov ecx, dword ptr ds : [eax]
SETNE DL
push VID
add ecx, 04
mov eax, [ecx]
call dword ptr [eax + 0x8]
mov ecx, eax
call getCoordsCall
movaps xmm5, xmm0
movss pX, xmm0
shufps xmm5, xmm5, 0x85
movss y, xmm5
} |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Sat Mar 27, 2021 11:30 am Post subject: |
|
|
Why use dword ptr ds specifier only there, and what's with setne dl?
You can try to debug your application and get more information - i.e. where it's crashing and what machine code the compiler is assembling that code to.
ps: on msvc. you should be using __asm instead of _asm. The latter is only a synonym for the former for compatibility reasons.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|