<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="52">
  <CheatEntries>
    <CheatEntry>
      <ID>1</ID>
      <Description>"Breathedge 2 - Trainer (F1-F11)"</Description>
      <Options moHideChildren="1" moManualExpandCollapse="1" moDeactivateChildrenAsWell="1"/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
{$lua}
--[[
  Breathedge 2 - Cheat Engine Lua Trainer (Self-Adapting)
  Process: Breathedge2-Win64-Shipping.exe (Unreal Engine 5.7.4)

  Architecture &amp; Pointer Chain:
    GWorld -&gt; UWorld -&gt; OwningGameInstance (BP_Breathedge2GameInstance_C)
      -&gt; LocalPlayers[0] -&gt; PlayerController (BP_Breathedge2Controller_C)
        -&gt; BPC_Stats (BPC_Stats_C)
             [Health, Oxygen, Gas, Hunger, Thirst, Fatigue, Weight, Battery, Mood, Speed, Protections]
        -&gt; Character -&gt; CharacterMovementComponent (UCharacterMovementComponent)
             [MaxWalkSpeed, MaxFlySpeed, MaxSwimSpeed, MaxAcceleration]

  Auto-Adapting Features:
    - FNamePool &amp; GWorld dynamically validated and auto-scanned via AOB if patched
    - All UObject properties resolved dynamically via Unreal Engine 5 reflection
    - Native Developer Flags hooked (IsUnlimitedParameters, bUnlimitedParams)
    - Full Cheat Engine UI with F1-F11 hotkeys and child checkboxes
]]

if syntaxcheck then return end

BH2 = BH2 or {}
local B = BH2
if B.stop then pcall(B.stop) end

-- ============================================================
-- 1. Initial Offsets (UE 5.7.4 Build)
-- ============================================================
B.MODULES = {
  'Breathedge2-Win64-Shipping.exe',
  'Breathedge2-Win64.exe',
  'Breathedge2.exe',
}
B.MODULE = B.MODULES[1]

B.off = {
  GWORLD       = 0x9BA6BE8,  -- module + offset (AOB auto-scanned if mismatch)
  FNAMEBLOCKS  = 0x994DED0,  -- module + offset (FNamePool.Blocks)
  WORLD_GI     = 0x228,      -- UWorld -&gt; OwningGameInstance (BP_Breathedge2GameInstance_C)
  GI_PLAYERS   = 0x38,       -- GameInstance -&gt; LocalPlayers (TArray&lt;ULocalPlayer*&gt;)
  LP_PC        = 0x30,       -- LocalPlayer -&gt; PlayerController
  PC_CHAR      = 0x300,      -- PlayerController -&gt; Character
  PC_STATS     = 0x790,      -- PlayerController -&gt; BPC_Stats (BPC_Stats_C)
  CHAR_CMC     = 0x338,      -- Character -&gt; CharacterMovementComponent
}

-- UObject / Reflection layout (Unreal Engine 5 64-bit)
local UOBJ_CLASS, UOBJ_NAME = 0x10, 0x18
local USTRUCT_SUPER, USTRUCT_PROPS = 0x40, 0x50
local FFIELD_NEXT, FFIELD_NAME, FPROP_OFFSET = 0x18, 0x20, 0x44

-- Fallback offsets on BPC_Stats_C (resolved dynamically via reflection)
B.STATS_FALLBACK = {
  Health = 0xE0, MaxHealth = 0x110,
  Oxygen = 0xE4, MaxOxygen = 0x114,
  Gas = 0xE8, MaxGas = 0x118,
  Hunger = 0xEC, MaxHunger = 0x11C,
  Thirst = 0xF0, MaxThirst = 0x120,
  Fatigue = 0xF4, MaxFatigue = 0x124,
  Weight = 0xF8, MaxWeight = 0x128,
  FlashlightBattery = 0xFC, MaxFlashlightBattery = 0x12C,
  Mood = 0x100, MaxMood = 0x104,
  DefaultWalkSpeed = 0x140, DefaultFlySpeed = 0x13C, SprintSpeed = 0x144,
  PhysicalProtection = 0x154, FireProtection = 0x158, ColdProtection = 0x15C,
  RadiationProtection = 0x160, ElectroProtection = 0x164, ChemicalProtection = 0x168,
  bUnlimitedParams = 0x1F2, bStatsPaused = 0x1F1,
  OxygenConsumptionRate = 0x150, GasConsumptionRate = 0x148, OxygenDecreaseRate = 0x210,
}

-- Fallback offsets on BP_Breathedge2GameInstance_C (resolved dynamically via reflection)
B.GI_FALLBACK = {
  IsUnlimitedParameters = 0x23C,
  IsSandboxMode = 0x23B,
  LoseItems = 0x23D,
  DecreaseingOxygenMultiplier = 0x270,
  DecreaseingHungerMultiplier = 0x278,
  DecreasingFatiqueMultiplier = 0x280,
  DecreasingGasMultiplier = 0x288,
  PlayerDamageMultiplier = 0x2B8,
  EnemyDamageMultiplier = 0x2E8,
  EnvironmentDamageMultiplier = 0x2E0,
  OxygenDamageMultiplier = 0x2D8,
  MiningSpeedMultiplier = 0x2C0,
  GettingResourcesMultiplier = 0x2C8,
  BreakingItemsSpeedMultiplier = 0x2D0,
  CraftingValueMult = 0x330,
  RepairValueMult = 0x338,
  StationDurabilityMult = 0x328,
  StationContrainerMult = 0x320,
  DecreaseStationsBatteryMult = 0x318,
  OxygenStationIncreaseMult = 0x310,
}

-- Fallback offsets on CharacterMovementComponent
B.CMC_FALLBACK = {
  MovementMode = 0x241,
  MaxWalkSpeed = 0x288,
  MaxSwimSpeed = 0x290,
  MaxFlySpeed = 0x294,
  MaxAcceleration = 0x29C,
  GravityScale = 0x1A8,
  JumpZVelocity = 0x1B0,
}

-- ============================================================
-- 2. Helpers &amp; Reflection Engine
-- ============================================================
local function valid(p)
  return p and p &gt; 0x10000 and p &lt; 0x7FFFFFFFFFFF and (p &amp; 7) == 0
end

local function logConsole(fmt, ...)
  print('[BH2] ' .. string.format(fmt, ...))
end

