 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Fri Oct 16, 2015 9:17 pm Post subject: Scan and replace double value (again) |
|
|
I read this function from mgr.inz.Player
Code: |
function findDoubleValueAndReplace(findValue, replaceWith)
memscan = createMemScan()
foundlist = createFoundList(memscan)
protectionflags = "-W*X-C"
-- firstScan(scanoption, vartype, roundingtype, input1, input2,
-- startAddress, stopAddress, protectionflags,
-- alignmenttype, "alignmentparam",
-- isHexadecimalInput, isNotABinaryString, isunicodescan, iscasesensitive)
-- scanOption: soUnknownValue, soExactValue, soValueBetween, soBiggerThan, soSmallerThan
-- vartype: vtByte, vtWord, vtDword, vtQword, vtSingle, vtDouble, vtString,
-- vtByteArray, vtGrouped, vtBinary, vtAll
-- roundingtype: rtRounded, rtTruncated, rtExtremerounded
-- alignmenttype: fsmNotAligned, fsmAligned, fsmLastDigits
-- protectionflags: X W C (+ to indicate that flag MUST be set, - MUST NOT, * whatever)
memscan.firstScan(soExactValue, vtDouble, rtTruncated, findValue, nil,
"0","7fffffff",protectionflags,
fsmAligned,"4",
false, false, false, false)
memscan.waitTillDone()
foundlist.initialize()
for i=0,foundlist.Count-1 do
fullAccess( getAddress(foundlist.Address[i]) , 8)
writeDouble( foundlist.Address[i], replaceWith)
end
sleep(50)
foundlist.destroy()
sleep(50)
memscan.destroy()
end
--- used example
a=findDoubleValueAndReplace(0.01, -0.04)
print(a)
|
Question :
1. Is there any way we get/ filter scan result that exactly 0.01 ?
2. What is different protectionflags = "-W*X-C" / "-W*X*C" / "-W*X+C" ?
3. From Cheat Engine Help file:
Quote: |
rtRounded : Normal rounded scans. If exact value = "3" then it includes 3.0 to 3.49999999. If exact value is "3.0" it includes 3.00 to 3.0499999999
rtTruncated: Truncated algoritm. If exact value = "3" then it includes 3.0 to 3.99999999. If exact value is "3.0" it includes 3.00 to 3.099999999
rtExtremerounded: Rounded Extreme. If exact value = "3" then it includes 2.0000001 to 3.99999999. If exact value is "3.0" it includes 2.900000001 to 3.099999999
|
Shown we can;t get exact value as we need (in this case 0.01).
How if we get all result scan first, put all as string, filtering the string for 0.01 and return it to number and last use it as replace value ?.
If possible, does any one should make a function for usage it ?
Regards
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Fri Oct 16, 2015 10:02 pm Post subject: |
|
|
Scan for vtQword with value 0x3F847AE147AE147B instead?
|
|
Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Oct 17, 2015 5:21 am Post subject: |
|
|
For that use a string instead of a number, and append few zeroes:
Code: | findDoubleValueAndReplace("0.0100000", -0.04) |
Or make scan for "array of bytes" type.
"7B 14 AE 47 E1 7A 84 3F" == 0.01 double
_________________
|
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Sat Oct 17, 2015 9:42 am Post subject: |
|
|
vtQword, ah yes need to try this also shall to try with vtDword.
Thank Zanzer for hint.
mgr.inz.Player, i did changed the double value 0.01 (AOB = 7B 14 AE 47 E1 7A 84 3F) to -0.04 (AOB = 7B 14 AE 47 E1 7A A4 BF)
I post this topic to get know a way how get exact value from scan double value if possible.
Anyhow, use
Code: |
findDoubleValueAndReplace("0.0100000", -0.04)
|
also very helpful to reduce number of scan results found.
Thank you
|
|
Back to top |
|
 |
|
|
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
|
|