<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="42">
  <CheatEntries>
    <CheatEntry>
      <ID>26724</ID>
      <Description>"Set editor font size (Ctrl+ to increase, Ctrl- to decrease)"</Description>
      <Options moHideChildren="1"/>
      <LastState/>
      <Color>FF0000</Color>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
{$lua}
-- changes font size for all editor forms
local function ChangeFontSize(NewFontSize)
  for i = 0, getFormCount() - 1 do
    local frm = getForm(i)
    if frm.ClassName == 'TfrmAutoInject' then
      frm.Assemblescreen.Font.Size = NewFontSize
    end
  end
end

-- if memory record value changed then use it to change font
local mr = getAddressList().getMemoryRecordByDescription("FontSize")
local OldFontSize = nil
mr.OnGetDisplayValue=function(sender,displayedvalue)
  local changed = OldFontSize and (displayedvalue~=OldFontSize)
  OldFontSize = displayedvalue
  if changed then
    ChangeFontSize(displayedvalue)
  end
  return false,displayedvalue --false because you don't want to change the displayed value
end

-- local variable for memory record
local CEName="cheatengine-x86_64-SSE4-AVX2.exe"
openProcess(CEName)
registerSymbol("CELocal",CEName)
{$asm}
//-----------------------------------------------------------------------
globalAlloc(FontSize, 0x4, CELocal)
FontSize:
  dd #10
[DISABLE]
dealloc(FontSize)
unregisterSymbol(FontSize)
unregisterSymbol(CELocal)
</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>26725</ID>
          <Description>"FontSize"</Description>
          <LastState Value="11" RealAddress="08100020"/>
          <ShowAsSigned>0</ShowAsSigned>
          <VariableType>4 Bytes</VariableType>
          <Address>FontSize</Address>
          <Hotkeys>
            <Hotkey>
              <Action>Toggle Activation</Action>
              <Keys/>
              <ID>0</ID>
            </Hotkey>
            <Hotkey>
              <Action>Increase Value</Action>
              <Keys>
                <Key>17</Key>
                <Key>107</Key>
              </Keys>
              <Value>1</Value>
              <ID>1</ID>
            </Hotkey>
            <Hotkey>
              <Action>Decrease Value</Action>
              <Keys>
                <Key>17</Key>
                <Key>109</Key>
              </Keys>
              <Value>1</Value>
              <ID>2</ID>
            </Hotkey>
          </Hotkeys>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
  <LuaScript>print
</LuaScript>
</CheatTable>
