1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

sceNpCustomMenu: improvements

This commit is contained in:
Megamouse 2021-10-11 23:22:19 +02:00
parent 80ef348600
commit 8f328b2624
2 changed files with 29 additions and 8 deletions

View File

@ -2165,11 +2165,29 @@ error_code sceNpCustomMenuRegisterActions(vm::cptr<SceNpCustomMenu> menu, vm::pt
return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED;
}
if (!menu || !handler)
if (!menu || !handler) // TODO: handler check might come later
{
return SCE_NP_CUSTOM_MENU_ERROR_INVALID_ARGUMENT;
}
if (menu->numActions > SCE_NP_CUSTOM_MENU_ACTION_ITEMS_TOTAL_MAX)
{
return SCE_NP_CUSTOM_MENU_ERROR_EXCEEDS_MAX;
}
for (u32 i = 0; i < menu->numActions; i++)
{
if (!menu->actions[i].name)
{
return SCE_NP_CUSTOM_MENU_ERROR_INVALID_ARGUMENT;
}
if (!memchr(menu->actions[i].name.get_ptr(), '\0', SCE_NP_CUSTOM_MENU_ACTION_CHARACTER_MAX))
{
return SCE_NP_CUSTOM_MENU_ERROR_EXCEEDS_MAX;
}
}
return CELL_OK;
}
@ -2184,6 +2202,8 @@ error_code sceNpCustomMenuActionSetActivation(vm::cptr<SceNpCustomMenuIndexArray
return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED;
}
// TODO: SCE_NP_CUSTOM_MENU_ERROR_NOT_REGISTERED
if (!array)
{
return SCE_NP_CUSTOM_MENU_ERROR_INVALID_ARGUMENT;
@ -2203,17 +2223,18 @@ error_code sceNpCustomMenuRegisterExceptionList(vm::cptr<SceNpCustomMenuActionEx
return SCE_NP_CUSTOM_MENU_ERROR_NOT_INITIALIZED;
}
// TODO: SCE_NP_CUSTOM_MENU_ERROR_NOT_REGISTERED
if (numItems > SCE_NP_CUSTOM_MENU_EXCEPTION_ITEMS_MAX)
{
return SCE_NP_CUSTOM_MENU_ERROR_EXCEEDS_MAX;
}
if (!items)
{
return SCE_NP_CUSTOM_MENU_ERROR_INVALID_ARGUMENT;
}
if (numItems > SCE_NP_CUSTOM_MENU_ACTION_ITEMS_MAX)
{
// TODO: what about SCE_NP_CUSTOM_MENU_ACTION_ITEMS_TOTAL_MAX
return SCE_NP_CUSTOM_MENU_ERROR_EXCEEDS_MAX;
}
return CELL_OK;
}

View File

@ -1205,7 +1205,7 @@ struct SceNpSignalingNetInfo
struct SceNpCustomMenuAction
{
be_t<u32> options;
char name[SCE_NP_CUSTOM_MENU_ACTION_CHARACTER_MAX];
vm::bcptr<char> name;
be_t<SceNpCustomMenuActionMask> mask;
};