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 


Calculations in the Value Search Bar?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Simps
How do I cheat?
Reputation: 0

Joined: 25 Apr 2011
Posts: 2

PostPosted: Mon Apr 25, 2011 8:28 am    Post subject: Calculations in the Value Search Bar? Reply with quote

Is there anyway that I can make Cheat engine look for a value that is the result of a calculation I enter in the value bar?

Example: I want to find a value of (Total HP x 2), so I go into the game, look at my HP, and put in the value bar something like (56*2), and it will return results of addresses where the value is 112.

inb4 "Use the calculator", I do, but I was just thinking it would be really useful and less time consuming if Cheat Engine had this feature.

Thanks in advance
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25827
Location: The netherlands

PostPosted: Mon Apr 25, 2011 8:36 am    Post subject: Reply with quote

I guess I could use lua or the symbolhandler to parse mathematical stuff when the value type is an integer type

For now, just define a custom value type that multiplies the value by 2 (shifts the value by 1)

check out:
http://forum.cheatengine.org/viewtopic.php?t=529904

this multiplies by 8 (shifts by 3) but I'm sure you can figure out how to adapt it to multiple by 2 (shift only 1 instead of 3)

edit: Just in case you can't figure it out:
Code:

alloc(TypeName,256)
alloc(ByteSize,4)
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)

TypeName:
db 'Multiplied by 2',0

ByteSize:
dd 4

//The convert routine should hold a routine that converts the data to an nteger (in eax)
//function declared as: stdcall int ConvertRoutine(unsigned char *input);

//Note: Keep in mind that this routine can be called by multiple threads at the same time.

ConvertRoutine:
[32-bit]
push ebp
mov ebp,esp
push ecx
mov ecx,[ebp+8]
[/32-bit]

//at this point ecx contains the address where the bytes are stored

//put the bytes into the eax register
mov eax,[ecx] //second fun fact, addressing with 32-bit registers doesn't work in 64-bit, it becomes a 64-bit automatically (most of the time)
shr eax,1 //shift right by 1 bits (divide by 2)

//and now exit the routine
[64-bit]
ret
[/64-bit]
[32-bit]
pop ecx
pop ebp
ret 4
[/32-bit]

//The convert back routine should hold a routine that converts the given integer back to a row of bytes (e.g when the user wats to write a new value)
//function declared as: stdcall void ConvertBackRoutine(int i, unsigned char *output);
ConvertBackRoutine:
[32-bit]
push ebp
mov ebp,esp
push edx //save the registers
push ecx
mov edx,[ebp+0c]
mov ecx,[ebp+08]
[/32-bit]

//at this point edx contains the address to write the value to
//and ecx contains the value

push eax
push edx


mov edx,[edx] //edx now contains the original value
and edx,1 //only save the first bit

mov eax,ecx //eax gets the user input value
shl eax,1 //shift left by 1 bit (multiply by 2)
or eax,edx //add the bit of the original value

pop edx
mov [edx],eax //write the new value into the old value
pop eax

[64-bit]
//everything is back to what it was, so exit
ret
[/64-bit]

[32-bit]
//cleanup first
pop ecx
pop edx
pop ebp
ret 8
[/32-bit]

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Simps
How do I cheat?
Reputation: 0

Joined: 25 Apr 2011
Posts: 2

PostPosted: Mon Apr 25, 2011 8:52 am    Post subject: Reply with quote

Wow, thank you very much for the quick reply!

That is great help, thanks, and *2 was just the example I was giving, what I was actually looking for, as you posted, was *8 so that's even better.

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