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 


help with auto assemble
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
low_density
Expert Cheater
Reputation: 1

Joined: 08 Aug 2009
Posts: 156

PostPosted: Fri Dec 17, 2010 2:07 am    Post subject: help with auto assemble Reply with quote

hi, want to ask around, how do you compare between float values? like, for example, i want to compare [eax+10] with [edi+04], both are of float values? also, how do you make a script to do something like: add 1 to [ebx+08] when the script is enabled, and subtract 1 from [ebx+08] when the script is disabled? because i want to modify a value whenever i enable the cheat, but i do not want to set the value, just add or sub only... all help appreciated Very Happy
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Fri Dec 17, 2010 3:16 am    Post subject: Reply with quote

To compare a float value:

fld dword ptr [eax+10] //push value in the stack
fcomp dword ptr [edi+04] //compare the value in top of the stack with [edi+04] and pop the stack

If it is a Double value, use qword instead of dword.

As for adding or removing the value only when the script is enabled or disabled, put the inc/dec [ebx+08] code in the general part below the [ENABLE] and [DISABLE] (where You see the alloc instruction, not in the newmem section). That part of the script is executed only when You enable or disable the script.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
low_density
Expert Cheater
Reputation: 1

Joined: 08 Aug 2009
Posts: 156

PostPosted: Fri Dec 17, 2010 4:12 am    Post subject: Reply with quote

what do you mean for the general part? ok, let me give an example, in the game Saints Row 2, there is one address, sr2_pc.exe+239b810, that contains the required address i need for setting infinite sprint. This is the line that makes my game character's sprint infinite: or [sr2_pc.exe+239b810],00000080. so, can i write a script to execute this once (when i enable the script) and execute this line: and [sr2_pc.exe+239b810],ffffff7f to remove the infinite sprint (when i disable the code)? an example script will be helpful.
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Fri Dec 17, 2010 4:34 am    Post subject: Reply with quote

Example:

This code is for Step 2 in the tutorial. It will set Your health to 20 when the script is enabled and set it to 10 when it is disabled. Of course You can use add/sub or inc/dec instead of mov.

Code:
globalalloc(something,32)
createthread(something)
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
something:
mov [0096276C],14  //set the value on 0096276C to 10
ret
 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
something:
mov [0096276C],0A  //set the value on 0096276C to 20
ret



Somewhere in the past, I have seen a topic about this.

EDIT: Yep, here it is, a script made by Dark Byte. The only difference in this script that it is doing the same thing regardless if You turn the script on or off.
http://forum.cheatengine.org/viewtopic.php?p=4977258

EDIT 2:
But this isn't useful at all if You want to change a code. This script is good for modifying a value only. If You want to change the code itself, use the code injection template.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.


Last edited by Geri on Fri Dec 17, 2010 5:21 am; edited 1 time in total
Back to top
View user's profile Send private message
low_density
Expert Cheater
Reputation: 1

Joined: 08 Aug 2009
Posts: 156

PostPosted: Fri Dec 17, 2010 4:50 am    Post subject: Reply with quote

hi, thanks for your link, the script by dark byte is good, i only want to increase the value once when i enable the script, and decrease the value once when i disable the script, the script given by dark byte works perfectly Very Happy thanks again
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Fri Dec 17, 2010 5:23 am    Post subject: Reply with quote

Yes, but keep in mind that the script which is made by Dark Byte is increasing the value by 1 when it is enabled and also increasing the value by 1 when it is disabled. Thus it doesn't have the same effect that You are looking for. Your code should decrease the number when it is disabled, not increase it in all cases (at least You said You need to achieve that effect).
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
low_density
Expert Cheater
Reputation: 1

Joined: 08 Aug 2009
Posts: 156

PostPosted: Mon Dec 20, 2010 2:58 am    Post subject: Reply with quote

hi, i'm back again, just wanna ask one more question.... using dark byte's script, how can i increase the value of an address that is stored in ecx register at a certain address (for example, i wan to increase the time in a game, the address of the time changes with every time i restart the game, the address that is changing the time address is deadrising2.exe+19262, the time address is stored in the register ecx+1c)... i wan to increase the time ONCE when i enable and ONCE when i disable the script... is it possible to get the address from the register?
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Mon Dec 20, 2010 5:06 am    Post subject: Reply with quote

It is possible, but You need to write 2 different scripts for it.

1. You need to inject a code at the place where the game is accessing to the timer that You want to change and save the timer's address. You can allocate 4 bytes to store the address or You can use an unused area in the program to store Your thing.

2. Create the script which is increasing the address that You have saved.

OR

The other method for example, to make a counter (this is probably less problematic). Like I made for the Civ 5 when I made Add x stuff cheats.

Then You need to write Your script like that.
1. Check if counter is 0 or not.
2. If not 0, do things.
3. At some point, make sure to set the counter to 0 again so the value will not be changed unless the counter is changed by the user manually.
The counter can be any allocated or unused memory address again. Up to You.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
low_density
Expert Cheater
Reputation: 1

Joined: 08 Aug 2009
Posts: 156

PostPosted: Mon Dec 20, 2010 7:03 am    Post subject: Reply with quote

ok, i don't quite understand the second option, i will go for the easier one, can you gimme an example script on how to make the first option?
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Mon Dec 20, 2010 7:46 am    Post subject: Reply with quote

