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 


LUA checks before mono launch

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Csimbi
I post too much
Reputation: 94

Joined: 14 Jul 2007
Posts: 3107

PostPosted: Wed Apr 21, 2021 3:36 pm    Post subject: LUA checks before mono launch Reply with quote

Hi!

I am building an AA script for a mono game and I'd like to do some tests before I try enabling mono.

Here's the top section of the script, below on the pic is the error message I get; the second number is 12, not 11 (made a change since the screenshot was taken).

Line 8 is "{$lua}" and line 12 is "else" - not sure what the error means.

Any clues?
Thanks!

Code:

[ENABLE]
{$lua}
if syntaxcheck then return end
if process == nil then ShowMessage('Process is not selected.')
elseif readInteger(process) == 0 then ShowMessage('Process cannot be opened. Gone?')
else
  if (monopipe~=nil) and (monopipe.ProcessID~=getOpenedProcessID()) then
    monopipe.destroy()
    monopipe=nil
  end
  if (monopipe==nil) then
    LaunchMonoDataCollector()
    while not monoSymbolList.FullyLoaded do sleep(50) end
  end
end
{$asm}
...



CE-LUAError.png
 Description:
 Filesize:  2.67 KB
 Viewed:  2004 Time(s)

CE-LUAError.png


Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Wed Apr 21, 2021 3:55 pm    Post subject: Reply with quote

Seems like "monoSymbolList" isn't loaded right away. Might check it for nil then check "FullyLoaded".
_________________
Back to top
View user's profile Send private message Visit poster's website
Csimbi
I post too much
Reputation: 94

Joined: 14 Jul 2007
Posts: 3107

PostPosted: Wed Apr 21, 2021 4:53 pm    Post subject: Reply with quote

Changing the while:
Code:
    while (monoSymbolList==nil) or (not monoSymbolList.FullyLoaded) do sleep(50) end

Causes CE to hang (infinite loop).
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Apr 21, 2021 6:57 pm    Post subject: Reply with quote

monoSymbolList is only available if the target is il2cpp and not normal mono

Also, instead of sleep use checkSynchronize(50) or chabge your memrec to be an async record

_________________
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
Csimbi
I post too much
Reputation: 94

Joined: 14 Jul 2007
Posts: 3107

PostPosted: Thu Apr 22, 2021 8:05 am    Post subject: Reply with quote

Dark Byte wrote:
monoSymbolList is only available if the target is il2cpp and not normal mono

Also, instead of sleep use checkSynchronize(50) or change your memrec to be an async record

And hence the loopum infinitum.
Makes sense, thank you!

Is it safe to assume that LaunchMonoDataCollector() is instant in a normal mono target? (instant from an AA script's perspective)
If not, what could possibly be checked to ensure the AA script only continues once the data collector is loaded?

As per Dark Byte's guidance, this works fine in normal mono when you enable single ASync memRecs one by one.
However, it causes process termination when trying to enable two or more ASync memRecs at the same time (race condition?):
Code:

[ENABLE]
{$lua}
if syntaxcheck then return end
if process == nil then ShowMessage('Process is not selected.')
elseif readInteger(process) == 0 then ShowMessage('Process cannot be opened. Gone?')
else
  if (monopipe~=nil) and (monopipe.ProcessID~=getOpenedProcessID()) then
    monopipe.destroy()
    monopipe=nil
  end
  if (monopipe==nil) then
    LaunchMonoDataCollector()
    -- monoSymbolList is only available if the target is il2cpp and not normal mono
    --while (monoSymbolList==nil) or (not monoSymbolList.FullyLoaded) do checkSynchronize(50) end -- checkSynchronize requires that memRec is ASynch.
  end
end
{$asm}

I'll see what happens what happens with monoSymbolList on an IL2CPP target later on - that nil check might not be needed.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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