local function qwordAOB(v)
  local b = {}
  for i = 0, 7 do b[#b+1] = string.format('%02X', (v &gt;&gt; (8*i)) &amp; 0xFF) end
  return table.concat(b, ' ')
end

function B.fname(idx)
  if not idx or idx &lt; 0 or not B.blocks then return nil end
  local blk = readQword(B.blocks + (idx &gt;&gt; 16) * 8)
  if not valid(blk) then return nil end
  local e = blk + (idx &amp; 0xFFFF) * 2
  local h = readSmallInteger(e)
  if not h then return nil end
  local len = h &gt;&gt; 6
  if len &lt;= 0 or len &gt; 250 then return nil end
  if (h &amp; 1) == 1 then return readString(e + 2, len * 2, true) end
  return readString(e + 2, len)
end

function B.objName(o)
  if valid(o) then return B.fname(readInteger(o + UOBJ_NAME)) end
end

function B.className(o)
  if not valid(o) then return nil end
  return B.objName(readQword(o + UOBJ_CLASS))
end

local function scanPtr(obj, from, to, test)
  for off = from, to, 8 do
    local p = readQword(obj + off)
    if valid(p) then
      local c = B.className(p)
      if c and test(c, p) then return off, p end
    end
  end
end

local function writeByteIf(addr, val)
  if addr and readBytes(addr, 1) ~= val then writeBytes(addr, val) end
end
local function writeFloatIf(addr, val)
  if addr then
    local cur = readFloat(addr)
    if not cur or math.abs(cur - val) &gt; 0.001 then writeFloat(addr, val) end
  end
end

-- Universal Unreal Engine 5 Property Reflection
local function reflectProps(obj)
  local map, cls, guard = {}, readQword(obj + UOBJ_CLASS), 0
  while valid(cls) and guard &lt; 15 do
    local f, g = readQword(cls + USTRUCT_PROPS), 0
    while valid(f) and g &lt; 300 do
      local n = B.fname(readInteger(f + FFIELD_NAME))
      local off = readInteger(f + FPROP_OFFSET)
      if n and off and off &gt;= 0x28 and off &lt; 0x2000 then map[n] = off end
      f, g = readQword(f + FFIELD_NEXT), g + 1
    end
    cls, guard = readQword(cls + USTRUCT_SUPER), guard + 1
  end
  return map
end

-- ============================================================
-- 3. Dynamic FNamePool &amp; GWorld Auto-Discovery
-- ============================================================
local function blocksOK(addr)
  local b0 = readQword(addr)
  return valid(b0) and readString(b0 + 2, 4) == 'None'
end

local function findFNameBlocks()
  local hits = AOBScan('4E 6F 6E 65 ?? ?? 42 79 74 65 50 72 6F 70 65 72 74 79', '-X')
  if not hits then return nil end
  local list = {}
  for i = 0, hits.Count - 1 do list[#list+1] = tonumber('0x' .. hits[i]) - 2 end
  hits.destroy()
  local lo, hi = B.base, B.base + getModuleSize(B.MODULE)
  for _, blk in ipairs(list) do
    local refs = AOBScan(qwordAOB(blk), '-X', fsmAligned, '8')
    if refs then
      for i = 0, refs.Count - 1 do
        local a = tonumber('0x' .. refs[i])
        if a &gt;= lo and a &lt; hi and blocksOK(a) then refs.destroy(); return a end
      end
      refs.destroy()
    end
  end
end

local function worldOK(addr)
  return B.className(readQword(addr)) == 'World'
end

local function findGWorld()
  local patterns = {
    '48 8B 1D ?? ?? ?? ?? 48 85 DB 74 ?? 41 B0 01',
    '48 8B 05 ?? ?? ?? ?? 48 3B C3 48 0F 44 C6',
    '48 8B 1D ?? ?? ?? ?? 48 85 DB 74 ?? 48 8B 0B',
    '48 8B 05 ?? ?? ?? ?? 48 85 C0 74 ?? 48 8B C8',
  }
  for _, pat in ipairs(patterns) do
    local ms = createMemScan()
    ms.firstScan(soExactValue, vtByteArray, rtRounded, pat, nil, B.base, B.base + getModuleSize(B.MODULE),
                 '+X', fsmNotAligned, '1', true, false, false, false)
    ms.waitTillDone()
    local fl = createFoundList(ms); fl.initialize()
    local found = nil
    for i = 0, math.min(fl.Count, 50) - 1 do
      local a = tonumber('0x' .. fl.Address[i])
      local g = a + 7 + readInteger(a + 3, true)
      if worldOK(g) then found = g; break end
    end
    fl.destroy(); ms.destroy()
    if found then return found end
  end
end

-- ============================================================
-- 4. Initialization &amp; Object Chain Resolution
-- ============================================================
function B.init()
  B.base = nil
  if process and process ~= '' then
    local b = getAddressSafe(process)
    if b and b ~= 0 then B.MODULE = process; B.base = b end
  end
  if not B.base then
    for _, m in ipairs(B.MODULES) do
      local b = getAddressSafe(m)
      if b and b ~= 0 then B.MODULE = m; B.base = b; break end
    end
  end
  if not B.base or B.base == 0 then error('Game module not found.') end

  -- 1) FNamePool
  B.blocks = B.base + B.off.FNAMEBLOCKS
  if not blocksOK(B.blocks) then
    B.blocks = findFNameBlocks()
    if not B.blocks then error('FNamePool not found') end
    B.off.FNAMEBLOCKS = B.blocks - B.base
  end

  -- 2) GWorld
  B.gworld = B.base + B.off.GWORLD
  if not worldOK(B.gworld) then
    B.gworld = findGWorld()
    if not B.gworld then error('GWorld not found') end
    B.off.GWORLD = B.gworld - B.base
  end
  registerSymbol('BH2_GWorld', B.gworld, true)
  logConsole('Init OK | GWorld=0x%X | FNameBlocks=0x%X', B.gworld, B.blocks)
end

B.statsOff = {}
B.giOff = {}
B.cmcOff = {}

local function resolveOffsets(gi, stats, cmc)
  local giMap = valid(gi) and reflectProps(gi) or {}
  for k, fb in pairs(B.GI_FALLBACK) do B.giOff[k] = giMap[k] or fb end

  local stMap = valid(stats) and reflectProps(stats) or {}
  for k, fb in pairs(B.STATS_FALLBACK) do B.statsOff[k] = stMap[k] or fb end

  local cmcMap = valid(cmc) and reflectProps(cmc) or {}
  for k, fb in pairs(B.CMC_FALLBACK) do B.cmcOff[k] = cmcMap[k] or fb end
end

function B.resolveChain()
  local world = readQword(B.gworld)
  if not valid(world) then return nil, 'World not loaded' end

  -- UWorld -&gt; OwningGameInstance
  local gi = readQword(world + B.off.WORLD_GI)
  if not valid(gi) or not (B.className(gi) and B.className(gi):find('GameInstance')) then
    local off, p = scanPtr(world, 0x1C0, 0x300, function(c) return c:find('GameInstance') end)
    if off then B.off.WORLD_GI, gi = off, p end
  end

  -- GameInstance -&gt; LocalPlayers[0] -&gt; PlayerController
  local lpArr = valid(gi) and readQword(gi + B.off.GI_PLAYERS)
  local lp = valid(lpArr) and readQword(lpArr)
  local pc = valid(lp) and readQword(lp + B.off.LP_PC)
  if not valid(pc) or not (B.className(pc) and B.className(pc):find('Controller')) then
    local off, p = scanPtr(lp or 0, 0x20, 0x60, function(c) return c:find('Controller') end)
    if off then B.off.LP_PC, pc = off, p end
  end

  -- PlayerController -&gt; BPC_Stats
  local stats = valid(pc) and readQword(pc + B.off.PC_STATS)
  if not valid(stats) or not (B.className(stats) and B.className(stats):find('Stats')) then
    local off, p = scanPtr(pc or 0, 0x200, 0x900, function(c) return c:find('Stats') end)
    if off then B.off.PC_STATS, stats = off, p end
  end

  -- PlayerController -&gt; Character
  local char = valid(pc) and readQword(pc + B.off.PC_CHAR)
  if not valid(char) or not (B.className(char) and (B.className(char):find('Character') or B.className(char):find('Camera'))) then
    local off, p = scanPtr(pc or 0, 0x200, 0x500, function(c) return c:find('Character') or c:find('Camera') end)
    if off then B.off.PC_CHAR, char = off, p end
  end

  -- Character -&gt; CharacterMovementComponent
  local cmc = valid(char) and readQword(char + B.off.CHAR_CMC)
  if not valid(cmc) or not (B.className(cmc) and B.className(cmc):find('Movement')) then
    local off, p = scanPtr(char or 0, 0x200, 0x500, function(c) return c:find('Movement') end)
    if off then B.off.CHAR_CMC, cmc = off, p end
  end

  return { world = world, gi = gi, pc = pc, stats = stats, char = char, cmc = cmc }
end

B.cache = nil
function B.refresh()
  local r, err = B.resolveChain()
  if not r then B.cache = nil; return false, err end
  B.cache = r
  if not B.attrResolved then
    resolveOffsets(r.gi, r.stats, r.cmc)
    B.attrResolved = true
  end
  return true
end

-- ============================================================
-- 5. Cheats Logic
-- ============================================================
local function fillStat(statName, maxStatName)
  local s = B.cache and B.cache.stats
  if not valid(s) then return end
  local sOff = B.statsOff
  local curOff = sOff[statName]
  local maxOff = sOff[maxStatName]
  if curOff and maxOff then
    local m = readFloat(s + maxOff) or 100.0
    local v = readFloat(s + curOff)
    if v and m and v &lt; m then writeFloatIf(s + curOff, m) end
  end
end

B.speedMult = B.speedMult or 1.0
B.SPEED_STEP = 1.0
B.SPEED_MAX = 8.0

function B.applySpeed()
  local c = B.cache and B.cache.cmc
  local s = B.cache and B.cache.stats
  local mult = B.speedMult or 1.0
  if valid(c) then
    local co = B.cmcOff
    writeFloatIf(c + co.MaxWalkSpeed, (B.defWalk or 600.0) * mult)
    writeFloatIf(c + co.MaxFlySpeed,  (B.defFly or 400.0) * mult)
    writeFloatIf(c + co.MaxSwimSpeed, (B.defSwim or 300.0) * mult)
    writeFloatIf(c + co.MaxAcceleration, (B.defAccel or 2048.0) * mult)
  end
  if valid(s) then
    writeFloatIf(s + B.statsOff.SprintSpeed, 600.0 * mult)
  end
end

function B.speedStep(delta)
  if not B.cache then B.refresh() end
  local cmc = B.cache and B.cache.cmc
  if valid(cmc) and not B.defWalk then
    local co = B.cmcOff
    B.defWalk  = readFloat(cmc + co.MaxWalkSpeed) or 600.0
    B.defFly   = readFloat(cmc + co.MaxFlySpeed) or 400.0
    B.defSwim  = readFloat(cmc + co.MaxSwimSpeed) or 300.0
    B.defAccel = readFloat(cmc + co.MaxAcceleration) or 2048.0
  end
  B.speedMult = math.max(1.0, math.min(B.SPEED_MAX, (B.speedMult or 1.0) + delta))
  B.applySpeed()
  logConsole('Speed Multiplier: x%.1f', B.speedMult)
  if B.syncUI then pcall(B.syncUI) end
