View previous topic :: View next topic |
Author |
Message |
ifree How do I cheat? Reputation: 0
Joined: 22 Feb 2019 Posts: 2
|
Posted: Fri Feb 22, 2019 11:44 am Post subject: C++ AOB scan speed |
|
|
Hi, I just implemented a multithread AOB scan using c++.
When I do it scan on DS3, it take almost 10s to get the result, but CE at do it in 1 or 2s.
I just wonder how CE achieve that.
Thanks
P.S.
I do use memory region cache:
Code: |
void MemScanner::build_page_cache() {
page_cache_.clear();
MEMORY_BASIC_INFORMATION mem_info{};
for (uintptr_t addr = 0;
VirtualQueryEx(handle_, reinterpret_cast<LPVOID>(addr), &mem_info,
sizeof(MEMORY_BASIC_INFORMATION));
addr += mem_info.RegionSize) {
if ((mem_info.State == MEM_COMMIT) &&
(mem_info.Protect & PAGE_GUARD) == 0 &&
(mem_info.Protect & PAGE_NOACCESS) == 0 &&
(mem_info.Type == MEM_IMAGE || mem_info.Type == MEM_PRIVATE) &&
mem_info.RegionSize < 0x2ffffffff) {
// follow cheat engine's logic
bool writable = ((mem_info.Protect & PAGE_READWRITE) > 0) ||
((mem_info.Protect & PAGE_WRITECOPY) > 0) ||
((mem_info.Protect & PAGE_EXECUTE_READWRITE) > 0) ||
((mem_info.Protect & PAGE_EXECUTE_WRITECOPY) > 0);
// ignore it now
bool executable = ((mem_info.Protect & PAGE_EXECUTE) > 0) ||
((mem_info.Protect & PAGE_EXECUTE_READ) > 0) ||
((mem_info.Protect & PAGE_EXECUTE_READWRITE) > 0) ||
((mem_info.Protect & PAGE_EXECUTE_WRITECOPY) > 0);
if (writable) {
page_cache_.emplace_back(
reinterpret_cast<uintptr_t>(mem_info.BaseAddress),
mem_info.RegionSize);
}
}
}
}
|
Just a simple scan
Code: |
uintptr_t addr{};
std::vector<uintptr_t> address_list{};
// pm.aob_scan("48 8B 05 * * * * 48 85 C0 * * 48 8b 40 * C3",
// address_list); addr = address_list[0]; context.BaseA = addr +
// pm.read<int>(addr + 3) + 7;
// aobscanmodule(Findit2,DarkSoulsIII.exe,48 8B 1D ?? ?? ?? 04 48 8B F9 48
// 85 DB ?? ?? 8B 11 85 D2 ?? ?? 8D)
address_list.clear();
pm.aob_scan("48 8B 1D * * * 04 48 8B F9 48 85 DB * * 8B 11 85 D2 * * 8D",
address_list);
addr = address_list[0];
addr = addr + pm.read<int>(addr + 3) + 7;
addr = pm.read<uintptr_t>(addr);
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Fri Feb 22, 2019 1:59 pm Post subject: |
|
|
perhaps your aobscan check is parsing the aob string every time ?
Or it doesn't stop comparing all the bytes until the whole string has been scanned ?
You're creating more threads than there are processors ?
You're not splitting up the memory blocks evenly by the number of CPU's and leave one CPU to do 90% of the work ?
You have critical sections around readonly blocks of data ?
You're constantly allocating and freeing memory ?
_________________
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 |
|
|
ifree How do I cheat? Reputation: 0
Joined: 22 Feb 2019 Posts: 2
|
Posted: Sat Feb 23, 2019 3:39 am Post subject: |
|
|
Thanks for your reply!
I should have done the profiling after ask the stupid question, sorry.
And I found out my issues are, scan address range too big, and memory allocation frequency.
Thanks!
|
|
Back to top |
|
|
|