-
Автор темы
- #1
Получение адреса:
Цикл для ентити листа:
Проблема:
Крашит сразу после запуска цикла.(Ошибка по типу, ошибка доступа к адресу).
Скрины как получал сигнатуру приложил. Оффсеты для hPawn и health -
На всякйи код PatternScan:
main.cpp:
bool getOffsets() {
dwEntityList = reinterpret_cast<uintptr_t>(PatternScan("client.dll", "48 8B 15 ? ? ? ? 4C 8B C8 41 83 F8 FF")); //48 8B 15 ?? ?? ?? ?? 4C 8B C8 41 83 F8 FF
static auto ViewMatrixPointer = PatternScan("client.dll", "48 63 C2 48 8D 0D ? ? ? ? 48 C1 E0");
LocalPlayerController = reinterpret_cast<uintptr_t>(PatternScan("client.dll", "48 8B 0D ? ? ? ? 48 85 C9 74 65 83 FF FF"));
static auto CCitadelCameraManager = PatternScan("client.dll", "48 8D 3D ? ? ? ? 8B D9");
if (dwEntityList) {
printf("Address: 0x%llX\n", dwEntityList);
}
else printf("Not found\n");
if (ViewMatrixPointer) {
printf("Address: 0x%llX\n", ViewMatrixPointer);
}
else printf("Not found\n");
if (LocalPlayerController) {
printf("Address: 0x%llX\n", LocalPlayerController);
}
else printf("Not found\n");
if (CCitadelCameraManager) {
printf("Address: 0x%llX\n", CCitadelCameraManager);
}
else printf("Not found\n");
return true;
}
Цикл для ентити листа:
entityList.cpp:
#include "math.h"
#include "includes.h"
#include "globals.h"
void entityList(){
for (int playerIndex = 0; playerIndex < 64; playerIndex++) {
uintptr_t listEntry = [I](uintptr_t[/I])(dwEntityList + 0x8 * (playerIndex & 0x7FFF) >> 9);
if (!listEntry)
{
continue;
}
uintptr_t entityController = [I](uintptr_t[/I])(listEntry + 0x120 * (playerIndex & 0x1FF));
if (!entityController)
continue;
uintptr_t entityControllerPawn = [I](uintptr_t[/I])(entityController + 0x060C); //0x060C - m_hPawn / 0x5f4
uintptr_t listEntry2 = [I](uintptr_t[/I])(entityController + 0x8 * (entityControllerPawn & 0x7FFF) >> 9);
if (!listEntry2) {
continue;
}
uintptr_t entityPawn = [I](uintptr_t[/I])(listEntry2 + 0x120 * (entityControllerPawn & 0x1FF));
if (!entityPawn) {
continue;
}
int health = [I](int[/I])(entityPawn + 0x034C);
}
}
Проблема:
Крашит сразу после запуска цикла.(Ошибка по типу, ошибка доступа к адресу).
Скрины как получал сигнатуру приложил. Оффсеты для hPawn и health -
Пожалуйста, авторизуйтесь для просмотра ссылки.
(no ad).На всякйи код PatternScan:
pointer scan:
#pragma once
#include "includes.h"
#include "iostream"
#include <vector>
std::uint8_t* PatternScan(const char* module_name, const char* signature) noexcept {
const auto module_handle = GetModuleHandleA(module_name);
if (!module_handle)
return nullptr;
static auto pattern_to_byte = [](const char* pattern) {
auto bytes = std::vector<int>{};
auto start = const_cast<char*>(pattern);
auto end = const_cast<char*>(pattern) + std::strlen(pattern);
for (auto current = start; current < end; ++current) {
if (*current == '?') {
++current;
if (*current == '?')
++current;
bytes.push_back(-1);
}
else {
bytes.push_back(std::strtoul(current, ¤t, 16));
}
}
return bytes;
};
auto dos_header = reinterpret_cast<PIMAGE_DOS_HEADER>(module_handle);
auto nt_headers =
reinterpret_cast<PIMAGE_NT_HEADERS>(reinterpret_cast<std::uint8_t*>(module_handle) + dos_header->e_lfanew);
auto size_of_image = nt_headers->OptionalHeader.SizeOfImage;
auto pattern_bytes = pattern_to_byte(signature);
auto scan_bytes = reinterpret_cast<std::uint8_t*>(module_handle);
auto s = pattern_bytes.size();
auto d = pattern_bytes.data();
for (auto i = 0ul; i < size_of_image - s; ++i) {
bool found = true;
for (auto j = 0ul; j < s; ++j) {
if (scan_bytes[i + j] != d[j] && d[j] != -1) {
found = false;
break;
}
}
if (found)
return &scan_bytes[i];
}
throw std::runtime_error(std::string("Wrong signature: ") + signature);
}