<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="46">
  <CheatEntries>
    <CheatEntry>
      <ID>37</ID>
      <Description>"Hook Game"</Description>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>{ AUTO-GEN gated hook + fixed-cache love.update wrap for lua51.dll }
[ENABLE]
alloc(newmem,$400)
alloc(stateStore,8)
alloc(cmd,1024)
alloc(doit,8)
alloc(savedtop,8)
alloc(mintop,8)
alloc(gate,8)
registersymbol(stateStore)
registersymbol(cmd)
registersymbol(doit)
registersymbol(mintop)
registersymbol(gate)
registersymbol(gettopHook)
stateStore:
  dq 0
doit:
  dq 0
savedtop:
  dq 0
mintop:
  dq 7FFFFFFF
gate:
  dq 0
cmd:
  db 'a=1',0
label(gettopHook)
label(code)
label(skip)
label(trackmin)
newmem:
  mov [stateStore],rcx
  mov rax,[rcx+28]
  sub rax,[rcx+20]
  sar rax,03
  mov rdx,[mintop]
  cmp rax,rdx
  jge trackmin
  mov [mintop],rax
trackmin:
  cmp qword ptr [doit],0
  je skip
  mov rdx,[gate]
  cmp rax,rdx
  jg skip
  mov [savedtop],rax
  push rbp
  mov rbp,rsp
  and rsp,-10
  sub rsp,20
  mov qword ptr [doit],0
  mov rcx,[stateStore]
  lea rdx,[cmd]
  call lua51.luaL_loadstring
  mov rcx,[stateStore]
  xor edx,edx
  mov r8d,0FFFFFFFF
  xor r9d,r9d
  call lua51.lua_pcall
  mov rcx,[stateStore]
  mov edx,[savedtop]
  call lua51.lua_settop
  mov rsp,rbp
  pop rbp
  mov rcx,[stateStore]
  mov rax,[rcx+28]
  sub rax,[rcx+20]
  sar rax,03
skip:
code:
  ret
lua51.lua_gettop:
gettopHook:
  jmp newmem

