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 


[Autoassembler] I'm total idiot and don't know what to do

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Gargule
How do I cheat?
Reputation: 0

Joined: 27 Mar 2022
Posts: 2

PostPosted: Sun Mar 27, 2022 4:00 pm    Post subject: [Autoassembler] I'm total idiot and don't know what to do Reply with quote

So, here's idea: i want game to crash exactly before character will receive fatal damage. I have an address of instruction that changes everyone's HP. Now i'm trying to understand how to check if HP that changed was Players HP and how to check if that damage was fatal.
There's code. (i lost my pointer to Player's HP and cannot find another right now, but even with the correct pointers game just crashes on script activation)
UPD: have a new pointer
Code:

[ENABLE]
define(bytes,89 91 EC 01 00 00)
define(inPoint,GameAssembly.dll+172d153)
assert(inPoint,bytes)
define(pointerStart,GameAssembly.dll+3CABB58)
alloc(newmem,$1000)
label(code)
label(return)
label(alive)

newmem:

code:
  push rsi
  mov rsi,pointerStart
  mov rsi,[rsi+b8]
  mov rsi,[rsi+20]
  mov rsi,[rsi+2b0]
  mov rsi,[rsi+1EC]
  cmp [rcx+000001EC],rsi
  pop rsi
  jne alive //if isn't player
  cmp edx,0
  jne alive //if isn't dead
  jmp 0 //We almost died. Crush
  jmp return //just placeholder. Normally never executes

alive:
  mov [rcx+000001EC],edx
  jmp return

inPoint:
  jmp newmem
return:

[DISABLE]

inPoint:
  mov [rcx+000001EC],edx
dealloc(newmem)

Also I want to know where and why my code is dumb.
And sorry if my english isn't good enough. Sadly i'm not native speaker.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25833
Location: The netherlands

PostPosted: Sun Mar 27, 2022 4:46 pm    Post subject: Reply with quote

1:
the target is 64-bit, you're not using the 3th alloc parameter, and the jmp doesn't look like it's relocating 14 bytes

There is a very high chance this is going to crash


2: perhaps the pointer isn't always valid. try
Code:

...
  push rsi
{$try}
  mov rsi,pointerStart
  mov rsi,[rsi+b8]
  mov rsi,[rsi+20]
  mov rsi,[rsi+2b0]
  mov rsi,[rsi+1EC]
  cmp [rcx+000001EC],rsi
  pop rsi
  jne alive //if isn't player
  cmp edx,0
  jne alive //if isn't dead
  jmp 0 //We almost died. Crush
{$except}
  //unreadable
  pop rsi
  jmp alive


alive:
...


3: Perhaps you're dead but don't know it yet

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Gargule
How do I cheat?
Reputation: 0

Joined: 27 Mar 2022
Posts: 2

PostPosted: Sun Mar 27, 2022 6:07 pm    Post subject: Reply with quote

Dark Byte wrote:
1:

2: perhaps the pointer isn't always valid. try

Thank you for helping.
I'm trying like this now and nothing crashes. Anyway at some point game process somewhy just skips part of the code.
Code:

code:
  push rax
{$try}
  mov rax,pointerStart //-------------------i was wrong here. This must be [pointerStart]
  mov rax,[rax+8]
  mov rax,[rax+2e0]
  mov rax,[rax+28]----------- //it dies after this point
  mov rax,[rax+660]
  mov rax,[rax+118]
  mov rax,[rax+30]
  cmp rcx,rax
  pop rax
  jne alive //if isn't player
  cmp edx,0
  jne alive //if isn't dead
  jmp 0 //We almost died. Crush
{$except}
  //unreadable
  nop
  nop
  pop rax --------------//and starts again exactly here
  jmp alive

nothing in between my markers do not react to breakpoints and idk what's going on.

UPD: i just fixed it. Thank you again. For the help and for the CE itself. ^^
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