<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="29">
  <CheatEntries>
        <CheatEntry>
          <ID>1</ID>
          <Description>"[?] How to use - click to open"</Description>
          <LastState/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
ShowMessage('1) Run the game (the main menu is fine).\n\n2) Load this table - it attaches to InstanceServerG.exe automatically.\n\n3) Activate [MAIN] for the game you want (you can do this at the menu).\n\n4) Activate "Infinite Money", "Instant Build", and/or "No Fog of War".\n\n5) Start a mission - the cheats engage automatically and re-hook every mission.')
{$asm}

[DISABLE]
</AssemblerScript>
        </CheatEntry>
<CheatEntry>
          <ID>2</ID>
          <Description>"Red Alert  (RedAlert.dll)"</Description>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>3</ID>
              <Description>"[MAIN] Red Alert - Activate Once (auto re-hooks)"</Description>
              <Options moHideChildren="1" moDeactivateChildrenAsWell="1"/>
              <LastState/>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end

local self = memrec

local hookScript = [=[
AOBScanModule(MOHP,RedAlert.dll,8B 87 9C 25 00 00 A8 01 0F 84 ?? ?? 00 00 A8 02 ?? ?? 84 DB 0F 84)
AOBScanModule(MOMM,RedAlert.dll,8B 81 B4 01 00 00 03 81 B0 01 00 00 C3 CC CC ?? ?? ?? ?? ?? ?? ??)
AOBScanModule(MOCP,RedAlert.dll,8B 4E 0E 85 C9 0F 84 ?? ?? 00 00 FF 06 83 CB 04 A1 ?? ?? ?? ?? 89 4D FB)
alloc(MyCode,4096,$process)
label(_MonHumanPlayer)
label(_BackMHP)
label(_MonMinimumMoney)
label(_BackMMM)
label(_MonConstProd)
label(_BackMCP)
label(iEnableMMM)
label(iEnableMCP)
label(iMinMon)
label(pPlayer)
label(pMoney)
registersymbol(MOHP)
registersymbol(MOMM)
registersymbol(MOCP)
registersymbol(MyCode)
registersymbol(iEnableMMM)
registersymbol(iEnableMCP)
registersymbol(iMinMon)
registersymbol(pPlayer)
registersymbol(pMoney)
MyCode:
_MonHumanPlayer:
lea eax,[edi+000025A0]
mov [pPlayer],eax
_ExitMHP:
mov eax,[edi+0000259C]
jmp _BackMHP
_MonMinimumMoney:
cmp esi,[pPlayer]
jne _ExitMMM
mov [pMoney],ecx
cmp dword ptr [iEnableMMM],0
je _ExitMMM
mov eax,[iMinMon]
cmp [ecx+000001B4],eax
jns _ExitMMM
mov [ecx+000001B4],eax
_ExitMMM:
mov eax,[ecx+000001B4]
jmp _BackMMM
_MonConstProd:
cmp dword ptr [iEnableMCP],0
je _ExitMCP
cmp word ptr [esi],00
je _ExitMCP
mov ecx,[esi+2B]
cmp ecx,[pMoney]
jne _ExitMCP
mov ecx,#53
cmp [esi],ecx
jns _ExitMCP
mov [esi],ecx
_ExitMCP:
mov ecx,[esi+0E]
test ecx,ecx
jmp _BackMCP
align 10
iEnableMMM:
dd 0
iEnableMCP:
dd 0
iMinMon:
dd #70000
pPlayer:
dd MyCode
pMoney:
dd MyCode
MOHP:
jmp _MonHumanPlayer
nop
_BackMHP:
MOMM:
jmp _MonMinimumMoney
nop
_BackMMM:
MOCP:
jmp _MonConstProd
_BackMCP:
]=]

local unhookScript = [=[
MOHP:
 db 8B 87 9C 25 00 00
MOMM:
 db 8B 81 B4 01 00 00
MOCP:
 db 8B 4E 0E 85 C9
unregistersymbol(MOHP)
unregistersymbol(MOMM)
unregistersymbol(MOCP)
unregistersymbol(MyCode)
unregistersymbol(iEnableMMM)
unregistersymbol(iEnableMCP)
unregistersymbol(iMinMon)
unregistersymbol(pPlayer)
unregistersymbol(pMoney)
dealloc(MyCode)
]=]

