Make iCursor threadsafe.

This commit is contained in:
Riley 2024-05-27 21:35:38 -05:00
parent 6f22959aec
commit 0f511b7f24
4 changed files with 8 additions and 4 deletions

View File

@ -2307,7 +2307,8 @@ void CMenu::Render()
AddDraggable("Conditions", Vars::Menu::ConditionsDisplay, FGet(Vars::Menu::Indicators) & (1 << 4));
AddDraggable("Seed prediction", Vars::Menu::SeedPredictionDisplay, FGet(Vars::Menu::Indicators) & (1 << 5));
F::Render.Cursor = GetMouseCursor();
//F::Render.Cursor = GetMouseCursor();
F::Render.m_iCursor.store(ImGui::GetMouseCursor());
}
else
mActives.clear();

View File

@ -3,6 +3,8 @@
#include <ImGui/imgui_impl_dx9.h>
#include <ImGui/imgui.h>
#include <atomic>
class CRender
{
public:
@ -12,7 +14,7 @@ public:
void LoadColors();
void LoadStyle();
int Cursor = 2;
std::atomic<int> m_iCursor = ATOMIC_VAR_INIT(0);
// Colors
ImColor Accent = { 255, 101, 101 };

View File

@ -82,7 +82,8 @@ MAKE_HOOK(VGuiSurface_SetCursor, U::Memory.GetVFunc(I::MatSystemSurface, 51), vo
{
if (F::Menu.IsOpen)
{
switch (F::Render.Cursor)
auto iCursor = F::Render.m_iCursor.load();
switch(iCursor)
{
case 0: cursor = 2; break;
case 1: cursor = 3; break;