View previous topic :: View next topic |
Author |
Message |
theboy181 Advanced Cheater
Reputation: 0
Joined: 26 Jan 2018 Posts: 91
|
Posted: Sat Mar 02, 2024 3:12 pm Post subject: Scripting AOB scans in Private Memory only |
|
|
I want to make a scrip that will only seach a range within the mem_private section for an AOB scan.
Code: |
[ENABLE]
{$lua}
if syntaxcheck then return end
function setupAobScanAndRegister(sym, pat)
-- Scan only in private memory (MEM_PRIVATE) within the specified range
local result = AOBScan(pat, "+r+w", "0", "FFFFFFFFFF")
if result and result.Count > 0 then
local baseAddress = result[0] -- Get the first result
result.destroy() -- Immediately destroy the result object to free up resources
baseAddress = tonumber(baseAddress, 16)
-- Read the start and stop values directly from memory
local startOffset = readQword(baseAddress) -- Read value at baseAddress as the start
local stopOffset = readQword(baseAddress + 0x10) -- Read value at baseAddress + 0x10 as the stop
-- Directly set the memory scan range in Cheat Engine
MainForm.FromAddress.Text = string.format("%X", startOffset)
MainForm.ToAddress.Text = string.format("%X", stopOffset)
unregisterSymbol(sym)
registerSymbol(sym, baseAddress)
print("AOB pattern found in private memory and memory range set.")
else
print("No results found for the AOB pattern in private memory.")
end
end
-- Replace the pattern with your actual AOB pattern
setupAobScanAndRegister("MySymbol0", "Your AOB Pattern Here")
{$asm}
[DISABLE]
unregistersymbol(MySymbol0)
|
Is it possible to set in a script? I only want to do other scans in emulation memory except when I am running the script.
Sidenote. Can you have your script stop searching AOB as soon as it finds the first instance of the AOB you are looking for?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 467
Joined: 09 May 2003 Posts: 25700 Location: The netherlands
|
Posted: Sat Mar 02, 2024 6:04 pm Post subject: |
|
|
Code: |
s=getSettings()
s.MEM_PRIVATE='1'
s.MEM_MAPPED='0'
s.MEM_IMAGE='0'
reloadSettingsFromRegistry()
|
will make sure the next scan will scan private memory only
Code: |
s=getSettings()
s.MEM_PRIVATE='0'
s.MEM_MAPPED='1'
s.MEM_IMAGE='0'
|
when done and you wish to scan emulation memory only (adjust to any other config to your liking)
use AOBScanUnique to make it stop on the first result it encounters while scanning. (Note that scanning happens by multiple threads that all start at a random location and the first one to find a match wins)
Alternatively, use the createMemScan function and then configure your own scan. You can set it to only return one result, which uses only 1 result
also, autoAssemble's aobscan only returns the first result
_________________
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 |
|
 |
theboy181 Advanced Cheater
Reputation: 0
Joined: 26 Jan 2018 Posts: 91
|
Posted: Sat Mar 02, 2024 8:46 pm Post subject: |
|
|
also, autoAssemble's aobscan only returns the first result
If they only return the first result, why does it keep scanning all the memory? the AOB is discovered after 1 second into the scan and it takes 16 seconds to finish looking at all the located memory.
I want the scan to stop as soon as it finds the first result, is that possible?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 467
Joined: 09 May 2003 Posts: 25700 Location: The netherlands
|
Posted: Sun Mar 03, 2024 10:55 am Post subject: |
|
|
you're mixing up lua and AA aobscan. lua aobscan finds everything, aa aobscan only the first thing
_________________
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 |
|
 |
theboy181 Advanced Cheater
Reputation: 0
Joined: 26 Jan 2018 Posts: 91
|
Posted: Sun Mar 03, 2024 11:12 am Post subject: |
|
|
I think that could be very true.
I managed to get it working quickly with the AOBScanUnique as per your suggestions. Running this script will set the start and stop memory scan options.
However, I have another script that is looking looking for an AOB but it will scan outside the range that I just set with the other script.
The first scrip is setting the range for all future scans, 0x3F96A000000 - 0x47969FFFFFF
Code: | [ENABLE]
{$lua}
if syntaxcheck then return end
function aob_register(sym, pat)
instr = AOBScan(pat, "+r+w")
addy = instr[0]
instr.destroy()
addy = tonumber(addy, 16)
unregisterSymbol(sym)
registerSymbol(sym, addy)
end
aob_register("Interval2","MyAOB")
{$asm}
[DISABLE]
unregistersymbol(interval2)
|
But running this AOB scan, resulted in locating the AOB before 0x3F96A000000
Im not sure why this is happening, as any AOB search I do in the GUI only returns results within the range that was set.
Can you help me understand what I am doing wrong in the script?
I tried this and it comes up with Zero results, but the same AOB can be discovered in the GUI.
Code: |
[ENABLE]
aobscan(test,AOB_HERE)
[DISABLE]
unregistersymbol(test)
|
|
|
Back to top |
|
 |
|