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 


registerAutoAssemblerCommand & aobscanmodule [Solved]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 152

PostPosted: Wed Aug 03, 2022 11:53 am    Post subject: registerAutoAssemblerCommand & aobscanmodule [Solved] Reply with quote

a. Issue: a new update changes the offset in opcode; problem is only a few "active" opcodes access focused value. Working with wildcard introduces many more hits, and no way to reduce that to target_opcode.
b. Goal: maintain only 1 table supporting both versions

Solutions:
1. use AutoAssemble(): doable, but AA script less "readeable"
=> unless returned AA_str is "added" to existing Asm code ?! (~ need to test that)

2. use registerAutoAssemblerCommand: came across this while researching another/similar problem. But stumbled on this atm: [ https://imgur.com/a/AMfekb3 ]
(i assumed CE would insert the string in the Asm section (well, it does seem to do that, based on errorline), and then runs it; iow run that scan and assign address to symbol 'Adrenaline')
> on a subnote: what is best way to execute 'unregisterAutoAssemblerCommand(command)' when ?

3. run scanmodule in lua (eg createMemScan), and assign result to symbol; asm should pick this up, no ?! (need to test that)

also tried:
4. pass AOB via global lua_string (eg: $aob_str) to scanfn, but no-go.


Last edited by paul44 on Sat Aug 06, 2022 3:00 am; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Wed Aug 03, 2022 12:56 pm    Post subject: Reply with quote

{$lua} blocks can return a string that gets substituted into the script. example:
https://forum.cheatengine.org/viewtopic.php?p=5779813#5779813

registerAutoAssemblerCommand is mostly for repeated work you do often in many scripts. example:
https://forum.cheatengine.org/viewtopic.php?p=5773240#5773240

_________________
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
panraven
Grandmaster Cheater
Reputation: 54

Joined: 01 Oct 2008
Posts: 941

PostPosted: Wed Aug 03, 2022 1:49 pm    Post subject: Reply with quote

aa script executed in some phases in order, roughly,
1.preaob : pre processing, remove comment, lua block etc->
2.aob scan ->
3.postaob : custom command and built-in command <eg. alloc>)
->line assembler
-> some finishing process

by the time custom command run, no aobscan line is recognized, so it treat it as assembler line and said that line cannot compile.

You may try execute you aobscan with lua function autoAssemble within your custom command, so hopefully the symbol is registered after the custom command. Effect should be similar as run autoAssemble within a lua block.

May be useful,
Code:

unregisterAutoAssemblerCommand('spawnAA')
registerAutoAssemblerCommand('spawnAA',function(aa, sc)
  if not sc then  autoAssemble( (aa:gsub(';;+','\n') )end
end)

-- ^not tested, maybe typo
So with this you can run another aa with ';;' to means crlf, return result with registerSymbol (aa version).
eg.
Code:

spawnAA(aobscanmodule(adrenalin, ...)   ;;    registerSymbol(adrenalin))

_________________
- Retarded.
Back to top
View user's profile Send private message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 152

PostPosted: Thu Aug 04, 2022 12:14 am    Post subject: to research.... Reply with quote

@ParkourPenguin: i actually read both those posts; 1st one i got, but wanted to try out the command_vs. did not (immediately) grasp the 2nd example... Embarassed

@panraven: i assumed something in those lines; being symbol not registered/initialised/etc. but you bring up an interesting suggestion, passing on the aobscan w/ symbol ?!

=> will take some time to try/test suggestions out (my first intake would be to go for #ParkourPenguin's 1st example though). anyways, i should be able to close this by coming weekend...
Back to top
View user's profile Send private message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 152

PostPosted: Thu Aug 04, 2022 11:41 am    Post subject: working solution... Reply with quote

i got this working on my side, following #ParkourPenguin's 1st suggestion: [ https://imgur.com/a/bk4ejg7 ]. (~ EDIT: updated solutions)
=> needed to tackle some hurdles obviously, incl the [Disable] section.

Q: can one 'define' a global token (so one does not need to introduce a $lua section there as well) ?
(iow no function and strict local vars)

Notes:
1. topic is considered closed, and will do so once i've tried out #panraven's suggestion
2. FYI: #panraven explained the AA execution sequence in far more detail here: [ https://www.cheatengine.org/forum/viewtopic.php?p=5765665&sid=3db0911196c80f579e5770159a221e0d#5765665 ]

-EDIT-
Tested (and working) #Panraven's solution (pic 3 ~ see above)
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