end

B.cheats = {
  godmode = {
    name = 'God Mode (Infinite Health)',
    on = false,
    tick = function()
      fillStat('Health', 'MaxHealth')
      local gi = B.cache and B.cache.gi
      local st = B.cache and B.cache.stats
      if valid(gi) then
        writeByteIf(gi + B.giOff.IsUnlimitedParameters, 1)
        writeFloatIf(gi + B.giOff.EnemyDamageMultiplier, 0.0)
        writeFloatIf(gi + B.giOff.EnvironmentDamageMultiplier, 0.0)
        writeFloatIf(gi + B.giOff.OxygenDamageMultiplier, 0.0)
      end
      if valid(st) then writeByteIf(st + B.statsOff.bUnlimitedParams, 1) end
    end
  },

  oxygen = {
    name = 'Infinite Oxygen &amp; Jetpack Gas',
    on = false,
    tick = function()
      fillStat('Oxygen', 'MaxOxygen')
      fillStat('Gas', 'MaxGas')
      local gi = B.cache and B.cache.gi
      local st = B.cache and B.cache.stats
      if valid(gi) then
        writeFloatIf(gi + B.giOff.DecreaseingOxygenMultiplier, 0.0)
        writeFloatIf(gi + B.giOff.DecreasingGasMultiplier, 0.0)
      end
      if valid(st) then
        writeFloatIf(st + B.statsOff.OxygenConsumptionRate, 0.0)
        writeFloatIf(st + B.statsOff.GasConsumptionRate, 0.0)
      end
    end
  },

  survival = {
    name = 'Max Hunger &amp; Thirst',
    on = false,
    tick = function()
      fillStat('Hunger', 'MaxHunger')
      fillStat('Thirst', 'MaxThirst')
      local gi = B.cache and B.cache.gi
      if valid(gi) then writeFloatIf(gi + B.giOff.DecreaseingHungerMultiplier, 0.0) end
    end
  },

  fatigue = {
    name = 'Infinite Stamina / No Fatigue &amp; Max Mood',
    on = false,
    tick = function()
      fillStat('Fatigue', 'MaxFatigue')
      fillStat('Mood', 'MaxMood')
      local gi = B.cache and B.cache.gi
      if valid(gi) then writeFloatIf(gi + B.giOff.DecreasingFatiqueMultiplier, 0.0) end
    end
  },

  immunity = {
    name = 'Environment Immunity (Rad/Cold/Fire)',
    on = false,
    tick = function()
      local s = B.cache and B.cache.stats
      if valid(s) then
        local so = B.statsOff
        writeFloatIf(s + so.RadiationProtection, 100.0)
        writeFloatIf(s + so.ColdProtection, 100.0)
        writeFloatIf(s + so.FireProtection, 100.0)
        writeFloatIf(s + so.ElectroProtection, 100.0)
        writeFloatIf(s + so.ChemicalProtection, 100.0)
      end
      local gi = B.cache and B.cache.gi
      if valid(gi) then writeFloatIf(gi + B.giOff.EnvironmentDamageMultiplier, 0.0) end
    end
  },

  utility = {
    name = 'Infinite Flashlight Battery &amp; Zero Weight',
    on = false,
    tick = function()
      fillStat('FlashlightBattery', 'MaxFlashlightBattery')
      local s = B.cache and B.cache.stats
      if valid(s) then writeFloatIf(s + B.statsOff.Weight, 0.0) end
      local gi = B.cache and B.cache.gi
      if valid(gi) then writeByteIf(gi + B.giOff.LoseItems, 0) end
    end
  },

  harvest = {
    name = '10x Harvest &amp; Instant Mining',
    on = false,
    tick = function()
      local gi = B.cache and B.cache.gi
      if valid(gi) then
        local go = B.giOff
        writeFloatIf(gi + go.MiningSpeedMultiplier, 10.0)
        writeFloatIf(gi + go.GettingResourcesMultiplier, 10.0)
        writeFloatIf(gi + go.BreakingItemsSpeedMultiplier, 10.0)
        writeFloatIf(gi + go.CraftingValueMult, 10.0)
        writeFloatIf(gi + go.RepairValueMult, 10.0)
      end
    end
  },

  onehitkill = {
    name = 'One-Hit Kill (Super Player Damage)',
    on = false,
    tick = function()
      local gi = B.cache and B.cache.gi
      if valid(gi) then writeFloatIf(gi + B.giOff.PlayerDamageMultiplier, 50.0) end
    end
  },
}

function B.toggle(id)
  local c = B.cheats[id]
  if not c then return end
  c.on = not c.on
  logConsole('%s: %s', c.name, c.on and 'ENABLED' or 'DISABLED')
  if c.on then beep() end
  if B.syncUI then pcall(B.syncUI) end
end

function B.status()
  local ok, err = B.refresh()
  if not ok then logConsole('Status unavailable: %s', err or '?'); return end
  local s = B.cache and B.cache.stats
  if not valid(s) then logConsole('BPC_Stats not found (in-game?)'); return end
  local so = B.statsOff
  logConsole('HP: %.0f/%.0f | O2: %.0f/%.0f | Gas: %.0f/%.0f | Hunger: %.0f | Thirst: %.0f | Fatigue: %.0f | Speed: x%.1f',
    readFloat(s + so.Health) or 0, readFloat(s + so.MaxHealth) or 0,
    readFloat(s + so.Oxygen) or 0, readFloat(s + so.MaxOxygen) or 0,
    readFloat(s + so.Gas) or 0, readFloat(s + so.MaxGas) or 0,
    readFloat(s + so.Hunger) or 0, readFloat(s + so.Thirst) or 0,
    readFloat(s + so.Fatigue) or 0, B.speedMult or 1.0)
end

-- ============================================================
-- 6. Cheat Engine UI (Child Checkboxes F1-F11)
-- ============================================================
B.UI_ITEMS = {
  { id = 'f1',  desc = 'F1 - God Mode (Infinite Health)',                 kind = 'toggle' },
  { id = 'f2',  desc = 'F2 - Infinite Oxygen &amp; Jetpack Gas',              kind = 'toggle' },
  { id = 'f3',  desc = 'F3 - Max Hunger &amp; Thirst',                        kind = 'toggle' },
  { id = 'f4',  desc = 'F4 - Infinite Stamina / No Fatigue &amp; Max Mood',   kind = 'toggle' },
  { id = 'f5',  desc = 'F5 - Environment Immunity (Rad/Cold/Fire)',       kind = 'toggle' },
  { id = 'f6',  desc = 'F6 - Infinite Flashlight Battery &amp; Zero Weight',  kind = 'toggle' },
  { id = 'f7',  desc = 'F7 - Increase Speed (+1.0x)',                     kind = 'action' },
  { id = 'f8',  desc = 'F8 - Decrease Speed (-1.0x)',                     kind = 'action' },
  { id = 'f9',  desc = 'F9 - 10x Harvest &amp; Instant Mining',               kind = 'toggle' },
  { id = 'f10', desc = 'F10 - One-Hit Kill (Super Player Damage)',        kind = 'toggle' },
  { id = 'f11', desc = 'F11 - Print Player Status (Lua Console)',         kind = 'action' },
}

function B.getUIState(id)
  if id == 'f1'  then return B.cheats.godmode.on end
  if id == 'f2'  then return B.cheats.oxygen.on end
  if id == 'f3'  then return B.cheats.survival.on end
  if id == 'f4'  then return B.cheats.fatigue.on end
  if id == 'f5'  then return B.cheats.immunity.on end
  if id == 'f6'  then return B.cheats.utility.on end
  if id == 'f9'  then return B.cheats.harvest.on end
  if id == 'f10' then return B.cheats.onehitkill.on end
  return false
end

function B.onChildUI(id, enable)
  if B.syncingUI then return end
  if id == 'f1' then if B.cheats.godmode.on ~= enable then B.toggle('godmode') end
  elseif id == 'f2' then if B.cheats.oxygen.on ~= enable then B.toggle('oxygen') end
  elseif id == 'f3' then if B.cheats.survival.on ~= enable then B.toggle('survival') end
  elseif id == 'f4' then if B.cheats.fatigue.on ~= enable then B.toggle('fatigue') end
  elseif id == 'f5' then if B.cheats.immunity.on ~= enable then B.toggle('immunity') end
  elseif id == 'f6' then if B.cheats.utility.on ~= enable then B.toggle('utility') end
  elseif id == 'f7' and enable then B.speedStep(B.SPEED_STEP)
  elseif id == 'f8' and enable then B.speedStep(-B.SPEED_STEP)
  elseif id == 'f9' then if B.cheats.harvest.on ~= enable then B.toggle('harvest') end
  elseif id == 'f10' then if B.cheats.onehitkill.on ~= enable then B.toggle('onehitkill') end
  elseif id == 'f11' and enable then B.status()
  end
  B.syncUI()
