sceNp: fix invalid ctx dereference

Fixes "Buzz! Quiz Player" Offline Gameplay
This commit is contained in:
Megamouse 2021-07-01 22:15:25 +02:00
parent 020fdcc781
commit e212f16962
1 changed files with 14 additions and 1 deletions

View File

@ -107,7 +107,10 @@ s32 sceNpCommerce2DestroyCtx(u32 ctx_id)
{
sceNpCommerce2.warning("sceNpCommerce2DestroyCtx(ctx_id=%d)", ctx_id);
destroy_commerce2_context(ctx_id);
if (!destroy_commerce2_context(ctx_id))
{
return SCE_NP_COMMERCE2_ERROR_CTX_NOT_FOUND; // TODO: verify
}
return CELL_OK;
}
@ -118,6 +121,11 @@ s32 sceNpCommerce2EmptyStoreCheckStart(u32 ctx_id, s32 store_check_type, vm::cpt
const auto ctx = get_commerce2_context(ctx_id);
if (!ctx)
{
return SCE_NP_COMMERCE2_ERROR_CTX_NOT_FOUND; // TODO: verify
}
if (ctx->context_callback)
{
sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32
@ -149,6 +157,11 @@ s32 sceNpCommerce2CreateSessionStart(u32 ctx_id)
const auto ctx = get_commerce2_context(ctx_id);
if (!ctx)
{
return SCE_NP_COMMERCE2_ERROR_CTX_NOT_FOUND; // TODO: verify
}
if (ctx->context_callback)
{
sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32