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 make a copy of a value?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
ubiByte
Advanced Cheater
Reputation: 1

Joined: 08 Mar 2013
Posts: 57

PostPosted: Fri May 08, 2015 12:41 am    Post subject: How to make a copy of a value? Reply with quote

Hi

I have a question about copying a value from an address here's my example:

Code:
mov [eax+0C],edi
mov edx,[esi]
jmp return


In this example here, mov [eax+0C],edi --- this will decrease ammo count when reloading. So that means edi is holding the amount that needs to be grabbed from your total ammo and added back into your weapon assuming you have the remaining amount.

My question is this, how can I know what edi will be so that I can add it back into the total? This way the game will allow you to reload but your ammo won't actually decrease.

I know I can just do something like this:
Code:
add edi, #50
mov [eax+0C],edi
mov edx,[esi]
jmp return


And just add 50 every time I reload but I think that's really ugly. I want to know if it's possible to know exactly how much to add back into edi after this line mov [eax+0C],edi, so add back in after the reload is complete?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri May 08, 2015 12:57 am    Post subject: Reply with quote

Two things based on what you gave so far would work:

1. Determine what calculated EDI. Typically before the line you are at, there may be a calculation that was done with EDI being the result register. Something like..

mov edi, [eax+0C]
dec edi
mov [eax+0C], edi

Not to say this is the exact flow of what is happening in your situation but find that calculation to determine what is happening.

2. Use the original value, if possible. Since the target is overwriting the value inside of [eax+0C] try just resetting EDI to that value. Such as:

mov edi, [eax+0C] // do this yourself
mov [eax+0C], edi // original code afterward..

Lastly would be just nop'ing out the instruction altogether if that is possible in your situation. Hard to say though since you did not show much asm.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
ubiByte
Advanced Cheater
Reputation: 1

Joined: 08 Mar 2013
Posts: 57

PostPosted: Fri May 08, 2015 1:16 am    Post subject: Reply with quote

Okay the 2nd suggestion you gave was perfect that works. Just so I make sure I understand this, you are taking the value from [eax+0C] and copying the value into edi. So edi gets added back into [eax+0C] when you reload. Makes perfect sense to me. Thanks a lot for clearing this up!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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