Merge pull request #215 from prabhatKrMishra/main
Fix bone esp causing crashes due to a race condition with the reader thread
This commit is contained in:
@@ -26,6 +26,9 @@ namespace hack {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(dataMutex);
|
||||||
|
|
||||||
if (g_game.isC4Planted)
|
if (g_game.isC4Planted)
|
||||||
{
|
{
|
||||||
Vector3 c4Origin = g_game.c4.get_origin();
|
Vector3 c4Origin = g_game.c4.get_origin();
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ void CGame::close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CGame::loop() {
|
void CGame::loop() {
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(dataMutex);
|
||||||
|
|
||||||
inGame = false;
|
inGame = false;
|
||||||
isC4Planted = false;
|
isC4Planted = false;
|
||||||
|
|
||||||
@@ -151,14 +154,14 @@ void CGame::loop() {
|
|||||||
if (player.origin.x == 0 && player.origin.y == 0) continue;
|
if (player.origin.x == 0 && player.origin.y == 0) continue;
|
||||||
|
|
||||||
if (config::show_skeleton_esp) {
|
if (config::show_skeleton_esp) {
|
||||||
player.gameSceneNode = process->read<uint64_t>(player.pCSPlayerPawn + 0x308);
|
player.gameSceneNode = process->read<uintptr_t>(player.pCSPlayerPawn + updater::offsets::m_pGameSceneNode);
|
||||||
player.boneArray = process->read<uint64_t>(player.gameSceneNode + 0x170 + 0x80);
|
player.boneArray = process->read<uintptr_t>(player.gameSceneNode + 0x1F0);
|
||||||
player.ReadBones();
|
player.ReadBones();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config::show_head_tracker && !config::show_skeleton_esp) {
|
if (config::show_head_tracker && !config::show_skeleton_esp) {
|
||||||
player.gameSceneNode = process->read<uint64_t>(player.pCSPlayerPawn + 0x308);
|
player.gameSceneNode = process->read<uintptr_t>(player.pCSPlayerPawn + updater::offsets::m_pGameSceneNode);
|
||||||
player.boneArray = process->read<uint64_t>(player.gameSceneNode + 0x170 + 0x80);
|
player.boneArray = process->read<uintptr_t>(player.gameSceneNode + 0x1F0);
|
||||||
player.ReadHead();
|
player.ReadHead();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "../classes/vector.hpp"
|
#include "../classes/vector.hpp"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
struct view_matrix_t {
|
struct view_matrix_t {
|
||||||
float* operator[ ](int index) {
|
float* operator[ ](int index) {
|
||||||
@@ -75,3 +76,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline CGame g_game;
|
inline CGame g_game;
|
||||||
|
|
||||||
|
inline std::mutex dataMutex;
|
||||||
Reference in New Issue
Block a user