end

function B.findParentRecord(passedRec)
  if passedRec then return passedRec end
  local al = getAddressList()
  for i = 0, al.Count - 1 do
    local mr = al.getMemoryRecord(i)
    if mr and mr.Type == vtAutoAssembler and mr.Script and mr.Script:find('BH2 = BH2 or {}', 1, true) then
      return mr
    end
  end
  return nil
end

function B.buildUI(passedRec)
  local al = getAddressList()
  local parent = B.findParentRecord(passedRec)
  if not parent then return end
  B.parentRec = parent
  parent.Description = 'Breathedge 2 - Trainer (F1-F11)'
  parent.Options = '[moHideChildren,moDeactivateChildrenAsWell,moManualExpandCollapse]'

  B.uiRecords = {}
  local existing, stray, extraGroups = {}, {}, {}
  for i = 0, parent.Count - 1 do
    local ch = parent.Child[i]
    if ch then
      local key = (ch.Script or ''):match("onChildUI%('(f%d+)'")
      if not key and ch.Description then
        local k = ch.Description:match('^(F%d+)')
        key = k and k:lower()
      end
      if key then
        if existing[key] then stray[#stray + 1] = ch else existing[key] = ch end
      else
        extraGroups[#extraGroups + 1] = ch
      end
    end
  end
  for _, ch in ipairs(stray) do pcall(function() ch.destroy() end) end

  for _, item in ipairs(B.UI_ITEMS) do
    local mr = existing[item.id]
    if not mr then
      mr = al.createMemoryRecord()
      mr.appendToEntry(parent)
    end
    mr.Description = item.desc
    mr.Type = vtAutoAssembler
    if item.kind == 'action' then
      mr.Script = string.format(
        "[ENABLE]\n{$lua}\nif syntaxcheck then return end\nif BH2 and not BH2.syncingUI then\n  BH2.onChildUI('%s', true)\n  local t = createTimer(nil, false); t.Interval = 30\n  t.OnTimer = function(tm) tm.destroy(); if BH2 then BH2.syncingUI = true; memrec.Active = false; BH2.syncingUI = false end end\n  t.Enabled = true\nend\n{$asm}\n[DISABLE]\n{$lua}\nif syntaxcheck then return end\n{$asm}\n",
        item.id
      )
    else
      mr.Script = string.format(
        "[ENABLE]\n{$lua}\nif syntaxcheck then return end\nif BH2 and not BH2.syncingUI then BH2.onChildUI('%s', true) end\n{$asm}\n[DISABLE]\n{$lua}\nif syntaxcheck then return end\nif BH2 and not BH2.syncingUI then BH2.onChildUI('%s', false) end\n{$asm}\n",
        item.id, item.id
      )
    end
    B.uiRecords[item.id] = mr
  end
  -- keep the children in F1..F11 order, followed by any extra group headers
  for _, item in ipairs(B.UI_ITEMS) do
    local mr = B.uiRecords[item.id]
    if mr then pcall(function() mr.appendToEntry(parent) end) end
  end
  for _, grp in ipairs(extraGroups) do
    pcall(function() grp.appendToEntry(parent) end)
  end

  local t = createTimer(nil, false)
  t.Interval = 50
  t.OnTimer = function(tm)
    tm.destroy()
    if B.parentRec then pcall(function() B.parentRec.Collapsed = false end) end
    B.syncUI()
  end
  t.Enabled = true
end

function B.syncUI()
  if not B.uiRecords or B.syncingUI then return end
  B.syncingUI = true
  pcall(function()
    local defColor = (B.parentRec and B.parentRec.Color) or -2147483640
    for _, item in ipairs(B.UI_ITEMS) do
      local mr = B.uiRecords[item.id]
      if mr then
        if item.id == 'f7' then
          mr.Description = string.format('F7 - Increase Speed (+1.0x) [x%.1f]', B.speedMult or 1.0)
          mr.Color = (B.speedMult and B.speedMult &gt; 1.0) and 0x008000 or defColor
        elseif item.kind == 'toggle' then
          local st = B.getUIState(item.id)
          if mr.Active ~= st then mr.Active = st end
          mr.Color = st and 0x008000 or defColor
        else
          mr.Color = defColor
        end
      end
    end
  end)
  B.syncingUI = false
end

-- ============================================================
-- Compact View Mode (hides the Cheat Engine scanner panels)
--   * menu item created once (found again by Name, never duplicated)
--   * stale items left by older versions of this script are purged
--   * full view is restored and the menu item removed on Stop
-- ============================================================
B.COMPACT_ITEM_NAME = 'BH2CompactViewMenuItem'
B.compactOn = false

local function mainFormSafe()
  local ok, mf = pcall(getMainForm)
  if ok and mf then return mf end
end

local function findCompactItems()
  local list = {}
  local mf = mainFormSafe()
  if not mf then return list end
  local ok = pcall(function()
    local items = mf.Menu.Items
    for i = 0, items.Count - 1 do
      local it = items.Item[i]
      local cap = it.Caption
      if it.Name == B.COMPACT_ITEM_NAME or cap == 'Compact View Mode' or cap == 'Full View Mode' then
        list[#list + 1] = it
      end
    end
  end)
  return list
end

function B.setCompact(on)
  on = on and true or false
  local mf = mainFormSafe()
  if not mf then return false end
  local ok, err = pcall(function()
    mf.Splitter1.Visible = not on
    mf.Panel4.Visible    = not on
    mf.Panel5.Visible    = not on
  end)
  if not ok then logConsole('Compact View: %s', tostring(err)); return false end
  B.compactOn = on
  for _, it in ipairs(findCompactItems()) do
    pcall(function() it.Caption = on and 'Full View Mode' or 'Compact View Mode' end)
  end
  return true
end

-- Kept under the historical global names for compatibility
-- force == true -&gt; compact view, force == false -&gt; full view, nil -&gt; toggle
function cycleFullCompact(sender, force)
  local on
  if force == nil then
    local mf = mainFormSafe()
    on = mf and mf.Panel5.Visible or false   -- panels visible -&gt; go compact
  else
    on = force and true or false
  end
  B.setCompact(on)
end

function addCompactMenu()
  local mf = mainFormSafe()
  if not mf then return end
  local found = findCompactItems()
  local keep = nil
  for _, it in ipairs(found) do
    if not keep and it.Name == B.COMPACT_ITEM_NAME then keep = it
    elseif not keep and it.Name == '' then keep = it
    else pcall(function() it.destroy() end) end
  end
  if not keep then
    local parent = mf.Menu.Items
    keep = createMenuItem(parent)
    parent.add(keep)
  end
  pcall(function() keep.Name = B.COMPACT_ITEM_NAME end)
  keep.Caption = B.compactOn and 'Full View Mode' or 'Compact View Mode'
  keep.OnClick = function(sender) cycleFullCompact(sender) end
  compactmenuitem = keep
  compactmenualreadyexists = 'yes'
end

function B.removeCompactMenu()
  for _, it in ipairs(findCompactItems()) do pcall(function() it.destroy() end) end
  compactmenuitem = nil
  compactmenualreadyexists = nil
end

-- ============================================================
-- 7. Start / Stop Lifecycle
-- ============================================================
function B.start(passedRec)
  local okInit, errInit = pcall(B.init)
  if not okInit then
    logConsole('Initialization failed: %s', tostring(errInit))
    error(errInit, 0)
  end
  pcall(addCompactMenu)
  pcall(B.setCompact, true)
  B.attrResolved = false
  B.refresh()
  pcall(B.buildUI, passedRec)

  B.timer = createTimer(nil, false)
  B.timer.Interval = 100
  B.timer.OnTimer = function()
    B.refresh()
    for _, c in pairs(B.cheats) do
      if c.on then pcall(c.tick) end
    end
    if B.speedMult and B.speedMult &gt; 1.0 then pcall(B.applySpeed) end
  end
  B.timer.Enabled = true

  B.hotkeys = {
    createHotkey(function() B.toggle('godmode') end, VK_F1),
    createHotkey(function() B.toggle('oxygen') end,  VK_F2),
    createHotkey(function() B.toggle('survival') end, VK_F3),
    createHotkey(function() B.toggle('fatigue') end,  VK_F4),
    createHotkey(function() B.toggle('immunity') end, VK_F5),
    createHotkey(function() B.toggle('utility') end,  VK_F6),
    createHotkey(function() B.speedStep(B.SPEED_STEP) end,  VK_F7),
    createHotkey(function() B.speedStep(-B.SPEED_STEP) end, VK_F8),
    createHotkey(function() B.toggle('harvest') end, VK_F9),
    createHotkey(function() B.toggle('onehitkill') end, VK_F10),
    createHotkey(function() B.status() end, VK_F11),
  }
  logConsole('Breathedge 2 Trainer Ready! F1 Health | F2 O2 | F3 Hunger/Thirst | F4 Stamina | F5 Immunity | F6 Battery/Weight | F7/F8 Speed | F9 10x Harvest | F10 One-Hit Kill | F11 Status')
end

function B.stop()
  if B.timer then B.timer.destroy(); B.timer = nil end
  if B.hotkeys then
    for _, h in ipairs(B.hotkeys) do h.destroy() end
    B.hotkeys = nil
  end
  if B.cheats then
    for _, c in pairs(B.cheats) do c.on = false end
  end
  if B.defWalk then pcall(function() B.speedMult = 1.0; B.applySpeed() end) end
  if B.syncUI then pcall(B.syncUI) end
  if B.parentRec then pcall(function() B.parentRec.Collapsed = true end) end
  pcall(B.setCompact, false)
  pcall(B.removeCompactMenu)
  logConsole('Breathedge 2 Trainer Stopped.')
end

B.start(memrec)

{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if BH2 and BH2.stop then pcall(BH2.stop) end
{$asm}
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>2</ID>
          <Description>"F1 - God Mode (Infinite Health)"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f1', true) end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f1', false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>3</ID>
          <Description>"F2 - Infinite Oxygen &amp; Jetpack Gas"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f2', true) end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f2', false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>4</ID>
          <Description>"F3 - Max Hunger &amp; Thirst"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f3', true) end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f3', false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>5</ID>
          <Description>"F4 - Infinite Stamina / No Fatigue &amp; Max Mood"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f4', true) end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f4', false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>6</ID>
          <Description>"F5 - Environment Immunity (Rad/Cold/Fire)"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f5', true) end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f5', false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>7</ID>
          <Description>"F6 - Infinite Flashlight Battery &amp; Zero Weight"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f6', true) end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f6', false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>8</ID>
          <Description>"F7 - Increase Speed (+1.0x) [x1.0]"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then
  BH2.onChildUI('f7', true)
  local t = createTimer(nil, false); t.Interval = 30
  t.OnTimer = function(tm) tm.destroy(); if BH2 then BH2.syncingUI = true; memrec.Active = false; BH2.syncingUI = false end end
  t.Enabled = true
end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>9</ID>
          <Description>"F8 - Decrease Speed (-1.0x)"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then
  BH2.onChildUI('f8', true)
  local t = createTimer(nil, false); t.Interval = 30
  t.OnTimer = function(tm) tm.destroy(); if BH2 then BH2.syncingUI = true; memrec.Active = false; BH2.syncingUI = false end end
  t.Enabled = true
end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>10</ID>
          <Description>"F9 - 10x Harvest &amp; Instant Mining"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f9', true) end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f9', false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>20</ID>
          <Description>"F10 - One-Hit Kill (Super Player Damage)"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f10', true) end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then BH2.onChildUI('f10', false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>12</ID>
          <Description>"F11 - Print Player Status (Lua Console)"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
if BH2 and not BH2.syncingUI then
  BH2.onChildUI('f11', true)
  local t = createTimer(nil, false); t.Interval = 30
  t.OnTimer = function(tm) tm.destroy(); if BH2 then BH2.syncingUI = true; memrec.Active = false; BH2.syncingUI = false end end
  t.Enabled = true
end
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>21</ID>
          <Description>"Test [some scripts may or may not work, you have been warned!!!]"</Description>
          <Options moManualExpandCollapse="1"/>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>13</ID>
              <Description>"[Tab 1] Inventory &amp; Tools: 100% Durability, Fixed 100% Charge (No Flicker) &amp; Zero Weight"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
--[[
  Breathedge 2 - Inventory, Equipment &amp; Tools (No Flicker &amp; Zero Consumption)
  Tab 1: Inventory &amp; Equipment
  - Weight set to 0 kg (Max Capacity 9999 kg)
  - Tool &amp; equipment durability locked at 100%
  - Tool battery charge locked at 100%
  - Native charge consumption rate = 0.0 (ChargeConsumeRate = 0.0, ZERO 98%-&gt;100% flicker)
  - Native durability wear rate = 0.0 (DurabilityConsumeRate = 0.0)
  - Zero cyclic tool wear (CyclicDurabilityConsumeMultiplier = 0.0)
  - Zero item breaking speed (BreakingItemsSpeedMultiplier = 0.0)
  - Keep items on death (LoseItems = 0)
]]

if syntaxcheck then return end

BH2_Inventory = BH2_Inventory or {}
local I = BH2_Inventory

local function valid(p)
  return p and p &gt; 0x10000 and p &lt; 0x7FFFFFFFFFFF and (p &amp; 7) == 0
end

function I.applyInventoryCheats()
  local base = getAddressSafe(process) or getAddressSafe('Breathedge2-Win64-Shipping.exe')
  if not base or base == 0 then return end
  local world = readQword(base + 0x9BA6BE8)
  if not valid(world) then return end
  local gi = readQword(world + 0x228)
  if not valid(gi) then return end
  local lpArr = readQword(gi + 0x38)
  local lp = valid(lpArr) and readQword(lpArr)
  local pc = valid(lp) and readQword(lp + 0x30)
  if not valid(pc) then return end

  local stats = readQword(pc + 0x790)
  local inv = readQword(pc + 0x798)
  local char = readQword(pc + 0x300)

  -- 1) Zero Weight &amp; Max Capacity
  if valid(stats) then
    writeFloat(stats + 0xF8, 0.0)     -- Weight = 0.0 kg
    writeFloat(stats + 0x128, 9999.0) -- MaxWeight = 9999.0 kg
  end

  -- 2) No item loss on death &amp; no breaking
  if valid(gi) then
    writeBytes(gi + 0x23D, 0)         -- LoseItems = 0
    writeFloat(gi + 0x2D0, 0.0)       -- BreakingItemsSpeedMultiplier = 0.0
  end

  -- 3) Zero wear on equipped tool actor
  if valid(char) then
    local tool = readQword(char + 0x930)
    if valid(tool) then
      writeFloat(tool + 0x110, 0.0)   -- CyclicDurabilityConsumeMultiplier = 0.0
    end
  end

  -- 4) Tool in hand: 100% Durability, 100% Charge, Consume Rate = 0.0 (No Flicker)
  if valid(inv) then
    local toolInHand = readQword(inv + 0x138)
    if valid(toolInHand) then
      writeFloat(toolInHand + 0x34, 100.0)
      writeFloat(toolInHand + 0x38, 100.0)
      local da = readQword(toolInHand + 0x28)
      if valid(da) then
        writeFloat(da + 0x214, 0.0) -- ChargeConsumeRate = 0.0 (Gauge locked at 100%)
        writeFloat(da + 0x218, 0.0) -- DurabilityConsumeRate = 0.0
      end
    end

    -- 5) All items in inventory
    local data = readQword(inv + 0xD8) -- TArray&lt;UItemObject*&gt; Items
    local cnt = readInteger(inv + 0xD8 + 8) or 0
    if valid(data) and cnt &gt; 0 and cnt &lt; 200 then
      for i = 0, cnt - 1 do
        local obj = readQword(data + i * 8)
        if valid(obj) then
          local dur = readFloat(obj + 0x34)
          if dur and dur &gt; 0.0 and dur &lt; 100.0 then writeFloat(obj + 0x34, 100.0) end
          local chg = readFloat(obj + 0x38)
          if chg and chg &gt; 0.0 and chg &lt; 100.0 then writeFloat(obj + 0x38, 100.0) end
          local da = readQword(obj + 0x28)
          if valid(da) then
            writeFloat(da + 0x214, 0.0)
            writeFloat(da + 0x218, 0.0)
          end
        end
      end
    end
  end
