View previous topic :: View next topic |
Author |
Message |
papaflyn How do I cheat?
Reputation: 0
Joined: 11 Apr 2021 Posts: 4
|
Posted: Mon Feb 20, 2023 7:46 am Post subject: inject AA into cheatengine, call lua functions |
|
|
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 |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4702
|
Posted: Mon Feb 20, 2023 3:29 pm Post subject: |
|
|
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 |
|
 |
papaflyn How do I cheat?
Reputation: 0
Joined: 11 Apr 2021 Posts: 4
|
Posted: Mon Feb 20, 2023 7:38 pm Post subject: |
|
|
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 |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4702
|
Posted: Mon Feb 20, 2023 8:21 pm Post subject: |
|
|
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 |
|
 |
papaflyn How do I cheat?
Reputation: 0
Joined: 11 Apr 2021 Posts: 4
|
Posted: Mon Feb 20, 2023 8:35 pm Post subject: |
|
|
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 |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4702
|
Posted: Mon Feb 20, 2023 11:11 pm Post subject: |
|
|
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
|
Posted: Tue Feb 21, 2023 2:27 am Post subject: |
|
|
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 |
|
 |
|