View previous topic :: View next topic |
Author |
Message |
Vip_eR Newbie cheater Reputation: 0
Joined: 11 Aug 2016 Posts: 19
|
Posted: Thu Aug 11, 2016 6:20 am Post subject: need help with code inject |
|
|
hey guys ....
i am new in CE (but NOT TOO NOOB at it). i have a problem with injecting a code
i inject my code wtih "add" command , but i want the address increases when the main address changes . when i use this command the address that i want to be increased , increases constantly ( its keep being biger and biger until i disable it) . what should i do ??
i know i explained it bad.... because english is NOT my first language
let me explain the case that im gonna use this injection ...
the case is :
i want when the fisrt address changes , another address be added by some value
i remember its worked one time , but next time that i do it in the same way , my problem occured
thanks for your time & answers ...
sorry for mistyping , ENGLISH is not my first language ( i know i said IT TWICE !)
|
|
Back to top |
|
|
hhhuut Grandmaster Cheater Reputation: 6
Joined: 08 Feb 2015 Posts: 607
|
Posted: Thu Aug 11, 2016 6:22 am Post subject: |
|
|
Could you post your script, that always makes it easier to understand certain things.
|
|
Back to top |
|
|
Vip_eR Newbie cheater Reputation: 0
Joined: 11 Aug 2016 Posts: 19
|
Posted: Thu Aug 11, 2016 6:43 am Post subject: |
|
|
here it is .....
i typed the things that i think i should say them ...
Description: |
|
Filesize: |
307.83 KB |
Viewed: |
28049 Time(s) |
|
|
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Thu Aug 11, 2016 7:02 am Post subject: |
|
|
Sounds like your problem is simply that the game executes that code much more than you think.
If you only want to add to your static address when ECX is a certain other address, then you need to add that logic.
I assume you don't want to simply add 5 to EAX?
|
|
Back to top |
|
|
Vip_eR Newbie cheater Reputation: 0
Joined: 11 Aug 2016 Posts: 19
|
Posted: Thu Aug 11, 2016 12:06 pm Post subject: |
|
|
it would be very great if you help me with this ....
i very bad at making logic for machines
|
|
Back to top |
|
|
Vip_eR Newbie cheater Reputation: 0
Joined: 11 Aug 2016 Posts: 19
|
Posted: Fri Aug 12, 2016 6:07 am Post subject: |
|
|
sorry for spamming ....
but anybody??
i admit it ...... i AM A N00B
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4302
|
Posted: Fri Aug 12, 2016 8:27 am Post subject: |
|
|
So, you only want to add a value to [2BE85CA4] when the instruction mov [ecx],eax writes a different value to [ecx]?
The first step is to allocate a place to store the previous value of [ecx].
Code: | alloc(lastValue,4)
lastValue:
dd 0 |
Check if the new value matches the last value. If it is equal, jump past your add.
Code: | cmp eax,[lastValue]
je originalcode
add [2BE85CA4],5 |
Don't forget to update the previous value with the new value.
Code: | mov [lastValue],eax |
You should be able to figure out where these snippets go.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Vip_eR Newbie cheater Reputation: 0
Joined: 11 Aug 2016 Posts: 19
|
Posted: Fri Aug 12, 2016 11:55 am Post subject: |
|
|
i get the first code part , except that "dd 0"
could you please explain it ??
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4302
|
Posted: Fri Aug 12, 2016 12:10 pm Post subject: |
|
|
"dd" = "declare dword"
"dd 0" writes the 4-byte value 0 to the location of wherever it's at (i.e. lastValue).
That was really just a force of habit on my part to reserve and initialize a memory location. It's not needed in this case since the label lastValue was declared using alloc (no need to reserve anything) and it should already be initialized to 0.
A short example of when it would be needed:
Code: | alloc(whatever,8)
label(num1)
label(num2)
whatever:
num1:
dd 0
num2:
dd 0 |
In this example, if the first "dd 0" wasn't there, num2 would be assigned the same address as num1.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Vip_eR Newbie cheater Reputation: 0
Joined: 11 Aug 2016 Posts: 19
|
Posted: Fri Aug 12, 2016 12:16 pm Post subject: |
|
|
sorry for asking a LOT !!....
but ... i meant the whole 3 part codes
i didnt get it ..
Last edited by Vip_eR on Fri Aug 12, 2016 12:23 pm; edited 1 time in total |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4302
|
Posted: Fri Aug 12, 2016 12:22 pm Post subject: |
|
|
- alloc - allocates memory.
- lastValue: - the identifier of the allocated memory.
- dd 0 - see previous post.
- cmp eax,[lastValue] - compares eax (the potential new value) with the value stored at lastValue.
- je originalcode - jump to originalcode if eax is equal to the value at lastValue.
- add [2BE85CA4],5 - your code.
- mov [lastValue],eax - moves eax (the new value) into the address lastValue for the next time the game runs this code.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Vip_eR Newbie cheater Reputation: 0
Joined: 11 Aug 2016 Posts: 19
|
Posted: Fri Aug 12, 2016 1:06 pm Post subject: |
|
|
i tried , but nothing happened ...
i am sure the addresses are all correct (at least until when i respawn ... so the code should work until the next respawn... )
here is the script .... i hope i understood your hints ...
Description: |
|
Filesize: |
328.73 KB |
Viewed: |
27887 Time(s) |
|
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4302
|
Posted: Fri Aug 12, 2016 1:26 pm Post subject: |
|
|
Storing the previous value this instruction wrote to that address restricts your code to run only if this instruction changes the value it's writing to that address. If some other instruction is writing to that address and this instruction is still writing the same value, then your code won't run.
If you want your code to run whenever eax is not equal to [ecx], then forget the previous value and just use that comparison.
Code: | newmem:
cmp eax,[ecx]
je originalcode
add [2BE85CA4],5
originalcode:
... |
If it still doesn't work... I dunno, maybe you have the wrong instruction? Look at what value those instructions are writing to that address. Also make sure those instructions are only writing to that address and not other addresses (right click in disassembler -> find out what addresses this instruction accesses).
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Vip_eR Newbie cheater Reputation: 0
Joined: 11 Aug 2016 Posts: 19
|
Posted: Sat Aug 13, 2016 6:16 am Post subject: |
|
|
i did what you said & look likes another problem occured
Description: |
|
Filesize: |
341.84 KB |
Viewed: |
27776 Time(s) |
|
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4302
|
Posted: Sat Aug 13, 2016 9:36 am Post subject: |
|
|
You'll either need to find an instruction you can still use that doesn't change any other addresses, or figure out something you can use (i.e. a filter) that will distinguish when that instruction is accessing the address you care about.
http://forum.cheatengine.org/viewtopic.php?t=583376
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
|