diff --git a/rpcs3/Emu/Cell/Modules/sceNp.cpp b/rpcs3/Emu/Cell/Modules/sceNp.cpp index 6432678dc3..638f7600ee 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNp.cpp @@ -2165,11 +2165,29 @@ error_code sceNpCustomMenuRegisterActions(vm::cptr 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 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; } diff --git a/rpcs3/Emu/Cell/Modules/sceNp.h b/rpcs3/Emu/Cell/Modules/sceNp.h index f3d9e04289..01fda93ccc 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp.h +++ b/rpcs3/Emu/Cell/Modules/sceNp.h @@ -1205,7 +1205,7 @@ struct SceNpSignalingNetInfo struct SceNpCustomMenuAction { be_t options; - char name[SCE_NP_CUSTOM_MENU_ACTION_CHARACTER_MAX]; + vm::bcptr name; be_t mask; };