local function dllBase()
  pcall(loadNewSymbols)
  local b = getAddressSafe('RedAlert.dll')
  if b == nil or b == 0 then return nil end
  return b
end

local function syncFlags()
  if RA_MMM then pcall(writeInteger, 'iEnableMMM', 1) else pcall(writeInteger, 'iEnableMMM', 0) end
  if RA_MCP then pcall(writeInteger, 'iEnableMCP', 1) else pcall(writeInteger, 'iEnableMCP', 0) end
end

local function applyFog()
  local fb = dllBase()
  if fb == nil then return end
  if RA_FOG then
    pcall(autoAssemble, [=[
RedAlert.dll+31f70:
db B0 01 C2 04 00 90
RedAlert.dll+31fe0:
db B0 01 C2 04 00 90
]=])
    if DIAG and not RA_FOGVERIFIED then
      local ok1, m0 = pcall(readBytes, fb + 0x31f70, 1)
      local ok2, v0 = pcall(readBytes, fb + 0x31fe0, 1)
      if not (ok1 and ok2 and m0 == 0xB0 and v0 == 0xB0) then
        ShowMessage('[Diagnostic] Fog patch NOT applied (Red Alert): IsMapped byte=' .. tostring(m0) .. ' IsVisible byte=' .. tostring(v0) .. ' (both should be 176)')
      end
      RA_FOGVERIFIED = true
    end
  else
    pcall(autoAssemble, [=[
RedAlert.dll+31f70:
db 55 8B EC 8B 45 08
RedAlert.dll+31fe0:
db 55 8B EC 8B 45 08
]=])
  end
end

RA_Hooked = false
RA_Base = nil
RA_Checked = false
RA_Engaged = false
RA_Err = false
RA_Timer = createTimer(nil, false)
RA_Timer.Interval = 1000
RA_Timer.OnTimer = function(t)
  local ok, err = pcall(function()
    local target = getProcessIDFromProcessName('InstanceServerG.exe')
    if target ~= nil then
      local cur = getOpenedProcessID()
      if cur == nil or cur == 0 or cur ~= target then
        openProcess(target)
      end
    end
    if not RA_Checked then
      local pid2 = getOpenedProcessID()
      if pid2 ~= nil and pid2 ~= 0 then
        if DSH_GAME_VERSION ~= nil then
          local vok, vver = DSH_GAME_VERSION()
          if vok == false then
            ShowMessage('Wrong game version: found ' .. tostring(vver) .. '. This table targets 1.153 (745903).')
            self.Active = false
            return
          end
          RA_Checked = true
        end
      end
    end
    local base = dllBase()
    if base ~= nil then
      if not RA_Hooked or RA_Base ~= base then
        if RA_Hooked then autoAssemble(unhookScript) end
        if autoAssemble(hookScript) then
          RA_Hooked = true
          RA_Base = base
          if not RA_Engaged then
            if DIAG then ShowMessage('Cheat engaged: Red Alert hooked.') end
            RA_Engaged = true
          end
        else
          if not RA_HOOKFAIL then
            if DIAG then ShowMessage('Hook FAILED: RedAlert.dll found but AOB signature did not match (wrong game version?).') end
            RA_HOOKFAIL = true
          end
        end
      end
      if RA_Hooked then syncFlags() applyFog() end
    else
      if RA_Hooked then
        autoAssemble(unhookScript)
        RA_Hooked = false
        RA_Base = nil
      end
      RA_NOTICKS = (RA_NOTICKS or 0) + 1
      if RA_NOTICKS == 15 and not RA_NOLOAD then
        RA_NOLOAD = true
        if DIAG then ShowMessage('[Diagnostic] RedAlert.dll not detected. Are you in a mission?') end
      end
    end
  end)
  if not ok and not RA_Err then
    if DIAG then ShowMessage('Cheat script error: ' .. tostring(err)) end
    RA_Err = true
  end
end
RA_Timer.Enabled = true
{$asm}

[DISABLE]
{$lua}
if RA_Timer ~= nil then RA_Timer.destroy() RA_Timer = nil end
if RA_Hooked then
  autoAssemble([=[
MOHP:
 db 8B 87 9C 25 00 00
MOMM:
 db 8B 81 B4 01 00 00
MOCP:
 db 8B 4E 0E 85 C9
]=])
  RA_Hooked = false
