View previous topic :: View next topic |
Author |
Message |
Darcon2k Cheater Reputation: 0
Joined: 13 Feb 2015 Posts: 48
|
Posted: Thu Mar 19, 2015 4:47 pm Post subject: Need help with Injection Script to restore original value |
|
|
Last edited by Darcon2k on Thu Mar 26, 2015 9:51 am; edited 1 time in total |
|
Back to top |
|
|
hhhuut Grandmaster Cheater Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Thu Mar 19, 2015 5:05 pm Post subject: |
|
|
Why don't you use the available script template of cheat engine? It's far more easier and far less frail to errors than writing a script on hand ...
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Thu Mar 19, 2015 5:05 pm Post subject: |
|
|
Highlight the code in Memory Viewer
Select Tools > Auto Assemble
Select Template > AOB Injection
Accept the defaults
Add the following under the code: label in the script
or
Not sure which address you want to zero out
|
|
Back to top |
|
|
Darcon2k Cheater Reputation: 0
Joined: 13 Feb 2015 Posts: 48
|
Posted: Thu Mar 19, 2015 6:01 pm Post subject: |
|
|
Last edited by Darcon2k on Thu Mar 26, 2015 9:50 am; edited 2 times in total |
|
Back to top |
|
|
hhhuut Grandmaster Cheater Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Thu Mar 19, 2015 6:04 pm Post subject: |
|
|
Well, that's because a code injection is not really supposed to work that way ...
|
|
Back to top |
|
|
Darcon2k Cheater Reputation: 0
Joined: 13 Feb 2015 Posts: 48
|
Posted: Thu Mar 19, 2015 6:14 pm Post subject: |
|
|
Last edited by Darcon2k on Thu Mar 26, 2015 9:52 am; edited 1 time in total |
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Thu Mar 19, 2015 6:51 pm Post subject: |
|
|
As long as nothing else is accessing that address, you can do:
Code: | code:
//mov [esi+20],0
//mov ecx,[esi+20]
mov ecx,0
test ecx,ecx
jmp return |
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Thu Mar 19, 2015 7:14 pm Post subject: |
|
|
Either set it up to write a predetermined value (e.g. 90000) upon disable/deactivate, or, set it up to save the value of [esi+20] upon enable/activate, and just write that value upon disable/deactivate...whichever you prefer.
|
|
Back to top |
|
|
Darcon2k Cheater Reputation: 0
Joined: 13 Feb 2015 Posts: 48
|
Posted: Thu Mar 19, 2015 9:36 pm Post subject: |
|
|
Last edited by Darcon2k on Thu Mar 26, 2015 9:52 am; edited 1 time in total |
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Thu Mar 19, 2015 10:34 pm Post subject: |
|
|
Have you checked to see if the instruction is accessing other addresses?
Anyway, you can just save the value and load it using a custom symbol as described.
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Thu Mar 19, 2015 10:54 pm Post subject: |
|
|
Code: | [ENABLE]
aobscan(myaob,8B 4E 20 85 C9 0F 84)
alloc(newmem,$1000)
label(code)
label(return)
alloc(save_ptr,4)
alloc(save_val,4)
newmem:
cmp dword ptr [save_ptr],0
jne code
mov ecx,[esi+20]
mov [save_val],ecx
mov [save_ptr],esi
add [save_ptr],20
mov [esi+20],0
code:
mov ecx,[esi+20]
test ecx,ecx
jmp return
myaob:
jmp newmem
return:
registersymbol(myaob)
registersymbol(save_ptr)
registersymbol(save_val)
[DISABLE]
save_ptr:
readmem(save_val,4)
myaob:
db 8B 4E 20 85 C9
unregistersymbol(myaob)
unregistersymbol(save_ptr)
unregistersymbol(save_val)
dealloc(newmem)
dealloc(save_ptr)
dealloc(save_val) |
|
|
Back to top |
|
|
Darcon2k Cheater Reputation: 0
Joined: 13 Feb 2015 Posts: 48
|
Posted: Fri Mar 20, 2015 1:19 am Post subject: |
|
|
Last edited by Darcon2k on Thu Mar 26, 2015 9:51 am; edited 1 time in total |
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Fri Mar 20, 2015 12:30 pm Post subject: |
|
|
Oh, duh. That disable sets the value back inside my own variable's address. Not the address at which it was pointing.
Uhm, I think I typed this LUA correctly...
Code: | [DISABLE]
{$lua}
writeInteger(readInteger("save_ptr"), readInteger("save_val"))
{$asm}
myaob:
db 8B 4E 20 85 C9
unregistersymbol(myaob)
unregistersymbol(save_ptr)
unregistersymbol(save_val)
dealloc(newmem)
dealloc(save_ptr)
dealloc(save_val) |
|
|
Back to top |
|
|
Darcon2k Cheater Reputation: 0
Joined: 13 Feb 2015 Posts: 48
|
Posted: Fri Mar 20, 2015 8:20 pm Post subject: |
|
|
Zanzer
Thank you so much! Everything working perfectly.
|
|
Back to top |
|
|
|