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7tJC@Tj[=FuBgN2J^38s@Kf)((,[r#$zJ37</UDFChangeValue>
  </Forms>
  <CheatEntries>
    <CheatEntry>
      <ID>26721</ID>
      <Description>"CE compact mode"</Description>
      <Color>FF0000</Color>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
{$lua}
function CECompactMode(state)
  local f = getMainForm()
  local controls = {f.Splitter1, f.Panel4, f.Panel5}
  for k,c in ipairs(controls) do c.Visible = not state end
end
CECompactMode(true)
{$asm}
[DISABLE]
{$lua}
CECompactMode(false)
</AssemblerScript>
    </CheatEntry>
    <CheatEntry>
      <ID>9210</ID>
      <Description>"Attach CE to itself"</Description>
      <Options moHideChildren="1" moDeactivateChildrenAsWell="1"/>
      <Color>FF0000</Color>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
GetLuaEngine().MenuItem5.doClick() -- crear lua output
OpenProcess(getCheatEngineProcessID())
--------------------------------------------------------------------------------
function getPointerSize()
  return 4 + 4*(targetIs64Bit() and 1 or 0)
end
--------------------------------------------------------------------------------
function DeAllocateMemoryEx(symbol)
  if getAddressSafe(symbol) then
    deAlloc(symbol)
    unregisterSymbol(symbol)
  end
end
--------------------------------------------------------------------------------
function AllocateMemoryEx(symbol,size)
  local mem = allocateMemory(size)
  registerSymbol(symbol,mem)
  return mem
end
--------------------------------------------------------------------------------
strings = {}
function WriteStringEx(value,len,widechar)
  local num = #strings+1
  local memSize = (len+1)*(widechar and 2 or 1)
  local terminator = widechar and {0x0, 0x0} or {0x0}
  local addr = allocateMemory(memSize)
  if addr == nil or addr == 0 then
    print("allocateMemory() error!")
    return nil
  end
  strings[num] = addr
  writeString(addr,value,widechar)
  writeBytes(addr+len,terminator)
  registerSymbol("strings_" .. tostring(num), addr)
  return addr
end
--------------------------------------------------------------------------------
function AllocateMemoryWriteString(value)
  local len = string.len(value)
  local strAddr = WriteStringEx(value,len)

  local strMetaAddr = AllocateMemoryEx("StrMeta",16)
  local strPtrAddr = strMetaAddr
  local strLenAddr = strMetaAddr + getPointerSize()
  writePointer(strPtrAddr,strAddr)
  writeInteger(strLenAddr,len)
end
--------------------------------------------------------------------------------
function getSubAddress(mr, newOffsetCount)
  local addr = getAddressSafe(mr.Address)
  if newOffsetCount &gt;= mr.OffsetCount then return mr.CurrentAddress end
  if newOffsetCount &gt; 0 then
    for i = mr.OffsetCount-1, mr.OffsetCount-newOffsetCount, -1 do
      local ptr = readPointer(addr)
      local ofs = tonumber(mr.OffsetText[i],16)
      if ptr == nil or ptr == 0 or ofs == nil then return 0 end
      addr = ptr + ofs
    end
  end
  return addr
end
--------------------------------------------------------------------------------
function UDFChangeValue_Close(sender)
  UDFChangeValue.ModalResult = sender.ModalResult
end
--------------------------------------------------------------------------------
function UDFChangeValue_FormShow(sender)
  UDFChangeValue.CEMemoStringValue.setFocus()
end
--------------------------------------------------------------------------------
function OnValueChangeEx( addresslist, mr )
  if mr.Type == vtString and mr.OffsetCount &gt; 0 then
    local memo = UDFChangeValue.CEMemoStringValue
    memo.Lines.Text = mr.Value
    memo.selectAll()
    if UDFChangeValue.showModal() == mrOK then
      local newValue = memo.Lines.Text
      local newLen = string.len(newValue)
      local oldLen = string.len(mr.Value)
      if newLen ~= oldLen then
        local strPtrAddr = getSubAddress(mr, mr.OffsetCount-1)
        local strLenAddr = strPtrAddr + getPointerSize()
        if newLen &gt; oldLen and UDFChangeValue.CECheckboxStringValue.Checked then
          local size = (newLen+1)*(mr.String.Unicode and 2 or 1)
          writePointer(strPtrAddr, WriteStringEx(newValue, newLen, mr.String.Unicode))
        end
        writeInteger(strLenAddr,newLen)
      end
      mr.Value = newValue
    end
    return true
  end
  return false -- use default editing UI
end
--------------------------------------------------------------------------------
getAddressList().OnValueChange = OnValueChangeEx
AllocateMemoryWriteString("Hello World!")
{$asm}
[DISABLE]
{$lua}
--------------------------------------------------------------------------------
local function DeleteUserdefinedSymbols()
  local mv = getMemoryViewForm()
  if mv.frmSymbolhandler == nil then
    mv.Symbolhandler1.doClick()
    mv.frmSymbolhandler.Close()
  end
  local items = mv.frmSymbolhandler.ListView1.Items
  for i=0,items.Count-1 do
    unregisterSymbol(items.Item[0].Caption)
  end
end
--------------------------------------------------------------------------------
DeleteUserdefinedSymbols()
DeAllocateMemoryEx("StrMeta")
</AssemblerScript>
      <Hotkeys>
        <Hotkey>
          <Action>Activate</Action>
          <Keys>
            <Key>18</Key>
            <Key>45</Key>
          </Keys>
          <ID>0</ID>
          <ActivateSound>Activate</ActivateSound>
        </Hotkey>
        <Hotkey>
          <Action>Deactivate</Action>
          <Keys>
            <Key>18</Key>
            <Key>46</Key>
          </Keys>
          <ID>1</ID>
          <DeactivateSound>Deactivate</DeactivateSound>
        </Hotkey>
        <Hotkey>
          <Action>Toggle Activation</Action>
          <Keys>
            <Key>17</Key>
            <Key>99</Key>
          </Keys>
          <ID>2</ID>
          <ActivateSound>Activate</ActivateSound>
          <DeactivateSound>Deactivate</DeactivateSound>
        </Hotkey>
      </Hotkeys>
      <CheatEntries>
        <CheatEntry>
          <ID>2</ID>
          <Description>"TestString [edit this value to test custom edit handler]"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>String</VariableType>
          <Length>128</Length>
          <Unicode>0</Unicode>
          <CodePage>0</CodePage>
          <ZeroTerminate>1</ZeroTerminate>
          <Address>StrMeta</Address>
          <Offsets>
            <Offset>0</Offset>
          </Offsets>
          <CheatEntries>
            <CheatEntry>
              <ID>26722</ID>
              <Description>"Inspect parent address"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
createStructureForm(memrec.Parent.Address,memrec.Parent.Description)
{$asm}
[DISABLE]

</AssemblerScript>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>6</ID>
          <Description>"Pointer to TestString [this value changes automatically if memory allocated for new string]"</Description>
          <ShowAsHex>1</ShowAsHex>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>8 Bytes</VariableType>
          <Address>StrMeta</Address>
        </CheatEntry>
        <CheatEntry>
          <ID>9211</ID>
          <Description>"Length of TestString [this value changes automatically if new value length differs]"</Description>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>StrMeta+8</Address>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols>
    <SymbolEntry>
      <Name>strings_1</Name>
      <Address>7FE0000</Address>
    </SymbolEntry>
    <SymbolEntry>
      <Name>StrMeta</Name>
      <Address>7FF0000</Address>
    </SymbolEntry>
  </UserdefinedSymbols>
  <Structures StructVersion="2">
    <Structure Name="String" AutoFill="0" AutoCreate="1" DefaultHex="0" AutoDestroy="0" DoNotSaveLocal="0" RLECompression="1" AutoCreateStructsize="4096">
      <Elements>
        <Element Offset="0" Vartype="Pointer" Bytesize="8" OffsetHex="00000000" Description="StrPointer" DisplayMethod="unsigned integer" BackgroundColor="00FFFF">
          <Structure Name="Autocreated from 001C6380" AutoFill="0" AutoCreate="1" DefaultHex="0" AutoDestroy="0" DoNotSaveLocal="0" RLECompression="1" AutoCreateStructsize="4096">
            <Elements>
              <Element Offset="0" Vartype="String" Bytesize="15" OffsetHex="00000000" DisplayMethod="unsigned integer"/>
            </Elements>
          </Structure>
        </Element>
      </Elements>
    </Structure>
  </Structures>
</CheatTable>