end
pcall(autoAssemble, [=[
RedAlert.dll+31f70:
db 55 8B EC 8B 45 08
RedAlert.dll+31fe0:
db 55 8B EC 8B 45 08
]=])
autoAssemble([=[
unregistersymbol(MOHP)
unregistersymbol(MOMM)
unregistersymbol(MOCP)
unregistersymbol(MyCode)
unregistersymbol(iEnableMMM)
unregistersymbol(iEnableMCP)
unregistersymbol(iMinMon)
unregistersymbol(pPlayer)
unregistersymbol(pMoney)
dealloc(MyCode)
]=])
{$asm}
</AssemblerScript>
              <CheatEntries>
                <CheatEntry>
                  <ID>4</ID>
                  <Description>"Infinite Money  (min 70,000)"</Description>
                  <LastState/>
                  <VariableType>Auto Assembler Script</VariableType>
                  <AssemblerScript>[enable]
{$LUA}
RA_MMM = true
pcall(writeInteger,"iEnableMMM",1)
{$ASM}

[disable]
{$LUA}
RA_MMM = false
pcall(writeInteger,"iEnableMMM",0)
{$ASM}
</AssemblerScript>
                </CheatEntry>
                <CheatEntry>
                  <ID>5</ID>
                  <Description>"Instant Build"</Description>
                  <LastState/>
                  <VariableType>Auto Assembler Script</VariableType>
                  <AssemblerScript>[enable]
{$LUA}
RA_MCP = true
pcall(writeInteger,"iEnableMCP",1)
{$ASM}

[disable]
{$LUA}
RA_MCP = false
pcall(writeInteger,"iEnableMCP",0)
{$ASM}
</AssemblerScript>
                </CheatEntry>
                <CheatEntry>
                  <ID>11</ID>
                  <Description>"No Fog of War (Reveal Map)"</Description>
                  <LastState/>
                  <VariableType>Auto Assembler Script</VariableType>
                  <AssemblerScript>[enable]
{$LUA}
RA_FOG = true
RA_FOGVERIFIED = false
{$ASM}

[disable]
{$LUA}
RA_FOG = false
{$ASM}
</AssemblerScript>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>6</ID>
          <Description>"Tiberian Dawn  (TiberianDawn.dll)"</Description>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>7</ID>
              <Description>"[MAIN] Tiberian Dawn - Activate Once (auto re-hooks)"</Description>
              <Options moHideChildren="1" moDeactivateChildrenAsWell="1"/>
              <LastState/>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end

local self = memrec

local hookScript = [=[
AOBScanModule(MOHP_TD,TiberianDawn.dll,8B 87 71 14 00 00 A8 01 0F 84 ?? ?? 00 00 A8 02 75 ?? 84 DB 0F 84)
AOBScanModule(MOMM_TD,TiberianDawn.dll,8B 86 0E 01 00 00 03 86 0A 01 00 00 5E C3 CC CC ?? ?? ?? ?? ?? ??)
AOBScanModule(MOCP_TD,TiberianDawn.dll,8A 46 03 84 C0 0F 84 ?? ?? 00 00 80 46 02 FF 0F 85 ?? ?? 00 00 66 FF 06)
alloc(MyCode_TD,4096,$process)
label(_MonHumanPlayer)
label(_BackMHP)
label(_MonMinimumMoney)
label(_BackMMM)
label(_MonConstProd)
label(_BackMCP)
label(iEnableMMM_TD)
label(iEnableMCP_TD)
label(iMinMon_TD)
label(pPlayer_TD)
label(pMoney_TD)
registersymbol(MOHP_TD)
registersymbol(MOMM_TD)
registersymbol(MOCP_TD)
registersymbol(MyCode_TD)
registersymbol(iEnableMMM_TD)
registersymbol(iEnableMCP_TD)
registersymbol(iMinMon_TD)
registersymbol(pPlayer_TD)
registersymbol(pMoney_TD)
MyCode_TD:
_MonHumanPlayer:
mov [pPlayer_TD],edi
_ExitMHP:
mov eax,[edi+00001471]
jmp _BackMHP
_MonMinimumMoney:
cmp edi,[pPlayer_TD]
jne _ExitMMM
mov [pMoney_TD],esi
cmp dword ptr [iEnableMMM_TD],0
je _ExitMMM
mov eax,[iMinMon_TD]
cmp [esi+0000010E],eax
jns _ExitMMM
mov [esi+0000010E],eax
_ExitMMM:
mov eax,[esi+0000010E]
jmp _BackMMM
_MonConstProd:
cmp dword ptr [iEnableMCP_TD],0
je _ExitMCP
cmp word ptr [esi],00
je _ExitMCP
mov eax,[esi+18]
cmp eax,[pMoney_TD]
jne _ExitMCP
mov ax,#107
cmp [esi],ax
jns _ExitMCP
mov [esi],ax
_ExitMCP:
mov al,[esi+03]
test al,al
jmp _BackMCP
align 10
iEnableMMM_TD:
dd 0
iEnableMCP_TD:
dd 0
iMinMon_TD:
dd #70000
pPlayer_TD:
dd MyCode_TD
pMoney_TD:
dd MyCode_TD
MOHP_TD:
jmp _MonHumanPlayer
nop
_BackMHP:
MOMM_TD:
jmp _MonMinimumMoney
nop
_BackMMM:
MOCP_TD:
jmp _MonConstProd
_BackMCP:
]=]

