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 


How to define bytes inside registersymbol

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

Joined: 11 Mar 2016
Posts: 231

PostPosted: Fri May 26, 2017 10:28 am    Post subject: How to define bytes inside registersymbol Reply with quote

I made register symbol _modad and its contain the
offset 208 for version one of the game
and
offset 220 for version two of the game

both offsets for one code but 2 different versions of the game ...
The injection works very well but the problem in Disable section



If I disable the script it will
db 89 86 08 02 00 00
the offset will change for v2 of the game to 208 instead of 220
I want to place the bytes of the offset like this

db 89 86 [bytes of the offset ] 00 00



Code:
[ENABLE]
    aobscanmodule(Antistuns,game.exe,89 86 ?? ?? ?? ??       ?? ?? ?? ?? ??          8B 86 ?? ?? ?? ??       89 86 ?? ?? ?? ??       8B 86 ?? ?? ?? ??       89 86 ?? ?? ?? ??       8B 86 ?? ?? ?? ??       85 C0        )

label(code)
label(return)

newmem:
cmp [esi+_karen],#40
jne code
mov [esi+_modad],#103
jmp return
code:
  mov [esi+_modad],eax


  jmp return

Antistuns:
  jmp newmem
  nop
return:
registersymbol(Antistuns)

[Disable]

Antistuns:
 db 89 86 08 02 00 00

unregistersymbol(Antistuns)
dealloc(newmem)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri May 26, 2017 10:33 am    Post subject: This post has 1 review(s) Reply with quote

Code:
Antistuns:
 db 89 86
 dw _modad
 db 00 00

_________________
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
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Fri May 26, 2017 12:32 pm    Post subject: another question Reply with quote

another question:
thnx the above code works
for this code the register symbol want work

Code:
 mov eax,[esi+2C]

Code:
aobscan(koo,8B 46 2C 85 C0 7E 06   )

label(_koo)
registersymbol(_koo)
[koo+2]:
_koo:



while this code works !
code → mov ebx,[esi+00000220]

aob → 8B 9E 20020000


can u explain why and how to use offset 2c in reg symbol or something constant ..
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri May 26, 2017 1:13 pm    Post subject: Reply with quote

I don't know what you're asking.

If you want to know how to dynamically change the displacement in an addressing mode, modifying the machine code would be the most straightforward option.
Code:
// replace uint32 with a 32-bit displacement
_koo:
  db 8B 9E   // mov ebx,[esi+disp32]
  dd uint32  // disp32

Lua is another option.
Code:
_koo:
{$lua}
return string.format('mov ebx,[esi+%X]', uint32)
{$asm}

_________________
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: Fri May 26, 2017 1:30 pm    Post subject: Reply with quote

The [koo+2] read 4 bytes so work for 20 02 00 00 but not 2c (will read as 0x7ec0862c).

But with ce 6.7, this is possible:
Code:

...
label(_koo)
registersymbol(_koo)
$readBytes('koo+2'): // only single quote work
_koo:
...


_koo label is 0x2c, not 0x7ec0862c.

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

Joined: 11 Mar 2016
Posts: 231

PostPosted: Fri May 26, 2017 2:50 pm    Post subject: Reply with quote

panraven wrote:
The [koo+2] read 4 bytes so work for 20 02 00 00 but not 2c


Code:
aobscan(koo,8B 46 ?? 85 C0 ?? ?? 89 86 ?? ?? ?? ?? 53)
label(_koo)
registersymbol(_koo)
$readBytes('_koo+2'):
_koo:


it doesn't work the script can't be activated.
u mean Ce 6.6 or where is version 6.7 ?
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