|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
satanrules666 Advanced Cheater Reputation: 0
Joined: 31 Oct 2010 Posts: 70 Location: New Zealand
|
Posted: Wed Aug 31, 2016 7:08 am Post subject: How to save a value in a register plus offset to restore.... |
|
|
So I have found the register plus offset in farcry 3 that have my ammo stored in it and I can make a script to edit this to 999 however when I disable this I still have 999 ammo.
If anyone knows how to save the value in [ecx+10] before its modified that would be awesome and would also help me for other scripts.
Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
mov eax,3e7
mov [ecx+10],eax
test eax,eax
originalcode:
//mov eax,[ecx+10]
//test eax,eax
exit:
jmp returnhere
"FC3_d3d11.dll"+41F7A6:
jmp newmem
returnhere:
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"FC3_d3d11.dll"+41F7A6:
mov eax,[ecx+10]
test eax,eax
//Alt: db 8B 41 10 85 C0
|
_________________
|
|
Back to top |
|
|
sbryzl Master Cheater Reputation: 6
Joined: 25 Jul 2016 Posts: 252
|
Posted: Wed Aug 31, 2016 9:12 am Post subject: |
|
|
Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(ammo)
registersymbol(ammo)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
//mov eax,3e7
add ecx,10
mov [ammo],ecx
sub ecx,10
mov eax,[ammo]
test eax,eax
jmp returnhere
originalcode:
//mov eax,[ecx+10]
//test eax,eax
ammo:
"FC3_d3d11.dll"+41F7A6:
jmp newmem
returnhere:
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"FC3_d3d11.dll"+41F7A6:
mov eax,[ecx+10]
test eax,eax
//Alt: db 8B 41 10 85 C0
|
Then add an address manually to cheat engine with ammo as the address. |
|
Back to top |
|
|
satanrules666 Advanced Cheater Reputation: 0
Joined: 31 Oct 2010 Posts: 70 Location: New Zealand
|
Posted: Wed Aug 31, 2016 12:03 pm Post subject: |
|
|
This wouldn't achieve what I want to. That would be you adding a pointer plus the offset of this address and manually adding a value back.
What I want to do in Auto Assembler is to save the value of a register and restore it when my code is disabled. _________________
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Wed Aug 31, 2016 5:00 pm Post subject: |
|
|
Code: | [ENABLE]
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
label(value_bkp)
label(address_bkp)
registersymbol(value_bkp)
registersymbol(address_bkp)
newmem:
cmp [address_bkp],0
jne @f
mov eax,[ecx+10]
mov [value_bkp],eax
mov [address_bkp],ecx
@@:
mov eax,3e7
mov [ecx+10],eax
test eax,eax
originalcode:
//mov eax,[ecx+10]
//test eax,eax
value_bkp:
dd 0
address_bkp:
dd 0
exit:
jmp returnhere
"FC3_d3d11.dll"+41F7A6:
jmp newmem
returnhere:
[DISABLE]
[address_bkp]+10:
readmem(value_bkp,4)
unregistersymbol(value_bkp)
unregistersymbol(address_bkp)
dealloc(newmem)
"FC3_d3d11.dll"+41F7A6:
mov eax,[ecx+10]
test eax,eax
//Alt: db 8B 41 10 85 C0 |
|
|
Back to top |
|
|
satanrules666 Advanced Cheater Reputation: 0
Joined: 31 Oct 2010 Posts: 70 Location: New Zealand
|
Posted: Wed Aug 31, 2016 9:25 pm Post subject: |
|
|
Thanks Zanzer
Sadly if I try add this to auto assembler then add to my table i get
Error
Error in line 42 ([00000000]+10:) :This address specifier is not valid
@sbryzl
Thank you your code worked perfectly.
I get a massive ammount instead of 999 I guess it doesn't really matter though. _________________
|
|
Back to top |
|
|
sbryzl Master Cheater Reputation: 6
Joined: 25 Jul 2016 Posts: 252
|
Posted: Wed Aug 31, 2016 11:15 pm Post subject: |
|
|
Sorry I messed up. I was moving the address as though it was the value. The altered section should be like this to record the address at ammo then use the same address to grab the value.
Code: |
//mov eax,3e7
add ecx,10
mov [ammo],ecx
mov eax,[ecx]
sub ecx,10
test eax,eax
jmp returnhere
|
If you want to save the value and restore you need to use readmem like zanzer said. |
|
Back to top |
|
|
satanrules666 Advanced Cheater Reputation: 0
Joined: 31 Oct 2010 Posts: 70 Location: New Zealand
|
Posted: Thu Sep 01, 2016 5:08 am Post subject: |
|
|
Thanks sbryzl
With a tiny wee bit of a mod of your newer fixed script it worked perfectly and now does exactly what I want it to do.
Though I'm mostly a bit of a noob with assembler the only programing language I've learnt a tiny wee bit of is
Pascal - ancient as hell and not really used anymore
first program was a calculator for fahrenheit to celsius and back.
Java - Made a java calculator once but sadly cannot find it anymore.
That and a few wee mindcraft mods though only simple ones to add my own weapons. back in the day when I did play that game and only played it modded which was always fun.
Oh yeah and I once made a tiny trainer off a tutorial for assembly off the internet it was for the Beta of Crysis 2 it sort of worked. The code to check if the procress was attached didn't work properly. instead of changing ammo it just added to it but it was still functional.
If cheat engine tutorial maker had an option to show if the trainer is attached and the process matches like you find in trainers from lowbit and Caliber cheat happens and fling (those guys rule) then that would rule.
Anyways here is the script.
Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
//label(doit)
label(ammo)
registersymbol(ammo)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
add ecx,10
mov [ammo],ecx
mov eax,[ecx]
sub ecx,10
mov eax,3e7
test eax,eax
//jmp doit
jmp returnhere
//doit:
//mov [ecx+10],3e7
//test eax,eax
ammo:
"FC3_d3d11.dll"+41F7A6:
jmp newmem
returnhere:
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"FC3_d3d11.dll"+41F7A6:
mov eax,[ecx+10]
test eax,eax
//Alt: db 8B 41 10 85 C0
|
Thanks for the help from you and Zanzer. _________________
|
|
Back to top |
|
|
satanrules666 Advanced Cheater Reputation: 0
Joined: 31 Oct 2010 Posts: 70 Location: New Zealand
|
Posted: Sun Sep 04, 2016 10:43 am Post subject: |
|
|
So I understand how this will work for every register with a offset [ecx+10] but what say if you just have [ecx] what would the script be then. _________________
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sun Sep 04, 2016 10:52 am Post subject: |
|
|
[ecx] is the same as [ecx+0] |
|
Back to top |
|
|
satanrules666 Advanced Cheater Reputation: 0
Joined: 31 Oct 2010 Posts: 70 Location: New Zealand
|
Posted: Sun Sep 04, 2016 12:41 pm Post subject: |
|
|
So I've managed to get it all to work for me again.
oddly though when I go through one clip and the ammo changed it changes to the stored value and freezes giving you temp no reload until you deactive the script and then it will still give you no reload until you switch weapons. |
|
Back to top |
|
|
sbryzl Master Cheater Reputation: 6
Joined: 25 Jul 2016 Posts: 252
|
Posted: Sun Sep 04, 2016 4:49 pm Post subject: |
|
|
You could just record the initial value to ammo then keep putting it back in.
Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
//label(doit)
label(skip)
label(ammo)
registersymbol(ammo)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
cmp [ammo],0
jne skip
mov eax,[ecx+10]
mov [ammo],eax
skip:
mov eax,[ammo]
mov [ecx+10],eax
mov eax,3e7
test eax,eax
//jmp doit
jmp returnhere
//doit:
//mov [ecx+10],3e7
//test eax,eax
ammo:
"FC3_d3d11.dll"+41F7A6:
jmp newmem
returnhere:
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"FC3_d3d11.dll"+41F7A6:
mov eax,[ecx+10]
test eax,eax
//Alt: db 8B 41 10 85 C0 |
I think zanzer's code should work too even though there was an error message.
If there is still a problem with the clip then there must be another mechanic for it. |
|
Back to top |
|
|
satanrules666 Advanced Cheater Reputation: 0
Joined: 31 Oct 2010 Posts: 70 Location: New Zealand
|
Posted: Mon Sep 05, 2016 12:06 pm Post subject: |
|
|
Oh nah his worked for Farcry 3 but I tried the same in Farcry 4 it will work but when I disable the cheat you are stuck with 0 even though the ammos just frozen till you change weapons.
I'm trying to save the ammount of ammo which works and both yours and Zanzers works for that but I'm also wanting to change the ammount of ammo to 999
So if I can save the ammo you have first then change the ammo to 999 then restore the original value later. _________________
|
|
Back to top |
|
|
|
|
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
|
|