local unhookScript = [=[
MOHP_TD:
 db 8B 87 71 14 00 00
MOMM_TD:
 db 8B 86 0E 01 00 00
MOCP_TD:
 db 8A 46 03 84 C0
unregistersymbol(MOHP_TD)
unregistersymbol(MOMM_TD)
unregistersymbol(MOCP_TD)
unregistersymbol(MyCode_TD)
unregistersymbol(iEnableMMM_TD)
unregistersymbol(iEnableMCP_TD)
unregistersymbol(iMinMon_TD)
unregistersymbol(pPlayer_TD)
unregistersymbol(pMoney_TD)
dealloc(MyCode_TD)
]=]

local function dllBase()
  pcall(loadNewSymbols)
  local b = getAddressSafe('TiberianDawn.dll')
  if b == nil or b == 0 then return nil end
  return b
end

local function syncFlags()
  if TD_MMM then pcall(writeInteger, 'iEnableMMM_TD', 1) else pcall(writeInteger, 'iEnableMMM_TD', 0) end
  if TD_MCP then pcall(writeInteger, 'iEnableMCP_TD', 1) else pcall(writeInteger, 'iEnableMCP_TD', 0) end
end

local function applyFog()
  local fb = dllBase()
  if fb == nil then return end
  if TD_FOG then
    pcall(autoAssemble, [=[
TiberianDawn.dll+23670:
db B0 01 C2 04 00 90
TiberianDawn.dll+236a0:
db B0 01 C2 04 00 90
]=])
    if DIAG and not TD_FOGVERIFIED then
      local ok1, m0 = pcall(readBytes, fb + 0x23670, 1)
      local ok2, v0 = pcall(readBytes, fb + 0x236a0, 1)
      if not (ok1 and ok2 and m0 == 0xB0 and v0 == 0xB0) then
        ShowMessage('[Diagnostic] Fog patch NOT applied (Tiberian Dawn): IsMapped byte=' .. tostring(m0) .. ' IsVisible byte=' .. tostring(v0) .. ' (both should be 176)')
      end
      TD_FOGVERIFIED = true
    end
  else
    pcall(autoAssemble, [=[
TiberianDawn.dll+23670:
db 55 8B EC 8B 45 08
TiberianDawn.dll+236a0:
db 55 8B EC 8B 45 08
]=])
  end
end

