<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="46">
  <CheatEntries>
    <CheatEntry>
      <ID>61</ID>
      <Description>"Infinite Health example"</Description>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]

aobscanmodule(Health,GameAssembly.dll,F3 0F 11 43 20 0F 2F)
alloc(newmem,$1000,Health)

label(code)
label(return)

newmem:
  cmp [rax+2C],0        // Check who is being affected: 0 = player, anything else = enemy
  jne code              // If it's not the player skip to code (jne = Jump if Not Equal. Enemy doesn't equal 0 so jump to code)

  movss xmm0,[rbx+24]   // Load max health from [rbx+24] into xmm0 (player only)
  movss [rbx+20],xmm0   // Set current health [rbx+20] to max (xmm0 now has rbx+24's max health value and puts it into rbx+20)
  jmp return

code:                   // the enemy is now here from our jne above
  movss [rbx+20],xmm0   // the game writes enemy health normally
  jmp return

Health:
  jmp newmem

return:
registersymbol(Health)

[DISABLE]

Health:
  db F3 0F 11 43 20

unregistersymbol(Health)
dealloc(newmem)
</AssemblerScript>
    </CheatEntry>
    <CheatEntry>
      <ID>62</ID>
      <Description>"Infinite Health with 0 health for enemies example"</Description>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]

aobscanmodule(Health,GameAssembly.dll,F3 0F 11 43 20 0F 2F)
alloc(newmem,$1000,Health)

label(code)
label(return)

newmem:
  cmp [rax+28],0              // Check who is being affected: 0 = player
  jne code                    // If not the player jump to code

  // Player
  movss xmm0,[rbx+2C]         // Load max health into xmm0
  movss [rbx+20],xmm0         // Set current health = max
  jmp return

code:
  // Enemy
  xorps xmm0,xmm0             // Set xmm0 to 0 (float zero)
  movss [rbx+20],xmm0         // Write 0 to enemy's current health
  jmp return

Health:
  jmp newmem

return:
registersymbol(Health)

[DISABLE]

Health:
  db F3 0F 11 43 20

unregistersymbol(Health)
dealloc(newmem)
</AssemblerScript>
    </CheatEntry>
    <CheatEntry>
      <ID>67</ID>
      <Description>"Infinite Health and Zero Health with toggles"</Description>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]

aobscanmodule(Health,GameAssembly.dll,F3 0F 11 43 20 0F 2F)

alloc(newmem,$1000,Health)
alloc(PlayerToggle,1)  // Toggle to enable/disable player full health
alloc(EnemyToggle,1)   // Toggle to enable/disable enemy zero health

// Register symbols so toggles can be use with an separate enable/disable script
registersymbol(Health)
registersymbol(PlayerToggle)
registersymbol(EnemyToggle)

label(Enemy)
label(Original)
label(return)

newmem:
  cmp [rax+2C],0
  jne Enemy

  // Player
  cmp byte ptr [PlayerToggle],1   // Check if PlayerToggle is on/enabled (1)
  jne Original                     // If off/disabled (0), skip to original code
  movss xmm0,[rbx+24]
  movss [rbx+20],xmm0
  jmp return

Enemy:
  cmp byte ptr [EnemyToggle],1    // Check if EnemyToggle is ON (1)
  jne Original                    // If off/disabled (0), skip to original code
  xorps xmm0,xmm0
  movss [rbx+20],xmm0
  jmp return

Original:
  movss [rbx+20],xmm0
  jmp return

Health:
  jmp newmem                   // Hook the original instruction to jump to our new code

return:

[DISABLE]

Health:
  db F3 0F 11 43 20            // Restore original bytes to remove hook

// Unregister symbols and deallocate memory
unregistersymbol(Health)
unregistersymbol(PlayerToggle)
unregistersymbol(EnemyToggle)

dealloc(newmem)
dealloc(PlayerToggle)
dealloc(EnemyToggle)
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>64</ID>
          <Description>"Infinite Health player"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]

PlayerToggle:
  db 1

[DISABLE]

PlayerToggle:
  db 0
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>65</ID>
          <Description>"Zero Health enemy"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]

EnemyToggle:
  db 1

[DISABLE]

EnemyToggle:
  db 0
</AssemblerScript>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
</CheatTable>
