diff --git a/rpcs3/Emu/Cell/Modules/sceNp2.cpp b/rpcs3/Emu/Cell/Modules/sceNp2.cpp index 56249c4204..f5eadc8fe3 100644 --- a/rpcs3/Emu/Cell/Modules/sceNp2.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNp2.cpp @@ -178,6 +178,31 @@ error_code sceNpMatching2Init2(u64 stackSize, s32 priority, vm::ptr *nph, SceNpMatching2ContextId ctxId, vm::cptr reqParam, vm::ptr assignedReqId) +{ + if (!nph->is_NP2_Match2_init) + { + return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; + } + + if (!reqParam || !assignedReqId) + { + return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + } + + if (!ctxId) + { + return SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID; + } + + if (!check_match2_context(ctxId)) + { + return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND; + } + + return CELL_OK; +} + error_code sceNp2Init(u32 poolsize, vm::ptr poolptr) { sceNp2.warning("sceNp2Init(poolsize=0x%x, poolptr=*0x%x)", poolsize, poolptr); @@ -306,15 +331,9 @@ error_code sceNpMatching2LeaveLobby( sceNp2.todo("sceNpMatching2LeaveLobby(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -340,20 +359,9 @@ error_code sceNpMatching2GetWorldInfoList( sceNp2.warning("sceNpMatching2GetWorldInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; - } - - if (!check_match2_context(ctxId)) - { - return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND; + return res; } if (reqParam->serverId == 0) @@ -386,15 +394,9 @@ error_code sceNpMatching2GetLobbyMemberDataInternalList(SceNpMatching2ContextId sceNp2.todo("sceNpMatching2GetLobbyMemberDataInternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -406,15 +408,9 @@ error_code sceNpMatching2SearchRoom( sceNp2.warning("sceNpMatching2SearchRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } *assignedReqId = nph->search_room(ctxId, optParam, reqParam.get_ptr()); @@ -463,15 +459,9 @@ error_code sceNpMatching2SetUserInfo( sceNp2.todo("sceNpMatching2SetUserInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -497,15 +487,9 @@ error_code sceNpMatching2GetLobbyMemberDataInternal( sceNp2.todo("sceNpMatching2GetLobbyMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -543,15 +527,9 @@ error_code sceNpMatching2CreateServerContext( sceNp2.warning("sceNpMatching2CreateServerContext(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } if (reqParam->serverId == 0) @@ -584,15 +562,9 @@ error_code sceNpMatching2LeaveRoom( sceNp2.warning("sceNpMatching2LeaveRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } *assignedReqId = nph->leave_room(ctxId, optParam, reqParam.get_ptr()); @@ -606,15 +578,9 @@ error_code sceNpMatching2SetRoomDataExternal( sceNp2.warning("sceNpMatching2SetRoomDataExternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } *assignedReqId = nph->set_roomdata_external(ctxId, optParam, reqParam.get_ptr()); @@ -675,20 +641,9 @@ error_code sceNpMatching2SendRoomMessage( sceNp2.todo("sceNpMatching2SendRoomMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; - } - - if (!ctxId || !check_match2_context(ctxId)) - { - return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND; + return res; } *assignedReqId = nph->send_room_message(ctxId, optParam, reqParam.get_ptr()); @@ -702,15 +657,9 @@ error_code sceNpMatching2JoinLobby( sceNp2.todo("sceNpMatching2JoinLobby(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -722,15 +671,9 @@ error_code sceNpMatching2GetRoomMemberDataExternalList(SceNpMatching2ContextId c sceNp2.todo("sceNpMatching2GetRoomMemberDataExternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -756,15 +699,9 @@ error_code sceNpMatching2GetServerInfo( sceNp2.warning("sceNpMatching2GetServerInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } *assignedReqId = nph->get_server_status(ctxId, optParam, reqParam->serverId); @@ -811,15 +748,9 @@ error_code sceNpMatching2SendLobbyChatMessage( sceNp2.todo("sceNpMatching2SendLobbyChatMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -859,15 +790,9 @@ error_code sceNpMatching2JoinRoom( sceNp2.warning("sceNpMatching2JoinRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } *assignedReqId = nph->join_room(ctxId, optParam, reqParam.get_ptr()); @@ -911,15 +836,9 @@ error_code sceNpMatching2KickoutRoomMember( sceNp2.todo("sceNpMatching2KickoutRoomMember(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -936,6 +855,11 @@ error_code sceNpMatching2ContextStartAsync(SceNpMatching2ContextId ctxId, u32 ti return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } + if (!ctxId) + { + return SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID; + } + const auto ctx = get_match2_context(ctxId); if (!ctx) return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND; @@ -957,15 +881,9 @@ error_code sceNpMatching2SetSignalingOptParam( sceNp2.todo("sceNpMatching2SetSignalingOptParam(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -982,6 +900,11 @@ error_code sceNpMatching2RegisterContextCallback(SceNpMatching2ContextId ctxId, return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; } + if (!ctxId) + { + return SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID; + } + const auto ctx = get_match2_context(ctxId); if (!ctx) return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND; @@ -998,15 +921,9 @@ error_code sceNpMatching2SendRoomChatMessage( sceNp2.todo("sceNpMatching2SendRoomChatMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -1018,15 +935,9 @@ error_code sceNpMatching2SetRoomDataInternal( sceNp2.todo("sceNpMatching2SetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } *assignedReqId = nph->set_roomdata_internal(ctxId, optParam, reqParam.get_ptr()); @@ -1040,15 +951,9 @@ error_code sceNpMatching2GetRoomDataInternal( sceNp2.todo("sceNpMatching2GetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } *assignedReqId = nph->get_roomdata_internal(ctxId, optParam, reqParam.get_ptr()); @@ -1062,15 +967,9 @@ error_code sceNpMatching2SignalingGetPingInfo( sceNp2.warning("sceNpMatching2SignalingGetPingInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } *assignedReqId = nph->get_ping_info(ctxId, optParam, reqParam.get_ptr()); @@ -1133,15 +1032,9 @@ error_code sceNpMatching2GrantRoomOwner( sceNp2.todo("sceNpMatching2GrantRoomOwner(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -1220,15 +1113,9 @@ error_code sceNpMatching2GetUserInfoList( sceNp2.todo("sceNpMatching2GetUserInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -1240,15 +1127,9 @@ error_code sceNpMatching2GetRoomMemberDataInternal( sceNp2.todo("sceNpMatching2GetRoomMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -1260,15 +1141,9 @@ error_code sceNpMatching2SetRoomMemberDataInternal( sceNp2.todo("sceNpMatching2SetRoomMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -1280,15 +1155,9 @@ error_code sceNpMatching2JoinProhibitiveRoom( sceNp2.warning("sceNpMatching2JoinProhibitiveRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } // TODO: add blocked users @@ -1317,15 +1186,9 @@ error_code sceNpMatching2DeleteServerContext( sceNp2.todo("sceNpMatching2DeleteServerContext(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -1394,15 +1257,9 @@ error_code sceNpMatching2GetRoomDataExternalList( sceNp2.todo("sceNpMatching2GetRoomDataExternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -1414,15 +1271,9 @@ error_code sceNpMatching2CreateJoinRoom( sceNp2.warning("sceNpMatching2CreateJoinRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } *assignedReqId = nph->create_join_room(ctxId, optParam, reqParam.get_ptr()); @@ -1450,15 +1301,9 @@ error_code sceNpMatching2GetLobbyInfoList( sceNp2.todo("sceNpMatching2GetLobbyInfoList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -1485,15 +1330,9 @@ error_code sceNpMatching2SendLobbyInvitation( sceNp2.todo("sceNpMatching2SendLobbyInvitation(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK; @@ -1534,15 +1373,9 @@ error_code sceNpMatching2SetLobbyMemberDataInternal( sceNp2.todo("sceNpMatching2SetLobbyMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId); const auto nph = g_fxo->get>(); - - if (!nph->is_NP2_Match2_init) + if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK) { - return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED; - } - - if (!reqParam || !assignedReqId) - { - return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT; + return res; } return CELL_OK;