TD_Hooked = false
TD_Base = nil
TD_Checked = false
TD_Engaged = false
TD_Err = false
TD_Timer = createTimer(nil, false)
TD_Timer.Interval = 1000
TD_Timer.OnTimer = function(t)
  local ok, err = pcall(function()
    local target = getProcessIDFromProcessName('InstanceServerG.exe')
    if target ~= nil then
      local cur = getOpenedProcessID()
      if cur == nil or cur == 0 or cur ~= target then
        openProcess(target)
      end
    end
    if not TD_Checked then
      local pid2 = getOpenedProcessID()
      if pid2 ~= nil and pid2 ~= 0 then
        if DSH_GAME_VERSION ~= nil then
          local vok, vver = DSH_GAME_VERSION()
          if vok == false then
            ShowMessage('Wrong game version: found ' .. tostring(vver) .. '. This table targets 1.153 (745903).')
            self.Active = false
            return
          end
          TD_Checked = true
        end
      end
    end
    local base = dllBase()
    if base ~= nil then
      if not TD_Hooked or TD_Base ~= base then
        if TD_Hooked then autoAssemble(unhookScript) end
        if autoAssemble(hookScript) then
          TD_Hooked = true
          TD_Base = base
          if not TD_Engaged then
            if DIAG then ShowMessage('Cheat engaged: Tiberian Dawn hooked.') end
            TD_Engaged = true
          end
        else
          if not TD_HOOKFAIL then
            if DIAG then ShowMessage('Hook FAILED: TiberianDawn.dll found but AOB signature did not match (wrong game version?).') end
            TD_HOOKFAIL = true
          end
        end
      end
      if TD_Hooked then syncFlags() applyFog() end
    else
      if TD_Hooked then
        autoAssemble(unhookScript)
        TD_Hooked = false
        TD_Base = nil
      end
      TD_NOTICKS = (TD_NOTICKS or 0) + 1
      if TD_NOTICKS == 15 and not TD_NOLOAD then
        TD_NOLOAD = true
        if DIAG then ShowMessage('[Diagnostic] TiberianDawn.dll not detected. Are you in a mission?') end
      end
    end
  end)
  if not ok and not TD_Err then
    if DIAG then ShowMessage('Cheat script error: ' .. tostring(err)) end
    TD_Err = true
  end
end
TD_Timer.Enabled = true
{$asm}

[DISABLE]
{$lua}
if TD_Timer ~= nil then TD_Timer.destroy() TD_Timer = nil end
if TD_Hooked then
  autoAssemble([=[
MOHP_TD:
 db 8B 87 71 14 00 00
MOMM_TD:
 db 8B 86 0E 01 00 00
MOCP_TD:
 db 8A 46 03 84 C0
]=])
  TD_Hooked = false
end
pcall(autoAssemble, [=[
TiberianDawn.dll+23670:
db 55 8B EC 8B 45 08
TiberianDawn.dll+236a0:
db 55 8B EC 8B 45 08
]=])
autoAssemble([=[
unregistersymbol(MOHP_TD)
unregistersymbol(MOMM_TD)
unregistersymbol(MOCP_TD)
unregistersymbol(MyCode_TD)
unregistersymbol(iEnableMMM_TD)
unregistersymbol(iEnableMCP_TD)
unregistersymbol(iMinMon_TD)
unregistersymbol(pPlayer_TD)
unregistersymbol(pMoney_TD)
dealloc(MyCode_TD)
]=])
{$asm}
</AssemblerScript>
              <CheatEntries>
                <CheatEntry>
                  <ID>8</ID>
                  <Description>"Infinite Money  (min 70,000)"</Description>
                  <LastState/>
                  <VariableType>Auto Assembler Script</VariableType>
                  <AssemblerScript>[enable]
{$LUA}
TD_MMM = true
pcall(writeInteger,"iEnableMMM_TD",1)
{$ASM}

[disable]
{$LUA}
TD_MMM = false
pcall(writeInteger,"iEnableMMM_TD",0)
{$ASM}
</AssemblerScript>
                </CheatEntry>
                <CheatEntry>
                  <ID>9</ID>
                  <Description>"Instant Build"</Description>
                  <LastState/>
                  <VariableType>Auto Assembler Script</VariableType>
                  <AssemblerScript>[enable]
{$LUA}
TD_MCP = true
pcall(writeInteger,"iEnableMCP_TD",1)
{$ASM}

[disable]
{$LUA}
TD_MCP = false
pcall(writeInteger,"iEnableMCP_TD",0)
{$ASM}
</AssemblerScript>
                </CheatEntry>
                <CheatEntry>
                  <ID>12</ID>
                  <Description>"No Fog of War (Reveal Map)"</Description>
                  <LastState/>
                  <VariableType>Auto Assembler Script</VariableType>
                  <AssemblerScript>[enable]
{$LUA}
TD_FOG = true
TD_FOGVERIFIED = false
{$ASM}

