Conversion of damage modifier script to conditional MIN health

Memory scanning, code injection, debugger internals and other gamemodding related discussion
Post Reply
Architect
What is cheating?
What is cheating?
Posts: 2
Joined: Mon May 22, 2017 4:09 pm
Reputation: 0

Conversion of damage modifier script to conditional MIN health

Post by Architect » Mon May 22, 2017 4:32 pm

Hi, all.

Really new to CE scripting but have had my fair share of using AOB tables. Recently got Doom 2016 on sale and found a video on YouTube for generating an infinite health script for the player (I think it went with the title "Let's Hack Doom" or something by a Stephen something guy).

Anyway, I'm hijacking his code and discovered that I don't really like the feel of the Infinite Health and decided to go Buddha mode instead. However, I'm finding my code to be a bit inelegant.

Code: Select all

[ENABLE]

aobscanmodule(aobBuddha,DOOMx64.exe,00 F3 0F 10 74 24 40 F3 0F 11 44 1E 1C) // should be unique
alloc(newmem,$1000,"DOOMx64.exe"+3A9260)

label(code)
label(playerCheck)
label(healthCheck)
label(return)

newmem:

playerCheck:
  push rax
  mov rax,[rsi+rbx+30]
  cmp rax,(float)12                     // Check type...
  pop rax
  je healthCheck                        // If player, check health.
  jne code                              // Else, jump to usual code.
  jmp return

healthCheck:
  cmp [rsi+rbx+1C],(float)50            // Check health value.
  jge code                              // Get damaged if >=50 HP.
  jmp return                            // Else, ignore.

code:
  movss [rsi+rbx+1C],xmm0
  jmp return

aobBuddha+07:
  jmp playerCheck
  nop
return:
registersymbol(aobBuddha)

[DISABLE]

aobBuddha+07:
  db F3 0F 11 44 1E 1C

unregistersymbol(aobBuddha)
dealloc(newmem)
Eh, found this not immersive as well. Originally set the CMP line to lower health but if damage (which I believe is in xmm0) is greater than health, it floors me anyway. I've tried setting xmm0 to 0 but it acts as some sort of one-hit kill so I'm guessing it stores the health you will get after the damage rather than the damage itself. Tried reading up on the other threads but seems like the behavior changes from game to game.

TLDR: Is there a way to just set the min health to 1 --OR-- check ahead of time if damage is going to cause me to get negative health and ignore it if so?

Thanks!

panraven
Cheater
Cheater
Posts: 25
Joined: Fri Mar 03, 2017 12:03 am
Reputation: 15

Re: Conversion of damage modifier script to conditional MIN health

Post by panraven » Mon May 22, 2017 7:38 pm

This check if the xmm0 is smaller than 50.0, if yes set it as 50.0

This compiled both 32bit/64bit, but I'm not actually tested in game, hope it work~

Code: Select all

...
healthCheck:
movss [esp-4],xmm0        // [esp-4] is temporary storage
cmp   [esp-4],(float)50   // compare it as signed integer, as they are ordered similar as float
jge   short @f            // jump to next forward label, skip following modification if xmm0 >= 50.0
  mov   [esp-4],(float)50 // store 50.0 to temporary as immediate value cannot move to xmm0 directly
  movss xmm0,[esp-4]      // mov to lower 32bit float of xmm0
@@:  // an anonymous label 
//   continue to code: immediately 
code:
 movss [rsi+rbx+1C],xmm0
...
There is xmm0 comparison instruction as float,ie. cmpss or may be other ways, but I'm not sure how they works.

Architect
What is cheating?
What is cheating?
Posts: 2
Joined: Mon May 22, 2017 4:09 pm
Reputation: 0

Re: Conversion of damage modifier script to conditional MIN health

Post by Architect » Tue May 23, 2017 5:30 am

Hi, panraven.

Thanks, this actually works but I have found the flaw in my own code. Apparently, [rsi+rbx+1C] seems to be pointing to Armor rather than Health because I was able to kill myself with my Armor staying at 1 (changed the instruction to use mov [esp-4],(float)1 instead).

I will be exploring this further and let you know.

panraven
Cheater
Cheater
Posts: 25
Joined: Fri Mar 03, 2017 12:03 am
Reputation: 15

Re: Conversion of damage modifier script to conditional MIN health

Post by panraven » Wed May 24, 2017 12:45 am

Oh dang, I don't known the obvious! :oops:
Thanks SunBeam!

... then it should be simply

Code: Select all

maxss   xmm0,dword ptr[MinimumHP]
...
MinimumHP: // label in somewhere
dd (float)1.0

Post Reply

Who is online

Users browsing this forum: No registered users