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.
This commit is contained in:
Kawe Mazidjatari 2024-11-17 11:51:45 +01:00
parent ba83bd9ae9
commit 72c71fac8b

View File

@ -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);
}