Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Bug report: top half of CE window gets corrupted

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
GlenMcD
How do I cheat?
Reputation: 0

Joined: 24 Mar 2025
Posts: 6

PostPosted: Fri Jul 25, 2025 9:31 pm    Post subject: Bug report: top half of CE window gets corrupted Reply with quote

hi,
I've noticed for some time, the top half of the primary CE window becoming corrupted visually. Temporary workaround is to resize window to minumum vertically and then back up to whatever height, no need to actually let go of LMB during this just at end works okay. The actual visual data that appears, seems similar to what is currently displaying in bottom pane of main CE window. It's only very recently that I've noticed that this happens after:
1. Hibernate my Windows 11 system.
2. Power off
3. Power on (after power off for some reasonable number of seconds)
4. Start up from hibernation to continue session.

My guess is that there are certain hoops to jump through following a hibernation event, and that CE is not taking all appropriate actions in this regard.

It could be that opening additional windows exacerbates the issue. It appears that the only way to stop the corruption is to restart windows (and thus lose your session, so not suitable in middle of a game, thus the workaround being essential to know while this issue exists).

My system was new in late 2023, AMD CPU, nVidia GPU, 32GB memory. 2x SSD, 4x HDD. Using 4K desktop/monitor with 1/2 scaling.

_________________
Glen
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25762
Location: The netherlands

PostPosted: Sat Jul 26, 2025 1:03 pm    Post subject: Reply with quote

instead of hibernate, try normal sleep.

besides that no idea. Try other lazarus applications and see if they have the same issue, and try turning of dark mode support in CE in case you're using it

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
GlenMcD
How do I cheat?
Reputation: 0

Joined: 24 Mar 2025
Posts: 6

PostPosted: Sat Jul 26, 2025 7:42 pm    Post subject: Reply with quote

Dark Byte wrote:
instead of hibernate, try normal sleep.

besides that no idea. Try other lazarus applications and see if they have the same issue, and try turning of dark mode support in CE in case you're using it


Thanks! I'm actually trying out your previous suggestion, managed to do the settings as you suggested. Fingers crossed! Sleep not viable alternative for me ongoing due to power savings with power completely off.

_________________
Glen
Back to top
View user's profile Send private message
Labyrnth
Moderator
Reputation: 10

Joined: 28 Nov 2006
Posts: 6301

PostPosted: Sun Jul 27, 2025 1:11 am    Post subject: Reply with quote

Here is something else to try as well.

Right click your shortcut and then compatability tab.
Click button to Change high DPI settings
Then check the box for Override high DPI scaling behavior


Can even try doing this:
Code:
-- Cheat Engine: Visual Redraw Hotkey Script
-- Binds F12 to force CE main window repaint (fixes corruption after hibernation)

-- Destroy old hotkey if reloading script
if redrawHotkey then
  redrawHotkey.destroy()
  redrawHotkey = nil
end

-- Function to force redraw of the main form
local function forceRedraw()
  local form = getMainForm()
  if form then
    form.Invalidate()
    form.Repaint()
    print("[CE Redraw] Main window repaint triggered.")
  else
    print("[CE Redraw] Failed: Main form not found.")
  end
end

-- Bind the function to F12 (you can change VK_F12 to another key)
redrawHotkey = createHotkey(forceRedraw, VK_F12)

-- Notify user
print("[CE Redraw] Hotkey set: Press F12 to refresh CE window.")
Back to top
View user's profile Send private message
GlenMcD
How do I cheat?
Reputation: 0

Joined: 24 Mar 2025
Posts: 6

PostPosted: Sun Jul 27, 2025 3:02 am    Post subject: App scaling doesn't fix Reply with quote

After some hours and twice hibernating (with power off) the corruption is back. Probably your refresh hotkey idea is decent workaround, thanks.
_________________
Glen
Back to top
View user's profile Send private message
Labyrnth
Moderator
Reputation: 10

Joined: 28 Nov 2006
Posts: 6301

PostPosted: Mon Jul 28, 2025 4:07 am    Post subject: Reply with quote

Did you try the settings on the properties of a shortcut to CE?
Back to top
View user's profile Send private message
GlenMcD
How do I cheat?
Reputation: 0

Joined: 24 Mar 2025
Posts: 6

PostPosted: Mon Jul 28, 2025 6:23 am    Post subject: Reply with quote

Labyrnth wrote:
Did you try the settings on the properties of a shortcut to CE?

