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 


Crash on compare

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

Joined: 12 Sep 2023
Posts: 23
Location: Austria

PostPosted: Fri Jun 21, 2024 9:56 am    Post subject: Crash on compare Reply with quote

Hey Community!
Im stumped again and like your help, thanks in advance!

im trying a HP script and everytime a kinda levelswitch occurs (no loading times) a crash happens.

Code:

newmem:
  push ebx
  mov ebx,[ebx+10]
  mov ebx,[ebx+34]
  cmp [ebx+20],1            //Crash happens
  pop ebx
  jne hp_code

hp_godmode:
  mov [ebx+30],(float)value

hp_code:                             //original code
  fcomp dword ptr [ebx+30]
  fnstsw ax
  jmp hp_return


i narrowed it down to the cmp and did the same script in another location, but it crashes too. When im not "changin maps" its working like a charm.

Orginalcode:
Code:

game.GEvent::TryAcquireCancel+7113: F6 C4 05              - test ah,05
game.GEvent::TryAcquireCancel+7116: 7A 04                 - jp game.GEvent::TryAcquireCancel+711C
game.GEvent::TryAcquireCancel+7118: DD D8                 - fstp st(0)
game.GEvent::TryAcquireCancel+711A: D9 E8                 - fld1
game.GEvent::TryAcquireCancel+711C: D9 5C 24 28           - fstp dword ptr [esp+28]
game.GEvent::TryAcquireCancel+7120: D9 44 24 28           - fld dword ptr [esp+28]
game.GEvent::TryAcquireCancel+7124: D9 5B 30              - fstp dword ptr [ebx+30]
game.GEvent::TryAcquireCancel+7127: 8B FB                 - mov edi,ebx
game.GEvent::TryAcquireCancel+7129: E8 82 13 00 00        - call game.GEvent::TryAcquireCancel+84B0
game.GEvent::TryAcquireCancel+712E: D9 EE                 - fldz
// ---------- INJECTING HERE ----------
game.GEvent::TryAcquireCancel+7130: D8 5B 30              - fcomp dword ptr [ebx+30]
// ---------- DONE INJECTING  ----------
game.GEvent::TryAcquireCancel+7133: DF E0                 - fnstsw ax
game.GEvent::TryAcquireCancel+7135: F6 C4 01              - test ah,01
game.GEvent::TryAcquireCancel+7138: 75 1E                 - jne game.GEvent::TryAcquireCancel+7158
game.GEvent::TryAcquireCancel+713A: 80 7B 20 00           - cmp byte ptr [ebx+20],00
game.GEvent::TryAcquireCancel+713E: 8D 4C 24 38           - lea ecx,[esp+38]
game.GEvent::TryAcquireCancel+7142: 51                    - push ecx
game.GEvent::TryAcquireCancel+7143: 0F 94 C0              - sete al
game.GEvent::TryAcquireCancel+7146: 53                    - push ebx
game.GEvent::TryAcquireCancel+7147: 88 84 24 98 00 00 00  - mov [esp+00000098],al
game.GEvent::TryAcquireCancel+714E: E8 BD 2B 00 00        - call game.GEvent::TryAcquireCancel+9D10



I hope i was clear enough, thanks!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Fri Jun 21, 2024 11:01 am    Post subject: Reply with quote

The pointer probably isn't valid in that moment. Maybe the game sets it to null and you can check for that.
Code:
nemem:
  push eax
  mov eax,[ebx+10]
  test eax,eax
  jz hp_code
  mov eax,[eax+34]
  test eax,eax
  jz hp_code
  cmp [eax+20],1
  jne hp_code
  mov [ebx+30],(float)value
hp_code:
  pop eax
  fcomp dword ptr [ebx+30]
  fnstsw ax
  jmp hp_return

If that doesn't work and exceptions are fairly rare, use {$try} / {$except} to let CE's debugger handle them
Code:
nemem:
  push eax
{$try}
  mov eax,[ebx+10]
  mov eax,[eax+34]
  cmp [eax+20],1
  jne hp_code
  mov [ebx+30],(float)value
{$except}
hp_code:
  pop eax
  fcomp dword ptr [ebx+30]
  fnstsw ax
  jmp hp_return

Otherwise, find a better comparison and/or injection point

_________________
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
Diambro
Newbie cheater
Reputation: 0

Joined: 12 Sep 2023
Posts: 23
Location: Austria

PostPosted: Sat Jun 22, 2024 1:25 am    Post subject: Reply with quote

The first one works like a charm.

And about the second idea with try and except: is the documentary in the forum or in an folder in cheat engine? I should probably read that too.

Thanks again for your quick and easy help!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Sat Jun 22, 2024 10:22 am    Post subject: Reply with quote

There's a page the CE wiki:
https://wiki.cheatengine.org/index.php?title=Auto_Assembler:TRY_EXCEPT

Beyond that, I don't know of any "official" documentation.

_________________
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
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