Add mutex lock for NP changes

This commit is contained in:
RipleyTom 2021-02-20 22:33:17 +01:00 committed by Ivan
parent 81270f3142
commit 8be2a55ccc
3 changed files with 28 additions and 12 deletions

View file

@ -401,6 +401,8 @@ error_code sceNpInit(u32 poolsize, vm::ptr<void> poolptr)
const auto nph = g_fxo->get<named_thread<np_handler>>();
std::lock_guard lock(nph->mutex_status);
if (nph->is_NP_init)
{
return SCE_NP_ERROR_ALREADY_INITIALIZED;
@ -432,6 +434,8 @@ error_code sceNpTerm()
const auto nph = g_fxo->get<named_thread<np_handler>>();
std::lock_guard lock(nph->mutex_status);
if (!nph->is_NP_init)
{
return SCE_NP_ERROR_NOT_INITIALIZED;