<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="46">
  <CheatEntries>
    <CheatEntry>
      <ID>4070</ID>
      <Description>"Backups (PTRs and Symbol Scripts, see Table Extras)"</Description>
      <Options moHideChildren="1"/>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>4071</ID>
          <Description>"Register GEngine As Symbol"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if not syntaxcheck then
  local function isValidPointer(addr)
    if not addr or addr == 0 then return false end
    if addr &lt; 0x10000 then return false end
    if addr % 8 ~= 0 then return false end
    return true
  end

  local function hasValidVTable(objectPtr)
    local success, vtable = pcall(readPointer, objectPtr)
    if not success or not isValidPointer(vtable) then return false end
    if vtable &lt; 0x100000000 or vtable &gt; 0x7FFFFFFFFFFF then return false end
    return true
  end

  local function validateGEngine(gEngineAddr)
    local success, enginePtr = pcall(readPointer, gEngineAddr)
    if not success or not isValidPointer(enginePtr) or not hasValidVTable(enginePtr) then
      return false, 0
    end

    local score = 0

    for viewportOffset = 0x700, 0x900, 0x8 do
      local success1, viewportPtr = pcall(readPointer, enginePtr + viewportOffset)
      if success1 and isValidPointer(viewportPtr) and hasValidVTable(viewportPtr) then
        score = score + 10

        for worldOffset = 0x70, 0x100, 0x8 do
          local success2, worldPtr = pcall(readPointer, viewportPtr + worldOffset)
          if success2 and isValidPointer(worldPtr) and hasValidVTable(worldPtr) then
            score = score + 20

            for giOffset = 0x150, 0x200, 0x8 do
              local success3, giPtr = pcall(readPointer, worldPtr + giOffset)
              if success3 and isValidPointer(giPtr) and hasValidVTable(giPtr) then
                score = score + 30
                return true, score
              end
            end
          end
        end
      end
    end

    return score &gt;= 30, score
  end

  local function isLikelyModuleAddress(addr)
    local addrStr = string.format("%X", addr)
    if #addrStr &lt; 12 then return false end
    local prefix = tonumber(addrStr:sub(1, 3), 16)
    if prefix &gt;= 0x7FF and prefix &lt;= 0x7FF then return true end
    if prefix &gt;= 0x140 and prefix &lt;= 0x180 then return true end
    return false
  end

  local function findGEngine()
    local patterns = {
      {"48 8B 0D ?? ?? ?? ?? 48 85 C9 74", 3, 7, 3},
      {"48 8B 05 ?? ?? ?? ?? 48 8B 88 ?? ?? ?? ??", 3, 7, 2},
      {"48 8B 0D ?? ?? ?? ?? 48 8B 01 FF", 3, 7, 3},
      {"48 89 0D ?? ?? ?? ?? 48 85 C9", 3, 7, 1},
      {"48 8B 05 ?? ?? ?? ?? 48 85 C0 74", 3, 7, 2},
      {"48 8B 0D ?? ?? ?? ?? 4C 8B 01", 3, 7, 3},
      {"4C 8B 05 ?? ?? ?? ?? 4C 85 C0", 3, 7, 2},
      {"48 8B 15 ?? ?? ?? ?? 48 85 D2 74", 3, 7, 2},
    }

    print("Scanning for GEngine...")
    local candidates = {}

    for i, patternData in ipairs(patterns) do
      local pattern = patternData[1]
      local offsetPos = patternData[2]
      local instrLen = patternData[3]
      local weight = patternData[4]

      local result = AOBScan(pattern, "+X")
      if result and result.Count &gt; 0 then
        local maxCheck = math.min(result.Count, 50)
        for j = 0, maxCheck - 1 do
          pcall(function()
            local instructionAddrStr = result.getString(j)
            local instructionAddr = getAddress(instructionAddrStr)
            local offsetAddr = instructionAddr + offsetPos
            local ripOffset = readInteger(offsetAddr)
            local gEngineAddr = instructionAddr + instrLen + ripOffset

            if not isLikelyModuleAddress(gEngineAddr) then return end

            local isValid, validationScore = validateGEngine(gEngineAddr)
            if isValid then
              if not candidates[gEngineAddr] then
                candidates[gEngineAddr] = {count = 0, score = 0, uniquePatterns = {}}
              end
              candidates[gEngineAddr].count = candidates[gEngineAddr].count + weight
              candidates[gEngineAddr].score = math.max(candidates[gEngineAddr].score, validationScore)
              candidates[gEngineAddr].uniquePatterns[i] = true
            end
          end)
        end
        result.destroy()
      end
    end

    local bestAddr = nil
    local bestScore = 0

    for addr, data in pairs(candidates) do
      local uniquePatternCount = 0
      for _ in pairs(data.uniquePatterns) do
        uniquePatternCount = uniquePatternCount + 1
      end

      local ratio = data.count / uniquePatternCount

      local ratioPenalty = 0
      if ratio &gt; 20 then
        ratioPenalty = math.pow(ratio - 20, 2) * 2
      end

      local singlePatternPenalty = 0
      if uniquePatternCount == 1 and data.count &gt; 20 then
        singlePatternPenalty = (data.count - 20) * 15
      end

      local excessCountPenalty = 0
      if data.count &gt; 50 then
        excessCountPenalty = (data.count - 50) * 5
      end

      local diversityBonus = math.pow(uniquePatternCount, 2) * 300

      local countBonus = 0
      if data.count &gt;= 15 and data.count &lt;= 40 then
        countBonus = 200
      end

      local finalScore = (data.count * 10) + (data.score * 0.5) + diversityBonus + countBonus - ratioPenalty - singlePatternPenalty - excessCountPenalty

      print(string.format("  %X: count %d, patterns %d, ratio %.1f, score %d",
        addr, data.count, uniquePatternCount, ratio, finalScore))

      if finalScore &gt; bestScore then
        bestAddr = addr
        bestScore = finalScore
      end
    end

    if bestAddr then
      registerSymbol("GEngine", bestAddr, true)
      print(string.format("GEngine registered: %X", bestAddr))
      return true
    end

    print("GEngine not found!")
    return false
  end

  findGEngine()