end

if I.timer then
  I.timer.destroy()
  I.timer = nil
end

I.timer = createTimer(nil, false)
I.timer.Interval = 200
I.timer.OnTimer = function()
  pcall(I.applyInventoryCheats)
end
I.timer.Enabled = true

pcall(I.applyInventoryCheats)
beep()
print('[BH2] Tab 1 ENABLED: 100% Durability, Fixed 100% Charge (No Flicker), 0kg Weight!')

{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
local I = BH2_Inventory
if I and I.timer then
  I.timer.destroy()
  I.timer = nil
end
print('[BH2] Tab 1 DISABLED.')
{$asm}
</AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>14</ID>
              <Description>"[Tab 2] DIY Workbench: 100% Recipes Unlocked, Free Craft (0 Cost), Instant (0s) &amp; Level 999"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
Breathedge2-Win64-Shipping.exe+52C9910:
  mov al,01
  ret

Breathedge2-Win64-Shipping.exe+52C8250:
  mov al,01
  ret

Breathedge2-Win64-Shipping.exe+518D360:
  ret

{$lua}
if syntaxcheck then return end

local function valid(p)
  return p and p &gt; 0x10000 and p &lt; 0x7FFFFFFFFFFF and (p &amp; 7) == 0
end

local function applyCraft()
  local base = getAddressSafe('Breathedge2-Win64-Shipping.exe')
  if not base or base == 0 then return end
  local world = readPointer(base + 0x9BA6BE8)
  if not valid(world) then return end
  local gi = readPointer(world + 0x228)
  if not valid(gi) then return end
  local lpArr = readPointer(gi + 0x38)
  local lp = valid(lpArr) and readPointer(lpArr)
  local pc = valid(lp) and readPointer(lp + 0x30)
  if not valid(pc) then return end
  local craft = readPointer(pc + 0x788)
  if not valid(craft) then return end

  local trCnt = readInteger(craft + 0x120 + 8) or 0
  if trCnt &gt; 0 then writeInteger(craft + 0x120 + 8, 0) end

  writeInteger(craft + 0x114, 999)
  writeFloat(craft + 0x118, 0.0)
  writeBytes(gi + 0x23B, 1)
  writeFloat(gi + 0x330, 10.0)
  writeFloat(gi + 0x338, 10.0)

  local unlData = readPointer(craft + 0xE0)
  local unlCount = readInteger(craft + 0xE0 + 8) or 0
  for i = 0, unlCount - 1 do
    local item = readPointer(unlData + i * 8)
    if valid(item) then
      writeInteger(item + 0x40, 999)
    end
  end

  beep()
  print('[BH2] Tab 2 ENABLED: 37 Recipes Unlocked, Free Craft (0 Cost), Instant (0s) &amp; Level 999!')
end

pcall(applyCraft)
{$asm}

[DISABLE]
Breathedge2-Win64-Shipping.exe+52C9910:
  mov [rsp+08],rbx

Breathedge2-Win64-Shipping.exe+52C8250:
  mov [rsp+10],rsi

Breathedge2-Win64-Shipping.exe+518D360:
  db 40 55 53

{$lua}
if syntaxcheck then return end
local base = getAddressSafe('Breathedge2-Win64-Shipping.exe')
if base and base &gt; 0 then
  local world = readPointer(base + 0x9BA6BE8)
  if world and world &gt; 0x10000 then
    local gi = readPointer(world + 0x228)
    if gi and gi &gt; 0x10000 then
      writeBytes(gi + 0x23B, 0)
    end
  end
end
print('[BH2] Tab 2 DISABLED: Crafting settings restored.')
{$asm}
</AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>17</ID>
              <Description>"[Tab 3] Star Map &amp; Beacons / POI"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
--[[
  ================================================================================
  Breathedge 2 - [Tab 3] Star Map &amp; Beacons / POI (Ultra-Stable 100% In-Place)
  ================================================================================
  Features:
  - Reveals all Points of Interest (POI), containers, stations, lockers, wrecks &amp; beacons
  - Unlocks and forces visibility of all 3D and 2D markers (BP_Marker_C)
  - Prevents visited beacons from being hidden/removed (clears RemovedMarkerTags)
  - Reveals all star map points and unlocks all navigation routes (MapPoint)
  - 100% In-Place: ZERO external memory allocation, ZERO GC crash risk
  ================================================================================
]]

if syntaxcheck then return end

BH2_Map = BH2_Map or {}
local M = BH2_Map

local function valid(p)
  return p and p &gt; 0x10000 and p &lt; 0x7FFFFFFFFFFF and (p &amp; 7) == 0
end

local function getBase()
  return getAddressSafe(process) or getAddressSafe('Breathedge2-Win64-Shipping.exe')
end

local function getObjName(obj)
  if not valid(obj) then return '' end
  local nameIdx = readInteger(obj + 0x18)
  if not nameIdx or nameIdx &lt; 0 then return '' end
  local base = getBase()
  if not base or base == 0 then return '' end
  local fNameBlocks = base + 0x994DED0
  local blk = readPointer(fNameBlocks + math.floor(nameIdx / 65536) * 8)
  if not valid(blk) then return '' end
  local entry = blk + (nameIdx % 65536) * 2
  local h = readSmallInteger(entry)
  if not h then return '' end
  local len = math.floor(h / 64)
  if len &lt;= 0 or len &gt; 250 then return '' end
  return readString(entry + 2, len) or ''
end

local function getClassName(obj)
  if not valid(obj) then return '' end
  local cls = readPointer(obj + 0x10)
  return getObjName(cls)
end

local function getPC()
  local base = getBase()
  if not base or base == 0 then return nil end
  local world = readQword(base + 0x9BA6BE8)
  if not valid(world) then return nil end
  local gi = readQword(world + 0x228)
  if not valid(gi) then return nil end
  local lpArr = readQword(gi + 0x38)
  local lp = valid(lpArr) and readQword(lpArr)
  return valid(lp) and readQword(lp + 0x30)
end

M.markers = M.markers or {}
M.mapPoints = M.mapPoints or {}
M.lastScan = 0

function M.scanObjects()
  local base = getBase()
  if not base or base == 0 then return end
  local guo = base + 0x9A1BF50
  local chunks = readPointer(guo + 0x10)
  local numElements = readInteger(guo + 0x24) or 120000

  local markers = {}
  local mapPoints = {}

  for i = 0, numElements - 1 do
    local chunk = readPointer(chunks + math.floor(i / 65536) * 8)
    if chunk and chunk &gt; 0 then
      local obj = readPointer(chunk + (i % 65536) * 24 + 8)
      if valid(obj) then
        local c = getClassName(obj)
        if c == 'BP_Marker_C' then
          table.insert(markers, obj)
        elseif c == 'MapPoint' or c == 'BP_MapPoint_C' then
          table.insert(mapPoints, obj)
        end
      end
    end
  end

  M.markers = markers
  M.mapPoints = mapPoints
  M.lastScan = os.time()
end

function M.applyMapCheats()
  local pc = getPC()
  if not valid(pc) then return end

  -- BPC_Markers_C: Clear RemovedMarkerTags to prevent visited beacons from hiding
  local bpcMarkers = readQword(pc + 0x7D8)
  if valid(bpcMarkers) then
    writeInteger(bpcMarkers + 0xF8, 0)
  end

  -- Rescan if list is empty or every 30 seconds
  if #M.markers == 0 or (os.time() - (M.lastScan or 0)) &gt; 30 then
    M.scanObjects()
  end

  -- 1) Map &amp; HUD Beacons (BP_Marker_C)
  for _, m in ipairs(M.markers) do
    if valid(m) then
      writeByte(m + 0x2F2, 0) -- IsDisabled = false (force display)
      writeByte(m + 0x315, 1) -- IsVisibleByJournal = true (force map/journal visibility)
    end
  end

  -- 2) Star Map Navigation Points (MapPoint)
  for _, p in ipairs(M.mapPoints) do
    if valid(p) then
      writeByte(p + 0x368, 1) -- CanBeUsedInRoute = true (unlock route)
      writeByte(p + 0x388, 1) -- PointState = Discovered (reveal point)
    end
  end
