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 


Floats Filtering ?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Sun Sep 01, 2019 4:28 pm    Post subject: Floats Filtering ? Reply with quote

Is there a way I can search for a a range of floats (ex 1000.0 - 5000.0) and then filter the results that are WHOLE numbers only?

a setting or a script perhaps?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Mon Sep 02, 2019 12:43 am    Post subject: Reply with quote

Do a Float value type and tick "Lua Formula"

Then do a scan with:
Code:

(value>1000.0) and (value<5000.0) and ((value % 1)==0)


the `((value % 1)==0)` part makes it so that there is nothing after the decimal seperator

_________________
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
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Mon Sep 02, 2019 6:07 pm    Post subject: Reply with quote

Thank you Dark Byte! This works WELL!
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue Sep 03, 2019 3:58 pm    Post subject: Reply with quote

or you can use CustomType for this:

Code:
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(UsesFloat,1)
alloc(CallMethod,1)

TypeName:
db 'mod Float(Int)',0

ByteSize:
dd 4

UsesFloat:
db 1

CallMethod:
db 1

ConvertRoutine:
[64-bit]
mov eax,[rcx]
[/64-bit]

[32-bit]
mov eax,[esp+4]
mov eax,[eax]
[/32-bit]

movd xmm0,eax
cvtps2dq xmm1,xmm0 // convert single to integer
cvtdq2ps xmm1,xmm1 // convert integer to single

ucomiss xmm0,xmm1
je @f
mov eax,7FC00000 // NaN

@@:
ret


ConvertBackRoutine:
[64-bit]
movd xmm0,ecx
cvtps2dq xmm0,xmm0 // convert single to integer
cvtdq2ps xmm0,xmm0 // convert integer to single
movss [r8],xmm0
[/64-bit]

[32-bit]
push ebp
mov ebp,esp
push eax
push ebx
mov eax,[ebp+8]
mov ebx,[ebp+10]
movd xmm0,eax
cvtps2dq xmm0,xmm0 // convert single to integer
cvtdq2ps xmm0,xmm0 // convert integer to single
movss [ebx],xmm0
pop ebx
pop eax
pop ebp
[/32-bit]

ret


Code:
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(PreferedAlignment,4)
alloc(UsesFloat,1)
alloc(CallMethod,1)

TypeName:
db 'mod Double(Int)',0

ByteSize:
dd 8

PreferedAlignment:
dd 4

UsesFloat:
db 1

CallMethod:
db 1

ConvertRoutine:
[64-bit]
movsd xmm0,[rcx]
[/64-bit]

[32-bit]
mov eax,[esp+4]
movsd xmm0,[eax]
[/32-bit]

cvtsd2ss xmm0,xmm0 // convert double to single
movd eax,xmm0

cvtps2dq xmm1,xmm0 // convert single to integer
cvtdq2ps xmm1,xmm1 // convert integer to single

ucomiss xmm0,xmm1
je @f
mov eax,7FC00000 // NaN

@@:
ret


ConvertBackRoutine:
[64-bit]
movd xmm0,ecx
cvtps2dq xmm0,xmm0 // convert single to integer
cvtdq2ps xmm0,xmm0 // convert integer to single
cvtss2sd xmm0,xmm0 // convert single to double
movsd [r8],xmm0
[/64-bit]

[32-bit]
push ebp
mov ebp,esp
push eax
push ebx
mov eax,[ebp+8]
mov ebx,[ebp+10]
movd xmm0,eax
cvtps2dq xmm0,xmm0 // convert single to integer
cvtdq2ps xmm0,xmm0 // convert integer to single
cvtss2sd xmm0,xmm0 // convert single to double
movsd [ebx],xmm0
pop ebx
pop eax
pop ebp
[/32-bit]

ret

_________________
Back to top
View user's profile Send private message MSN Messenger
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Tue Sep 03, 2019 7:02 pm    Post subject: Reply with quote

This is even moar AWESOME!

Small issue, you can't make any non integer changes to the results. is it possible to fix that, or will I need to change the code type each time?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Sep 04, 2019 3:29 am    Post subject: Reply with quote

Those scripts use this trick: "mov eax,7FC00000 // NaN "
It makes all floating-point values with fractions treated as NaN (not a number). CE rejects NaN from scan results.

Just change type to regular float/double. Then change to desired value with fractions.
tip: highlight entries with "mod Float(Int)" type, then press ALT+ENTER.

Check attached image below.



customtype_double(Int).png
 Description:
 Filesize:  5.08 KB
 Viewed:  7949 Time(s)

customtype_double(Int).png



_________________
Back to top
View user's profile Send private message MSN Messenger
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Wed Sep 04, 2019 8:28 am    Post subject: Reply with quote

Tricky!

That's what I though.. I guess there is no good way to do searches for 0.25,0.5.1.5,etc..... ??
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Sep 04, 2019 9:30 am    Post subject: Reply with quote

Simple math, fractions 0.25, 0.5, 0.75 multiplied by 4 will give a whole number.

You can achieve this with Lua, tick "Lua formula" and "simple values only":
Code:
(value*4) % 1 == 0