{$lua}
if syntaxcheck then return end
if __v8boot then __v8boot.destroy() end
__v8boot = createTimer(getMainForm())
__v8boot.Interval = 250
__v8boot.OnTimer = function()
  local Laddr = readQword(getAddress('stateStore'))
  if not Laddr or Laddr==0 then return end
  local mt = readQword(getAddress('mintop'))
  if not mt or mt &gt;= 0x7FFFFFFF then return end
  writeQword(getAddress('gate'), mt)
  local c = getAddress('cmd')
  local boot = "if type(love)=='table' and type(love.update)=='function' and not __V8_WRAP then __V8_WRAP=true; __CMDCACHE={}; __V8_ORIG=love.update; love.update=function(dt) if __CMD then local code=__CMD; __CMD=nil; local f=__CMDCACHE[code]; if not f then f=loadstring(code); if f then __CMDCACHE[code]=f end end; if f then pcall(f) end end return __V8_ORIG(dt) end end"
  writeString(c, boot); writeByte(c+#boot, 0); writeQword(getAddress('doit'), 1)
  __v8boot.destroy(); __v8boot=nil
  print('[v8.1] gate armed top='..mt..'; fixed-cache wrapper sent. Render-safe now.')
end
return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
if __v8boot then __v8boot.destroy(); __v8boot=nil end
local c=getAddress('cmd')
local un="if __V8_WRAP and __V8_ORIG then love.update=__V8_ORIG; __V8_WRAP=nil; __CMDCACHE=nil end"
writeString(c,un); writeByte(c+#un,0); writeQword(getAddress('doit'),1)
return true
{$asm}
lua51.lua_gettop:
  db 48 8B 41 28 48 2B 41 20 48 C1 F8 03 C3
unregistersymbol(stateStore)
unregistersymbol(cmd)
unregistersymbol(doit)
unregistersymbol(mintop)
unregistersymbol(gate)
unregistersymbol(gettopHook)
dealloc(gate)
dealloc(mintop)
dealloc(savedtop)
dealloc(doit)
dealloc(cmd)
dealloc(stateStore)
dealloc(newmem)
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>8</ID>
          <Description>"Godmode/Invisible"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Trainer - master toggle. Requires v7 hook + wrapper. }
[ENABLE]
{$lua}
if syntaxcheck then return end
local mf = getMainForm()

-- clean any prior instance first
if __trKick then __trKick.destroy(); __trKick=nil end
if __trTimer then __trTimer.destroy(); __trTimer=nil end
if __trHK then for _,h in ipairs(__trHK) do h.destroy() end __trHK=nil end

__trOn = true                       -- master enabled flag
__F = { invis=false, hp=false }

__trKick = createTimer(mf)
__trKick.Interval = 1
__trKick.OnTimer = function()
  __trKick.destroy(); __trKick=nil

  local function send(body)
    local c=getAddress("cmd")
    local w="__CMD="..string.format("%q", body)
    writeString(c,w); writeByte(c+#w,0); writeQword(getAddress("doit"),1)
  end

  __trTimer = createTimer(mf)
  __trTimer.Interval = 200
  __trTimer.OnTimer = function()
    if not __trOn then return end
    local parts = {"local a=getPlayerActor() if a then"}
    if __F.invis then parts[#parts+1]="a.invisible=true" end
    if __F.hp    then parts[#parts+1]="a.health=math.max(a.health,9999) a.dead=false" end
    parts[#parts+1]="end"
    send(table.concat(parts," "))
  end

  __trHK = {}
  local function bind(vk, fn) __trHK[#__trHK+1]=createHotkey(fn, vk) end
  bind(0x31, function() if not __trOn then return end __F.invis=not __F.invis; print("invis "..(__F.invis and "on" or "off")) end)
  bind(0x32, function() if not __trOn then return end __F.hp=not __F.hp;       print("hp "..(__F.hp and "on" or "off")) end)
  print("[trainer] 1=invis 2=hp")
end
return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
__trOn = false                      -- callbacks no-op immediately
if __trKick then __trKick.destroy(); __trKick=nil end
if __trTimer then __trTimer.destroy(); __trTimer=nil end
if __trHK then for _,h in ipairs(__trHK) do h.destroy() end __trHK=nil end
return true
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>40</ID>
          <Description>"1B Money (disable when not in use)"</Description>
          <Options moAlwaysHideChildren="1" moActivateChildrenAsWell="1" moDeactivateChildrenAsWell="1"/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ generated: world:setFinishMoney(999999) }

[ENABLE]
{$lua}
if syntaxcheck then return end

-- Original ID 40 functionality
local function fire(b)
    local c = getAddress('cmd')
    local q = '__CMD=' .. string.format('%q', b)
    writeString(c, q)
    writeByte(c + #q, 0)
    writeQword(getAddress('doit'), 1)
end

fire([==[world:setFinishMoney(1000000000)]==])

-- Clean up old hotkey/timer if they exist
if __money3_hotkey then
    __money3_hotkey.destroy()
    __money3_hotkey = nil
end

if __money3_timer then
    __money3_timer.destroy()
    __money3_timer = nil
end

if __money3_disableTimer then
    __money3_disableTimer.destroy()
    __money3_disableTimer = nil
end

-- ID 43
local moneyRecord = getAddressList().getMemoryRecordByID(43)

if not moneyRecord then
    print('[cheat] ERROR: Could not find memory record ID 43.')
    return false
end

-- ID 43 MUST start disabled.
-- Enabling ID 40 does NOT enable ID 43.
if moneyRecord.Active then
    moneyRecord.Active = false
end

local pending = false

-- Timer responsible for performing the actual ID 43 activation.
-- The hotkey callback itself does NOT touch the MemoryRecord.
__money3_timer = createTimer(nil, false)
__money3_timer.Interval = 10

__money3_timer.OnTimer = function(timer)

    if not pending then
        timer.Enabled = false
        return
    end

    pending = false
    timer.Enabled = false

    -- Make sure ID 43 is off before starting a new cycle
    if moneyRecord.Active then
        moneyRecord.Active = false
    end

    -- =========================================================
    -- PHYSICALLY ENABLE ID 43
    --
    -- This executes ID 43's [ENABLE] section:
    -- world:grantFinishMoney()
    -- =========================================================
    moneyRecord.Active = true

    -- Disable ID 43 automatically after 25 ms
    if __money3_disableTimer then
        __money3_disableTimer.destroy()
        __money3_disableTimer = nil
    end

    __money3_disableTimer = createTimer(nil, false)
    __money3_disableTimer.Interval = 500

    __money3_disableTimer.OnTimer = function(dt)

        dt.Enabled = false

        if moneyRecord.Active then
            moneyRecord.Active = false
        end

        dt.destroy()
        __money3_disableTimer = nil

    end

    __money3_disableTimer.Enabled = true
end

-- =============================================================
-- HOTKEY: 3
-- =============================================================
__money3_hotkey = createHotkey(function()

    -- Ignore another press while the current cycle is running
    if pending then
        return
    end

    pending = true

    -- Queue ID 43 activation
    __money3_timer.Enabled = true

end, 0x33)

print('[trainer] 3=add money')

return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end

-- Remove hotkey
if __money3_hotkey then
    __money3_hotkey.destroy()
    __money3_hotkey = nil
end

-- Remove activation timer
if __money3_timer then
    __money3_timer.destroy()
    __money3_timer = nil
end

-- Remove disable timer
if __money3_disableTimer then
    __money3_disableTimer.destroy()
    __money3_disableTimer = nil
end

-- ID 43 must be OFF when ID 40 is disabled
local moneyRecord = getAddressList().getMemoryRecordByID(43)

if moneyRecord and moneyRecord.Active then
    moneyRecord.Active = false
end

return true
{$asm}
</AssemblerScript>
          <CheatEntries>
            <CheatEntry>
              <ID>43</ID>
              <Description>"run money update"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>{ generated: world:grantFinishMoney() }

[ENABLE]
{$lua}
if syntaxcheck then return end

if __finishMoneyHK then
    __finishMoneyHK.destroy()
    __finishMoneyHK = nil
end

__finishMoneyHK = createHotkey(function()

    local c = getAddress('cmd')
    local q = '__CMD=' .. string.format('%q', 'world:grantFinishMoney()')

    writeString(c, q)
    writeByte(c + #q, 0)
    writeQword(getAddress('doit'), 1)

    print('money added')

end, 0x33)


return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end

if __finishMoneyHK then
    __finishMoneyHK.destroy()
    __finishMoneyHK = nil
end

return true
{$asm}
</AssemblerScript>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>17</ID>
          <Description>"Weapon Hacks (recoil, spread, ammo, full auto)"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Weapon Hax + Infinite Ammo - tick to enable. Requires v7 hook + wrapper installed. }
[ENABLE]
{$lua}
if syntaxcheck then return end
local mf = getMainForm()
if __whKick then __whKick.destroy() end
__whKick = createTimer(mf)
__whKick.Interval = 1
__whKick.OnTimer = function()
  __whKick.destroy(); __whKick = nil
  if __whTimer then __whTimer.destroy() end
  __whTimer = createTimer(mf)
  __whTimer.Interval = 100
  __whTimer.OnTimer = function()
    local c = getAddress("cmd")
    local body = table.concat({
      "local a=getPlayerActor()",
      "if a then",
      -- reserve ammo (the ammo table, keyed by caliber)
      "  if a.ammo then for k in pairs(a.ammo) do a.ammo[k]=999 end end",
      -- weapon fields (the loaded magazine + weapon stats)
      "  if a.weapon then local w=a.weapon",
      "    w.spread=0",
      "    w.realSpread=0",
      "    w.spreadPerShot=0",
      "    w.damage=999",
      "    w.fullAuto=true",
      "    w.mag=999",
      "    w.reloadSpeedMultiplier=0.0001",
      -- optional extra recoil/spread killers (delete if you want ONLY your listed fields):
      "    w.spreadPerShotMultiplier=0",
      "    w.maxSpreadIncrease=0",
      "    w.lookSpread=0",
      "    w.lookSpreadMax=0",
      "  end",
      "end",
    }, " ")
    local wcmd = "__CMD="..string.format("%q", body)
    writeString(c, wcmd); writeByte(c+#wcmd, 0); writeQword(getAddress("doit"), 1)
  end
end
print("[weapon hax + inf ammo] running")
return true
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if __whKick then __whKick.destroy(); __whKick=nil end
if __whTimer then __whTimer.destroy(); __whTimer=nil end
return true
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>44</ID>
          <Description>"Slow Motion"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ generated: game.timescale=0.05 }
[ENABLE]
{$lua}
if syntaxcheck then return end
local function fire(b) local c=getAddress('cmd') local q='__CMD='..string.format('%q',b) writeString(c,q) writeByte(c+#q,0) writeQword(getAddress('doit'),1) end
if __CG_17887155711546_k then __CG_17887155711546_k.destroy() end
__CG_17887155711546_k=createTimer(getMainForm())
__CG_17887155711546_k.Interval=1
__CG_17887155711546_k.OnTimer=function()
  __CG_17887155711546_k.destroy() __CG_17887155711546_k=nil
  if __CG_17887155711546 then __CG_17887155711546.destroy() end
  __CG_17887155711546=createTimer(getMainForm())
  __CG_17887155711546.Interval=200
  __CG_17887155711546.OnTimer=function() fire([==[game.timescale=0.05]==]) end
end
print('[cheat] running: game.timescale=0.05.')
return true
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if __CG_17887155711546 then __CG_17887155711546.destroy() __CG_17887155711546=nil end
if __CG_17887155711546_k then __CG_17887155711546_k.destroy() __CG_17887155711546_k=nil end
return true
{$asm}
</AssemblerScript>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
</CheatTable>
