Fixed the name reading

This commit is contained in:
hydrophobis
2025-07-12 23:11:17 -05:00
parent 9c3ee2fa1f
commit 9c6ef69169
4 changed files with 51 additions and 33 deletions
+20 -5
View File
@@ -139,11 +139,26 @@ void CGame::loop() {
* player.is_spotted = process->read<bool>(player.spottedState + 0x8); // bSpotted
*/
playerNameData = process->read<uintptr_t>(player.entity + updater::offsets::m_sSanitizedPlayerName);
char buffer[256];
process->read_raw(playerNameData, buffer, sizeof(buffer));
std::string name = std::string(buffer);
player.name = name;
uint32_t handle = process->read<std::uint32_t>(player.pCSPlayerPawn + updater::offsets::m_hController);
int index = handle & 0x7FFF;
int segment = index >> 9;
int entry = index & 0x1FF;
uintptr_t controllerListSegment = process->read<uintptr_t>(entity_list + 0x8 * segment + 0x10);
uintptr_t controller = process->read<uintptr_t>(controllerListSegment + 120 * entry);
if (!controller || controller > 0x7FFFFFFFFFFF)
continue;
char buffer[256] = {};
uintptr_t name_ptr = process->read<uintptr_t>(controller + updater::offsets::m_iszPlayerName);
process->read_raw(name_ptr, buffer, sizeof(buffer) - 1);
buffer[sizeof(buffer) - 1] = '\0';
player.name = buffer;
player.gameSceneNode = process->read<uintptr_t>(player.pCSPlayerPawn + updater::offsets::m_pGameSceneNode);
player.origin = process->read<Vector3>(player.pCSPlayerPawn + updater::offsets::m_vOldOrigin);