end

-- Clean up old timer if it existed
if M.timer then
  M.timer.destroy()
  M.timer = nil
end

-- Immediate initial scan
M.scanObjects()

-- Background maintenance timer (every second, 0% CPU thanks to cache)
M.timer = createTimer(nil, false)
M.timer.Interval = 1000
M.timer.OnTimer = function()
  pcall(M.applyMapCheats)
end
M.timer.Enabled = true

-- Immediate application
pcall(M.applyMapCheats)
beep()
print(string.format('[BH2] Tab 3 ENABLED: %d Beacons &amp; %d Star Map Points revealed!', #M.markers, #M.mapPoints))

{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
local M = BH2_Map
if M and M.timer then
  M.timer.destroy()
  M.timer = nil
end
print('[BH2] Tab 3 (Star Map &amp; Beacons / POI) DISABLED.')
{$asm}
</AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>15</ID>
              <Description>"[Tab 4] Journal: Door Codes, Safes &amp; Intercoms (100% In-Place)"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
--[[
  ================================================================================
  Breathedge 2 - [Tab 4] Journal (100% In-Place &amp; Ultra-Stable)
  ================================================================================
  Features:
  - Unlocks and examines all door and safe lock codes in the level
  - Unlocks all discovered intercom / phone numbers
  - 100% DYNAMIC resolution via GUObjectArray (NO hardcoded addresses)
  - 100% In-Place: reuses existing game buffers, ZERO foreign malloc, ZERO GC crash
  ================================================================================
]]

if syntaxcheck then return end

BH2_Journal = BH2_Journal or {}
local J = BH2_Journal

local function valid(p)
  return p and p &gt; 0x10000 and p &lt; 0x7FFFFFFFFFFF and (p &amp; 7) == 0
end

local function applyJournal()
  local base = getAddressSafe(process) or getAddressSafe('Breathedge2-Win64-Shipping.exe')
  if not base or base == 0 then return end
  local world = readQword(base + 0x9BA6BE8)
  if not valid(world) then return end
  local gi = readQword(world + 0x228)
  if not valid(gi) then return end
  local lpArr = readQword(gi + 0x38)
  local lp = valid(lpArr) and readQword(lpArr)
  local pc = valid(lp) and readQword(lp + 0x30)
  if not valid(pc) then return end
  local jour = readQword(pc + 0x7C8)
  if not valid(jour) then return end

  -- Dynamic discovery of DALockInfo objects in memory
  local guo = base + 0x9A1BF50
  local chunks = readPointer(guo + 0x10)
  local numElements = readInteger(guo + 0x24) or 120000
  local fNameBlocks = base + 0x994DED0

  local function fname(idx)
    if not idx or idx &lt; 0 then return '' end
    local blk = readPointer(fNameBlocks + math.floor(idx / 65536) * 8)
    if not valid(blk) then return '' end
    local e = blk + (idx % 65536) * 2
    local h = readSmallInteger(e)
    if not h then return '' end
    local len = math.floor(h / 64)
    if len &lt;= 0 or len &gt; 250 then return '' end
    return readString(e + 2, len) or ''
  end

  local codes = {}
  local phones = {}

  for i = 0, numElements - 1 do
    local chunk = readPointer(chunks + math.floor(i / 65536) * 8)
    if chunk and chunk &gt; 0 then
      local obj = readPointer(chunk + (i % 65536) * 24 + 8)
      if valid(obj) then
        local cls = readPointer(obj + 0x10)
        if valid(cls) and fname(readInteger(cls + 0x18)) == 'DALockInfo' then
          local oname = fname(readInteger(obj + 0x18))
          if not oname:find('Default__') then
            local lType = readBytes(obj + 0x30, 1) or 0
            if lType == 1 then
              table.insert(phones, obj)
            else
              table.insert(codes, obj)
            end
          end
        end
      end
    end
  end

  -- In-Place insertion into arrays already allocated by the game
  local function fillArray(offset, items)
    local data = readQword(jour + offset)
    local maxCnt = readInteger(jour + offset + 12) or 0
    if valid(data) and maxCnt &gt; 0 then
      local toWrite = math.min(#items, maxCnt)
      for i = 1, toWrite do
        writeQword(data + (i - 1) * 8, items[i])
      end
      writeInteger(jour + offset + 8, toWrite)
    end
  end

  -- Door &amp; safe codes
  fillArray(0x188, codes) -- ExaminedCodes
  fillArray(0x158, codes) -- UsedCodes

  -- Intercoms &amp; phones
  fillArray(0x178, phones) -- ExaminedPhones
  fillArray(0x138, phones) -- UsedPhones

  beep()
  print(string.format('[BH2] Tab 4 (Journal) ENABLED: %d Codes and %d Intercoms unlocked without crash!', #codes, #phones))
end

pcall(applyJournal)

{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
print('[BH2] Tab 4 (Journal) DISABLED.')
{$asm}
</AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>18</ID>
              <Description>"[Tab 7] Achievements: 100% Achievements &amp; Trophies Unlocked (39/39)"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end

local function valid(p)
  return p and p &gt; 0x10000 and p &lt; 0x7FFFFFFFFFFF and (p &amp; 7) == 0
end

local function unlockAllAchievements()
  local base = getAddressSafe('Breathedge2-Win64-Shipping.exe')
  if not base or base == 0 then return end
  local world = readPointer(base + 0x9BA6BE8)
  if not valid(world) then return end
  local gi = readPointer(world + 0x228)
  if not valid(gi) then return end
  local lpArr = readPointer(gi + 0x38)
  local lp = valid(lpArr) and readPointer(lpArr)
  local pc = valid(lp) and readPointer(lp + 0x30)
  if not valid(pc) then return end

  local ach = readPointer(pc + 0x7B8)
  if not valid(ach) then return end

  local itemsData = readPointer(ach + 0xF0)
  local count = readInteger(ach + 0xF0 + 8) or 0
  local unlocked = 0
  for i = 0, count - 1 do
    local obj = readPointer(itemsData + i * 8)
    if valid(obj) then
      writeBytes(obj + 0x30, 1) -- IsOpen = 1
      writeQword(obj + 0x38, 0x8DF39437775F130) -- UnlockDate
      local maxVal = readInteger(obj + 0x44) or 1
      writeInteger(obj + 0x40, maxVal) -- Progress = Max
      writeBytes(obj + 0x48, 1) -- bViewed = 1
      unlocked = unlocked + 1
    end
  end
  beep()
  print(string.format('[BH2] Tab 7 ENABLED: %d/%d Achievements unlocked (100%%)!', unlocked, count))
end

pcall(unlockAllAchievements)
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
print('[BH2] Tab 7 (Achievements) DISABLED.')
{$asm}
</AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>16</ID>
              <Description>"[Tab 9] Spaceship &amp; Crew: Max Fuel, Hull, Cargo &amp; Crew Mood (Excellent)"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
--[[
  Breathedge 2 - Spaceship &amp; Crew (100% In-Place &amp; Ultra-Stable)
  Tab 9: Spaceship (BPC_Ship_C) &amp; Crew (BPC_Crew_C)
  - Infinite Fuel (9999 / 9999 L)
  - Infinite Hull &amp; Health (9999 / 9999 HP)
  - Max Ship Oxygen, Food &amp; Water (9999)
  - Unlimited Cargo Hold (99,999 kg, weight set to 0 kg)
  - Zero consumption rates in flight (0.0)
  - All Ship Protections at 100% (Rad, Cold, Fire, Elec, Physical)
  - Boosted Travel Speed (TravelSpeed = 300.0)
  - All Crew Members Mood at Maximum (100.0 - Mood: Excellent for everyone!)
  - 100% In-Place (ZERO memory allocation, ZERO crash guaranteed)
]]

if syntaxcheck then return end

BH2_Ship = BH2_Ship or {}
local S = BH2_Ship

local function valid(p)
  return p and p &gt; 0x10000 and p &lt; 0x7FFFFFFFFFFF and (p &amp; 7) == 0
end

local function getComponents()
  local base = getAddressSafe(process) or getAddressSafe('Breathedge2-Win64-Shipping.exe')
  if not base or base == 0 then return nil, nil end
  local world = readQword(base + 0x9BA6BE8)
  if not valid(world) then return nil, nil end
  local gi = readQword(world + 0x228)
  if not valid(gi) then return nil, nil end
  local lpArr = readQword(gi + 0x38)
  local lp = valid(lpArr) and readQword(lpArr)
  local pc = valid(lp) and readQword(lp + 0x30)
  if not valid(pc) then return nil, nil end

  local ship = readQword(pc + 0x768)
  local crew = readQword(pc + 0x760)
  return ship, crew
end

function S.applyCheats()
  local ship, crew = getComponents()

  -- 1) Spaceship (BPC_Ship_C)
  if valid(ship) then
    writeFloat(ship + 0x158, 9999.0) -- MaxFuel
    writeFloat(ship + 0x148, 9999.0) -- Fuel
    writeFloat(ship + 0x16C, 9999.0) -- MaxHealth
    writeFloat(ship + 0x168, 9999.0) -- Health
    writeFloat(ship + 0x15C, 9999.0) -- MaxOxygen
    writeFloat(ship + 0x14C, 9999.0) -- Oxygen
    writeFloat(ship + 0x160, 9999.0) -- MaxFood
    writeFloat(ship + 0x150, 9999.0) -- Food
    writeFloat(ship + 0x164, 9999.0) -- MaxWater
    writeFloat(ship + 0x154, 9999.0) -- Water

    -- Unlimited Cargo Weight
    writeFloat(ship + 0x174, 99999.0) -- MaxCargoWeight
    writeFloat(ship + 0x170, 0.0)     -- CargoWeight

    -- Zero Consumption in Flight
    writeFloat(ship + 0x190, 0.0) -- BaseFuelRate = 0
    writeFloat(ship + 0x194, 0.0) -- BaseOxygenRate = 0
    writeFloat(ship + 0x198, 0.0) -- BaseFoodRate = 0
    writeFloat(ship + 0x19C, 0.0) -- BaseWaterRate = 0
    writeFloat(ship + 0x1A0, 0.0) -- WeightFuelMultiplier = 0

    -- 100% Ship Protections
    writeFloat(ship + 0x178, 100.0) -- RadiationProtection
    writeFloat(ship + 0x17C, 100.0) -- FireProtection
    writeFloat(ship + 0x180, 100.0) -- ColdProtection
    writeFloat(ship + 0x184, 100.0) -- ElectricityProtection
    writeFloat(ship + 0x188, 100.0) -- PhysicalProtection

    -- Boosted Cruise Speed
    writeFloat(ship + 0x144, 300.0) -- TravelSpeed
  end

  -- 2) Crew (BPC_Crew_C): Excellent Mood for everyone
  if valid(crew) then
    local count = readInteger(crew + 0x188 + 8)
    local data = readQword(crew + 0x188)
    if valid(data) and count and count &gt; 0 and count &lt; 32 then
      for i = 0, count - 1 do
        local mBase = data + i * 32
        -- Offset +0x10 is the Mood float inside FCrewMemberState
        writeFloat(mBase + 0x10, 100.0)
      end
    end
  end
end

if S.timer then
  S.timer.destroy()
  S.timer = nil
end

S.timer = createTimer(nil, false)
S.timer.Interval = 250
S.timer.OnTimer = function()
  pcall(S.applyCheats)
end
S.timer.Enabled = true

pcall(S.applyCheats)
beep()
print('[BH2] Tab 9 (Spaceship &amp; Crew) ENABLED: 9999 Fuel, 9999 Hull, Unlimited Cargo, Excellent Crew Mood!')

{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
local S = BH2_Ship
if S and S.timer then
  S.timer.destroy()
  S.timer = nil
end
print('[BH2] Tab 9 (Spaceship &amp; Crew) DISABLED.')
{$asm}
</AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>19</ID>
              <Description>"[Debug] Secret Developer Menu (W_DevelopersMenu_C) [F12]"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
--[[
  Breathedge 2 - [Debug] Secret Developer Menu (W_DevelopersMenu_C) [F12]
  - Binds the F12 key (VK_F12) to toggle W_DevelopersMenu_C open and closed in-game
  - Uses single-shot guarded UberGraph execution on BP_BreathedgeCharacter_C
  - Automatically closes the Developer Menu and unbinds F12 when disabled
]]

if syntaxcheck then return end

BH2_DevMenu = BH2_DevMenu or {}
local D = BH2_DevMenu

local function valid(p)
  return p and p &gt; 0x10000 and p &lt; 0x7FFFFFFFFFFF and (p &amp; 7) == 0
end

function D.resolveFunctions()
  local base = getAddressSafe(process) or getAddressSafe('Breathedge2-Win64-Shipping.exe')
  if not base or base == 0 then return nil end
  local world = readPointer(base + 0x9BA6BE8)
  if not valid(world) then return nil end
  local gi = readPointer(world + 0x228)
  if not valid(gi) then return nil end
  local lpArr = readPointer(gi + 0x38)
  local lp = valid(lpArr) and readPointer(lpArr)
  local pc = valid(lp) and readPointer(lp + 0x30)
  if not valid(pc) then return nil end
  local char = readPointer(pc + 0x300)
  if not valid(char) then return nil end
  local charCls = readPointer(char + 0x10)
  if not valid(charCls) then return nil end

  local baseFNames = base + 0x994DED0
  local function getFName(nId)
    if not nId or nId &lt;= 0 or nId &gt; 0x2000000 then return '' end
    local blk = readPointer(baseFNames + math.floor(nId / 65536) * 8)
    if not valid(blk) then return '' end
    local e = blk + (nId % 65536) * 2
    local h = readSmallInteger(e)
    if not h then return '' end
    local len = math.floor(h / 64)
    if len &lt;= 0 or len &gt; 128 then return '' end
    return readString(e + 2, len) or ''
  end

  local cur = readPointer(charCls + 0x48)
  local tickSp, uberSp = nil, nil
  while valid(cur) do
    local name = getFName(readInteger(cur + 0x18))
    if name == 'ReceiveTick' then
      tickSp = readPointer(cur + 0x60)
    elseif name == 'ExecuteUbergraph_BP_BreathedgeCharacter' then
      uberSp = readPointer(cur + 0x60)
    end
    if tickSp and uberSp then break end
    cur = readPointer(cur + 0x28)
  end

  if not valid(tickSp) or not valid(uberSp) then return nil end
  return { pc = pc, char = char, tickSp = tickSp, uberSp = uberSp }
end

function D.restoreBytecode(ctx)
  ctx = ctx or D.resolveFunctions()
  if not ctx then return end
  if valid(ctx.tickSp) then
    writeInteger(ctx.tickSp + 28, 2596) -- Normal ReceiveTick entry point
  end
  if valid(ctx.uberSp) then
    writeInteger(ctx.uberSp + 4641, 4188) -- EX_JumpIfNot target (Create W_DevelopersMenu_C)
    writeInteger(ctx.uberSp + 4655, 4436) -- EX_Jump target (RemoveDevMenu)
  end
end

-- targetOpen == true (open), false (close), nil (toggle via F12)
function D.setOpen(targetOpen)
  local ctx = D.resolveFunctions()
  if not ctx then return end

  if D.watcher then
    D.watcher.destroy()
    D.watcher = nil
  end

  local curMenu = readPointer(ctx.char + 0x980)
  local isOpen = valid(curMenu)
  if targetOpen == nil then
    if D.pendingTarget ~= nil then
      targetOpen = not D.pendingTarget
    else
      targetOpen = not isOpen
    end
  end

  if (targetOpen and isOpen) or ((not targetOpen) and (not isOpen)) then
    D.pendingTarget = nil
    D.restoreBytecode(ctx)
    return
  end

  D.pendingTarget = targetOpen

  if targetOpen then
    -- Guarded Open: if not valid -&gt; jump to 4188 (Create), if already valid -&gt; jump to 4435 (EX_Return no-op)
    writeInteger(ctx.uberSp + 4641, 4188)
    writeInteger(ctx.uberSp + 4655, 4435)
    writeInteger(ctx.tickSp + 28, 6038)
  else
    -- Guarded Close: if not valid -&gt; jump to 4435 (EX_Return no-op), if valid -&gt; jump to 4436 (RemoveDevMenu)
    writeInteger(ctx.uberSp + 4641, 4435)
    writeInteger(ctx.uberSp + 4655, 4436)
    writeInteger(ctx.tickSp + 28, 6038)
  end

  local tm = createTimer(nil, false)
  tm.Interval = 30
  local count = 0
  local maxTicks = targetOpen and 6000 or 200 -- Wait up to 3 min when opening from background/pause
  tm.OnTimer = function(t)
    count = count + 1
    local ch = readPointer(ctx.pc + 0x300)
    local menu = valid(ch) and readPointer(ch + 0x980)
    local nowOpen = valid(menu)
    if (targetOpen and nowOpen) or ((not targetOpen) and (not nowOpen)) or count &gt; maxTicks then
      D.pendingTarget = nil
      D.restoreBytecode(ctx)
      t.destroy()
      if D.watcher == t then D.watcher = nil end
      if targetOpen and nowOpen then
        beep()
        print('[BH2] Secret Developer Menu OPENED! (Press F12 to toggle open/close)')
      elseif (not targetOpen) and (not nowOpen) then
        beep()
        print('[BH2] Secret Developer Menu CLOSED.')
      end
    end
  end
  D.watcher = tm
  tm.Enabled = true
end

function D.start()
  if D.hotkey then
    D.hotkey.destroy()
    D.hotkey = nil
  end
  D.hotkey = createHotkey(function() pcall(D.setOpen, nil) end, VK_F12)
  print('[BH2] Secret Developer Menu Hotkey [F12] registered (unpause game to open/toggle).')
  pcall(D.setOpen, true)
end

function D.stop()
  if D.hotkey then
    D.hotkey.destroy()
    D.hotkey = nil
  end
  if D.watcher then
    D.watcher.destroy()
    D.watcher = nil
  end
  D.pendingTarget = nil
  local ctx = D.resolveFunctions()
  if ctx and valid(readPointer(ctx.char + 0x980)) then
    pcall(D.setOpen, false)
  else
    D.restoreBytecode(ctx)
  end
  print('[BH2] Secret Developer Menu [F12] DISABLED.')
end

pcall(D.start)
{$asm}

[DISABLE]
{$lua}
if syntaxcheck then return end
if BH2_DevMenu and BH2_DevMenu.stop then
  pcall(BH2_DevMenu.stop)
end
{$asm}
</AssemblerScript>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
</CheatTable>
