diff --git a/src/Client/Hook/Hooks/Render/SetupAndRenderHook.hpp b/src/Client/Hook/Hooks/Render/SetupAndRenderHook.hpp index 3d765029..c152d609 100644 --- a/src/Client/Hook/Hooks/Render/SetupAndRenderHook.hpp +++ b/src/Client/Hook/Hooks/Render/SetupAndRenderHook.hpp @@ -93,7 +93,10 @@ class SetUpAndRenderHook : public Hook } FrameTransform transform = { SDK::clientInstance->getviewMatrix(), origin, SDK::clientInstance->getFov(), pos}; + + SwapchainHook::frameTransformsMtx.lock(); SwapchainHook::FrameTransforms.push(transform); + SwapchainHook::frameTransformsMtx.unlock(); if(layer == "debug_screen" || layer == "hud_screen" || layer == "start_screen") { SetupAndRenderEvent event(muirc); diff --git a/src/Client/Hook/Hooks/Render/SwapchainHook.cpp b/src/Client/Hook/Hooks/Render/SwapchainHook.cpp index 0638daac..8a36c131 100644 --- a/src/Client/Hook/Hooks/Render/SwapchainHook.cpp +++ b/src/Client/Hook/Hooks/Render/SwapchainHook.cpp @@ -244,11 +244,13 @@ HRESULT SwapchainHook::swapchainCallback(IDXGISwapChain3 *pSwapChain, UINT syncI /* RENDER SYNC */ - if(init && initImgui) - while(FrameTransforms.size() > transformDelay) - { - MC::Transform = FrameTransforms.front(); - FrameTransforms.pop(); + if(init && initImgui) { + frameTransformsMtx.lock(); + while (FrameTransforms.size() > transformDelay) { + MC::Transform = FrameTransforms.front(); + FrameTransforms.pop(); + } + frameTransformsMtx.unlock(); } /* RENDER SYNC */ diff --git a/src/Client/Hook/Hooks/Render/SwapchainHook.hpp b/src/Client/Hook/Hooks/Render/SwapchainHook.hpp index d7cbb4f6..4f6cbc66 100644 --- a/src/Client/Hook/Hooks/Render/SwapchainHook.hpp +++ b/src/Client/Hook/Hooks/Render/SwapchainHook.hpp @@ -73,6 +73,7 @@ class SwapchainHook : public Hook { static inline uint64_t buffersCounts = 0; static inline std::vector frameContexts = {}; + static inline std::mutex frameTransformsMtx; static inline std::queue FrameTransforms; static inline int transformDelay = 3;