end
{$asm}

[DISABLE]
{$lua}
if not syntaxcheck then
  if getAddress("GEngine") then
    unregisterSymbol("GEngine")
    print("GEngine unregistered")
  end
end
{$asm}

</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>4068</ID>
          <Description>"Register GWorld As Symbol"</Description>
          <Options moHideChildren="1" moDeactivateChildrenAsWell="1"/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end

if not AOBScanModule then
  function AOBScanModule(moduleName, signature)
    local baseAddr = nil
    local maxAddr = 0
    local modList
    synchronize(function()
      modList = enumModules()
    end)
    for _, mod in ipairs(modList) do
      if string.lower(mod.Name) == string.lower(moduleName) then
        baseAddr = mod.Address
        maxAddr = baseAddr + mod.Size
        break
      end
    end
    if not baseAddr then return nil end
    local ms = createMemScan()
    synchronize(function()
      ms.firstScan(soExactValue, vtByteArray, nil, signature,
        nil, baseAddr, maxAddr, '+X-C-W', fsmNotAligned, '1', true, true, false, false)
    end)
    ms.waitTillDone()
    local results = createFoundList(ms)
    results.initialize()
    local addr
    synchronize(function()
      if results.getCount() &gt; 0 then
        addr = results[0]
      end
    end)
    results.destroy()
    ms.destroy()
    return addr
  end
end

if not closeLuaEngine then
  function closeLuaEngine()
    synchronize(function()
      getLuaEngine().Close()
    end)
  end
end
registerLuaFunctionHighlight('closeLuaEngine')

local AOBs = {
  {name='GWorld → gworld_addr_E37708', aob='48 8B 1D ?? ?? ?? ?? 48 85 ?? 74 ?? 41 B0 01 33 ?? ?? 8B ?? E8', pos=3, aoblen=7, symbol='gworld_addr_E37708'},
}

local module_name = process

for _, entry in ipairs(AOBs) do
  local aob_addr_str = AOBScanModule(module_name, entry.aob)
  if aob_addr_str then
    local aob_addr_val = tonumber(aob_addr_str, 16)
    local offset_addr = aob_addr_val + entry.pos
    local relative_offset = readInteger(offset_addr, true)
    local final_addr = relative_offset + aob_addr_val + entry.aoblen
    synchronize(function()
      unregisterSymbol(entry.symbol)
      registerSymbol(entry.symbol, final_addr)
    end)
    print(string.format('[SymbolScanner] %s registered at: %X', entry.name, final_addr))
  else
    print(string.format('[SymbolScanner] WARNING: AOB scan failed for %s', entry.name))
  end
end

closeLuaEngine()
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
unregisterSymbol('gworld_addr_E37708')
closeLuaEngine()
{$asm}
      
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>4066</ID>
          <Description>"Current Money"</Description>
          <VariableType>Double</VariableType>
          <Address>GEngine</Address>
          <Offsets>
            <Offset>70</Offset>
            <Offset>3E8</Offset>
            <Offset>330</Offset>
            <Offset>348</Offset>
            <Offset>6A8</Offset>
            <Offset>2D0</Offset>
            <Offset>3D0</Offset>
            <Offset>378</Offset>
            <Offset>228</Offset>
            <Offset>78</Offset>
            <Offset>C88</Offset>
          </Offsets>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>4069</ID>
      <Description>"Current Money"</Description>
      <VariableType>Double</VariableType>
      <Address>GWorld</Address>
      <Offsets>
        <Offset>70</Offset>
        <Offset>3E8</Offset>
        <Offset>330</Offset>
        <Offset>348</Offset>
        <Offset>6A8</Offset>
        <Offset>2D0</Offset>
        <Offset>3D0</Offset>
        <Offset>378</Offset>
        <Offset>228</Offset>
      </Offsets>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
  <Comments>The game... seems to register GEngine and GWorld itself. Never seen that before. Pretty cool. Symbol Registration scripts added just in case though.

Allow the pointers time to populate :)
</Comments>
</CheatTable>
