From 72c71fac8b24ab49c261aa1e78a12f5cee7f2074 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 17 Nov 2024 11:51:45 +0100 Subject: [PATCH] RTech: use Pak_UnloadAsyncAndWait for pak swap Use the actual api as this allows for helping other jobs as well rather than burning all cpu in our own thread. --- src/rtech/pak/pakstate.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/rtech/pak/pakstate.cpp b/src/rtech/pak/pakstate.cpp index e3b495fc..a6c53a7e 100644 --- a/src/rtech/pak/pakstate.cpp +++ b/src/rtech/pak/pakstate.cpp @@ -166,11 +166,7 @@ static void Pak_Swap_f(const CCommand& args) } Msg(eDLL_T::RTECH, "Requested pak swap for handle '%d'\n", pakHandle); - g_pakLoadApi->UnloadAsync(pakHandle); - - // TODO[ AMOS ]: use Pak_UnloadAsyncAndWaitOrHelp here. - while (pakInfo->status != PakStatus_e::PAK_STATUS_FREED) // Wait till this slot gets free'd. - std::this_thread::sleep_for(std::chrono::seconds(1)); + g_pakLoadApi->UnloadAsyncAndWait(pakHandle); // Wait till this slot gets free'd. g_pakLoadApi->LoadAsync(pakName, AlignedMemAlloc(), pakInfo->logChannel, 0); }