View previous topic :: View next topic |
Author |
Message |
Kamd Cheater
Reputation: 1
Joined: 02 May 2018 Posts: 28
|
Posted: Thu Feb 21, 2019 7:59 pm Post subject: Stop AOBScan after first result is found |
|
|
Hi, I am using a unique AOB to locate a value in memory.
On the CE GUI I see that it tells me "Found 1 result" before the scanning progress is completely finished.
Is there a way to terminate/stop AOBScan in Lua after the first result is found, to make it complete faster?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25806 Location: The netherlands
|
Posted: Fri Feb 22, 2019 12:37 am Post subject: |
|
|
Lua AOBScan is designed to find ALL
If you don't want that use the Memscan class instead and set OnlyOneResult to true
or use AutoAssembler with registerSymbol instead and afterwards use getAddress
_________________
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 |
|
 |
Kamd Cheater
Reputation: 1
Joined: 02 May 2018 Posts: 28
|
Posted: Mon Apr 29, 2019 5:01 am Post subject: |
|
|
Sorry for really late reply.
I have tried using MemScan and ms.OnlyOneResult = true with returning ms.getOnlyResult()
Code: |
function aobScanUnique(aob)
local ms = createMemScan()
ms.OnlyOneResult = true
ms.firstScan(
soExactValue,
vtByteArray,
rtRounded,
aob,
"",
0,
0xffffffffffffffff,
"",
fsmNotAligned,
"",
true,
false,
false,
false
)
ms.waitTillDone()
return ms.getOnlyResult()
end
|
This seems to work fine, though it is actually slower than regular AOBScan function, so I must be doing something wrong?
My speed tests, with same game and AOB, around of time:
AOBScan: 986ms - 1027ms
MemScan: 1500ms - 1532ms
My whole purpose is to try make AOB scan as fast as possible for unique AOB scans (where there is only 1 result) - I think I'm doing something wrong
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25806 Location: The netherlands
|
Posted: Mon Apr 29, 2019 4:03 pm Post subject: |
|
|
maybe don't create and free the memscan but reuse it
besides that it's the same code that aobscan uses
_________________
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 |
|
 |
Kamd Cheater
Reputation: 1
Joined: 02 May 2018 Posts: 28
|
Posted: Mon Apr 29, 2019 10:53 pm Post subject: |
|
|
Dark Byte wrote: | besides that it's the same code that aobscan uses |
Really strange then. Is it possible in future CE version to give more optional parameters to AOBScan (e.g. onlyOneResult), so I don't have to use MemScan.
I actually see that AOBScan uses way more CPU than MemScan:
AOBScan: 32%-42%-49%
MemScan: 10%-11% [gradual increase: 4%-9%-11%]
So I assume MemScan is being slower largely due to not utilizing as much CPU. Is this a bug, intentional, or anyway to make it faster/use more CPU (assuming you couldn't just directly add an onlyOneResult param to regular AOBScan function)?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25806 Location: The netherlands
|
Posted: Mon Apr 29, 2019 11:24 pm Post subject: |
|
|
Do you have kernelmode memory scanning enabled? If so, limit to 7fffffffffffffff instead
This is the lua aobscan code:
https://github.com/cheat-engine/cheat-engine/blob/741e3009e36baf1575fd48e73da1814d09fdcadf/Cheat%20Engine/simpleaobscanner.pas#L23
as you see it just uses a memscan object
But yes, only one result limits the scan to only one thread as otherwise you may get a random result if there are more results
you can also use autoassembler in lua
Code: |
autoAssemble([[
aobscan(xxx,xx xx xx xx)
registersymbol(xxx)
]]
)
address=getAddressSafe('xxx')
|
Of course, will be just as fast as it's the same method using onlyone
Anyhow, you do know that you can have multiple memscans going at the same time ? so if you have more than one, you can let the other cpu's scan at the same time. You don't have to wait till the previous one is done
_________________
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 |
|
 |
Kamd Cheater
Reputation: 1
Joined: 02 May 2018 Posts: 28
|
Posted: Wed May 01, 2019 7:59 pm Post subject: |
|
|
Dark Byte wrote: | you can also use autoassembler in lua
Code: |
autoAssemble([[
aobscan(xxx,xx xx xx xx)
registersymbol(xxx)
]]
)
address=getAddressSafe('xxx')
|
Of course, will be just as fast as it's the same method using onlyone
Anyhow, you do know that you can have multiple memscans going at the same time ? so if you have more than one, you can let the other cpu's scan at the same time. You don't have to wait till the previous one is done |
Will autoAssemble only return 1 result/faster than lua AOBScan?
Otherwise maybe I will have to look into multiple memscans, but I don't know how to do it efficiently and so it will be faster than regular AOBScan
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25806 Location: The netherlands
|
Posted: Wed May 01, 2019 9:08 pm Post subject: |
|
|
autoAssemble will be exactly as fast lua AOBScan
But if you havbe multiple aobscans in the script e.g
Code: |
aobscan(s1,xx xx xx xx xx)
aobscan(s2,xx xx xx xx xx)
aobscan(s3,xx xx xx xx xx)
|
it will group them into one scan that returns 3 results, or split them up into several different scans, up to the maximum number of CPU's you have
_________________
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 |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4706
|
Posted: Wed May 01, 2019 9:24 pm Post subject: |
|
|
I forget whether or not I ever tested this, but you should be able to do that from Lua by using the vartype vtByteArrays (enum value = 15) and a correctly formatted search string (I think "(aob1)(aob2)...").
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
|