Alright, btw. the first option is the harder one, but Your choice.

This example script is for the tutorial.
cmp [Ebx+00000314],000003E8 is the code which is accessing to the value that we want to modify.

Store the address of our value:

Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)
alloc(anyname,4)   //allocate 4 bytes for storing the address
registersymbol(anyname)  //registering it as a symbol to be able to use in other script

newmem: //this is allocated memory, you have read,write,execute access
push eax    //save eax in stack
lea eax,[Ebx+00000314]  //store the needed address on eax
mov [anyname],eax   //move eax to our storage
pop eax    //load eax from stack

originalcode:
cmp [Ebx+00000314],000003E8  //code which is accessing to our address

exit:
jmp returnhere

0045C627:
jmp newmem
nop
nop
nop
nop
nop
returnhere:


 
 
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
0045C627:
cmp [Ebx+00000314],000003E8
//Alt: db 81 BB 14 03 00 00 E8 03 00 00
unregistersymbol(anyname)   //unregister the smybol when we turn off the script
dealloc(anyname)  //de-allocate storage when we disable the script



Add 100 to the value every time when the script is triggered:

Code:
//Dark Byte's script, slightly modified

globalalloc(increaser,128) //allocate once, don't reallocate if executed again
createthread(increaser)

increaser:
push eax    //save eax
mov eax,[anyname]  //move the address from out storage to eax
add [eax],64   //add 100 to the value that we want
pop eax    //load eax
ret       //return

[enable]
[disable]

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
low_density
Expert Cheater
Reputation: 1

Joined: 08 Aug 2009
Posts: 156

PostPosted: Mon Dec 20, 2010 9:49 pm    Post subject: Reply with quote

ok thanks for the script Very Happy i would like to ask one more thing, how do you make a script that checks if a hotkey is pressed before it can be enabled? for example, normally, for the trainers that can be found anywhere, there will be some sort of like press F1 to activate trainer, before all the other hotkeys can work... does this depend on a script or?
EDIT: and also, is there any way to multiply a value by a certain number? like for example, i want to multiply the value stored in ebx by 3, how do i do that? i tried using "shl ebx,3", but it did ebx*2*2*2 instead of ebx*3...
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Tue Dec 21, 2010 4:34 am    Post subject: Reply with quote

lalala1990 wrote:
ok thanks for the script Very Happy i would like to ask one more thing, how do you make a script that checks if a hotkey is pressed before it can be enabled? for example, normally, for the trainers that can be found anywhere, there will be some sort of like press F1 to activate trainer, before all the other hotkeys can work... does this depend on a script or?
EDIT: and also, is there any way to multiply a value by a certain number? like for example, i want to multiply the value stored in ebx by 3, how do i do that? i tried using "shl ebx,3", but it did ebx*2*2*2 instead of ebx*3...


For the first question, it is the counter thing that I have said. You can easily write a script that is checking if a value is 0 or 1 and turn on/off the cheats according to that. For examples, check out Recifence's scripts. He is usually writing a huge script that covers everything, then You can turn on/off the cheats with changing a value to 1 or 0.
This is good if You are making a static code. But if You use aobscan, even if one code has changed, the whole script will stop working. Choose the option which is most suitable for Your situation.

As for multiplying.

mul eax
imul eax

This will multiply eax with itself.

imul eax,eax,5 //destination,source,source

This will multiply eax with 5 and store the result on eax.

This is for integers.

For float, You need to use fmul.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
low_density
Expert Cheater
Reputation: 1

Joined: 08 Aug 2009
Posts: 156

PostPosted: Wed Dec 29, 2010 10:05 am    Post subject: Reply with quote

thanks geri, you have been a great help! sigh, i need help again... how do you make a script that can keep changing the value of a certain address without hooking onto the game's api? i read a post by darkbyte, but i don't really understand the script... can you gimme and example of an easier script to do a createthread and lock an address at a value as long as the script is enabled?
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Wed Dec 29, 2010 1:42 pm    Post subject: Reply with quote

Probably the easiest way is to make a code injection at a very frequently used code (some screen routine for example) and change Your value there. Most screen routines are used even 100 times per second to update the display so that would pretty much "freeze" the value.
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
low_density
Expert Cheater
Reputation: 1

Joined: 08 Aug 2009
Posts: 156

PostPosted: Fri Dec 31, 2010 6:53 am    Post subject: Reply with quote

ok you hacked civilization 5 before right? funny thing is, the money address is always stored in Fxxxxxxx addresses for my game, and by using normal search, i can't seem to find it... i need to set the search range from 0 to FFFFFFFF to be able to find the address for the money... and when i tried to use the "find out what addresses this instruction accesses" on the opcode that changes the amount of money, it immediately crashed the game... is it because the address is on Fxxxxxxx address and not below 7FFFFFFF? how do you prevent the crash?

EDIT: and for the direct x 9 version, it seems that when using search for unknown initial value, the search range cannot be more than 40000000, or else cheat engine will show "Scan error:controller:Failure allocating memory for copy"..


Last edited by low_density on Fri Dec 31, 2010 7:01 am; edited 1 time in total
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
Goto page 1, 2, 3  Next
Page 1 of 3

 
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