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 


dont know why this code is not working (fld, fstp)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
themandem
Cheater
Reputation: 0

Joined: 06 Dec 2019
Posts: 35

PostPosted: Tue Jun 21, 2022 8:29 am    Post subject: dont know why this code is not working (fld, fstp) Reply with quote

i don't get why this is working:

Code:
  movss xmm0,[rbx+40]      // teleport in air to prevent falling through ground
  addss xmm0,[yincrease]
  movss [rbx+40],xmm0


but this isn't:
Code:
  fld [rbx+40]      // teleport in air to prevent falling through ground
  fadd [yincrease]
  fstp [rbx+40]


[rbx+40] is my y coordinate btw, the up and down/height one. im trying to make him teleport a bit higher so he doesn't fall through the ground. Let me know if you need more info. here's the rest of the code if u need to zoom out.

Code:
newmem:
  cmp rbx,[LibertyCity.exe+4BF7218]  // isPlayer check
  jne code
  cmp byte ptr [enable_save],1
  je save
  cmp byte ptr [enable_load],1
  je load
  cmp byte ptr [enable_load2],1
  je undo_load

  push rax
  lea rax,[rbx+38]
  mov [pCoords],rax
  pop rax

  cmp byte ptr [WpTeleportFlag],1    // Teleport to Waypoint
  jne @f
  mov byte ptr [WpTeleportFlag],0
  push rax
  mov rax,[wpCoords]  // write waypoint X coordinate to player X coordinate
  mov rax,[rax+0]
  mov [rbx+38],rax
  mov rax,[wpCoords]  // write waypoint Z coordinate to player Z coordinate
  mov rax,[rax+4]
  mov [rbx+3C],rax
  mov rax,[wpCoords]  // write waypoint Y coordinate to player Y coordinate
  mov rax,[rax+10]
  mov [rbx+40],rax

  fld [rbx+40]      // teleport in air to prevent falling through ground
  fadd [yincrease]
  fstp [rbx+40]

  pop rax


Last edited by themandem on Tue Jun 21, 2022 8:43 am; edited 1 time in total
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Tue Jun 21, 2022 8:39 am    Post subject: Reply with quote

The instructions fld,fadd,fstp all use the FPU stack. It could be that the game doesn't use the FPU stack and based on what you have written, it uses the xmm registers to do floating-point calculations.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Tue Jun 21, 2022 11:33 am    Post subject: Reply with quote

You should add dword ptr / qword ptr to make explicit the size of the data being accessed. (dword ptr is for floats, qword ptr is for doubles)

I'm not sure what could be wrong. "It doesn't work" doesn't help at all- does it crash or no? What happens when you step through the code? There might be some weird floating point exception.

Regardless, you really shouldn't be using x87 instructions in a 64-bit process. Pretty much everything related to the x87 FPU environment isn't relevant anymore and only exists for backwards compatibility in 32-bit code.

_________________
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
themandem
Cheater
Reputation: 0

Joined: 06 Dec 2019
Posts: 35

PostPosted: Tue Jun 21, 2022 11:52 am    Post subject: Reply with quote

ParkourPenguin wrote:
You should add dword ptr / qword ptr to make explicit the size of the data being accessed. (dword ptr is for floats, qword ptr is for doubles)

I'm not sure what could be wrong. "It doesn't work" doesn't help at all- does it crash or no? What happens when you step through the code? There might be some weird floating point exception.

Regardless, you really shouldn't be using x87 instructions in a 64-bit process. Pretty much everything related to the x87 FPU environment isn't relevant anymore and only exists for backwards compatibility in 32-bit code.


i meant my cheat works except for that `fld fadd fstp` part that i posted. im teleporting fine but not in the air like i expect it to. yeah i tried adding dword ptr to it, if i remember correctly but still didn't do anything
Back to top
View user's profile Send private message
Frouk
Master Cheater
Reputation: 5

Joined: 22 Jun 2021
Posts: 489
Location: mov dword ptr [Ukraine]

PostPosted: Wed Jun 22, 2022 12:42 pm    Post subject: Reply with quote

y might be 0 since it doesn't calculate the height of the waypoint
_________________
void(__cdecl *Haxing)(HWND hGameWindow)
Back to top
View user's profile Send private message
themandem
Cheater
Reputation: 0

Joined: 06 Dec 2019
Posts: 35

PostPosted: Wed Jun 22, 2022 4:33 pm    Post subject: Reply with quote

Frouk wrote:
y might be 0 since it doesn't calculate the height of the waypoint

No, the waypoint has all x,y,z coordinates, but even if it didn't that wouldn't matter anyway, it should still teleport me in the air.

ParkourPenguin wrote:
You should add dword ptr / qword ptr to make explicit the size of the data being accessed. (dword ptr is for floats, qword ptr is for doubles)

I'm not sure what could be wrong. "It doesn't work" doesn't help at all- does it crash or no? What happens when you step through the code? There might be some weird floating point exception.

Regardless, you really shouldn't be using x87 instructions in a 64-bit process. Pretty much everything related to the x87 FPU environment isn't relevant anymore and only exists for backwards compatibility in 32-bit code.


i figured out the problem and have been trying to tell you guys but it wouldn't allow me to double post. Take a look at the code section. xmm0 was overwriting all my fld, fadd, fstp stuff. sorry for wasting yall's time
Code:
code:
  movss [rbx+40],xmm0
  jmp return
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Thu Jun 23, 2022 3:48 am    Post subject: Reply with quote

You said in your initial post:
themandem wrote:

i don't get why this is working:

Code:

  movss xmm0,[rbx+40]      // teleport in air to prevent falling through ground
  addss xmm0,[yincrease]
  movss [rbx+40],xmm0



But here you said:
themandem wrote:

i figured out the problem and have been trying to tell you guys but it wouldn't allow me to double post. Take a look at the code section. xmm0 was overwriting all my fld, fadd, fstp stuff. sorry for wasting yall's time
Code:
code:
  movss [rbx+40],xmm0
  jmp return


You didn't post that code in your initial post so it's not possible that we could have told you what the problem was. In any case, at least it is resolved now. For future reference, you can use the edit button to the right-hand side of your post to add more information.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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