sys_prx_unload_module: Implement CELL_PRX_ERROR_NOT_REMOVABLE

This commit is contained in:
Eladash 2020-03-24 14:55:40 +02:00 committed by Ivan
parent e1f2f3f081
commit 150d1bcdd5

View File

@ -446,13 +446,29 @@ error_code _sys_prx_unload_module(u32 id, u64 flags, vm::ptr<sys_prx_unload_modu
sys_prx.todo("_sys_prx_unload_module(id=0x%x, flags=0x%x, pOpt=*0x%x)", id, flags, pOpt);
// Get the PRX, free the used memory and delete the object and its ID
const auto prx = idm::withdraw<lv2_obj, lv2_prx>(id);
const auto prx = idm::withdraw<lv2_obj, lv2_prx>(id, [](lv2_prx& prx) -> CellPrxError
{
switch (prx.state)
{
case PRX_STATE_INITIALIZED:
case PRX_STATE_STOPPED:
return {};
default: break;
}
return CELL_PRX_ERROR_NOT_REMOVABLE;
});
if (!prx)
{
return CELL_PRX_ERROR_UNKNOWN_MODULE;
}
if (prx.ret)
{
return prx.ret;
}
ppu_unload_prx(*prx);
//s32 result = prx->exit ? prx->exit() : CELL_OK;