Yes, did that followed by using CE in usual way, including hibernating with power off twice. Sometime after the second hibernation I noticed some corrupting coming in again. I don't have anything definitive proving that hibernation has anything to do with issue, it's more that it's my most recent attempt at finding something that triggers it. I remember having issues that definitely seemed to be from hibernating, when using older CE version. I'm using 7.6 now. Even the game I'm playing has issues with hibernation combined with power off. For example, in game sounds can start echoing (repeating) badly when timescale is reduced, yet after a restart and before any hibernation event, the issue never occurs. As ex software engineer, makes me think that some apps must be doing quasi-legal things that don't get picked up until there's a hibernation event. I used to in my debugging days, make tools that would entice target apps to fail unless code was virtually bug-free. Watching for read or write memory after free, that sort of thing. Because powering off after a hibernation event effectively corrupts or randomises memory that isn't specifically allocated, I imagine that on this platform it would be similar to the use memory after free? In any case I see issues arise if power off happens subsequent to hibernation that otherwise doesn't arise for hibernate only.

_________________
Glen
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 36

Joined: 16 Feb 2017
Posts: 1511

PostPosted: Mon Jul 28, 2025 12:14 pm    Post subject: Reply with quote

Is "Invalidate" defined for the form?
Maybe write a definition for it.

Code:
if redrawHotkey then
  redrawHotkey.destroy()
  redrawHotkey = nil
end

-- Trigger the form's layout engine with both a horizontal and vertical "jitter"!
 Invalidate = function(s)
s.Width = s.Width + 10
s.Height = s.Height + 10
s.Width = s.Width - 10
s.Height = s.Height - 10
return s
end

-- Function to force redraw of the main form
local function forceRedraw()
  local form = getMainForm()
  if form then
    Invalidate(form)
    form.Repaint()
    print("[CE Redraw] Main window repaint triggered.")
  else
    print("[CE Redraw] Failed: Main form not found.")
  end
end

-- Bind the function to F12 (you can change VK_F12 to another key)
redrawHotkey = createHotkey(forceRedraw, VK_F12)

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
GlenMcD
How do I cheat?
Reputation: 0

Joined: 24 Mar 2025
Posts: 6

PostPosted: Mon Jul 28, 2025 5:46 pm    Post subject: Redraw Reply with quote

so far, I've been using the forced redraw by clicking on corner of window (corruption happens not just to main window but others also, eg if I open script for editing), moving mouse so window is minimum height (or near to it) and then up to near whatever size it was. While this workaround is working I'm hesitant to add script to do same although may have a go a bit later. Thinking of how I could do it without using hotkey actually.
Glen

_________________
Glen
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 36

Joined: 16 Feb 2017
Posts: 1511

PostPosted: Mon Jul 28, 2025 10:02 pm    Post subject: Reply with quote

If you package this code with a timer as .lua and place it in the autorun folder, the code can detect any discrepancies between the timer and the system time and perform a refresh.
Code:
local function refreshVisibleForms()
  for i = 0, getFormCount() - 1 do
    local f = getForm(i)
    if f.Visible == true then
      f.Width = f.Width + 5
      f.Height = f.Height + 5
      f.Width = f.Width - 5
      f.Height = f.Height - 5
      f.repaint()
      --print("✅ Refreshed:", f.Name)
    end
  end
end

local lastTime = os.time()
if lstmr2 then lstmr2.Destroy() lstmr2=nil end

lstmr2 = createTimer(MainForm)
lstmr2.Interval = 1000
lstmr2.OnTimer=function()
  local now = os.time()
  --print(now)
  if now - lastTime > 5 then
     refreshVisibleForms()
     print(now - lastTime)
  end
  lastTime = now
  collectgarbage()
end

lstmr2.Enabled = true

Sleep mode stops the timer, provides a time offset, and upon waking from sleep mode, the timer calculates the time offset and initiates the necessary action.

The problem is that a timer stopped by sleep mode does not restart upon waking from sleep mode.
Therefore, it cannot perform the necessary calculations and interaction.
---------------------------------------------

For this reason, the most effective solution for now is a shortcut key combination.

If you package the code below into a Lua file and place it in the CE autorun folder, you can refresh CE and other open forms with the F12 key (or F4 or FCool each time the system wakes up.
Code:
local function refreshVisibleForms()
  for i = 0, getFormCount() - 1 do
    local f = getForm(i)
    if f.Visible == true then
      f.Width = f.Width + 5
      f.Height = f.Height + 5
      f.Width = f.Width - 5
      f.Height = f.Height - 5
      f.repaint()
      --print("✅ Refreshed:", f.Name)
    end
  end
end

if lstky2 then lstky2.Destroy() lstky2=nil end
lstky2 = createHotkey(refreshVisibleForms, VK_F12)


----------------------------------------------
So, did you use "Refresh" from the desktop right-click menu after waking from sleep mode?

What are the results if you apply it?

I hope this isn't a system issue.
Otherwise, system repairs like "restoreHealth" may be necessary.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites