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 


need help with code inject

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials
View previous topic :: View next topic  
Author Message
Vip_eR
Newbie cheater
Reputation: 0

Joined: 11 Aug 2016
Posts: 19

PostPosted: Thu Aug 11, 2016 6:20 am    Post subject: need help with code inject Reply with quote

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
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 606

PostPosted: Thu Aug 11, 2016 6:22 am    Post subject: Reply with quote

Could you post your script, that always makes it easier to understand certain things.
_________________
I hacked 127.0.0.1 Very Happy
Back to top
View user's profile Send private message
Vip_eR
Newbie cheater
Reputation: 0

Joined: 11 Aug 2016
Posts: 19

PostPosted: Thu Aug 11, 2016 6:43 am    Post subject: Reply with quote

here it is .....
i typed the things that i think i should say them ...



123.jpg
 Description:
 Filesize:  307.83 KB
 Viewed:  14318 Time(s)

123.jpg


Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 120

Joined: 09 Jun 2013
Posts: 3260

PostPosted: Thu Aug 11, 2016 7:02 am    Post subject: Reply with quote

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
View user's profile Send private message
Vip_eR
Newbie cheater
Reputation: 0

Joined: 11 Aug 2016
Posts: 19

PostPosted: Thu Aug 11, 2016 12:06 pm    Post subject: Reply with quote

it would be very great if you help me with this ....
i very bad at making logic for machines
Back to top
View user's profile Send private message
Vip_eR
Newbie cheater
Reputation: 0

Joined: 11 Aug 2016
Posts: 19

PostPosted: Fri Aug 12, 2016 6:07 am    Post subject: Reply with quote

sorry for spamming ....
but anybody??
i admit it ...... i AM A N00B
Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1813
Location: Arcadian Suburbia

PostPosted: Fri Aug 12, 2016 8:27 am    Post subject: Reply with quote

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
View user's profile Send private message
Vip_eR
Newbie cheater
Reputation: 0

Joined: 11 Aug 2016
Posts: 19

PostPosted: Fri Aug 12, 2016 11:55 am    Post subject: Reply with quote

i get the first code part , except that "dd 0"
could you please explain it ??
Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1813
Location: Arcadian Suburbia

PostPosted: Fri Aug 12, 2016 12:10 pm    Post subject: Reply with quote

"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
View user's profile Send private message
Vip_eR
Newbie cheater
Reputation: 0

Joined: 11 Aug 2016
Posts: 19

PostPosted: Fri Aug 12, 2016 12:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1813
Location: Arcadian Suburbia

PostPosted: Fri Aug 12, 2016 12:22 pm    Post subject: Reply with quote

  • 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
View user's profile Send private message
Vip_eR
Newbie cheater
Reputation: 0

Joined: 11 Aug 2016
Posts: 19

PostPosted: Fri Aug 12, 2016 1:06 pm    Post subject: Reply with quote

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 ...



123.jpg
 Description:
 Filesize:  328.73 KB
 Viewed:  14156 Time(s)

123.jpg


Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1813
Location: Arcadian Suburbia

PostPosted: Fri Aug 12, 2016 1:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Vip_eR
Newbie cheater
Reputation: 0

Joined: 11 Aug 2016
Posts: 19

PostPosted: Sat Aug 13, 2016 6:16 am    Post subject: Reply with quote

i did what you said & look likes another problem occured


123.jpg
 Description:
 Filesize:  341.84 KB
 Viewed:  14045 Time(s)

123.jpg


Back to top
View user's profile Send private message
ParkourPenguin
Grandmaster Cheater Supreme
Reputation: 54

Joined: 06 Jul 2014
Posts: 1813
Location: Arcadian Suburbia

PostPosted: Sat Aug 13, 2016 9:36 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials 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