[disable]
{$LUA}
TD_FOG = false
{$ASM}
</AssemblerScript>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
                <CheatEntry>
          <ID>10</ID>
          <Description>"Diagnosis Mode (show diagnostic popups)"</Description>
          <LastState/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[enable]
{$LUA}
DIAG = true
{$ASM}

[disable]
{$LUA}
DIAG = false
{$ASM}
</AssemblerScript>
        </CheatEntry>
  </CheatEntries>
  <Comments>============================================================
 Command &amp; Conquer Remastered Collection
 Infinite Money + Instant Build + No Fog of War  (HUMAN PLAYER ONLY)
============================================================
 Process to open : InstanceServerG.exe  (NOT ClientG.exe)
 Game version    : 1.153 (745903) - verified against local DLLs
 Table version   : v1.23
 Cheat Engine    : 7.0 or newer
============================================================

[USAGE]
1) Run the game (the main menu is fine).
2) Load this table - it attaches to InstanceServerG.exe automatically
   (no manual process selection).
3) Activate the [MAIN] script for the game you are playing
   (you can do this at the main menu).
4) Activate "Infinite Money", "Instant Build", and/or "No Fog of War".
5) Start a mission or skirmish. The cheats engage automatically and
   re-hook on every mission - no re-clicking between missions.

[VERSION CHECK]
 The table verifies the game is 1.153 on attach. If it detects a
 different version it shows a "Wrong game version" warning and
 refuses to enable the cheats.

[WHAT IT DOES]
 - Infinite Money: your credits never drop below 70,000.
 - Instant Build : production/construction completes almost instantly
   (units still play their short exit animation - engine limit).
 - No Fog of War : reveals the entire map for you only (not opponents).

[PLAYER-ONLY]
 Money/build: compare the object's owner against the human player's
 pointer. Fog: reveals your own map only. AI opponents are never affected.

[TWEAKING]
 - Minimum money: edit "iMinMon" (default 70000) in the [MAIN] script.
 - Build speed (Red Alert):     edit "#53" in _MonConstProd (#36 = 1/3 speed).
 - Build speed (Tiberian Dawn): edit "#107" in _MonConstProd (#72 = 1/3 speed).

[ADVICE]
 Save your game before enabling cheats.
============================================================</Comments>
<LuaScript>if not syntaxcheck then
  getAutoAttachList().add('InstanceServerG.exe')

  -- Returns (true, ver) if game is 1.153, (false, ver) if wrong, (nil, reason) if undetermined
  function DSH_GAME_VERSION()
    local pid = getProcessIDFromProcessName('InstanceServerG.exe')
    if pid == nil then return nil, 'game not running' end
    local exe = nil
    local okm, mods = pcall(enumModules, pid)
    if okm and mods ~= nil then
      for _, m in pairs(mods) do
        if type(m) == 'table' and m.Name == 'InstanceServerG.exe' then exe = m.PathToFile end
      end
    end
    if exe == nil then return nil, 'exe path unknown' end
    local okv, raw, info = pcall(getFileVersion, exe)
    if not okv or info == nil then return nil, 'version unknown' end
    local major = tonumber(info.major) or 0
    local minor = tonumber(info.minor) or 0
    local release = tonumber(info.release) or 0
    local ver = string.format('%d.%d.%d', major, minor, release)
    local match = (major == 1 and minor == 153)
    return match, ver
  end

  local vwarned = false
  local function tryAttach()
    local pname = process
    if pname ~= nil and string.lower(pname) == 'instanceserverg.exe' then
      if not vwarned then
        local ok, ver = DSH_GAME_VERSION()
        if ok == false then
          if DIAG then ShowMessage('Wrong game version: found ' .. tostring(ver) .. '. This table targets 1.153 (745903). The cheats may not work.') end
        end
        vwarned = true
      end
      return
    end
    local pid = getProcessIDFromProcessName('InstanceServerG.exe')
    if pid ~= nil then openProcess(pid) end
  end

  tryAttach()

  if AUTHWATCH == nil then
    AUTHWATCH = createTimer(nil, false)
    AUTHWATCH.Interval = 2000
    AUTHWATCH.OnTimer = function(t) tryAttach() end
    AUTHWATCH.Enabled = true
  end
end
</LuaScript>
</CheatTable>