<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="46">
  <CheatEntries>
    <CheatEntry>
      <ID>137</ID>
      <Description>"Love2D Toolset"</Description>
      <Options moHideChildren="1"/>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>138</ID>
          <Description>"Important Info"</Description>
          <Options moHideChildren="1" moManualExpandCollapse="1" moAllowManualCollapseAndExpand="1"/>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>139</ID>
              <Description>"Love2D has different modes, GC64 (common) and NonGC64 (uncommon)."</Description>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>140</ID>
              <Description>"See Table Extras for more information about GC64 vs NonGC64."</Description>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>141</ID>
              <Description>"If you experience a crash, restart and rehook to clear stale stub (required)."</Description>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>142</ID>
              <Description>"These tools are not guaranteed to work, especially if there's anti-debug involved."</Description>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>156</ID>
              <Description>"Currently only x64 applications are supported (calling conventions differ for x86)."</Description>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>143</ID>
              <Description>"Final note; Hook the games after your in a playable area for best results."</Description>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>144</ID>
          <Description>"Love2D GC64 Tools"</Description>
          <Options moHideChildren="1"/>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>145</ID>
              <Description>"Love2D GC64 Hook Generator"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end

local L, R = string.char(91), string.char(93)
local S_EN, S_DIS = L.."ENABLE"..R, L.."DISABLE"..R
local Q = string.char(34)

local function hx(n) if not n then return nil end return string.format("%X", n) end
local function say(...) local t={...} print(table.concat(t," ")) end

say("[hookgen] starting…")

local is64 = (targetIs64Bit and targetIs64Bit()) or false
if not is64 then say("[hookgen] x64 only."); return true end

-- module
local LUA_MODULE
for _,m in ipairs({"lua51.dll","luajit.dll","lua5.1.dll","love.dll","lua.dll"}) do
  local a=getAddress(m); if a and a~=0 then LUA_MODULE=m break end
end
if not LUA_MODULE and enumModules then
  for _,mod in ipairs(enumModules()) do
    local nm=(mod.Name or ""):lower()
    if nm:find("lua") or nm:find("jit") then LUA_MODULE=mod.Name break end
  end
end
if not LUA_MODULE then say("[hookgen] no Lua module found."); return true end
local MOD = LUA_MODULE:gsub("%.dll$","")
say("[hookgen] module:", LUA_MODULE)

-- functions
local function exp(name)
  for _,sym in ipairs({ LUA_MODULE.."."..name, MOD.."."..name, name }) do
    local ok,a=pcall(getAddress,sym); if ok and a and a~=0 then return a end
  end
end
local gettop=exp("lua_gettop")
local loadstr=exp("luaL_loadstring")
local pcallf=exp("lua_pcall")
local settop=exp("lua_settop")
if not gettop and AOBScan then
  local ok,res=pcall(function() return AOBScan("48 8B 41 ?? 48 2B 41 ?? 48 C1 F8 03 C3","+X",nil,true) end)
  if ok and res then if res.Count and res.Count&gt;0 then gettop=getAddress(res[0]) end res.destroy() end
end
say(string.format("  lua_gettop      : %s", hx(gettop) or "MISS"))
say(string.format("  luaL_loadstring : %s", hx(loadstr) or "MISS"))
say(string.format("  lua_pcall       : %s", hx(pcallf) or "MISS"))
say(string.format("  lua_settop      : %s", hx(settop) or "MISS (cleanup off)"))
if not (gettop and loadstr and pcallf) then
  say("[hookgen] missing required function; locate lua_gettop manually + retry.")
  return true
end

-- parse body
local topOff, baseOff, origParts, cur, hitRet = nil,nil,{},gettop,false
for i=1,8 do
  local dis=disassemble(cur)
  local mn=(dis:match(" %- .- %- (.+)$") or dis:match("%-%s*([%a].+)$") or dis):lower()
  local sz=getInstructionSize(cur); if not sz or sz&lt;1 then sz=1 end
  local bb=readBytes(cur,sz,true) or {}
  for _,v in ipairs(bb) do origParts[#origParts+1]=string.format("%02X",v) end
  local plus=mn:match("%[rcx%+(%x+)%]")
  if mn:find("mov") and mn:find("rax") and plus and not topOff  then topOff=plus  end
  if mn:find("sub") and mn:find("rax") and plus and not baseOff then baseOff=plus end
  if mn:find("ret") then hitRet=true break end
  cur=cur+sz
end
if not (hitRet and topOff and baseOff) then
  say("[hookgen] couldn't parse lua_gettop body."); return true
end
local origBytes=table.concat(origParts," ")
local T,B = topOff, baseOff
say("  restore bytes   :", origBytes)
say("  offsets         : top=[rcx+"..T.."] base=[rcx+"..B.."]")

-- line buffer
local H = {}
local function w(s) H[#H+1] = s end

-- v8 BOOTSTRAP: wrap love.update with a COMPILE-CACHE.
-- __CMDCACHE[code] stores the compiled function so identical commands compile once.
local BOOTSTRAP =
  "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 f==nil then f=loadstring(code) or false; __CMDCACHE[code]=f end; "..
  "if f then pcall(f) end end "..
  "return __V8_ORIG(dt) end "..
  "end"

w("{ AUTO-GEN gated hook + cached love.update wrap for "..MOD..".dll }")
w(S_EN)
w("alloc(newmem,$400)")
w("alloc(stateStore,8)")
w("alloc(cmd,1024)")
w("alloc(doit,8)")
w("alloc(savedtop,8)")
w("alloc(mintop,8)")
w("alloc(gate,8)")
w("registersymbol(stateStore)")
w("registersymbol(cmd)")
w("registersymbol(doit)")
w("registersymbol(mintop)")
w("registersymbol(gate)")
w("registersymbol(gettopHook)")
w("stateStore:")
w("  dq 0")
w("doit:")
w("  dq 0")
w("savedtop:")
w("  dq 0")
w("mintop:")
w("  dq 7FFFFFFF")
w("gate:")
w("  dq 0")
w("cmd:")
w("  db 'a=1',0")
w("label(gettopHook)")
w("label(code)")
w("label(skip)")
w("label(trackmin)")
w("newmem:")
w("  mov [stateStore],rcx")
w("  mov rax,[rcx+"..T.."]")
w("  sub rax,[rcx+"..B.."]")
w("  sar rax,03")
w("  mov rdx,[mintop]")
w("  cmp rax,rdx")
w("  jge trackmin")
w("  mov [mintop],rax")
w("trackmin:")
w("  cmp qword ptr [doit],0")
w("  je skip")
w("  mov rdx,[gate]")
w("  cmp rax,rdx")
w("  jg skip")
w("  mov [savedtop],rax")
w("  push rbp")
w("  mov rbp,rsp")
w("  and rsp,-10")
w("  sub rsp,20")
w("  mov qword ptr [doit],0")
w("  mov rcx,[stateStore]")
w("  lea rdx,[cmd]")
w("  call "..MOD..".luaL_loadstring")
w("  mov rcx,[stateStore]")
w("  xor edx,edx")
w("  mov r8d,0FFFFFFFF")
w("  xor r9d,r9d")
w("  call "..MOD..".lua_pcall")
if settop then
  w("  mov rcx,[stateStore]")
  w("  mov edx,[savedtop]")
  w("  call "..MOD..".lua_settop")
end
w("  mov rsp,rbp")
w("  pop rbp")
w("  mov rcx,[stateStore]")
w("  mov rax,[rcx+"..T.."]")
w("  sub rax,[rcx+"..B.."]")
w("  sar rax,03")
w("skip:")
w("code:")
w("  ret")
w(MOD..".lua_gettop:")
w("gettopHook:")
w("  jmp newmem")
w("")
-- [ENABLE] lua: wait for L + baseline, arm gate, send cached-wrap bootstrap once
w("{$lua}")
w("if syntaxcheck then return end")
w("if __v8boot then __v8boot.destroy() end")
w("__v8boot = createTimer(getMainForm())")
w("__v8boot.Interval = 250")
w("__v8boot.OnTimer = function()")
w("  local Laddr = readQword(getAddress('stateStore'))")
w("  if not Laddr or Laddr==0 then return end")
w("  local mt = readQword(getAddress('mintop'))")
w("  if not mt or mt &gt;= 0x7FFFFFFF then return end")
w("  writeQword(getAddress('gate'), mt)")
w("  local c = getAddress('cmd')")
w("  local boot = "..Q..BOOTSTRAP..Q)
w("  writeString(c, boot); writeByte(c+#boot, 0); writeQword(getAddress('doit'), 1)")
w("  __v8boot.destroy(); __v8boot=nil")
w("  print('[gate armed top='..mt..'; cached love.update wrapper sent. Render-safe now (cached).')")
w("end")
w("return true")
w("{$asm}")
w("")
w(S_DIS)
w("{$lua}")
w("if syntaxcheck then return end")
w("if __v8boot then __v8boot.destroy(); __v8boot=nil end")
w("local c=getAddress('cmd')")
w("local un="..Q.."if __V8_WRAP and __V8_ORIG then love.update=__V8_ORIG; __V8_WRAP=nil; __CMDCACHE=nil end"..Q)
w("writeString(c,un); writeByte(c+#un,0); writeQword(getAddress('doit'),1)")
w("return true")
w("{$asm}")
w(MOD..".lua_gettop:")
w("  db "..origBytes)
w("unregistersymbol(stateStore)")
w("unregistersymbol(cmd)")
w("unregistersymbol(doit)")
w("unregistersymbol(mintop)")
w("unregistersymbol(gate)")
w("unregistersymbol(gettopHook)")
w("dealloc(gate)")
w("dealloc(mintop)")
w("dealloc(savedtop)")
w("dealloc(doit)")
w("dealloc(cmd)")
w("dealloc(stateStore)")
w("dealloc(newmem)")

local hook = table.concat(H, "\n")

-- install
local al=getAddressList()
local function have(desc)
  for i=0,al.Count-1 do local r=al.getMemoryRecord(i)
    if r and r.Description==desc then return true end end
  return false
end
if have("Hook Game") then
  say("[hookgen] entry already present — remove it to regenerate."); return true
end
local rec=al.createMemoryRecord()
rec.Description="Hook Game"
rec.Type=vtAutoAssembler; rec.Script=hook
say("[hookgen] installed. Tick it, play ~1-2s; cached wrapper auto-installs.")

-- helpers
local HELP = {
  "function gcrun(s)",
  "  local c=getAddress('cmd')",
  "  local w='__CMD='..string.format('%q', s)",
  "  writeString(c,w); writeByte(c+#w,0); writeQword(getAddress('doit'),1)",
  "end",
  "function out(expr)",
  "  local c=getAddress('cmd'); local o=c+512",
  "  for i=0,1999 do writeByte(o+i,0) end",
  "  local body=table.concat({",
  "    'local ok,r=pcall(function() return tostring('..expr..') end)',",
  "    \"r=ok and r or ('ERR:'..tostring(r))\",",
  "    'if #r&gt;1900 then r=r:sub(1,1900) end',",
  "    \"local ffi=require('ffi')\",",
  "    \"local p=ffi.cast('char*',\"..string.format('0x%X',o)..')',",
  "    'for i=1,#r do p[i-1]=r:byte(i) end p[#r]=0'",
  "  }, ' ')",
  "  local w='__CMD='..string.format('%q', body)",
  "  writeString(c,w); writeByte(c+#w,0); writeQword(getAddress('doit'),1)",
  "  sleep(140); return readString(o,2000)",
  "end",
  "print(out('2+2'))   -- expect 4 (render-safe, cached)",
}
say("")
say("[hookgen] helpers — paste this whole block in the Lua Engine after the wrapper installs.. should be automated")
say("-----------------------------------------------------------")
for _,line in ipairs(HELP) do say(line) end
say("-----------------------------------------------------------")

if writeToClipboard then pcall(writeToClipboard, hook) end
say("[hookgen] done. (hook copied to clipboard)")
return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
--[[
local al=getAddressList()
for i=al.Count-1,0,-1 do local r=al.getMemoryRecord(i)
  if r and (r.Description=="Hook Game"
        or  (r.Description or ""):find("Lua hookgen")) then r.destroy() end end
]]
return true
{$asm}
</AssemblerScript>
              <CheatEntries>
                <CheatEntry>
                  <ID>146</ID>
                  <Description>"Love2D GC64 Globals Dumper (hook must be enabled)"</Description>
                  <VariableType>Auto Assembler Script</VariableType>
                  <AssemblerScript>{ LOVE2D GLOBAL DUMPER
  Requires the hook enabled + wrapper installed (auto-installs).
  Builds the sorted global name list game-side once, then pages it back in
  slices because a single readback only carries ~512 bytes. }

[ENABLE]
{$lua}
if syntaxcheck then return end

local READ = 480        -- bytes per page (readback buffer safely carries ~512)
local MAXPAGES = 200

local cmdA, doitA = getAddress("cmd"), getAddress("doit")
if not cmdA or not doitA then
  print("[gdump] cmd/doit missing - enable the v7 hook first."); return true
end
local outA = cmdA + 512

local function send(luastr)
  local w = "__CMD="..string.format("%q", luastr)
  writeString(cmdA,w); writeByte(cmdA+#w,0); writeQword(doitA,1)
  sleep(120)
end
local function out(expr)
  for i=0,1999 do writeByte(outA+i,0) end
  local body = table.concat({
    "local ok,r=pcall(function() return tostring("..expr..") end)",
    "r=ok and r or ('ERR:'..tostring(r))",
    "if #r&gt;1900 then r=r:sub(1,1900) end",
    "local ffi=require('ffi')",
    "local p=ffi.cast('char*',"..string.format("0x%X",outA)..")",
    "for i=1,#r do p[i-1]=r:byte(i) end p[#r]=0",
  }, " ")
  local w = "__CMD="..string.format("%q", body)
  writeString(cmdA,w); writeByte(cmdA+#w,0); writeQword(doitA,1)
  sleep(150)
  return readString(outA, 2000)
end

print("==================== GLOBAL DUMP ====================")
if out("2+2") ~= "4" then
  print("[gdump] readback failed - wrapper installed?")
  print("==============================================================="); return true
end

-- build the full sorted name list into __GD in one command
local n = tonumber(out([[(function()
  local names={} for k in pairs(_G) do names[#names+1]=tostring(k) end
  table.sort(names)
  __GD=table.concat(names, ', ')
  return #names
end)()]])) or 0
local len = tonumber(out("tostring(#__GD)")) or 0
print(string.format("[gdump] %d globals, %d chars:", n, len))

-- page __GD until empty
local pos=1
local part=0
local printed=0
while part &lt; MAXPAGES do
  part=part+1
  local piece = out("(function() return __GD:sub("..pos..","..(pos+READ-1)..") end)()")
  if piece==nil then break end
  if piece=="" then part=part-1; break end
  if piece:find("^ERR") then print("[gdump] err: "..piece); break end
  print("--- part "..part.." ---")
  print(piece)
  printed=printed+#piece
  pos=pos+READ
  if len&gt;0 and printed&gt;=len then break end
end

send("__GD=nil")
print("===============================================================")
print(string.format("[gdump] done: %d of %d chars, %d parts.", printed, len, part))
print("[gdump] Inspect a table with the inspector using a full path.")
return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
return true
{$asm}
</AssemblerScript>
                  <CheatEntries>
                    <CheatEntry>
                      <ID>147</ID>
                      <Description>"Love2D GC64 Table Inspector (hook must be enabled)"</Description>
                      <VariableType>Auto Assembler Script</VariableType>
                      <AssemblerScript>{ LOVE2D TABLE INSPECTOR
  Requires the hook enabled + wrapper installed (auto-installs).

  Set TARGET to any expression resolving to a table (full path).
  Set CALL=true only if TARGET itself is a function to call.

  Enumeration is single-pass and read-only: it uses next() so a custom __pairs
  can't hijack it, and never tostring's userdata/cdata/function/table values. }

[ENABLE]
{$lua}
if syntaxcheck then return end

-- ============ CONFIG ============
local TARGET = "game"
local CALL   = false
local READ   = 480     -- bytes per page (&lt; 1900 buffer)
local MAXPAGES = 200     -- safety cap
-- ================================

local cmdA, doitA = getAddress("cmd"), getAddress("doit")
if not cmdA or not doitA then
  print("[inspect] cmd/doit missing - enable the hook first."); return true
end
local outA = cmdA + 512

local function send(luastr)
  local w = "__CMD="..string.format("%q", luastr)
  writeString(cmdA,w); writeByte(cmdA+#w,0); writeQword(doitA,1)
  sleep(120)
end
local function out(expr)
  for i=0,1999 do writeByte(outA+i,0) end
  local body = table.concat({
    "local ok,r=pcall(function() return tostring("..expr..") end)",
    "r=ok and r or ('ERR:'..tostring(r))",
    "if #r&gt;1900 then r=r:sub(1,1900) end",
    "local ffi=require('ffi')",
    "local p=ffi.cast('char*',"..string.format("0x%X",outA)..")",
    "for i=1,#r do p[i-1]=r:byte(i) end p[#r]=0",
  }, " ")
  local w = "__CMD="..string.format("%q", body)
  writeString(cmdA,w); writeByte(cmdA+#w,0); writeQword(doitA,1)
  sleep(150)
  return readString(outA, 2000)
end

local REF = CALL and (TARGET.."()") or TARGET
print("==================== INSPECT: "..REF.." ====================")

if out("2+2") ~= "4" then
  print("[inspect] readback failed - wrapper installed?")
  print("========================================================"); return true
end
local ty = out("type("..REF..")")
print("[inspect] type = "..ty)
if ty:find("^ERR") then
  print("[inspect] couldn't resolve "..REF.."."); print("========================================================"); return true
end
if ty ~= "table" then
  if ty=="number" or ty=="boolean" or ty=="string" then
    print("[inspect] value = "..out("tostring("..REF..")"))
  else
    print("[inspect] ("..ty.." - value not shown, may be unsafe)")
  end
  print("========================================================"); return true
end

-- quote-free single-pass enumerator
local SETUP = table.concat({
  "function __IIbuild()",
  " local root=__IIroot",
  " local parts={} local n=0 local k=nil",
  " while true do",
  "  local key,v=next(root,k)",
  "  if key==nil then break end",
  "  k=key n=n+1",
  "  local ks='?' pcall(function() ks=tostring(key) end)",
  "  local tv=type(v)",
  "  local piece=ks..'('..tv",
  "  if tv=='number' or tv=='boolean' then piece=piece..'='..tostring(v)",
  "  elseif tv=='string' then local vs='' pcall(function() vs=v end) if #vs&gt;24 then vs=vs:sub(1,24) end piece=piece..'='..vs end",
  "  piece=piece..')'",
  "  parts[#parts+1]=piece",
  " end",
  " __IIOUT=table.concat(parts,', ') __IIN=n",
  " return n",
  "end",
}, " ")

send("__IIroot="..REF)
send("__IISRC=''")
local CH=300
local i=1
while i&lt;=#SETUP do
  send("__IISRC=__IISRC..[==["..SETUP:sub(i,i+CH-1).."]==]")
  i=i+CH
end
local setupOK = out("(function() local f,e=loadstring(__IISRC) if not f then return 'CERR:'..tostring(e) end local ok,er=pcall(f) return ok and 'ok' or ('RERR:'..tostring(er)) end)()")
if setupOK~="ok" then
  print("[inspect] setup failed: "..tostring(setupOK))
  print("========================================================"); return true
end

local n = tonumber(out("__IIbuild()")) or 0
local len = tonumber(out("tostring(#__IIOUT)")) or 0
print(string.format("[inspect] %d fields, %d chars total:", n, len))
if n==0 then print("========================================================"); return true end

-- page fixed slices until one comes back empty (doesn't rely on len to stop)
local pos = 1
local part = 0
local printed = 0
while part &lt; MAXPAGES do
  part = part + 1
  local piece = out("(function() local s=__IIOUT:sub("..pos..","..(pos+READ-1)..") return s end)()")
  if piece == nil then print("[inspect] nil read at part "..part); break end
  if piece == "" then part = part - 1; break end        -- reached the end
  if piece:find("^ERR") then print("[inspect] err read: "..piece); break end
  print("--- part "..part.." ---")
  print(piece)
  printed = printed + #piece
  pos = pos + READ
  if printed &gt;= len and len&gt;0 then break end            -- covered everything
end

send("__IIroot=nil __IIOUT=nil __IIN=nil __IIbuild=nil __IISRC=nil")
print("========================================================")
print(string.format("[inspect] done: printed %d of %d chars across %d parts.", printed, len, part))
print("[inspect] Nested table? set TARGET to its full path.")
--just a friendly reminder
return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
return true
{$asm}
</AssemblerScript>
                      <CheatEntries>
                        <CheatEntry>
                          <ID>148</ID>
                          <Description>"Love2D GC64 Function Sniffer (hook must be enabled)"</Description>
                          <VariableType>Auto Assembler Script</VariableType>
                          <AssemblerScript>{ LOVE2D FUNCTION SIGNATURE INSPECTOR
  Requires the hook enabled + wrapper installed (auto-installs).

  Set TARGET to the full path of a function, e.g. game.changeMoney.
  Reports param count, vararg flag, param names and the defining source:line.
  Names come from debug info (LuaJIT); if they show as '?' the count and vararg
  flag are still correct - cross-reference the source:line or test-call. }

[ENABLE]
{$lua}
if syntaxcheck then return end

-- ============ CONFIG ============
local TARGET = "game.logMoney"   -- full path to the function
-- ================================

local cmdA, doitA = getAddress("cmd"), getAddress("doit")
if not cmdA or not doitA then
  print("[fnsig] cmd/doit missing - enable the hook first."); return true
end
local outA = cmdA + 512

local function out(expr)
  for i=0,1999 do writeByte(outA+i,0) end
  local body = table.concat({
    "local ok,r=pcall(function() return tostring("..expr..") end)",
    "r=ok and r or ('ERR:'..tostring(r))",
    "if #r&gt;1900 then r=r:sub(1,1900) end",
    "local ffi=require('ffi')",
    "local p=ffi.cast('char*',"..string.format("0x%X",outA)..")",
    "for i=1,#r do p[i-1]=r:byte(i) end p[#r]=0",
  }, " ")
  local w = "__CMD="..string.format("%q", body)
  writeString(cmdA,w); writeByte(cmdA+#w,0); writeQword(doitA,1)
  sleep(150)
  return readString(outA, 2000)
end

print("================ FUNCTION SIGNATURE: "..TARGET.." ================")

if out("2+2") ~= "4" then
  print("[fnsig] readback failed - wrapper installed?")
  print("==============================================================="); return true
end

local ty = out("type("..TARGET..")")
if ty ~= "function" then
  print("[fnsig] "..TARGET.." is not a function (type="..ty..").")
  print("==============================================================="); return true
end

-- nparams, isvararg, source, line
print("info: "..out([[(function()
  local ok,info = pcall(debug.getinfo, ]]..TARGET..[[, 'uS')
  if not ok or not info then return 'no debug.getinfo' end
  return 'params='..tostring(info.nparams)
       ..' vararg='..tostring(info.isvararg)
       ..' defined='..tostring(info.short_src)..':'..tostring(info.linedefined)
       ..' what='..tostring(info.what)
end)()]]))

-- parameter names via debug.getlocal on the function prototype
print("param names: "..out([[(function()
  local names={}
  local i=1
  while true do
    local ok,n = pcall(debug.getlocal, ]]..TARGET..[[, i)
    if not ok or not n then break end
    names[#names+1]=i..':'..tostring(n)
    i=i+1
    if i&gt;20 then break end
  end
  if #names==0 then return '(names not available on this build)' end
  return table.concat(names, ', ')
end)()]]))

-- a first param named 'self' means it's meant to be called with ':'
print("hint: "..out([[(function()
  local ok,n = pcall(debug.getlocal, ]]..TARGET..[[, 1)
  if ok and n=='self' then return 'first param is self -&gt; call with :  e.g. owner:func(args after self)' end
  return 'no self as first param -&gt; likely plain call with .'
end)()]]))

print("===============================================================")
print("[fnsig] Use the param names/count to fill the generator's Args field.")
print("[fnsig] If names are '?', open the source at the defined: line, or test-call.")
print("[fnsig] Args should be in lua format without parenthesis. Example below.")
print("args for a function named game.changeMoney would be '1000, true' if it")
print("only requires the args 'amt' and 'pending'.")
return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
return true
{$asm}
</AssemblerScript>
                          <CheatEntries>
                            <CheatEntry>
                              <ID>149</ID>
                              <Description>"Love2D GC64 Cheat Generator (hook must be enabled)"</Description>
                              <VariableType>Auto Assembler Script</VariableType>
                              <AssemblerScript>{ LOVE2D CHEAT GENERATOR
  Requires the hook enabled + wrapper installed (auto-installs).

  boolean / number / string : sets  path = value
  function                  : calls the function
    Call style ':' passes self (game:changeMoney(x)); '.' is a plain call.
    Args      : text placed inside the parentheses, e.g.  1000  or  5, true
    OFF value : for value types, what to set on disable; for functions, a raw
                Lua command to run on disable (blank = none).

  Generate adds a toggle entry to the address list. }

[ENABLE]
{$lua}
if syntaxcheck then return end

if getAddress("cmd")==nil or getAddress("doit")==nil then
  print("[cheatgen] enable the hook first."); return true
end
if __CG_form then __CG_form.destroy(); __CG_form=nil end

local form = createForm(true)
form.Caption = "Love2D Cheat Generator"
form.Width = 440
form.Height = 340
__CG_form = form

local function lbl(txt,x,y) local l=createLabel(form) l.Caption=txt l.Left=x l.Top=y return l end
local function edit(x,y,w,d) local e=createEdit(form) e.Left=x e.Top=y e.Width=w e.Text=d or "" return e end

lbl("Path (e.g. game.g.creative  or  game.changeMoney):", 12, 12)
local ePath = edit(12, 32, 416, "game.g.")

lbl("Type:", 12, 66)
local cType = createComboBox(form)
cType.Left=60; cType.Top=62; cType.Width=140
for _,x in ipairs({"boolean","number","string","function"}) do cType.Items.add(x) end
cType.ItemIndex=0

local cBool = createComboBox(form)
cBool.Left=100; cBool.Top=96; cBool.Width=120
cBool.Items.add("true"); cBool.Items.add("false"); cBool.ItemIndex=0
-- ON value for number/string, or Args for function (same widget, relabeled)
local lVal = lbl("ON value:", 12, 100)
local eVal = edit(100, 96, 320, "")
eVal.Visible=false

local lStyle = lbl("Call style:", 12, 134)
local cStyle = createComboBox(form)
cStyle.Left=100; cStyle.Top=130; cStyle.Width=80
cStyle.Items.add(":"); cStyle.Items.add("."); cStyle.ItemIndex=0
lStyle.Visible=false; cStyle.Visible=false

lbl("OFF value / disable command (blank = none):", 12, 168)
local eOff = edit(12, 188, 416, "false")

lbl("Continuous (repeat every 200ms)?", 12, 222)
local cCont = createComboBox(form)
cCont.Left=240; cCont.Top=218; cCont.Width=90
cCont.Items.add("yes"); cCont.Items.add("no"); cCont.ItemIndex=1

local function refreshType()
  local t = cType.Text
  if t=="boolean" then
    cBool.Visible=true; eVal.Visible=false
    lStyle.Visible=false; cStyle.Visible=false
    lVal.Caption="ON value:"; eOff.Text="false"
  elseif t=="function" then
    cBool.Visible=false; eVal.Visible=true
    lStyle.Visible=true; cStyle.Visible=true
    lVal.Caption="Args (inside parentheses):"; eOff.Text=""
  else
    cBool.Visible=false; eVal.Visible=true
    lStyle.Visible=false; cStyle.Visible=false
    lVal.Caption="ON value:"; eOff.Text=""
    if t=="number" and eVal.Text=="" then eVal.Text="999" end
  end
end
cType.OnChange = refreshType
refreshType()

local function literal(t, raw)
  if t=="boolean" then return raw
  elseif t=="number" then local n=tonumber(raw) return n and tostring(n) or "0"
  else return string.format("%q", raw) end
end

local function buildOn(path, t)
  if t=="function" then
    local args = eVal.Text
    local style = cStyle.Text     -- ":" or "."
    if style==":" then
      -- split path into owner + method for ':' calls
      local owner, method = path:match("^(.*)%.([%w_]+)$")
      if owner and method then
        return owner..":"..method.."("..args..")"
      else
        -- nothing to split (top-level func) -&gt; plain call
        return path.."("..args..")"
      end
    else
      return path.."("..args..")"
    end
  else
    local onRaw = (t=="boolean") and cBool.Text or eVal.Text
    return path.."="..literal(t, onRaw), onRaw
  end
end

local status = lbl("", 12, 254)

local btn = createButton(form)
btn.Caption="Generate"; btn.Left=12; btn.Top=276; btn.Width=416; btn.Height=30
btn.OnClick = function()
  local path = ePath.Text:gsub("%s+$","")
  local t = cType.Text
  if path=="" or path:sub(-1)=="." then status.Caption="[!] enter a valid path"; return end

  local onBody, onRaw = buildOn(path, t)
  onRaw = onRaw or (t=="function" and ("("..eVal.Text..")") or onBody)
  local offRaw = eOff.Text
  local hasOff = (offRaw ~= "")
  -- OFF: value types set path=off; functions run the OFF text as a raw Lua command
  local offBody
  if hasOff then
    if t=="function" then offBody = offRaw
    else offBody = path.."="..literal(t, offRaw) end
  end
  local cont = (cCont.Text=="yes")

  local L,R = string.char(91), string.char(93)
  local EN,DIS = L.."ENABLE"..R, L.."DISABLE"..R
  local gname = "__CG_"..tostring(os.time())..tostring(math.random(1000,9999))
  local H={}
  local function w(s) H[#H+1]=s end

  w("{ generated: "..onBody.." }")
  w(EN)
  w("{$lua}")
  w("if syntaxcheck then return end")
  w("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 cont then
    w("if "..gname.."_k then "..gname.."_k.destroy() end")
    w(gname.."_k=createTimer(getMainForm())")
    w(gname.."_k.Interval=1")
    w(gname.."_k.OnTimer=function()")
    w("  "..gname.."_k.destroy() "..gname.."_k=nil")
    w("  if "..gname.." then "..gname..".destroy() end")
    w("  "..gname.."=createTimer(getMainForm())")
    w("  "..gname..".Interval=200")
    w("  "..gname..".OnTimer=function() fire([==["..onBody.."]==]) end")
    w("end")
    w("print('[cheat] running: "..onBody:gsub("'","")..".')")
    w("return true")
    w("{$asm}")
    w(DIS)
    w("{$lua}")
    w("if syntaxcheck then return end")
    w("if "..gname.." then "..gname..".destroy() "..gname.."=nil end")
    w("if "..gname.."_k then "..gname.."_k.destroy() "..gname.."_k=nil end")
    if hasOff then w("fire2 = function(b) local c=getAddress('cmd') local q='__CMD='..string.format('%q',b) writeString(c,q) writeByte(c+#q,0) writeQword(getAddress('doit'),1) end fire2([==["..offBody.."]==])") end
    w("return true")
    w("{$asm}")
  else
    w("fire([==["..onBody.."]==])")
    w("print('[cheat] ran: "..onBody:gsub("'","")..".')")
    w("return true")
    w("{$asm}")
    w(DIS)
    w("{$lua}")
    w("if syntaxcheck then return end")
    if hasOff then w("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([==["..offBody.."]==])") end
    w("return true")
    w("{$asm}")
  end
  local script = table.concat(H,"\n")

  local al = getAddressList()
  local rec = al.createMemoryRecord()
  rec.Description = (t=="function") and (path.."("..eVal.Text..")") or (path.." = "..onRaw)
  rec.Type = vtAutoAssembler
  rec.Script = script

  status.Caption = "[ok] added: "..rec.Description
  print("[cheatgen] added: "..rec.Description)
end

return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
if __CG_form then __CG_form.destroy(); __CG_form=nil end
return true
{$asm}
</AssemblerScript>
                            </CheatEntry>
                          </CheatEntries>
                        </CheatEntry>
                      </CheatEntries>
                    </CheatEntry>
                  </CheatEntries>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>150</ID>
          <Description>"Love2D NonGC64 Tools"</Description>
          <Options moHideChildren="1"/>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>151</ID>
              <Description>"Love2D NonGC64 Hook Generator"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end

local L, R = string.char(91), string.char(93)
local S_EN, S_DIS = L.."ENABLE"..R, L.."DISABLE"..R
local Q = string.char(34)
local BS = string.char(92)   -- backslash, for emitting \n in generated code

local function hx(n) if not n then return nil end return string.format("%X", n) end
local function say(...) local t={...} print(table.concat(t," ")) end

say("[nongc64-gen] starting…")
local is64 = (targetIs64Bit and targetIs64Bit()) or false
if not is64 then say("[nongc64-gen] x64 only."); return true end

-- module
local LUA_MODULE
for _,m in ipairs({"lua51.dll","luajit.dll","lua5.1.dll","love.dll","lua.dll"}) do
  local a=getAddress(m); if a and a~=0 then LUA_MODULE=m break end
end
if not LUA_MODULE and enumModules then
  for _,mod in ipairs(enumModules()) do
    local nm=(mod.Name or ""):lower()
    if nm:find("lua") or nm:find("jit") then LUA_MODULE=mod.Name break end
  end
end
if not LUA_MODULE then say("[nongc64-gen] no Lua module found."); return true end
local MOD = LUA_MODULE:gsub("%.dll$","")
say("[nongc64-gen] module:", LUA_MODULE)

-- functions
local function exp(name)
  for _,sym in ipairs({ MOD.."."..name, LUA_MODULE.."."..name, name }) do
    local ok,a=pcall(getAddress,sym); if ok and a and a~=0 then return a end
  end
end
local gettop=exp("lua_gettop")
local loadstr=exp("luaL_loadstring")
local pcallf=exp("lua_pcall")
local settop=exp("lua_settop")
if not gettop and AOBScan then
  local ok,res=pcall(function() return AOBScan("48 8B 41 ?? 48 2B 41 ?? 48 C1 F8 03 C3","+X",nil,true) end)
  if ok and res then if res.Count and res.Count&gt;0 then gettop=getAddress(res[0]) end res.destroy() end
end
say(string.format("  lua_gettop      : %s", hx(gettop) or "MISS"))
say(string.format("  luaL_loadstring : %s", hx(loadstr) or "MISS"))
say(string.format("  lua_pcall       : %s", hx(pcallf) or "MISS"))
say(string.format("  lua_settop      : %s", hx(settop) or "MISS"))
if not (gettop and loadstr and pcallf and settop) then
  say("[nongc64-gen] missing a required function (need all four)."); return true
end

-- parse body
local topOff, baseOff, origParts, cur, hitRet = nil,nil,{},gettop,false
for i=1,8 do
  local dis=disassemble(cur)
  local mn=(dis:match(" %- .- %- (.+)$") or dis:match("%-%s*([%a].+)$") or dis):lower()
  local sz=getInstructionSize(cur); if not sz or sz&lt;1 then sz=1 end
  local bb=readBytes(cur,sz,true) or {}
  for _,v in ipairs(bb) do origParts[#origParts+1]=string.format("%02X",v) end
  local plus=mn:match("%[rcx%+(%x+)%]")
  if mn:find("mov") and mn:find("rax") and plus and not topOff  then topOff=plus  end
  if mn:find("sub") and mn:find("rax") and plus and not baseOff then baseOff=plus end
  if mn:find("ret") then hitRet=true break end
  cur=cur+sz
end
if not (hitRet and topOff and baseOff) then
  say("[nongc64-gen] couldn't parse lua_gettop body."); return true
end
local origBytes=table.concat(origParts," ")
local T,B = topOff, baseOff
say("  restore bytes   :", origBytes)
say("  offsets         : top=[rcx+"..T.."] base=[rcx+"..B.."]")

-- line buffer (same approach as the working GC64 generator)
local H = {}
local function w(s) H[#H+1] = s end

w("{ AUTO-GEN nonGC64 capture+stub hook for "..MOD..".dll }")
w(S_EN)
w("alloc(newmem,$200)")
w("alloc(stateStore,8)")
w("registersymbol(stateStore)")
w("registersymbol(gettopHook)")
w("stateStore:")
w("  dq 0")
w("label(gettopHook)")
w("newmem:")
w("  mov [stateStore],rcx")
w("  mov rax,[rcx+"..T.."]")
w("  sub rax,[rcx+"..B.."]")
w("  sar rax,03")
w("  ret")
w(MOD..".lua_gettop:")
w("gettopHook:")
w("  jmp newmem")
-- {$lua} block: build stub + define out/gcrun. Emitted line-by-line (no template).
w("{$lua}")
w("if syntaxcheck then return end")
w("__KLS=getAddress("..Q..MOD..".luaL_loadstring"..Q..")")
w("__KPC=getAddress("..Q..MOD..".lua_pcall"..Q..")")
w("__KST=getAddress("..Q..MOD..".lua_settop"..Q..")")
w("__KSTR=__KSTR or allocateMemory(8192)")
w("__KOUT=__KOUT or allocateMemory(8192)")
w("__KSTUB=__KSTUB or allocateMemory(256)")
w("__KARGS=__KARGS or allocateMemory(32)")
w("if not __KSTUB_BUILT then")
w("  local a={}")
w("  a[#a+1]=string.format("..Q.."%X:"..Q..",__KSTUB)")
w("  a[#a+1]="..Q.."push rbp"..Q)
w("  a[#a+1]="..Q.."mov rbp,rsp"..Q)
w("  a[#a+1]="..Q.."and rsp,-10"..Q)
w("  a[#a+1]="..Q.."sub rsp,40"..Q)
w("  a[#a+1]=string.format("..Q.."mov rax,%X"..Q..",__KARGS)")
w("  a[#a+1]="..Q.."mov rcx,[rax]"..Q)
w("  a[#a+1]="..Q.."mov rdx,[rax+8]"..Q)
w("  a[#a+1]=string.format("..Q.."mov r10,%X"..Q..",__KLS)")
w("  a[#a+1]="..Q.."call r10"..Q)
w("  a[#a+1]=string.format("..Q.."mov rax,%X"..Q..",__KARGS)")
w("  a[#a+1]="..Q.."mov rcx,[rax]"..Q)
w("  a[#a+1]="..Q.."xor edx,edx"..Q)
w("  a[#a+1]="..Q.."mov r8d,0FFFFFFFF"..Q)
w("  a[#a+1]="..Q.."xor r9d,r9d"..Q)
w("  a[#a+1]=string.format("..Q.."mov r10,%X"..Q..",__KPC)")
w("  a[#a+1]="..Q.."call r10"..Q)
w("  a[#a+1]=string.format("..Q.."mov rax,%X"..Q..",__KARGS)")
w("  a[#a+1]="..Q.."mov rcx,[rax]"..Q)
w("  a[#a+1]="..Q.."xor edx,edx"..Q)
w("  a[#a+1]=string.format("..Q.."mov r10,%X"..Q..",__KST)")
w("  a[#a+1]="..Q.."call r10"..Q)
w("  a[#a+1]="..Q.."mov rsp,rbp"..Q)
w("  a[#a+1]="..Q.."pop rbp"..Q)
w("  a[#a+1]="..Q.."ret"..Q)
w("  autoAssemble(table.concat(a,string.char(10)))")
w("  __KSTUB_BUILT=true")
w("end")
w("__CMDMODE='stub'")
w("function gcrun(code)")
w("  local st=readQword(getAddress("..Q.."stateStore"..Q.."))")
w("  if not st or st==0 then return false end")
w("  writeString(__KSTR,code); writeByte(__KSTR+#code,0)")
w("  writeQword(__KARGS,st); writeQword(__KARGS+8,__KSTR)")
w("  executeCodeEx(false,5000,__KSTUB)")
w("  return true")
w("end")
w("function out(expr)")
w("  local o=__KOUT")
w("  for i=0,127 do writeByte(o+i,0) end")
w("  local body=\"local ffi=require('ffi') local ok,r=pcall(function() return tostring(\"..expr..\") end) r=ok and r or ('ERR:'..tostring(r)) if #r&gt;8000 then r=r:sub(1,8000) end local p=ffi.cast('char*',0x\"..string.format(\"%X\",o)..\") for i=1,#r do p[i-1]=r:byte(i) end p[#r]=0\"")
w("  gcrun(body)")
w("  return readString(o,8000)")
w("end")
w("if __kcap then __kcap.destroy() end")
w("__kcap=createTimer(getMainForm())")
w("__kcap.Interval=200")
w("__kcap.OnTimer=function()")
w("  local st=readQword(getAddress("..Q.."stateStore"..Q.."))")
w("  if not st or st==0 then return end")
w("  __kcap.destroy(); __kcap=nil")
w("  print('[nongc64] state @ '..string.format('%X',st)..' - out()/gcrun() ready. test: print(out(\"2+2\"))')")
w("end")
w("print('[nongc64] loaded; waiting for capture...')")
w("return true")
w("{$asm}")
w(S_DIS)
w("{$lua}")
w("if syntaxcheck then return end")
w("if __kcap then __kcap.destroy(); __kcap=nil end")
w("return true")
w("{$asm}")
w(MOD..".lua_gettop:")
w("  db "..origBytes)
w("unregistersymbol(stateStore)")
w("unregistersymbol(gettopHook)")
w("dealloc(stateStore)")
w("dealloc(newmem)")

local hook = table.concat(H, "\n")

-- install
local al=getAddressList()
local function have(desc)
  for i=0,al.Count-1 do local r=al.getMemoryRecord(i)
    if r and r.Description==desc then return true end end
  return false
end
if have("Hook Game (nonGC64)") then
  say("[nongc64-gen] entry already present - remove it to regenerate."); return true
end
local rec=al.createMemoryRecord()
rec.Description="Hook Game (nonGC64)"
rec.Type=vtAutoAssembler; rec.Script=hook
say("[nongc64-gen] installed 'Hook Game (nonGC64)'. Tick it, play ~1s.")
if writeToClipboard then pcall(writeToClipboard, hook) end
say("[nongc64-gen] done.")
return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
return true
{$asm}
</AssemblerScript>
              <CheatEntries>
                <CheatEntry>
                  <ID>152</ID>
                  <Description>"Love2D NonGC64 Globals Dumper"</Description>
                  <VariableType>Auto Assembler Script</VariableType>
                  <AssemblerScript>{ GLOBAL DUMPER (non-GC64) - crash-safe chunked version.
  Requires "Hook Game (nonGC64)" enabled (defines global out()/gcrun()).

  Design for stability on non-GC64 (executeCodeEx-per-call has a small risk each,
  and big single ops are marginal).}

[ENABLE]
{$lua}
if syntaxcheck then return end

if type(out)~="function" or type(gcrun)~="function" then
  print("[gdump] enable the nonGC64 hook first (defines out/gcrun)."); return true
end

local READ = 1500   -- small, safe per-read chunk

print("==================== GLOBAL DUMP (nonGC64) ====================")
if out("2+2") ~= "4" then
  print("[gdump] out() not ready."); print("=============================================================="); return true
end

-- ONE build call: sorted global names into game global __GD
gcrun("__GD=(function() local n={} for k in pairs(_G) do n[#n+1]=tostring(k) end table.sort(n) return table.concat(n,', ') end)()")

local len = tonumber(out("#__GD")) or 0
print(string.format("[gdump] %d chars:", len))
if len==0 then print("[gdump] nothing (build failed?)"); print("=============================================================="); return true end

-- page with small reads; each out() here is a light stub call
local pos, part, printed = 1, 0, 0
while part &lt; 200 do
  part = part + 1
  local piece = out("__GD:sub("..pos..","..(pos+READ-1)..")")
  if not piece or piece=="" then part=part-1; break end
  if piece:find("^ERR") then print("[gdump] err: "..piece); break end
  print("--- part "..part.." ---")
  print(piece)
  printed = printed + #piece
  pos = pos + READ
  if printed &gt;= len then break end
end

-- NO cleanup call (leaving __GD is harmless; the cleanup call was crashing).
print("==============================================================")
print(string.format("[gdump] done: %d of %d chars, %d parts.", printed, len, part))
print("[gdump] Inspect a table with the inspector (full path).")
return true
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
return true
{$asm}
</AssemblerScript>
                  <CheatEntries>
                    <CheatEntry>
                      <ID>153</ID>
                      <Description>"Love2D NonGC64 Table Inspector (hook must be enabled)"</Description>
                      <VariableType>Auto Assembler Script</VariableType>
                      <AssemblerScript>{ TABLE INSPECTOR (nongc64)}
[ENABLE]
{$lua}
if syntaxcheck then return end

-- ============ CONFIG ============
local TARGET = "DAMAGE_HOST"
local CALL   = false
-- ================================

if type(out)~="function" or type(gcrun)~="function" then
  print("[inspect] enable a hook first (defines out/gcrun)."); return true end
local READ = (__CMDMODE=="stub") and 1500 or 480

local REF = CALL and (TARGET.."()") or TARGET
print("==================== INSPECT: "..REF.." ====================")
if out("2+2") ~= "4" then print("[inspect] out() not ready."); return true end
local ty = out("type("..REF..")")
print("[inspect] type = "..ty)
if ty:find("^ERR") then print("[inspect] couldn't resolve "..REF.."."); return true end
if ty ~= "table" then
  if ty=="number" or ty=="boolean" or ty=="string" then print("[inspect] value = "..out("tostring("..REF..")"))
  else print("[inspect] ("..ty.." - value not shown)") end
  return true end

-- single-pass safe enumerator, installed piece-wise via gcrun
local SETUP = table.concat({
  "function __IIbuild()",
  " local root=__IIroot local parts={} local n=0 local k=nil",
  " while true do local key,v=next(root,k) if key==nil then break end k=key n=n+1",
  "  local ks='?' pcall(function() ks=tostring(key) end)",
  "  local tv=type(v) local piece=ks..'('..tv",
  "  if tv=='number' or tv=='boolean' then piece=piece..'='..tostring(v)",
  "  elseif tv=='string' then local vs='' pcall(function() vs=v end) if #vs&gt;24 then vs=vs:sub(1,24) end piece=piece..'='..vs end",
  "  piece=piece..')' parts[#parts+1]=piece",
  " end __IIOUT=table.concat(parts,', ') return n",
  "end",
}, " ")
gcrun("__IIroot="..REF)
gcrun("__IISRC=''")
local CH=300 local i=1
while i&lt;=#SETUP do gcrun("__IISRC=__IISRC..[==["..SETUP:sub(i,i+CH-1).."]==]") i=i+CH end
local sok=out("(function() local f,e=loadstring(__IISRC) if not f then return 'CERR:'..tostring(e) end local ok,er=pcall(f) return ok and 'ok' or ('RERR:'..tostring(er)) end)()")
if sok~="ok" then print("[inspect] setup failed: "..tostring(sok)); return true end

local n = tonumber(out("__IIbuild()")) or 0
local len = tonumber(out("#__IIOUT")) or 0
print(string.format("[inspect] %d fields, %d chars:", n, len))
if n==0 then return true end

local pos,part,printed=1,0,0
while part&lt;300 do
  part=part+1
  local piece=out("__IIOUT:sub("..pos..","..(pos+READ-1)..")")
  if not piece or piece=="" then part=part-1 break end
  if piece:find("^ERR") then break end
  print("--- part "..part.." ---"); print(piece)
  printed=printed+#piece; pos=pos+READ
  if len&gt;0 and printed&gt;=len then break end
end
gcrun("__IIroot=nil __IIOUT=nil __IIbuild=nil __IISRC=nil")
print(string.format("[inspect] done: %d of %d chars.", printed, len))
print("[inspect] Nested table? set TARGET to its full path.")
return true
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
return true
{$asm}
</AssemblerScript>
                      <CheatEntries>
                        <CheatEntry>
                          <ID>154</ID>
                          <Description>"Love2D NonGC64 Function Sniffer (hook must be enabled)"</Description>
                          <VariableType>Auto Assembler Script</VariableType>
                          <AssemblerScript>{ FUNCTION SNIFFER (nongc64)}
[ENABLE]
{$lua}
if syntaxcheck then return end

-- ============ CONFIG ============
local TARGET = "main.set_locale"
-- ================================

if type(out)~="function" then print("[fnsig] enable a hook first."); return true end

print("================ FUNCTION SIGNATURE: "..TARGET.." ================")
if out("2+2") ~= "4" then print("[fnsig] out() not ready."); return true end

local ty = out("type("..TARGET..")")
if ty ~= "function" then
  print("[fnsig] "..TARGET.." is not a function (type="..ty..").")
  print("==============================================================="); return true
end

-- getinfo: params, vararg, source:line (this works reliably)
print("info: "..out([[(function()
  local ok,info = pcall(debug.getinfo, ]]..TARGET..[[, 'uS')
  if not ok or not info then return 'no debug.getinfo' end
  return 'params='..tostring(info.nparams)
       ..' vararg='..tostring(info.isvararg)
       ..' defined='..tostring(info.short_src)..':'..tostring(info.linedefined)
       ..' what='..tostring(info.what)
end)()]]))

-- param names via getlocal - FULLY guarded (some LuaJIT builds error here).
-- Whole loop is inside ONE pcall so a bad getlocal can't cascade/crash.
print("param names: "..out([[(function()
  local ok,res = pcall(function()
    local names={}
    for i=1,20 do
      local n = debug.getlocal(]]..TARGET..[[, i)
      if type(n)~='string' then break end
      names[#names+1]=i..':'..n
    end
    if #names==0 then return '(names not available on this build)' end
    return table.concat(names, ', ')
  end)
  if ok then return res else return '(getlocal unsupported on this build)' end
end)()]]))

print("===============================================================")
print("[fnsig] params count + source:line are the reliable info here.")
print("[fnsig] Args go in the generator without parens, e.g. 1000, true")
return true
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
return true
{$asm}
</AssemblerScript>
                          <CheatEntries>
                            <CheatEntry>
                              <ID>155</ID>
                              <Description>"Love2D Cheat Generator (hook must be enabled)"</Description>
                              <VariableType>Auto Assembler Script</VariableType>
                              <AssemblerScript>{ CHEAT GENERATOR (nongc64)}
[ENABLE]
{$lua}
if syntaxcheck then return end
if type(gcrun)~="function" then print("[cheatgen] enable a hook first (defines gcrun)."); return true end
if __CG_form then __CG_form.destroy(); __CG_form=nil end

local form = createForm(true)
form.Caption = "Love2D Cheat Generator"
form.Width = 440; form.Height = 340
__CG_form = form

local function lbl(txt,x,y) local l=createLabel(form) l.Caption=txt l.Left=x l.Top=y return l end
local function edit(x,y,w,d) local e=createEdit(form) e.Left=x e.Top=y e.Width=w e.Text=d or "" return e end

lbl("Path (e.g. game.g.creative  or  game.changeMoney):", 12, 12)
local ePath = edit(12, 32, 416, "game.g.")
lbl("Type:", 12, 66)
local cType = createComboBox(form)
cType.Left=60; cType.Top=62; cType.Width=140
for _,x in ipairs({"boolean","number","string","function"}) do cType.Items.add(x) end
cType.ItemIndex=0
local cBool = createComboBox(form)
cBool.Left=100; cBool.Top=96; cBool.Width=120
cBool.Items.add("true"); cBool.Items.add("false"); cBool.ItemIndex=0
local lVal = lbl("ON value:", 12, 100)
local eVal = edit(100, 96, 320, ""); eVal.Visible=false
local lStyle = lbl("Call style:", 12, 134)
local cStyle = createComboBox(form)
cStyle.Left=100; cStyle.Top=130; cStyle.Width=80
cStyle.Items.add(":"); cStyle.Items.add("."); cStyle.ItemIndex=0
lStyle.Visible=false; cStyle.Visible=false
lbl("OFF value / disable command (blank = none):", 12, 168)
local eOff = edit(12, 188, 416, "false")
lbl("Continuous (repeat every 200ms)?", 12, 222)
local cCont = createComboBox(form)
cCont.Left=240; cCont.Top=218; cCont.Width=90
cCont.Items.add("yes"); cCont.Items.add("no"); cCont.ItemIndex=1

local function refreshType()
  local t = cType.Text
  if t=="boolean" then cBool.Visible=true eVal.Visible=false lStyle.Visible=false cStyle.Visible=false lVal.Caption="ON value:" eOff.Text="false"
  elseif t=="function" then cBool.Visible=false eVal.Visible=true lStyle.Visible=true cStyle.Visible=true lVal.Caption="Args (inside parentheses):" eOff.Text=""
  else cBool.Visible=false eVal.Visible=true lStyle.Visible=false cStyle.Visible=false lVal.Caption="ON value:" eOff.Text="" if t=="number" and eVal.Text=="" then eVal.Text="999" end end
end
cType.OnChange = refreshType; refreshType()

local function literal(t, raw)
  if t=="boolean" then return raw
  elseif t=="number" then local n=tonumber(raw) return n and tostring(n) or "0"
  else return string.format("%q", raw) end
end
local function buildOn(path, t)
  if t=="function" then
    local args = eVal.Text local style = cStyle.Text
    if style==":" then
      local owner, method = path:match("^(.*)%.([%w_]+)$")
      if owner and method then return owner..":"..method.."("..args..")" else return path.."("..args..")" end
    else return path.."("..args..")" end
  else local onRaw = (t=="boolean") and cBool.Text or eVal.Text return path.."="..literal(t, onRaw), onRaw end
end

local status = lbl("", 12, 254)
local btn = createButton(form)
btn.Caption="Generate"; btn.Left=12; btn.Top=276; btn.Width=416; btn.Height=30
btn.OnClick = function()
  local path = ePath.Text:gsub("%s+$","")
  local t = cType.Text
  if path=="" or path:sub(-1)=="." then status.Caption="[!] enter a valid path"; return end
  local onBody, onRaw = buildOn(path, t)
  onRaw = onRaw or (t=="function" and ("("..eVal.Text..")") or onBody)
  local offRaw = eOff.Text
  local hasOff = (offRaw ~= "")
  local offBody
  if hasOff then if t=="function" then offBody = offRaw else offBody = path.."="..literal(t, offRaw) end end
  local cont = (cCont.Text=="yes")
  local L,R = string.char(91), string.char(93)
  local EN,DIS = L.."ENABLE"..R, L.."DISABLE"..R
  local gname = "__CG_"..tostring(os.time())..tostring(math.random(1000,9999))
  local H={}
  local function w(s) H[#H+1]=s end

  w("{ generated: "..onBody.." }")
  w(EN)
  w("{$lua}")
  w("if syntaxcheck then return end")
  -- universal fire: calls the global gcrun() the active hook defined
  w("local function fire(b) if gcrun then gcrun(b) end end")
  if cont then
    w("if "..gname.."_k then "..gname.."_k.destroy() end")
    w(gname.."_k=createTimer(getMainForm())")
    w(gname.."_k.Interval=1")
    w(gname.."_k.OnTimer=function()")
    w("  "..gname.."_k.destroy() "..gname.."_k=nil")
    w("  if "..gname.." then "..gname..".destroy() end")
    w("  "..gname.."=createTimer(getMainForm())")
    w("  "..gname..".Interval=200")
    w("  "..gname..".OnTimer=function() fire([==["..onBody.."]==]) end")
    w("end")
    w("print('[cheat] running: "..onBody:gsub("'","")..".')")
    w("return true")
    w("{$asm}")
    w(DIS)
    w("{$lua}")
    w("if syntaxcheck then return end")
    w("if "..gname.." then "..gname..".destroy() "..gname.."=nil end")
    w("if "..gname.."_k then "..gname.."_k.destroy() "..gname.."_k=nil end")
    if hasOff then w("if gcrun then gcrun([==["..offBody.."]==]) end") end
    w("return true")
    w("{$asm}")
  else
    w("fire([==["..onBody.."]==])")
    w("print('[cheat] ran: "..onBody:gsub("'","")..".')")
    w("return true")
    w("{$asm}")
    w(DIS)
    w("{$lua}")
    w("if syntaxcheck then return end")
    if hasOff then w("if gcrun then gcrun([==["..offBody.."]==]) end") end
    w("return true")
    w("{$asm}")
  end
  local script = table.concat(H,"\n")
  local al = getAddressList()
  local rec = al.createMemoryRecord()
  rec.Description = (t=="function") and (path.."("..eVal.Text..")") or (path.." = "..onRaw)
  rec.Type = vtAutoAssembler
  rec.Script = script
  status.Caption = "[ok] added: "..rec.Description
  print("[cheatgen] added: "..rec.Description)
end
return true
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if __CG_form then __CG_form.destroy(); __CG_form=nil end
return true
{$asm}
</AssemblerScript>
                            </CheatEntry>
                          </CheatEntries>
                        </CheatEntry>
                      </CheatEntries>
                    </CheatEntry>
                  </CheatEntries>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
  <Comments>nongc64 is uncommon because only old versions of love2d automatically used that mode, now it defaults to gc64 and you have to manually/intentionally build the game with arguments that specifically enable nongc64 mode. just for context...

these tools were AI-ASSISTED... mostly written by a human. sorry if that is upsetting, but it's easier and faster than fully learning a niche engine that is not used very often.

x86 compatibility is likely pretty easy to implement if you use stack-based calling conventions.

Games tested:
GC64 - Intravenous 2, Gravity Circuit, Snacktorio, Blue Revolver
NonGC64 - Kingdom Rush 5</Comments>
</CheatTable>
