From b054e164612c5452a9c4b2d6bb0a842168ce1a3e Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Wed, 25 Dec 2024 22:12:17 +0300 Subject: [PATCH] Fix buffers getting copied with a closed command list. --- UnleashedRecomp/gpu/video.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index 65d362d..338ff95 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -563,6 +563,14 @@ static void DestructTempResources() } static std::thread::id g_mainThreadId; +static std::thread::id g_presentThreadId = std::this_thread::get_id(); + +PPC_FUNC_IMPL(__imp__sub_824ECA00); +PPC_FUNC(sub_824ECA00) +{ + g_presentThreadId = std::this_thread::get_id(); + __imp__sub_824ECA00(ctx, base); +} static ankerl::unordered_dense::map g_barrierMap; @@ -1814,7 +1822,7 @@ static void UnlockBuffer(GuestBuffer* buffer) { if (!buffer->lockedReadOnly) { - if (std::this_thread::get_id() == g_mainThreadId) + if (std::this_thread::get_id() == g_presentThreadId) { RenderCommand cmd; cmd.type = (sizeof(T) == 2) ? RenderCommandType::UnlockBuffer16 : RenderCommandType::UnlockBuffer32;