<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="42">
  <CheatEntries>
    <CheatEntry>
      <ID>26110</ID>
      <Description>"Credits"</Description>
      <ShowAsSigned>0</ShowAsSigned>
      <VariableType>4 Bytes</VariableType>
      <Address>"MidnightSuns-Win64-Shipping.exe"+0995C900</Address>
      <Offsets>
        <Offset>428</Offset>
        <Offset>B0</Offset>
        <Offset>20</Offset>
        <Offset>388</Offset>
        <Offset>D8</Offset>
        <Offset>8</Offset>
        <Offset>238</Offset>
      </Offsets>
    </CheatEntry>
    <CheatEntry>
      <ID>26112</ID>
      <Description>"Heroic Essence"</Description>
      <ShowAsSigned>0</ShowAsSigned>
      <VariableType>4 Bytes</VariableType>
      <Address>"MidnightSuns-Win64-Shipping.exe"+0995C900</Address>
      <Offsets>
        <Offset>470</Offset>
        <Offset>B0</Offset>
        <Offset>20</Offset>
        <Offset>388</Offset>
        <Offset>D8</Offset>
        <Offset>8</Offset>
        <Offset>238</Offset>
      </Offsets>
    </CheatEntry>
    <CheatEntry>
      <ID>26113</ID>
      <Description>"Gloss"</Description>
      <ShowAsSigned>0</ShowAsSigned>
      <VariableType>4 Bytes</VariableType>
      <Address>"MidnightSuns-Win64-Shipping.exe"+0995C900</Address>
      <Offsets>
        <Offset>2318</Offset>
        <Offset>B0</Offset>
        <Offset>20</Offset>
        <Offset>388</Offset>
        <Offset>D8</Offset>
        <Offset>8</Offset>
        <Offset>238</Offset>
      </Offsets>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
  <LuaScript>PROCESS_NAME = 'MidnightSuns-Win64-Shipping.exe'
--------
-------- Auto Attach
--------
local autoAttachTimer = nil
local autoAttachTimerInterval = 5

local function autoAttachTimer_tick(timer)
        ---- Check if process is running
	if getProcessIDFromProcessName(PROCESS_NAME) ~= nil then
		timer.destroy() ---- Destroy timer
		openProcess(PROCESS_NAME) ---- Open the process
		local EnumChildWindowsPtr = getAddressSafe("EnumChildWindows")
		WriteBytes(EnumChildWindowsPtr,0xC3)
	end
end

autoAttachTimer = createTimer(getMainForm())
autoAttachTimer.Interval = autoAttachTimerInterval
autoAttachTimer.OnTimer = autoAttachTimer_tick

function hexdecode(hex)
   return (hex:gsub("%x%x", function(digits) return string.char(tonumber(digits, 16)) end))
end

function renameComponents(c)
  local i
  if c.Component then
    for i=0,c.ComponentCount-1 do

      if c.Component[i].Items then
        local tmpstrthis = c.Component[i].Items.Text
        if(tmpstrthis) then
          if(string.find(tmpstrthis:lower(), hexdecode('6368656174'))) then
            tmpstrthis = tmpstrthis:lower()
            tmpstrthis = tmpstrthis:gsub(hexdecode('6368656174'), 'nop')
            c.Component[i].Items.Text = tmpstrthis
          end
        end
      end

      renameComponents(c.Component[i])
    end
  end

  if c.Caption then
    local strthis = c.Caption

    if(string.find(strthis:lower(), hexdecode('6368656174'))) then
      c.Caption='nop'
    end
  end
end

for i=0,getFormCount()-1 do
    local form = getForm(i)

    for j=0,form.ControlCount-1 do
      renameComponents(form)
    end

    form.Caption='AnInnocentProcess'
end
</LuaScript>
</CheatTable>
