bro u might be using it on like array but from the code u showed me it didn’t seem like it that’s why i asked for the full source
i think it’d be better if u make it a single function that extracts entities directly
also the way u read the name might be causing issues cuz the default encoder is utf-8
i’ll attach how i read names, maybe that’s why some entities aren’t showing for u
Code:
uintptr_t GetAddress(HANDLE hProcess, uintptr_t base, const std::vector<uintptr_t>& offsets) {
uintptr_t address = base;
for (size_t i = 0; i + 1 < offsets.size(); ++i) {
uint32_t tmp = 0;
if (!ReadProcessMemory(hProcess, reinterpret_cast<LPCVOID>(address + offsets[i]), &tmp, sizeof(tmp), nullptr) || tmp == 0) {
return 0;
}
address = tmp;
}
return offsets.empty() ? address : (address + offsets.back());
}
bool ReadValue(HANDLE hProcess, uintptr_t address, const std::string& type, void* out) {
SIZE_T bytesRead;
if (type == "float") {
return ReadProcessMemory(hProcess, reinterpret_cast<LPCVOID>(address), out, sizeof(float), &bytesRead) && bytesRead == sizeof(float);
} else if (type == "uint") {
return ReadProcessMemory(hProcess, reinterpret_cast<LPCVOID>(address), out, sizeof(uint32_t), &bytesRead) && bytesRead == sizeof(uint32_t);
} else if (type == "double") {
return ReadProcessMemory(hProcess, reinterpret_cast<LPCVOID>(address), out, sizeof(double), &bytesRead) && bytesRead == sizeof(double);
} else if (type == "int") {
return ReadProcessMemory(hProcess, reinterpret_cast<LPCVOID>(address), out, sizeof(int32_t), &bytesRead) && bytesRead == sizeof(int32_t);
}
return false;
}
std::string ReadString(HANDLE hProcess, uintptr_t address, size_t maxLen) {
std::vector<char> buffer(maxLen);
SIZE_T bytesRead;
if (!ReadProcessMemory(hProcess, reinterpret_cast<LPCVOID>(address), buffer.data(), maxLen, &bytesRead)) {
return {};
}
size_t len = 0;
while (len < bytesRead && buffer[len] != '\0') ++len;
return std::string(buffer.data(), len);
}
std::vector<Entity> GetAllEntities(HANDLE hProcess, uintptr_t world) {
std::vector<Entity> entities;
if (!world) return entities;
uintptr_t nodeInfo = GetAddress(hProcess, world, {0x7C});
if (!nodeInfo) return entities;
uint32_t baseAddr = 0;
ReadValue(hProcess, nodeInfo, "uint", &baseAddr);
if (!baseAddr) return entities;
uint32_t size = 0, step = 0;
uintptr_t sizeAddr = GetAddress(hProcess, nodeInfo, {0x8});
ReadValue(hProcess, sizeAddr, "uint", &size);
uintptr_t stepAddr = GetAddress(hProcess, nodeInfo, {0x4});
ReadValue(hProcess, stepAddr, "uint", &step);
std::vector<uintptr_t> nodes;
for (uint32_t i = 0; i < size; ++i) {
uintptr_t addr = baseAddr + i * step;
while (addr) {
uint32_t next = 0;
if (!ReadValue(hProcess, addr, "uint", &next)) break;
if (next != 1) nodes.push_back(addr);
addr = next & ~1u;
}
}
for (auto node : nodes) {
uintptr_t ent = GetAddress(hProcess, node, {0x10, 0xC4, 0x4, 0x0});
if (!ent) continue;
uintptr_t nameAddr = GetAddress(hProcess, ent, {0x58, 0x64, 0x0});
auto name = ReadString(hProcess, nameAddr, 96);
if (name.empty()) continue;
uintptr_t posAddr = GetAddress(hProcess, ent, {0x58, 0xC4, 0x4, 0x80});
float x=0,y=0,z=0;
ReadValue(hProcess, posAddr, "float", &x);
ReadValue(hProcess, posAddr+4, "float", &y);
ReadValue(hProcess, posAddr+8, "float", &z);
float scale = 0;
ReadValue(hProcess, posAddr+0x74, "float", &scale);
int level = 0;
uintptr_t lvlAddr = GetAddress(hProcess, ent, {0x58, 0xC4, 0x54, 0x120});
ReadValue(hProcess, lvlAddr, "int", &level);
int death = 0;
uintptr_t deathAddr = GetAddress(hProcess, ent, {0x58, 0x0});
ReadValue(hProcess, deathAddr, "int", &death);
double health = 0;
uintptr_t healthAddr = GetAddress(hProcess, ent, {0x58, 0xC4, 0x84, 0x80});
ReadValue(hProcess, healthAddr, "double", &health);
entities.push_back({name, x, y, z, scale, level, death, health});
}
std::cout << "\n[Info] Base: 0x" << std::hex << baseAddr << " Size: " << std::dec << size << " Step: " << step << std::endl;
std::cout << "[Info] Total entities found: " << entities.size() << std::endl;
return entities;
}