there would be many results with 0 value, so you can do:
Code:
(value~=0) and ((value*4) % 1 == 0)


Or try other customType scripts:
Code:
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(UsesFloat,1)
alloc(CallMethod,1)

TypeName:
db 'mod Float(quarter)',0

ByteSize:
dd 4

UsesFloat:
db 1

CallMethod:
db 1

ConvertRoutine:
[64-bit]
mov eax,[rcx]
[/64-bit]

[32-bit]
mov eax,[esp+4]
mov eax,[eax]
[/32-bit]

movd xmm0,eax

addss xmm0,xmm0  // multiply by 4
addss xmm0,xmm0

cvtps2dq xmm1,xmm0 // convert single to integer
cvtdq2ps xmm1,xmm1 // convert integer to single

ucomiss xmm0,xmm1
je @f
mov eax,7FC00000 // NaN

@@:
ret


ConvertBackRoutine:
[64-bit]
mov [r8],ecx
[/64-bit]

[32-bit]
push ebp
mov ebp,esp
push eax
push ebx
mov eax,[ebp+8]
mov ebx,[ebp+10]
mov [ebx],eax
pop ebx
pop eax
pop ebp
[/32-bit]

ret


Code:
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(PreferedAlignment,4)
alloc(UsesFloat,1)
alloc(CallMethod,1)

TypeName:
db 'mod Double(quarter)',0

ByteSize:
dd 8

PreferedAlignment:
dd 4

UsesFloat:
db 1

CallMethod:
db 1

ConvertRoutine:
[64-bit]
movsd xmm0,[rcx]
[/64-bit]

[32-bit]
mov eax,[esp+4]
movsd xmm0,[eax]
[/32-bit]

cvtsd2ss xmm0,xmm0 // convert double to single
movd eax,xmm0

addss xmm0,xmm0  // multiply by 4
addss xmm0,xmm0  //

cvtps2dq xmm1,xmm0 // convert single to integer
cvtdq2ps xmm1,xmm1 // convert integer to single

ucomiss xmm0,xmm1
je @f
mov eax,7FC00000 // NaN

@@:
ret


ConvertBackRoutine:
[64-bit]
movd xmm0,ecx
cvtss2sd xmm0,xmm0 // convert single to double
movsd [r8],xmm0
[/64-bit]

[32-bit]
push ebp
mov ebp,esp
push eax
push ebx
mov eax,[ebp+8]
mov ebx,[ebp+10]
movd xmm0,eax
cvtss2sd xmm0,xmm0 // convert single to double
movsd [ebx],xmm0
pop ebx
pop eax
pop ebp
[/32-bit]

ret

_________________
Back to top
View user's profile Send private message MSN Messenger
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Wed Sep 04, 2019 11:07 pm    Post subject: Reply with quote

Works like a charm..

Is there a way to do a bunch different scans at one time?

for example I want to scan for all these values at once.



Code:

34020001
34030001
   
24050001
24060001
24070001
   
34080001
34090001
340A0001
340B0001
340C0001
340D0001
340E0001
340F0001
   
34180001
34190001
   
   
34100001
34110001
34120001
34130001
34140001
34150001
34160001
34170001
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Thu Sep 05, 2019 3:34 am    Post subject: Reply with quote

execute this code in lua first:
Code:

list={}
list[0x34020001]=true
list[0x34030001]=true
list[0x24050001]=true
list[0x24060001]=true
list[0x24070001]=true
list[0x34080001]=true
list[0x34090001]=true
list[0x340A0001]=true
list[0x340B0001]=true
list[0x340C0001]=true
list[0x340D0001]=true
list[0x340E0001]=true
list[0x340F0001]=true
list[0x34180001]=true
list[0x34190001]=true
list[0x34100001]=true
list[0x34110001]=true
list[0x34120001]=true
list[0x34130001]=true
list[0x34140001]=true
list[0x34150001]=true
list[0x34160001]=true
list[0x34170001]=true


and then do a lua formula scan of
Code:

list[value]

_________________
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
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Thu Sep 05, 2019 12:38 pm    Post subject: Reply with quote

Is there a good way to make a selectable list for these types? Lets say I could have several lists that I could select in a pull down menu for opcodes
Back to top
View user's profile Send private message
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Tue Sep 10, 2019 3:00 pm    Post subject: Reply with quote

How do you unselect the list?
Back to top
View user's profile Send private message
theboy181
Advanced Cheater
Reputation: 0

Joined: 26 Jan 2018
Posts: 89

PostPosted: Mon Oct 14, 2019 6:32 pm    Post subject: Reply with quote

Where are these scripts saved ?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Tue Oct 15, 2019 12:51 am    Post subject: Reply with quote

registry
_________________
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
Csimbi
I post too much
Reputation: 92

Joined: 14 Jul 2007
Posts: 3102

PostPosted: Fri Nov 15, 2019 2:34 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
or you can use CustomType for this:


Any clues why CE throws this error (see attachment) when I try to add your custom type?
Your code looks legit to me.

Thanks!



error.png
 Description:
 Filesize:  8.6 KB
 Viewed:  7094 Time(s)

error.png


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
Goto page 1, 2  Next
Page 1 of 2

 
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