View previous topic :: View next topic |
Author |
Message |
gir489 Grandmaster Cheater
Reputation: 14
Joined: 03 Jan 2012 Posts: 837 Location: Maryland, United States
|
Posted: Sat May 25, 2024 1:11 pm Post subject: Need help telling Cheat Engine to wait until a DLL is loaded |
|
|
I have the following script:
Code: | while getProcessIDFromProcessName('helldivers2.exe') == nil do
sleep(100)
end
OpenProcess("helldivers2.exe")
errorOnLookupFailure(false)
while getAddress("game.dll") == 0 do
sleep(100)
end
local base_scripts = getAddressList().getMemoryRecordByDescription("Base Scripts")
for i=0, base_scripts.Count-1 do
local script = base_scripts.Child[i]
while not script.Active do
script.Active = true
end
end
closeCE() |
The problem is, the script just gets stuck waiting for game.dll to resolve. I have encountered this before manually doing this with HELLDIVERS 2. For some reason, Cheat Engine only grabs the list of mapped in modules when you attach it, not when you attempt to resolve a symbol, so the problem here is it will never escape the while game.dll == 0 loop regardless if the game has mapped in the dll.
How can I fix this?
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
ParkourPenguin I post too much
Reputation: 146
Joined: 06 Jul 2014 Posts: 4462
|
Posted: Sat May 25, 2024 1:53 pm Post subject: |
|
|
Running Lua code blocks everything else from happening in CE. Calling functions like processMessages or reinitializeSymbolhandler sometimes helps, but you're better off changing your synchronous blocking code to be asynchronous.
Code: | getAutoAttachList().add'helldivers2.exe'
local t = createTimer()
t.Interval = 100
t.OnTimer = function()
if not getAddressSafe'game.dll' then return end
local m = AddressList["Base Scripts"]
for i = 0, m.Count - 1 do
-- no need for while loop- this is blocking, and if it fails to activate the first time, it probably won't work the next
m.Child[i].Active = true
end
closeCE()
end | PS: right click memory record -> Group config -> Activating this entry activates its children
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Dark Byte Site Admin
Reputation: 462
Joined: 09 May 2003 Posts: 25452 Location: The netherlands
|
Posted: Sat May 25, 2024 2:04 pm Post subject: |
|
|
reinitializeSymbolhandler(true)
_________________
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 |
|
![](templates/subSilver/images/spacer.gif) |
gir489 Grandmaster Cheater
Reputation: 14
Joined: 03 Jan 2012 Posts: 837 Location: Maryland, United States
|
Posted: Sat May 25, 2024 5:05 pm Post subject: |
|
|
Dark Byte wrote: | reinitializeSymbolhandler(true) |
This doesn't work if it was attached before it was mapped and Game Guard was active. If I use a Game Gaurd bypass that shuts it down completly, it will work and it can find User32 and game.dll after it's been mapped. But if I load Cheat Engine after game.dll has been mapped with Game Guard active, my script will work.
ParkourPenguin wrote: | Running Lua code blocks everything else from happening in CE. Calling functions like processMessages or reinitializeSymbolhandler sometimes helps, but you're better off changing your synchronous blocking code to be asynchronous.
Code: | getAutoAttachList().add'helldivers2.exe'
local t = createTimer()
t.Interval = 100
t.OnTimer = function()
if not getAddressSafe'game.dll' then return end
local m = AddressList["Base Scripts"]
for i = 0, m.Count - 1 do
-- no need for while loop- this is blocking, and if it fails to activate the first time, it probably won't work the next
m.Child[i].Active = true
end
closeCE()
end | PS: right click memory record -> Group config -> Activating this entry activates its children |
Using a timer causes Cheat Engine to actually load, which causes Game Guard to detect it. If it doesn't load its main window, Game Guard never detects it, asynchronous threads are not an option.
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Dark Byte Site Admin
Reputation: 462
Joined: 09 May 2003 Posts: 25452 Location: The netherlands
|
Posted: Sun May 26, 2024 6:23 am Post subject: |
|
|
inside the loop
_________________
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 |
|
![](templates/subSilver/images/spacer.gif) |
|