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 


Script That Allows Setting A Value From Table

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Coreveen
Cheater
Reputation: 0

Joined: 12 May 2011
Posts: 41

PostPosted: Sun Oct 23, 2022 1:35 pm    Post subject: Script That Allows Setting A Value From Table Reply with quote

Hey guys! I was hoping to learn today how to convert a standard custom AOB script to have an adjustable value you input from the table instead of having 20 clone script of varying values from 1 - 99 (1, 5, 10, 20, 75, 99 etc etc).

Code:
[ENABLE]

aobscan(INJECT,41 89 46 30 B8 01 00 00 00)
alloc(newmem,$1000,INJECT)

label(code)
label(return)

newmem:

code:
  mov eax,(int)9
  mov [r14+30],eax
  mov eax,00000001
  jmp return

INJECT:
  jmp newmem
  nop 4
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
  db 41 89 46 30 B8 01 00 00 00

unregistersymbol(INJECT)
dealloc(newmem)


The value where you see (int)9 works great but I constantly have to disable the script and enable a different clone script of all the same code with a slightly different value in it's place and it's becoming quite cumbersome. I have no idea to go about doing this, but I'd love if someone could please show me?
Back to top
View user's profile Send private message
cooleko
Grandmaster Cheater
Reputation: 11

Joined: 04 May 2016
Posts: 717

PostPosted: Sun Oct 23, 2022 2:32 pm    Post subject: Reply with quote

Someone posted an almost working example here and received feedback.

In your case you replace the (int) 9 with w/e name you picked inside of []
Back to top
View user's profile Send private message
Coreveen
Cheater
Reputation: 0

Joined: 12 May 2011
Posts: 41

PostPosted: Sun Oct 23, 2022 4:58 pm    Post subject: Reply with quote

Thanks a lot @cooleko ! That was just the hint I needed. For search purposes in case anyone else ends up here, this is the code adjustment I got to work:

Code:
[ENABLE]

aobscan(INJECT,41 89 46 30 B8 01 00 00 00)
alloc(newmem,$1000,INJECT)

label(code)
label(return)

globalalloc(namehere,4)
namehere:
  dd (int)0

newmem:

code:
  mov eax,[namehere]
  mov [r14+30],eax
  mov eax,00000001
  jmp return

INJECT:
  jmp newmem
  nop 4
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
  db 41 89 46 30 B8 01 00 00 00

unregistersymbol(INJECT)
dealloc(newmem)


Then just add an address manually called namehere on the main table.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4710

PostPosted: Sun Oct 23, 2022 7:11 pm    Post subject: Reply with quote

Note that code might not work if the global allocation gets allocated more than 2 GiB away from the code you allocated. (see RIP-relative addressing; only relevant in 64-bit code)

I'd use a label w/ align, but a simple alloc also seems to work... sometimes, maybe. The label is more explicit and hence I like it more.
Code:
[ENABLE]
aobscan(INJECT,41 89 46 30 B8 01 00 00 00)
alloc(newmem,$1000,INJECT)

label(namehere)
label(return)

registersymbol(INJECT)
registersymbol(namehere)

newmem:
  mov eax,[namehere]
  mov [r14+30],eax
  mov eax,00000001
  jmp return

align 4 CC
namehere:
  dd 0


INJECT:
  jmp newmem
  nop 4
return:

[DISABLE]

INJECT:
  db 41 89 46 30 B8 01 00 00 00

unregistersymbol(INJECT)
unregistersymbol(namehere)
dealloc(newmem)

The memory record for the value "namehere" can be made a child of the script memory record, and the script memory record can be set to hide children when disabled.

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