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 


ASM code to a function. (syntax)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Jan 02, 2018 7:11 pm    Post subject: ASM code to a function. (syntax) Reply with quote

Hi there,

Since I loss almost my scripts from my PC by an stupid accident then I need some help for write these asm code below to a function and also I dpn't know about asm too much :

Code:
[ENABLE]

aobscan(MOVES,89 48 24 8B 48 24 83) // should be unique
alloc(newmem,$1000)

label(code)
label(return)

newmem:

code:
mov ecx,#99
mov [eax+24],ecx
mov ecx,[eax+24]
jmp return

MOVES:
jmp code
nop
return:
registersymbol(MOVES)

[DISABLE]

MOVES:
db 89 48 24 8B 48 24

unregistersymbol(MOVES)
dealloc(newmem)

SCORE

[ENABLE]

aobscan(SCORE,89 70 14 8D 8B 80 09 00 00) // should be unique
alloc(newmem,$1000)

label(code)
label(return)

newmem:

code:
mov esi,#100000000
mov [eax+14],esi
lea ecx,[ebx+00000980]
jmp return

SCORE:
jmp code
nop
nop
nop
nop
return:
registersymbol(SCORE)

[DISABLE]

SCORE:
db 89 70 14 8D 8B 80 09 00 00

unregistersymbol(SCORE)
dealloc(newmem)

COINS

[ENABLE]

aobscan(COINS,89 41 24 8D 8B 80 09 00 00) // should be unique
alloc(newmem,$1000)

label(code)
label(return)

newmem:

code:
mov eax,#9999999999
mov [ecx+24],eax
lea ecx,[ebx+00000980]
jmp return

COINS:
jmp code
nop
nop
nop
nop
return:
registersymbol(COINS)

[DISABLE]

COINS:
db 89 41 24 8D 8B 80 09 00 00

unregistersymbol(COINS)
dealloc(newmem)

DIAMONDS

[ENABLE]

aobscan(DIAMONDS,89 41 28 8D 8B 80 09 00 00) // should be unique
alloc(newmem,$1000)

label(code)
label(return)

newmem:

code:
mov eax,#9999999999
mov [ecx+28],eax
lea ecx,[ebx+00000980]
jmp return

DIAMONDS:
jmp code
nop
nop
nop
nop
return:
registersymbol(DIAMONDS)

[DISABLE]

DIAMONDS:
db 89 41 28 8D 8B 80 09 00 00

unregistersymbol(DIAMONDS)
dealloc(newmem)


1. How to write that codes with correct syntax to a function ?.
2. And then I able to call that function by a button click. (This is easy and already knew)

Thanks

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1587

PostPosted: Tue Jan 02, 2018 7:26 pm    Post subject: Reply with quote

im not sure about what you mean with "correct syntax" and "to a function"

i read the script twice, there is no syntax error.
an exception for multiple enable-disable sections, CE wont accept it unless you combine them all under one enable-disable section.

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Jan 02, 2018 8:45 pm    Post subject: Reply with quote

Thanks OldCheatEngineUser, so no syntax error there, what I mean is something like this below :

Code:
function hack1()
  [ENABLE]
  aobscan(MOVES,89 48 24 8B 48 24 83) // should be unique
  alloc(newmem,$1000)
  label(code)
  label(return)

  newmem:
  code:
  mov ecx,#99
  mov [eax+24],ecx
  mov ecx,[eax+24]
  jmp return

  MOVES:
  jmp code
  nop
  return:
  registersymbol(MOVES)

  [DISABLE]

  MOVES:
  db 89 48 24 8B 48 24
  unregistersymbol(MOVES)
  dealloc(newmem)
  --- and so on.......
end

f = createForm()
b1 = createButton(f)

b1.onClick = hack1
f.show()


Is the function with asm codes written right ? or need typing something like "$Asm" or "[AutoAssemble]"..etc ?
Of course, a opened process already done in separate script.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue Jan 02, 2018 8:54 pm    Post subject: Reply with quote

To do it in Lua you just need to put your script in a string, then pass the string to the autoAssemble function.
_________________
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Jan 02, 2018 9:35 pm    Post subject: Reply with quote

TheyCallMeTim13, like this ? :

Code:
 local scriptStr = [==[
   [ENABLE]
  aobscan(MOVES,89 48 24 8B 48 24 83) // should be unique
  alloc(newmem,$1000)
  label(code)
  label(return)

  newmem:
  code:
  mov ecx,#99
  mov [eax+24],ecx
  mov ecx,[eax+24]
  jmp return

  MOVES:
  jmp code
  nop
  return:
  registersymbol(MOVES)

  [DISABLE]

  MOVES:
  db 89 48 24 8B 48 24
  unregistersymbol(MOVES)
  dealloc(newmem)
]==]

function hack1()
 ---- 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
 ---- Disable script
 local disabledOk = autoAssemble(scriptStr, disableInfo)
 if disabledOk then
   disableInfo = nil
   print('The auto assembler script was disabled successfully.')
 else
   print('There was an error disabling the auto assembler script.')
 end
end

f = createForm()
b1 = createButton(f)

b1.onClick = hack1
f.show()

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue Jan 02, 2018 10:07 pm    Post subject: Reply with quote

EDIT:
Yeah that looks good to me, and you can also use a new functions added in Cheat Engine version 6.7 to check syntax, autoAssembleCheck

But note that with "autoAssembleCheck" if you pass "TargetSelf" even as nil it will ignore the enable argument.

_________________


Last edited by TheyCallMeTim13 on Tue Jan 02, 2018 10:11 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Jan 02, 2018 10:08 pm    Post subject: Reply with quote

Thank you all... Very Happy

EDIT :
Quote:
you can also use a new functions added in Cheat Engine version 6.7 to check syntax, autoAssembleCheck


Got it and understood, thanks again...

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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