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 


inject AA into cheatengine, call lua functions

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

Joined: 11 Apr 2021
Posts: 4

PostPosted: Mon Feb 20, 2023 7:46 am    Post subject: inject AA into cheatengine, call lua functions Reply with quote

Hey yall.
Im currently trying to run a custom ReadProcessMemory implementation (written in lua), however im stuck trying to call a lua function (defined in CEs global luaVM state) from my autoassembler script.
I'd be thankful for any tips/pointers.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Mon Feb 20, 2023 3:29 pm    Post subject: Reply with quote

Use a {$lua} block to execute Lua code when the script is enabled or disabled:
Code:
[ENABLE]
{$lua}
if syntaxcheck then return end

print'enabled'
{$asm}
// ...

[DISALBE]
{$lua}
if syntaxcheck then return end

print'disabled'
{$asm}
...

If you need to execute Lua code inside a code injection, use {$luacode}

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
papaflyn
How do I cheat?
Reputation: 0

Joined: 11 Apr 2021
Posts: 4

PostPosted: Mon Feb 20, 2023 7:38 pm    Post subject: Reply with quote

ParkourPenguin wrote:

If you need to execute Lua code inside a code injection, use {$luacode}

Thats what im looking for, sadly, {$luacode} does not work when injecting into cheat engine itself.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Mon Feb 20, 2023 8:21 pm    Post subject: Reply with quote

You're hooking ReadProcessMemory in CE's process? Why are you doing that, and why use Lua? Could a custom value type be what you're looking for?

{$luacode} was probably designed solely around IPC- I doubt calling Lua code from a locally injected AA script was ever accounted for.

{$ccode} is also a thing that exists, but it might not fit your use case.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
papaflyn
How do I cheat?
Reputation: 0

Joined: 11 Apr 2021
Posts: 4

PostPosted: Mon Feb 20, 2023 8:35 pm    Post subject: Reply with quote

I want to read process memory using DBVM. i could avoid using lua and just write my rpm function in pure asm, but some functions i need are not exposed to the Autoassembler (dbvm_findCR3 & getPhysicalAddressCR3)

the lua documentation suggests
Code:
setAPIPointer(1, dbvm_ReadPhysicalMemory)
is valid, but it causes bluescreens as dbvm_ReadPhysicalMemory has the wrong signature.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4702

PostPosted: Mon Feb 20, 2023 11:11 pm    Post subject: Reply with quote

I guess you've tried Settings -> Extra -> Kernel Read/Write Process

It is weird how the documentation suggests dbvm_ReadPhysicalMemory is valid.

I don't know any easy way of calling Lua code from a local AA script. Some of the functions exported by lua53-64.dll might be useful. You can play around with {$ccode} to avoid assembly directly, or make a plugin in some other language (I have no experience in this).

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Feb 21, 2023 2:27 am    Post subject: Reply with quote

you could use {$c} to write a wrapper yes

or, just use dbk_usePhysicalMemoryAccess()
if dbvm is detected it uses dbvm

_________________
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
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