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 


autoAssemble and disableInfo help

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

Joined: 02 May 2018
Posts: 28

PostPosted: Mon Sep 02, 2019 7:39 pm    Post subject: autoAssemble and disableInfo help Reply with quote

I am integrating an Assembly script in Lua.

As far as I know, disableInfo is a boolean, with true making it run the [DISABLE] section.

Though I read this thread, where they use disableInfo to access things defined from the Assembly script. Can someone give me more info about this, and how to properly use it?

For example,
Code:
---- Enable script
 local enabledOk, disableInfo = autoAssemble(scriptStr)
 if enabledOk then
   print('The auto assembler script was enabled successfully.')
 else
   print('There was an error enabling the auto assembler script.')
 end
print(disableInfo.allocs.newmem.address)
local val = readInteger(disableInfo.allocs.newmem.address)
print(tostring(val))


So is disableInfo a special type, or..?
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Mon Sep 02, 2019 8:16 pm    Post subject: Reply with quote

no it's not a boolean it's a table of information for how to disable the script.
if you were to run some code like this (note it uses a 3rd party library added to the autorun folder with a slight modification so I don't have to "require" it)
Code:
local success, disableInfo = autoAssemble[[[ENABLE]
alloc(newmem,$1000) // not automatically known outside the script
globalalloc(global,$2000) // automatically registered/known, not deallocated
registerSymbol(newmem)

label(skip_except_code)

// some fake code that's not actually called but creates an exception point
newmem:
  xor eax,eax
{$try}
  mov eax,[eax] // deref NULL pointer, throw exception
  add eax,1 // can't be reached
  jmp skip_except_code // if we didn't get an exception, skip handling it
  // label code will jump to when exception is thrown
{$except}
  mov eax, 0
skip_except_code:
  ret

[DISABLE]
dealloc(newmem)
unregistersymbol(newmem)]]

print(type(success), tostring(success))
-- note serpent is a lua pretty print library I've added to CE's autorun folder
print(type(disableInfo), serpent.block(disableInfo))
you'd get results like this:
Code:
boolean true
table {
  allocs = {
    newmem = {
      address = 42205184, --note in decimal
      size = 4096
    } --[[table: 0000000008E58600]]
  } --[[table: 0000000008E585C0]],
  exceptionlist = {
    42205186 -- try starts after the xor, a 2 byte instruction
  } --[[table: 0000000008E576C0]],
  registeredsymbols = {
    "newmem"
  } --[[table: 0000000008E57BC0]]
} --[[table: 0000000008E581C0]]


If you're willing to read some Pascal code you can see where CE generates it here


As for using it, a lot of the time you aren't going to do anything other than store it and pass it to autoAssemble when you are ready to disable the script so it can use that information. If you want to also use that information, you can.

_________________
https://github.com/FreeER/ has a few CE related repos
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