mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-13 07:14:49 +00:00
rpcn 0.3.5 (#9227)
This commit is contained in:
parent
b32d989a10
commit
a83df01bfd
@ -365,6 +365,7 @@ target_sources(rpcs3_emu PRIVATE
|
||||
# Np
|
||||
target_sources(rpcs3_emu PRIVATE
|
||||
NP/fb_helpers.cpp
|
||||
NP/np_contexts.cpp
|
||||
NP/np_handler.cpp
|
||||
NP/signaling_handler.cpp
|
||||
NP/np_structs_extra.cpp
|
||||
|
@ -318,7 +318,16 @@ error_code cellSysutilAvc2SetStreamPriority(u8 priority)
|
||||
|
||||
error_code cellSysutilAvc2LeaveChatRequest()
|
||||
{
|
||||
cellSysutilAvc2.todo("cellSysutilAvc2LeaveChatRequest()");
|
||||
cellSysutilAvc2.notice("cellSysutilAvc2LeaveChatRequest()");
|
||||
|
||||
if (avc2_cb)
|
||||
{
|
||||
sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32 {
|
||||
avc2_cb(cb_ppu, CELL_AVC2_EVENT_LEAVE_SUCCEEDED, 0, avc2_cb_arg);
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "cellSysutil.h"
|
||||
|
||||
#include "Emu/NP/np_handler.h"
|
||||
#include "Emu/NP/np_contexts.h"
|
||||
|
||||
LOG_CHANNEL(sceNp);
|
||||
|
||||
@ -1955,7 +1956,7 @@ error_code sceNpLookupTerm()
|
||||
|
||||
error_code sceNpLookupCreateTitleCtx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpId> selfNpId)
|
||||
{
|
||||
sceNp.warning("sceNpLookupCreateTitleCtx(communicationId=*0x%x, selfNpId=0x%x)", communicationId, selfNpId);
|
||||
sceNp.warning("sceNpLookupCreateTitleCtx(communicationId=*0x%x(%s), selfNpId=0x%x)", communicationId, communicationId->data, selfNpId);
|
||||
|
||||
const auto nph = g_fxo->get<named_thread<np_handler>>();
|
||||
|
||||
@ -1969,7 +1970,7 @@ error_code sceNpLookupCreateTitleCtx(vm::cptr<SceNpCommunicationId> communicatio
|
||||
return SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT;
|
||||
}
|
||||
|
||||
return not_an_error(nph->create_lookup_title_context(communicationId));
|
||||
return not_an_error(create_lookup_title_context(communicationId));
|
||||
}
|
||||
|
||||
error_code sceNpLookupDestroyTitleCtx(s32 titleCtxId)
|
||||
@ -1983,7 +1984,7 @@ error_code sceNpLookupDestroyTitleCtx(s32 titleCtxId)
|
||||
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!nph->destroy_lookup_title_context(titleCtxId))
|
||||
if (!destroy_lookup_title_context(titleCtxId))
|
||||
return SCE_NP_COMMUNITY_ERROR_INVALID_ID;
|
||||
|
||||
return CELL_OK;
|
||||
@ -2005,7 +2006,7 @@ error_code sceNpLookupCreateTransactionCtx(s32 titleCtxId)
|
||||
return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID;
|
||||
}
|
||||
|
||||
return not_an_error(nph->create_lookup_transaction_context(titleCtxId));
|
||||
return not_an_error(create_lookup_transaction_context(titleCtxId));
|
||||
}
|
||||
|
||||
error_code sceNpLookupDestroyTransactionCtx(s32 transId)
|
||||
@ -2019,7 +2020,7 @@ error_code sceNpLookupDestroyTransactionCtx(s32 transId)
|
||||
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!nph->destroy_lookup_transaction_context(transId))
|
||||
if (!destroy_lookup_transaction_context(transId))
|
||||
{
|
||||
return SCE_NP_COMMUNITY_ERROR_INVALID_ID;
|
||||
}
|
||||
@ -2426,7 +2427,9 @@ error_code sceNpLookupTitleSmallStorageAsync(s32 transId, vm::ptr<void> data, u6
|
||||
return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID;
|
||||
}
|
||||
|
||||
// TSS are game specific data we don't have access to, set buf to 0, return size 0
|
||||
std::memset(data.get_ptr(), 0, maxSize);
|
||||
*contentLength = 0;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -3274,7 +3277,7 @@ error_code sceNpScoreCreateTitleCtx(vm::cptr<SceNpCommunicationId> communication
|
||||
return SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT;
|
||||
}
|
||||
|
||||
return not_an_error(nph->create_score_context(communicationId, passphrase));
|
||||
return not_an_error(create_score_context(communicationId, passphrase));
|
||||
}
|
||||
|
||||
error_code sceNpScoreDestroyTitleCtx(s32 titleCtxId)
|
||||
@ -3288,7 +3291,7 @@ error_code sceNpScoreDestroyTitleCtx(s32 titleCtxId)
|
||||
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!nph->destroy_score_context(titleCtxId))
|
||||
if (!destroy_score_context(titleCtxId))
|
||||
return SCE_NP_COMMUNITY_ERROR_INVALID_ID;
|
||||
|
||||
return CELL_OK;
|
||||
@ -3310,7 +3313,7 @@ error_code sceNpScoreCreateTransactionCtx(s32 titleCtxId)
|
||||
return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID;
|
||||
}
|
||||
|
||||
return not_an_error(nph->create_score_transaction_context(titleCtxId));
|
||||
return not_an_error(create_score_transaction_context(titleCtxId));
|
||||
}
|
||||
|
||||
error_code sceNpScoreDestroyTransactionCtx(s32 transId)
|
||||
@ -4386,7 +4389,7 @@ error_code sceNpSignalingCreateCtx(vm::ptr<SceNpId> npId, vm::ptr<SceNpSignaling
|
||||
// return SCE_NP_SIGNALING_ERROR_CTX_MAX;
|
||||
//}
|
||||
|
||||
*ctx_id = nph->create_signaling_context(npId, handler, arg);
|
||||
*ctx_id = create_signaling_context(npId, handler, arg);
|
||||
|
||||
const auto sigh = g_fxo->get<named_thread<signaling_handler>>();
|
||||
sigh->set_sig_cb(*ctx_id, handler, arg);
|
||||
@ -4405,7 +4408,7 @@ error_code sceNpSignalingDestroyCtx(u32 ctx_id)
|
||||
return SCE_NP_SIGNALING_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!nph->destroy_signaling_context(ctx_id))
|
||||
if (!destroy_signaling_context(ctx_id))
|
||||
{
|
||||
return SCE_NP_SIGNALING_ERROR_CTX_NOT_FOUND;
|
||||
}
|
||||
@ -4740,10 +4743,10 @@ error_code sceNpUtilCmpNpIdInOrder(vm::cptr<SceNpId> id1, vm::cptr<SceNpId> id2,
|
||||
return SCE_NP_UTIL_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (id1->reserved[0] != 1 || id2->reserved[0] != 1)
|
||||
{
|
||||
return SCE_NP_UTIL_ERROR_INVALID_NP_ID;
|
||||
}
|
||||
// if (id1->reserved[0] != 1 || id2->reserved[0] != 1)
|
||||
// {
|
||||
// return SCE_NP_UTIL_ERROR_INVALID_NP_ID;
|
||||
// }
|
||||
|
||||
if (s32 res = strncmp(id1->handle.data, id2->handle.data, 16))
|
||||
{
|
||||
@ -4787,10 +4790,10 @@ error_code sceNpUtilCmpOnlineId(vm::cptr<SceNpId> id1, vm::cptr<SceNpId> id2)
|
||||
return SCE_NP_UTIL_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (id1->reserved[0] != 1 || id2->reserved[0] != 1)
|
||||
{
|
||||
return SCE_NP_UTIL_ERROR_INVALID_NP_ID;
|
||||
}
|
||||
// if (id1->reserved[0] != 1 || id2->reserved[0] != 1)
|
||||
// {
|
||||
// return SCE_NP_UTIL_ERROR_INVALID_NP_ID;
|
||||
// }
|
||||
|
||||
if (strncmp(id1->handle.data, id2->handle.data, 16) != 0)
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "sceNp.h"
|
||||
#include "sceNp2.h"
|
||||
#include "Emu/NP/np_handler.h"
|
||||
#include "Emu/NP/np_contexts.h"
|
||||
#include "cellSysutil.h"
|
||||
|
||||
LOG_CHANNEL(sceNp2);
|
||||
@ -293,7 +294,7 @@ error_code sceNpMatching2DestroyContext(SceNpMatching2ContextId ctxId)
|
||||
return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!nph->destroy_match2_context(ctxId))
|
||||
if (!destroy_match2_context(ctxId))
|
||||
return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND;
|
||||
|
||||
return CELL_OK;
|
||||
@ -350,6 +351,16 @@ error_code sceNpMatching2GetWorldInfoList(
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (!check_match2_context(ctxId))
|
||||
{
|
||||
return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (reqParam->serverId == 0)
|
||||
{
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID;
|
||||
}
|
||||
|
||||
*assignedReqId = nph->get_world_list(ctxId, optParam, reqParam->serverId);
|
||||
|
||||
return CELL_OK;
|
||||
@ -511,9 +522,9 @@ error_code sceNpMatching2ContextStart(SceNpMatching2ContextId ctxId)
|
||||
return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
const auto ctx = nph->get_match2_context(ctxId);
|
||||
const auto ctx = get_match2_context(ctxId);
|
||||
if (!ctx)
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID;
|
||||
return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND;
|
||||
|
||||
if (ctx->context_callback)
|
||||
{
|
||||
@ -522,7 +533,6 @@ error_code sceNpMatching2ContextStart(SceNpMatching2ContextId ctxId)
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -544,6 +554,11 @@ error_code sceNpMatching2CreateServerContext(
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (reqParam->serverId == 0)
|
||||
{
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID;
|
||||
}
|
||||
|
||||
*assignedReqId = nph->create_server_context(ctxId, optParam, reqParam->serverId);
|
||||
|
||||
return CELL_OK;
|
||||
@ -671,6 +686,11 @@ error_code sceNpMatching2SendRoomMessage(
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (!ctxId || !check_match2_context(ctxId))
|
||||
{
|
||||
return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND;
|
||||
}
|
||||
|
||||
*assignedReqId = nph->send_room_message(ctxId, optParam, reqParam.get_ptr());
|
||||
|
||||
return CELL_OK;
|
||||
@ -916,9 +936,9 @@ error_code sceNpMatching2ContextStartAsync(SceNpMatching2ContextId ctxId, u32 ti
|
||||
return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
const auto ctx = nph->get_match2_context(ctxId);
|
||||
const auto ctx = get_match2_context(ctxId);
|
||||
if (!ctx)
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID;
|
||||
return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND;
|
||||
|
||||
if (ctx->context_callback)
|
||||
{
|
||||
@ -962,9 +982,9 @@ error_code sceNpMatching2RegisterContextCallback(SceNpMatching2ContextId ctxId,
|
||||
return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
const auto ctx = nph->get_match2_context(ctxId);
|
||||
const auto ctx = get_match2_context(ctxId);
|
||||
if (!ctx)
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID;
|
||||
return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND;
|
||||
|
||||
ctx->context_callback = cbFunc;
|
||||
ctx->context_callback_param = cbFuncArg;
|
||||
@ -1039,7 +1059,7 @@ error_code sceNpMatching2GetRoomDataInternal(
|
||||
error_code sceNpMatching2SignalingGetPingInfo(
|
||||
SceNpMatching2ContextId ctxId, vm::cptr<SceNpMatching2SignalingGetPingInfoRequest> reqParam, vm::cptr<SceNpMatching2RequestOptParam> optParam, vm::ptr<SceNpMatching2RequestId> assignedReqId)
|
||||
{
|
||||
sceNp2.todo("sceNpMatching2SignalingGetPingInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
|
||||
sceNp2.warning("sceNpMatching2SignalingGetPingInfo(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
|
||||
|
||||
const auto nph = g_fxo->get<named_thread<np_handler>>();
|
||||
|
||||
@ -1069,6 +1089,11 @@ error_code sceNpMatching2GetServerIdListLocal(SceNpMatching2ContextId ctxId, vm:
|
||||
return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!check_match2_context(ctxId))
|
||||
{
|
||||
return SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND;
|
||||
}
|
||||
|
||||
const auto slist = nph->get_match2_server_list(ctxId);
|
||||
|
||||
u32 num_servs = std::min(static_cast<u32>(slist.size()), serverIdNum);
|
||||
@ -1081,7 +1106,7 @@ error_code sceNpMatching2GetServerIdListLocal(SceNpMatching2ContextId ctxId, vm:
|
||||
}
|
||||
}
|
||||
|
||||
return not_an_error(static_cast<s32>(num_servs));
|
||||
return not_an_error(static_cast<s32>(slist.size()));
|
||||
}
|
||||
|
||||
error_code sceNpUtilBuildCdnUrl(vm::cptr<char> url, vm::ptr<char> buf, u64 bufSize, vm::ptr<u64> required, vm::ptr<void> option)
|
||||
@ -1125,7 +1150,7 @@ error_code sceNpMatching2GrantRoomOwner(
|
||||
error_code sceNpMatching2CreateContext(
|
||||
vm::cptr<SceNpId> npId, vm::cptr<SceNpCommunicationId> commId, vm::cptr<SceNpCommunicationPassphrase> passPhrase, vm::ptr<SceNpMatching2ContextId> ctxId, s32 option)
|
||||
{
|
||||
sceNp2.todo("sceNpMatching2CreateContext(npId=*0x%x, commId=*0x%x, passPhrase=*0x%x, ctxId=*0x%x, option=%d)", npId, commId, passPhrase, ctxId, option);
|
||||
sceNp2.warning("sceNpMatching2CreateContext(npId=*0x%x, commId=*0x%x(%s), passPhrase=*0x%x, ctxId=*0x%x, option=%d)", npId, commId, commId->data, ctxId, option);
|
||||
|
||||
const auto nph = g_fxo->get<named_thread<np_handler>>();
|
||||
|
||||
@ -1139,7 +1164,7 @@ error_code sceNpMatching2CreateContext(
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
*ctxId = nph->create_match2_context(commId, passPhrase);
|
||||
*ctxId = create_match2_context(commId, passPhrase);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -1252,7 +1277,7 @@ error_code sceNpMatching2SetRoomMemberDataInternal(
|
||||
error_code sceNpMatching2JoinProhibitiveRoom(
|
||||
SceNpMatching2ContextId ctxId, vm::cptr<SceNpMatching2JoinProhibitiveRoomRequest> reqParam, vm::cptr<SceNpMatching2RequestOptParam> optParam, vm::ptr<SceNpMatching2RequestId> assignedReqId)
|
||||
{
|
||||
sceNp2.todo("sceNpMatching2JoinProhibitiveRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
|
||||
sceNp2.warning("sceNpMatching2JoinProhibitiveRoom(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
|
||||
|
||||
const auto nph = g_fxo->get<named_thread<np_handler>>();
|
||||
|
||||
@ -1266,6 +1291,9 @@ error_code sceNpMatching2JoinProhibitiveRoom(
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
// TODO: add blocked users
|
||||
*assignedReqId = nph->join_room(ctxId, optParam, &reqParam->joinParam);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -1319,7 +1347,7 @@ error_code sceNpMatching2SetDefaultRequestOptParam(SceNpMatching2ContextId ctxId
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
const auto ctx = nph->get_match2_context(ctxId);
|
||||
const auto ctx = get_match2_context(ctxId);
|
||||
if (!ctx)
|
||||
return SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID;
|
||||
|
||||
@ -1482,7 +1510,7 @@ error_code sceNpMatching2ContextStop(SceNpMatching2ContextId ctxId)
|
||||
return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
const auto ctx = nph->get_match2_context(ctxId);
|
||||
const auto ctx = get_match2_context(ctxId);
|
||||
|
||||
if (!ctx)
|
||||
{
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "cellSysutil.h"
|
||||
|
||||
#include "Emu/NP/np_handler.h"
|
||||
#include "Emu/NP/np_contexts.h"
|
||||
|
||||
LOG_CHANNEL(sceNpCommerce2);
|
||||
|
||||
@ -98,7 +99,7 @@ error_code sceNpCommerce2CreateCtx(u32 version, vm::cptr<SceNpId> npId, vm::ptr<
|
||||
sceNpCommerce2.warning("sceNpCommerce2CreateCtx(version=%d, npId=*0x%x, handler=*0x%x, arg=*0x%x, ctx_id=*0x%x)", version, npId, handler, arg, ctx_id);
|
||||
const auto nph = g_fxo->get<named_thread<np_handler>>();
|
||||
|
||||
*ctx_id = nph->create_commerce2_context(version, npId, handler, arg);
|
||||
*ctx_id = create_commerce2_context(version, npId, handler, arg);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -108,7 +109,7 @@ s32 sceNpCommerce2DestroyCtx(u32 ctx_id)
|
||||
sceNpCommerce2.warning("sceNpCommerce2DestroyCtx(ctx_id=%d)", ctx_id);
|
||||
const auto nph = g_fxo->get<named_thread<np_handler>>();
|
||||
|
||||
nph->destroy_commerce2_context(ctx_id);
|
||||
destroy_commerce2_context(ctx_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -119,7 +120,7 @@ s32 sceNpCommerce2EmptyStoreCheckStart(u32 ctx_id, s32 store_check_type, vm::cpt
|
||||
|
||||
const auto nph = g_fxo->get<named_thread<np_handler>>();
|
||||
|
||||
const auto ctx = nph->get_commerce2_context(ctx_id);
|
||||
const auto ctx = get_commerce2_context(ctx_id);
|
||||
|
||||
if (ctx->context_callback)
|
||||
{
|
||||
@ -150,7 +151,7 @@ s32 sceNpCommerce2CreateSessionStart(u32 ctx_id)
|
||||
sceNpCommerce2.warning("sceNpCommerce2CreateSessionStart(ctx_id=%d)", ctx_id);
|
||||
const auto nph = g_fxo->get<named_thread<np_handler>>();
|
||||
|
||||
const auto ctx = nph->get_commerce2_context(ctx_id);
|
||||
const auto ctx = get_commerce2_context(ctx_id);
|
||||
|
||||
if (ctx->context_callback)
|
||||
{
|
||||
|
@ -340,6 +340,8 @@ error_code sceNpTusWaitAsync(s32 transId, vm::ptr<s32> result)
|
||||
{
|
||||
sceNpTus.todo("sceNpTusWaitAsync(transId=%d, result=*0x%x)", transId, result);
|
||||
|
||||
*result = 0;
|
||||
|
||||
const bool processing_completed = true;
|
||||
return not_an_error(processing_completed ? 0 : 1);
|
||||
}
|
||||
@ -348,6 +350,8 @@ error_code sceNpTusPollAsync(s32 transId, vm::ptr<s32> result)
|
||||
{
|
||||
sceNpTus.todo("sceNpTusPollAsync(transId=%d, result=*0x%x)", transId, result);
|
||||
|
||||
*result = 0;
|
||||
|
||||
const bool processing_completed = true;
|
||||
return not_an_error(processing_completed ? 0 : 1);
|
||||
}
|
||||
@ -1438,6 +1442,11 @@ error_code sceNpTusGetDataAsync(s32 transId, vm::cptr<SceNpId> targetNpId, SceNp
|
||||
return SCE_NP_COMMUNITY_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
memcpy(&dataStatus->ownerId, targetNpId.get_ptr(), sizeof(SceNpId));
|
||||
memcpy(&dataStatus->lastChangedAuthorId, targetNpId.get_ptr(), sizeof(SceNpId));
|
||||
dataStatus->hasData = 0;
|
||||
dataStatus->dataSize = 0;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -747,6 +747,25 @@ struct nt_p2p_port
|
||||
}
|
||||
|
||||
sock->p2ps.backlog.push(new_sock_id);
|
||||
if (sock->events.test_and_reset(lv2_socket::poll::read))
|
||||
{
|
||||
bs_t<lv2_socket::poll> events = lv2_socket::poll::read;
|
||||
for (auto it = sock->queue.begin(); events && it != sock->queue.end();)
|
||||
{
|
||||
if (it->second(events))
|
||||
{
|
||||
it = sock->queue.erase(it);
|
||||
continue;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
|
||||
if (sock->queue.empty())
|
||||
{
|
||||
sock->events.store({});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (tcp_header->flags == lv2_socket::p2ps_i::SYN)
|
||||
{
|
||||
@ -878,7 +897,7 @@ struct nt_p2p_port
|
||||
|
||||
if (sp_size < sizeof(lv2_socket::p2ps_i::encapsulated_tcp))
|
||||
{
|
||||
sys_net.trace("Received P2P packet targeted at unbound vport(likely) or invalid");
|
||||
sys_net.trace("Received P2P packet targeted at unbound vport(likely) or invalid(vport=%d)", dst_vport);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -887,7 +906,7 @@ struct nt_p2p_port
|
||||
// Validate signature & length
|
||||
if (tcp_header->signature != lv2_socket::p2ps_i::U2S_sig)
|
||||
{
|
||||
sys_net.trace("Received P2P packet targeted at unbound vport");
|
||||
sys_net.trace("Received P2P packet targeted at unbound vport(vport=%d)", dst_vport);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1213,8 +1232,8 @@ error_code sys_net_bnet_accept(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sockaddr>
|
||||
::sockaddr_storage native_addr;
|
||||
::socklen_t native_addrlen = sizeof(native_addr);
|
||||
s32 result = 0;
|
||||
|
||||
bool p2ps = false;
|
||||
s32 p2ps_result = 0;
|
||||
|
||||
const auto sock = idm::check<lv2_socket>(s, [&](lv2_socket& sock)
|
||||
{
|
||||
@ -1222,27 +1241,54 @@ error_code sys_net_bnet_accept(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sockaddr>
|
||||
|
||||
if (sock.type == SYS_NET_SOCK_STREAM_P2P)
|
||||
{
|
||||
const auto accept_success = [&]()
|
||||
{
|
||||
p2ps_result = sock.p2ps.backlog.front();
|
||||
sock.p2ps.backlog.pop();
|
||||
|
||||
if (addr)
|
||||
{
|
||||
auto* sock_client = idm::check_unlocked<lv2_socket>(p2ps_result);
|
||||
std::lock_guard slock(sock_client->mutex);
|
||||
sys_net_sockaddr_in_p2p* addr_p2p = reinterpret_cast<sys_net_sockaddr_in_p2p*>(addr.get_ptr());
|
||||
addr_p2p->sin_family = AF_INET;
|
||||
addr_p2p->sin_addr = std::bit_cast<be_t<u32>, u32>(sock_client->p2ps.op_addr);
|
||||
addr_p2p->sin_port = sock_client->p2ps.op_vport;
|
||||
addr_p2p->sin_vport = sock_client->p2ps.op_port;
|
||||
addr_p2p->sin_len = sizeof(sys_net_sockaddr_in_p2p);
|
||||
}
|
||||
};
|
||||
|
||||
p2ps = true;
|
||||
if (sock.p2ps.backlog.size() == 0)
|
||||
{
|
||||
result = SYS_NET_EWOULDBLOCK;
|
||||
if (sock.so_nbio)
|
||||
{
|
||||
result = SYS_NET_EWOULDBLOCK;
|
||||
return false;
|
||||
}
|
||||
|
||||
sock.events += lv2_socket::poll::read;
|
||||
sock.queue.emplace_back(ppu.id, [&](bs_t<lv2_socket::poll> events) -> bool
|
||||
{
|
||||
if ((events & lv2_socket::poll::read) && sock.p2ps.backlog.size())
|
||||
{
|
||||
sys_net.trace("Now found a socket in backlog!");
|
||||
accept_success();
|
||||
lv2_obj::awake(&ppu);
|
||||
return true;
|
||||
}
|
||||
|
||||
sock.events += lv2_socket::poll::read;
|
||||
return false;
|
||||
});
|
||||
|
||||
lv2_obj::sleep(ppu);
|
||||
return false;
|
||||
}
|
||||
|
||||
sys_net.trace("Found a socket in backlog!");
|
||||
|
||||
p2ps = true;
|
||||
result = sock.p2ps.backlog.front();
|
||||
sock.p2ps.backlog.pop();
|
||||
|
||||
if (addr)
|
||||
{
|
||||
sys_net_sockaddr_in_p2p *addr_p2p = reinterpret_cast<sys_net_sockaddr_in_p2p *>(addr.get_ptr());
|
||||
addr_p2p->sin_family = AF_INET;
|
||||
addr_p2p->sin_addr = std::bit_cast<be_t<u32>, u32>(sock.p2ps.op_addr);
|
||||
addr_p2p->sin_port = std::bit_cast<be_t<u16>, u16>(sock.p2ps.op_vport);
|
||||
addr_p2p->sin_vport = std::bit_cast<be_t<u16>, u16>(sock.p2ps.op_port);
|
||||
addr_p2p->sin_len = sizeof(sys_net_sockaddr_in_p2p);
|
||||
}
|
||||
accept_success();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1302,11 +1348,6 @@ error_code sys_net_bnet_accept(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sockaddr>
|
||||
return -sys_net_error{result};
|
||||
}
|
||||
|
||||
if (p2ps)
|
||||
{
|
||||
return not_an_error(result);
|
||||
}
|
||||
|
||||
if (!sock.ret)
|
||||
{
|
||||
while (!ppu.state.test_and_reset(cpu_flag::signal))
|
||||
@ -1330,6 +1371,11 @@ error_code sys_net_bnet_accept(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sockaddr>
|
||||
}
|
||||
}
|
||||
|
||||
if (p2ps)
|
||||
{
|
||||
return not_an_error(p2ps_result);
|
||||
}
|
||||
|
||||
if (ppu.is_stopped())
|
||||
{
|
||||
return 0;
|
||||
@ -2180,7 +2226,7 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr<void> buf, u32
|
||||
::sockaddr_storage native_addr;
|
||||
::socklen_t native_addrlen = sizeof(native_addr);
|
||||
sys_net_error result{};
|
||||
std::vector<u8> _buf;
|
||||
std::vector<u8> _buf(len);
|
||||
|
||||
if (flags & SYS_NET_MSG_PEEK)
|
||||
{
|
||||
@ -2244,39 +2290,76 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr<void> buf, u32
|
||||
|
||||
if (sock.type == SYS_NET_SOCK_STREAM_P2P)
|
||||
{
|
||||
const auto get_data = [&](unsigned char *dest_buf)
|
||||
{
|
||||
const u32 to_give = std::min(sock.p2ps.data_available, len);
|
||||
sys_net.trace("STREAM-P2P socket had %d available, given %d", sock.p2ps.data_available, to_give);
|
||||
|
||||
u32 left_to_give = to_give;
|
||||
while (left_to_give)
|
||||
{
|
||||
auto& cur_data = sock.p2ps.received_data.begin()->second;
|
||||
auto to_give_for_this_packet = std::min(static_cast<u32>(cur_data.size()), left_to_give);
|
||||
memcpy(reinterpret_cast<u8*>(dest_buf) + (to_give - left_to_give), cur_data.data(), to_give_for_this_packet);
|
||||
if (cur_data.size() != to_give_for_this_packet)
|
||||
{
|
||||
auto amount_left = cur_data.size() - to_give_for_this_packet;
|
||||
std::vector<u8> new_vec(amount_left);
|
||||
memcpy(new_vec.data(), cur_data.data() + to_give_for_this_packet, amount_left);
|
||||
auto new_key = (sock.p2ps.received_data.begin()->first) + to_give_for_this_packet;
|
||||
sock.p2ps.received_data.emplace(new_key, std::move(new_vec));
|
||||
}
|
||||
|
||||
sock.p2ps.received_data.erase(sock.p2ps.received_data.begin());
|
||||
|
||||
left_to_give -= to_give_for_this_packet;
|
||||
}
|
||||
|
||||
sock.p2ps.data_available -= to_give;
|
||||
sock.p2ps.data_beg_seq += to_give;
|
||||
native_result = to_give;
|
||||
|
||||
if (addr)
|
||||
{
|
||||
sys_net_sockaddr_in_p2p* addr_p2p = reinterpret_cast<sys_net_sockaddr_in_p2p*>(addr.get_ptr());
|
||||
addr_p2p->sin_family = AF_INET;
|
||||
addr_p2p->sin_addr = std::bit_cast<be_t<u32>, u32>(sock.p2ps.op_addr);
|
||||
addr_p2p->sin_port = sock.p2ps.op_vport;
|
||||
addr_p2p->sin_vport = sock.p2ps.op_port;
|
||||
addr_p2p->sin_len = sizeof(sys_net_sockaddr_in_p2p);
|
||||
}
|
||||
};
|
||||
|
||||
if (!sock.p2ps.data_available)
|
||||
{
|
||||
result = SYS_NET_EWOULDBLOCK;
|
||||
if (sock.so_nbio)
|
||||
{
|
||||
result = SYS_NET_EWOULDBLOCK;
|
||||
return false;
|
||||
}
|
||||
|
||||
sock.events += lv2_socket::poll::read;
|
||||
sock.queue.emplace_back(ppu.id, [&](bs_t<lv2_socket::poll> events) -> bool
|
||||
{
|
||||
if (events & lv2_socket::poll::read)
|
||||
{
|
||||
if (sock.p2ps.data_available)
|
||||
{
|
||||
get_data(_buf.data());
|
||||
lv2_obj::awake(&ppu);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
sock.events += lv2_socket::poll::read;
|
||||
return false;
|
||||
});
|
||||
|
||||
lv2_obj::sleep(ppu);
|
||||
return false;
|
||||
}
|
||||
|
||||
const u32 to_give = std::min(sock.p2ps.data_available, len);
|
||||
sys_net.trace("STREAM-P2P socket had %d available, given %d", sock.p2ps.data_available, to_give);
|
||||
|
||||
u32 left_to_give = to_give;
|
||||
while (left_to_give)
|
||||
{
|
||||
auto& cur_data = sock.p2ps.received_data.begin()->second;
|
||||
auto to_give_for_this_packet = std::min(static_cast<u32>(cur_data.size()), left_to_give);
|
||||
memcpy(reinterpret_cast<u8 *>(buf.get_ptr()) + (to_give - left_to_give), cur_data.data(), to_give_for_this_packet);
|
||||
if (cur_data.size() != to_give_for_this_packet)
|
||||
{
|
||||
auto amount_left = cur_data.size() - to_give_for_this_packet;
|
||||
std::vector<u8> new_vec(amount_left);
|
||||
memcpy(new_vec.data(), cur_data.data() + to_give_for_this_packet, amount_left);
|
||||
auto new_key = (sock.p2ps.received_data.begin()->first) + to_give_for_this_packet;
|
||||
sock.p2ps.received_data.emplace(new_key, std::move(new_vec));
|
||||
}
|
||||
|
||||
sock.p2ps.received_data.erase(sock.p2ps.received_data.begin());
|
||||
|
||||
left_to_give -= to_give_for_this_packet;
|
||||
}
|
||||
|
||||
sock.p2ps.data_available -= to_give;
|
||||
sock.p2ps.data_beg_seq += to_give;
|
||||
native_result = to_give;
|
||||
|
||||
get_data(reinterpret_cast<unsigned char *>(buf.get_ptr()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2333,7 +2416,6 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr<void> buf, u32
|
||||
|
||||
// Enable read event
|
||||
sock.events += lv2_socket::poll::read;
|
||||
_buf.resize(len);
|
||||
sock.queue.emplace_back(ppu.id, [&](bs_t<lv2_socket::poll> events) -> bool
|
||||
{
|
||||
if (events & lv2_socket::poll::read)
|
||||
@ -2709,11 +2791,6 @@ error_code sys_net_bnet_setsockopt(ppu_thread& ppu, s32 s, s32 level, s32 optnam
|
||||
{
|
||||
std::lock_guard lock(sock.mutex);
|
||||
|
||||
if (sock.type == SYS_NET_SOCK_DGRAM_P2P || sock.type == SYS_NET_SOCK_STREAM_P2P)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
if (optlen >= sizeof(s32))
|
||||
{
|
||||
native_int = *reinterpret_cast<be_t<s32> *>(optval_buf.data());
|
||||
@ -2723,6 +2800,16 @@ error_code sys_net_bnet_setsockopt(ppu_thread& ppu, s32 s, s32 level, s32 optnam
|
||||
return SYS_NET_EINVAL;
|
||||
}
|
||||
|
||||
if (sock.type == SYS_NET_SOCK_DGRAM_P2P || sock.type == SYS_NET_SOCK_STREAM_P2P)
|
||||
{
|
||||
if (level == SYS_NET_SOL_SOCKET && optname == SYS_NET_SO_NBIO)
|
||||
{
|
||||
sock.so_nbio = native_int;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
if (level == SYS_NET_SOL_SOCKET)
|
||||
{
|
||||
native_level = SOL_SOCKET;
|
||||
@ -2909,7 +2996,7 @@ error_code sys_net_bnet_shutdown(ppu_thread& ppu, s32 s, s32 how)
|
||||
std::lock_guard lock(sock.mutex);
|
||||
|
||||
// Shutdown of P2P socket is always successful
|
||||
if (sock.type == SYS_NET_SOCK_DGRAM_P2P)
|
||||
if (sock.type == SYS_NET_SOCK_DGRAM_P2P || sock.type == SYS_NET_SOCK_STREAM_P2P)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
@ -3033,7 +3120,7 @@ error_code sys_net_bnet_close(ppu_thread& ppu, s32 s)
|
||||
sys_net.error("CLOSE");
|
||||
|
||||
// If it's a bound socket we "close" the vport
|
||||
if (sock->type == SYS_NET_SOCK_DGRAM_P2P && sock->p2p.port && sock->p2p.vport)
|
||||
if ((sock->type == SYS_NET_SOCK_DGRAM_P2P || sock->type == SYS_NET_SOCK_STREAM_P2P) && sock->p2p.port && sock->p2p.vport)
|
||||
{
|
||||
const auto nc = g_fxo->get<network_context>();
|
||||
{
|
||||
@ -3041,7 +3128,23 @@ error_code sys_net_bnet_close(ppu_thread& ppu, s32 s)
|
||||
auto& p2p_port = nc->list_p2p_ports.at(sock->p2p.port);
|
||||
{
|
||||
std::lock_guard lock(p2p_port.bound_p2p_vports_mutex);
|
||||
p2p_port.bound_p2p_vports.erase(sock->p2p.vport);
|
||||
if (sock->type == SYS_NET_SOCK_DGRAM_P2P)
|
||||
{
|
||||
p2p_port.bound_p2p_vports.erase(sock->p2p.vport);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto it = p2p_port.bound_p2p_streams.begin(); it != p2p_port.bound_p2p_streams.end();)
|
||||
{
|
||||
if (it->second == s)
|
||||
{
|
||||
it = p2p_port.bound_p2p_streams.erase(it);
|
||||
continue;
|
||||
}
|
||||
it++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ void np_handler::SearchRoomReponse_to_SceNpMatching2SearchRoomResponse(const Sea
|
||||
{
|
||||
search_resp->roomDataExternal = room_info;
|
||||
}
|
||||
|
||||
|
||||
previous_next = vm::cast(room_info.addr());
|
||||
|
||||
room_info->serverId = room->serverId();
|
||||
@ -357,33 +357,27 @@ void np_handler::RoomMessageInfo_to_SceNpMatching2RoomMessageInfo(const RoomMess
|
||||
|
||||
if (sce_mi->castType != SCE_NP_MATCHING2_CASTTYPE_BROADCAST)
|
||||
{
|
||||
vm::ptr<SceNpMatching2RoomMessageDestination> dst_info(allocate(sizeof(SceNpMatching2RoomMessageDestination)));
|
||||
vm::ptr<SceNpMatching2RoomMessageDestination> dst_info(allocate(sizeof(SceNpMatching2RoomMessageDestination)));
|
||||
sce_mi->dst = dst_info;
|
||||
}
|
||||
|
||||
switch(sce_mi->castType)
|
||||
switch (sce_mi->castType)
|
||||
{
|
||||
case SCE_NP_MATCHING2_CASTTYPE_BROADCAST:
|
||||
break;
|
||||
case SCE_NP_MATCHING2_CASTTYPE_UNICAST:
|
||||
sce_mi->dst->unicastTarget = mi->dst()->Get(0);
|
||||
break;
|
||||
case SCE_NP_MATCHING2_CASTTYPE_MULTICAST:
|
||||
case SCE_NP_MATCHING2_CASTTYPE_BROADCAST: break;
|
||||
case SCE_NP_MATCHING2_CASTTYPE_UNICAST: sce_mi->dst->unicastTarget = mi->dst()->Get(0); break;
|
||||
case SCE_NP_MATCHING2_CASTTYPE_MULTICAST:
|
||||
{
|
||||
sce_mi->dst->multicastTarget.memberIdNum = mi->dst()->size();
|
||||
vm::ptr<be_t<u16>> member_list(allocate(sizeof(u16) * mi->dst()->size()));
|
||||
sce_mi->dst->multicastTarget.memberId = member_list;
|
||||
for (u32 i = 0; i < mi->dst()->size(); i++)
|
||||
{
|
||||
sce_mi->dst->multicastTarget.memberIdNum = mi->dst()->size();
|
||||
vm::ptr<be_t<u16>> member_list(allocate(sizeof(u16) * mi->dst()->size()));
|
||||
sce_mi->dst->multicastTarget.memberId = member_list;
|
||||
for (u32 i = 0; i < mi->dst()->size(); i++)
|
||||
{
|
||||
sce_mi->dst->multicastTarget.memberId[i] = mi->dst()->Get(i);
|
||||
}
|
||||
break;
|
||||
sce_mi->dst->multicastTarget.memberId[i] = mi->dst()->Get(i);
|
||||
}
|
||||
case SCE_NP_MATCHING2_CASTTYPE_MULTICAST_TEAM:
|
||||
sce_mi->dst->multicastTargetTeamId = mi->dst()->Get(0);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
break;
|
||||
}
|
||||
case SCE_NP_MATCHING2_CASTTYPE_MULTICAST_TEAM: sce_mi->dst->multicastTargetTeamId = mi->dst()->Get(0); break;
|
||||
default: ASSERT(false);
|
||||
}
|
||||
|
||||
if (auto src_member = mi->srcMember())
|
||||
|
117
rpcs3/Emu/NP/np_contexts.cpp
Normal file
117
rpcs3/Emu/NP/np_contexts.cpp
Normal file
@ -0,0 +1,117 @@
|
||||
#include "stdafx.h"
|
||||
#include "np_contexts.h"
|
||||
|
||||
#include "Emu/IdManager.h"
|
||||
|
||||
score_ctx::score_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
|
||||
{
|
||||
ASSERT(!communicationId->term && strlen(communicationId->data) == 9);
|
||||
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
|
||||
memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase));
|
||||
}
|
||||
s32 create_score_context(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
|
||||
{
|
||||
return static_cast<s32>(idm::make<score_ctx>(communicationId, passphrase));
|
||||
}
|
||||
bool destroy_score_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<score_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
|
||||
score_transaction_ctx::score_transaction_ctx(s32 score_context_id)
|
||||
{
|
||||
this->score_context_id = score_context_id;
|
||||
}
|
||||
s32 create_score_transaction_context(s32 score_context_id)
|
||||
{
|
||||
return static_cast<s32>(idm::make<score_transaction_ctx>(score_context_id));
|
||||
}
|
||||
bool destroy_score_transaction_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<score_transaction_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
|
||||
match2_ctx::match2_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
|
||||
{
|
||||
ASSERT(!communicationId->term && strlen(communicationId->data) == 9);
|
||||
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
|
||||
memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase));
|
||||
}
|
||||
u16 create_match2_context(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
|
||||
{
|
||||
return static_cast<u16>(idm::make<match2_ctx>(communicationId, passphrase));
|
||||
}
|
||||
bool destroy_match2_context(u16 ctx_id)
|
||||
{
|
||||
return idm::remove<match2_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
bool check_match2_context(u16 ctx_id)
|
||||
{
|
||||
return (idm::check<match2_ctx>(ctx_id) != nullptr);
|
||||
}
|
||||
std::shared_ptr<match2_ctx> get_match2_context(u16 ctx_id)
|
||||
{
|
||||
return idm::get<match2_ctx>(ctx_id);
|
||||
}
|
||||
|
||||
lookup_title_ctx::lookup_title_ctx(vm::cptr<SceNpCommunicationId> communicationId)
|
||||
{
|
||||
ASSERT(!communicationId->term && strlen(communicationId->data) == 9);
|
||||
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
|
||||
}
|
||||
s32 create_lookup_title_context(vm::cptr<SceNpCommunicationId> communicationId)
|
||||
{
|
||||
return static_cast<s32>(idm::make<lookup_title_ctx>(communicationId));
|
||||
}
|
||||
bool destroy_lookup_title_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<lookup_title_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
|
||||
lookup_transaction_ctx::lookup_transaction_ctx(s32 lt_ctx)
|
||||
{
|
||||
this->lt_ctx = lt_ctx;
|
||||
}
|
||||
s32 create_lookup_transaction_context(s32 lt_ctx)
|
||||
{
|
||||
return static_cast<s32>(idm::make<lookup_transaction_ctx>(lt_ctx));
|
||||
}
|
||||
bool destroy_lookup_transaction_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<lookup_transaction_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
|
||||
commerce2_ctx::commerce2_ctx(u32 version, vm::cptr<SceNpId> npid, vm::ptr<SceNpCommerce2Handler> handler, vm::ptr<void> arg)
|
||||
{
|
||||
this->version = version;
|
||||
memcpy(&this->npid, npid.get_ptr(), sizeof(SceNpId));
|
||||
this->context_callback = handler;
|
||||
this->context_callback_param = arg;
|
||||
}
|
||||
s32 create_commerce2_context(u32 version, vm::cptr<SceNpId> npid, vm::ptr<SceNpCommerce2Handler> handler, vm::ptr<void> arg)
|
||||
{
|
||||
return static_cast<s32>(idm::make<commerce2_ctx>(version, npid, handler, arg));
|
||||
}
|
||||
bool destroy_commerce2_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<commerce2_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
std::shared_ptr<commerce2_ctx> get_commerce2_context(u16 ctx_id)
|
||||
{
|
||||
return idm::get_unlocked<commerce2_ctx>(ctx_id);
|
||||
}
|
||||
|
||||
signaling_ctx::signaling_ctx(vm::ptr<SceNpId> npid, vm::ptr<SceNpSignalingHandler> handler, vm::ptr<void> arg)
|
||||
{
|
||||
memcpy(&this->npid, npid.get_ptr(), sizeof(SceNpId));
|
||||
this->handler = handler;
|
||||
this->arg = arg;
|
||||
}
|
||||
s32 create_signaling_context(vm::ptr<SceNpId> npid, vm::ptr<SceNpSignalingHandler> handler, vm::ptr<void> arg)
|
||||
{
|
||||
return static_cast<s32>(idm::make<signaling_ctx>(npid, handler, arg));
|
||||
}
|
||||
bool destroy_signaling_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<signaling_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
115
rpcs3/Emu/NP/np_contexts.h
Normal file
115
rpcs3/Emu/NP/np_contexts.h
Normal file
@ -0,0 +1,115 @@
|
||||
#pragma once
|
||||
|
||||
#include "Emu/Memory/vm_ptr.h"
|
||||
#include "Emu/Cell/Modules/sceNp.h"
|
||||
#include "Emu/Cell/Modules/sceNp2.h"
|
||||
#include "Emu/Cell/Modules/sceNpCommerce2.h"
|
||||
|
||||
// Score related
|
||||
struct score_ctx
|
||||
{
|
||||
score_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase);
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
|
||||
SceNpCommunicationId communicationId{};
|
||||
SceNpCommunicationPassphrase passphrase{};
|
||||
};
|
||||
s32 create_score_context(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase);
|
||||
bool destroy_score_context(s32 ctx_id);
|
||||
|
||||
struct score_transaction_ctx
|
||||
{
|
||||
score_transaction_ctx(s32 score_context_id);
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
|
||||
s32 score_context_id = 0;
|
||||
};
|
||||
s32 create_score_transaction_context(s32 score_context_id);
|
||||
bool destroy_score_transaction_context(s32 ctx_id);
|
||||
|
||||
// Match2 related
|
||||
struct match2_ctx
|
||||
{
|
||||
match2_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase);
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 255;
|
||||
|
||||
SceNpCommunicationId communicationId{};
|
||||
SceNpCommunicationPassphrase passphrase{};
|
||||
|
||||
vm::ptr<SceNpMatching2ContextCallback> context_callback{};
|
||||
vm::ptr<void> context_callback_param{};
|
||||
|
||||
SceNpMatching2RequestOptParam default_match2_optparam{};
|
||||
};
|
||||
u16 create_match2_context(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase);
|
||||
bool check_match2_context(u16 ctx_id);
|
||||
std::shared_ptr<match2_ctx> get_match2_context(u16 ctx_id);
|
||||
bool destroy_match2_context(u16 ctx_id);
|
||||
|
||||
struct lookup_title_ctx
|
||||
{
|
||||
lookup_title_ctx(vm::cptr<SceNpCommunicationId> communicationId);
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
|
||||
SceNpCommunicationId communicationId{};
|
||||
SceNpCommunicationPassphrase passphrase{};
|
||||
};
|
||||
s32 create_lookup_title_context(vm::cptr<SceNpCommunicationId> communicationId);
|
||||
bool destroy_lookup_title_context(s32 ctx_id);
|
||||
|
||||
struct lookup_transaction_ctx
|
||||
{
|
||||
lookup_transaction_ctx(s32 lt_ctx);
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
|
||||
s32 lt_ctx = 0;
|
||||
};
|
||||
s32 create_lookup_transaction_context(s32 lt_ctx);
|
||||
bool destroy_lookup_transaction_context(s32 ctx_id);
|
||||
|
||||
struct commerce2_ctx
|
||||
{
|
||||
commerce2_ctx(u32 version, vm::cptr<SceNpId> npid, vm::ptr<SceNpCommerce2Handler> handler, vm::ptr<void> arg);
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
|
||||
u32 version{};
|
||||
SceNpId npid{};
|
||||
vm::ptr<SceNpCommerce2Handler> context_callback{};
|
||||
vm::ptr<void> context_callback_param{};
|
||||
};
|
||||
s32 create_commerce2_context(u32 version, vm::cptr<SceNpId> npid, vm::ptr<SceNpCommerce2Handler> handler, vm::ptr<void> arg);
|
||||
std::shared_ptr<commerce2_ctx> get_commerce2_context(u16 ctx_id);
|
||||
bool destroy_commerce2_context(s32 ctx_id);
|
||||
|
||||
struct signaling_ctx
|
||||
{
|
||||
signaling_ctx(vm::ptr<SceNpId> npid, vm::ptr<SceNpSignalingHandler> handler, vm::ptr<void> arg);
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
|
||||
SceNpId npid{};
|
||||
vm::ptr<SceNpSignalingHandler> handler{};
|
||||
vm::ptr<void> arg{};
|
||||
};
|
||||
s32 create_signaling_context(vm::ptr<SceNpId> npid, vm::ptr<SceNpSignalingHandler> handler, vm::ptr<void> arg);
|
||||
bool destroy_signaling_context(s32 ctx_id);
|
@ -12,6 +12,7 @@
|
||||
#include "np_structs_extra.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/NP/rpcn_config.h"
|
||||
#include "Emu/NP/np_contexts.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
@ -281,9 +282,10 @@ std::string np_handler::ether_to_string(std::array<u8, 6>& ether)
|
||||
|
||||
void np_handler::string_to_npid(const char* str, SceNpId* npid)
|
||||
{
|
||||
memset(npid, 0, sizeof(SceNpId));
|
||||
strncpy(npid->handle.data, str, sizeof(npid->handle.data));
|
||||
npid->handle.term = 0;
|
||||
npid->reserved[0] = 1;
|
||||
// npid->reserved[0] = 1;
|
||||
}
|
||||
|
||||
void np_handler::string_to_online_name(const char* str, SceNpOnlineName* online_name)
|
||||
@ -363,8 +365,6 @@ void np_handler::init_NP(u32 poolsize, vm::ptr<void> poolptr)
|
||||
|
||||
void np_handler::terminate_NP()
|
||||
{
|
||||
// is_psn_active = false;
|
||||
|
||||
// Reset memory pool
|
||||
mpool.set(0);
|
||||
mpool_size = 0;
|
||||
@ -380,6 +380,9 @@ void np_handler::terminate_NP()
|
||||
|
||||
vm::addr_t np_handler::allocate(u32 size)
|
||||
{
|
||||
if (!size)
|
||||
return vm::cast(static_cast<u64>(0));
|
||||
|
||||
// Align allocs
|
||||
const u32 alloc_size = ::align(size, 4);
|
||||
if (alloc_size > mpool_avail)
|
||||
@ -425,13 +428,15 @@ std::vector<SceNpMatching2ServerId> np_handler::get_match2_server_list(SceNpMatc
|
||||
{
|
||||
std::vector<SceNpMatching2ServerId> server_list{};
|
||||
|
||||
if (g_cfg.net.psn_status == np_psn_status::rpcn)
|
||||
if (g_cfg.net.psn_status != np_psn_status::rpcn)
|
||||
{
|
||||
if (!rpcn.get_server_list(get_req_id(0), idm::get<match2_ctx>(ctx_id)->communicationId.data, server_list))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
}
|
||||
return server_list;
|
||||
}
|
||||
|
||||
if (!rpcn.get_server_list(get_req_id(0), get_match2_context(ctx_id)->communicationId, server_list))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
}
|
||||
|
||||
return server_list;
|
||||
@ -478,7 +483,7 @@ u32 np_handler::get_world_list(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMat
|
||||
{
|
||||
u32 req_id = generate_callback_info(ctx_id, optParam);
|
||||
|
||||
if (!rpcn.get_world_list(req_id, server_id))
|
||||
if (!rpcn.get_world_list(req_id, get_match2_context(ctx_id)->communicationId, server_id))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
@ -491,7 +496,7 @@ u32 np_handler::create_join_room(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpM
|
||||
{
|
||||
u32 req_id = generate_callback_info(ctx_id, optParam);
|
||||
|
||||
if (!rpcn.createjoin_room(req_id, req))
|
||||
if (!rpcn.createjoin_room(req_id, get_match2_context(ctx_id)->communicationId, req))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
@ -504,7 +509,7 @@ u32 np_handler::join_room(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatching
|
||||
{
|
||||
u32 req_id = generate_callback_info(ctx_id, optParam);
|
||||
|
||||
if (!rpcn.join_room(req_id, req))
|
||||
if (!rpcn.join_room(req_id, get_match2_context(ctx_id)->communicationId, req))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
@ -517,7 +522,7 @@ u32 np_handler::leave_room(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatchin
|
||||
{
|
||||
u32 req_id = generate_callback_info(ctx_id, optParam);
|
||||
|
||||
if (!rpcn.leave_room(req_id, req))
|
||||
if (!rpcn.leave_room(req_id, get_match2_context(ctx_id)->communicationId, req))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
@ -530,7 +535,7 @@ u32 np_handler::search_room(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatchi
|
||||
{
|
||||
u32 req_id = generate_callback_info(ctx_id, optParam);
|
||||
|
||||
if (!rpcn.search_room(req_id, req))
|
||||
if (!rpcn.search_room(req_id, get_match2_context(ctx_id)->communicationId, req))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
@ -545,7 +550,7 @@ u32 np_handler::set_roomdata_external(SceNpMatching2ContextId ctx_id, vm::cptr<S
|
||||
|
||||
extra_nps::print_set_roomdata_ext_req(req);
|
||||
|
||||
if (!rpcn.set_roomdata_external(req_id, req))
|
||||
if (!rpcn.set_roomdata_external(req_id, get_match2_context(ctx_id)->communicationId, req))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
@ -558,7 +563,7 @@ u32 np_handler::get_roomdata_internal(SceNpMatching2ContextId ctx_id, vm::cptr<S
|
||||
{
|
||||
u32 req_id = generate_callback_info(ctx_id, optParam);
|
||||
|
||||
if (!rpcn.get_roomdata_internal(req_id, req))
|
||||
if (!rpcn.get_roomdata_internal(req_id, get_match2_context(ctx_id)->communicationId, req))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
@ -573,7 +578,7 @@ u32 np_handler::set_roomdata_internal(SceNpMatching2ContextId ctx_id, vm::cptr<S
|
||||
|
||||
extra_nps::print_set_roomdata_int_req(req);
|
||||
|
||||
if (!rpcn.set_roomdata_internal(req_id, req))
|
||||
if (!rpcn.set_roomdata_internal(req_id, get_match2_context(ctx_id)->communicationId, req))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
@ -586,7 +591,7 @@ u32 np_handler::get_ping_info(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatc
|
||||
{
|
||||
u32 req_id = generate_callback_info(ctx_id, optParam);
|
||||
|
||||
if (!rpcn.ping_room_owner(req_id, req->roomId))
|
||||
if (!rpcn.ping_room_owner(req_id, get_match2_context(ctx_id)->communicationId, req->roomId))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
@ -599,7 +604,7 @@ u32 np_handler::send_room_message(SceNpMatching2ContextId ctx_id, vm::cptr<SceNp
|
||||
{
|
||||
u32 req_id = generate_callback_info(ctx_id, optParam);
|
||||
|
||||
if (!rpcn.send_room_message(req_id, req))
|
||||
if (!rpcn.send_room_message(req_id, get_match2_context(ctx_id)->communicationId, req))
|
||||
{
|
||||
rpcn_log.error("Disconnecting from RPCN!");
|
||||
is_psn_active = false;
|
||||
@ -1310,77 +1315,6 @@ s32 np_handler::analyze_dns_packet(s32 s, const u8* buf, u32 len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32 np_handler::create_score_context(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
|
||||
{
|
||||
return static_cast<s32>(idm::make<score_ctx>(communicationId, passphrase));
|
||||
}
|
||||
bool np_handler::destroy_score_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<score_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
|
||||
s32 np_handler::create_score_transaction_context(s32 score_context_id)
|
||||
{
|
||||
return static_cast<s32>(idm::make<score_transaction_ctx>(score_context_id));
|
||||
}
|
||||
bool np_handler::destroy_score_transaction_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<score_transaction_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
|
||||
u16 np_handler::create_match2_context(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
|
||||
{
|
||||
return static_cast<u16>(idm::make<match2_ctx>(communicationId, passphrase));
|
||||
}
|
||||
bool np_handler::destroy_match2_context(u16 ctx_id)
|
||||
{
|
||||
return idm::remove<match2_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
std::shared_ptr<np_handler::match2_ctx> np_handler::get_match2_context(u16 ctx_id)
|
||||
{
|
||||
return idm::get_unlocked<match2_ctx>(ctx_id);
|
||||
}
|
||||
|
||||
s32 np_handler::create_lookup_title_context(vm::cptr<SceNpCommunicationId> communicationId)
|
||||
{
|
||||
return static_cast<s32>(idm::make<lookup_title_ctx>(communicationId));
|
||||
}
|
||||
bool np_handler::destroy_lookup_title_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<lookup_title_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
|
||||
s32 np_handler::create_lookup_transaction_context(s32 lt_ctx)
|
||||
{
|
||||
return static_cast<s32>(idm::make<lookup_transaction_ctx>(lt_ctx));
|
||||
}
|
||||
bool np_handler::destroy_lookup_transaction_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<lookup_transaction_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
|
||||
s32 np_handler::create_commerce2_context(u32 version, vm::cptr<SceNpId> npid, vm::ptr<SceNpCommerce2Handler> handler, vm::ptr<void> arg)
|
||||
{
|
||||
return static_cast<s32>(idm::make<commerce2_ctx>(version, npid, handler, arg));
|
||||
}
|
||||
bool np_handler::destroy_commerce2_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<commerce2_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
std::shared_ptr<np_handler::commerce2_ctx> np_handler::get_commerce2_context(u16 ctx_id)
|
||||
{
|
||||
return idm::get_unlocked<commerce2_ctx>(ctx_id);
|
||||
}
|
||||
|
||||
s32 np_handler::create_signaling_context(vm::ptr<SceNpId> npid, vm::ptr<SceNpSignalingHandler> handler, vm::ptr<void> arg)
|
||||
{
|
||||
return static_cast<s32>(idm::make<signaling_ctx>(npid, handler, arg));
|
||||
}
|
||||
bool np_handler::destroy_signaling_context(s32 ctx_id)
|
||||
{
|
||||
return idm::remove<signaling_ctx>(static_cast<u32>(ctx_id));
|
||||
}
|
||||
|
||||
bool np_handler::error_and_disconnect(const std::string& error_msg)
|
||||
{
|
||||
rpcn_log.error("%s", error_msg);
|
||||
|
@ -87,140 +87,6 @@ public:
|
||||
u16 room_msg_cb_ctx = 0;
|
||||
vm::ptr<void> room_msg_cb_arg{};
|
||||
|
||||
// Score related
|
||||
struct score_ctx
|
||||
{
|
||||
score_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
|
||||
{
|
||||
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
|
||||
memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase));
|
||||
}
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
SceNpCommunicationId communicationId{};
|
||||
SceNpCommunicationPassphrase passphrase{};
|
||||
};
|
||||
s32 create_score_context(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase);
|
||||
bool destroy_score_context(s32 ctx_id);
|
||||
|
||||
struct score_transaction_ctx
|
||||
{
|
||||
score_transaction_ctx(s32 score_context_id)
|
||||
{
|
||||
this->score_context_id = score_context_id;
|
||||
}
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
s32 score_context_id = 0;
|
||||
};
|
||||
s32 create_score_transaction_context(s32 score_context_id);
|
||||
bool destroy_score_transaction_context(s32 ctx_id);
|
||||
|
||||
// Match2 related
|
||||
struct match2_ctx
|
||||
{
|
||||
match2_ctx(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase)
|
||||
{
|
||||
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
|
||||
memcpy(&this->passphrase, passphrase.get_ptr(), sizeof(SceNpCommunicationPassphrase));
|
||||
}
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 255;
|
||||
|
||||
SceNpCommunicationId communicationId{};
|
||||
SceNpCommunicationPassphrase passphrase{};
|
||||
|
||||
vm::ptr<SceNpMatching2ContextCallback> context_callback{};
|
||||
vm::ptr<void> context_callback_param{};
|
||||
|
||||
SceNpMatching2RequestOptParam default_match2_optparam{};
|
||||
};
|
||||
u16 create_match2_context(vm::cptr<SceNpCommunicationId> communicationId, vm::cptr<SceNpCommunicationPassphrase> passphrase);
|
||||
std::shared_ptr<match2_ctx> get_match2_context(u16 ctx_id);
|
||||
bool destroy_match2_context(u16 ctx_id);
|
||||
|
||||
struct lookup_title_ctx
|
||||
{
|
||||
lookup_title_ctx(vm::cptr<SceNpCommunicationId> communicationId)
|
||||
{
|
||||
memcpy(&this->communicationId, communicationId.get_ptr(), sizeof(SceNpCommunicationId));
|
||||
}
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
|
||||
SceNpCommunicationId communicationId{};
|
||||
SceNpCommunicationPassphrase passphrase{};
|
||||
};
|
||||
s32 create_lookup_title_context(vm::cptr<SceNpCommunicationId> communicationId);
|
||||
bool destroy_lookup_title_context(s32 ctx_id);
|
||||
|
||||
struct lookup_transaction_ctx
|
||||
{
|
||||
lookup_transaction_ctx(s32 lt_ctx)
|
||||
{
|
||||
this->lt_ctx = lt_ctx;
|
||||
}
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
|
||||
s32 lt_ctx = 0;
|
||||
};
|
||||
s32 create_lookup_transaction_context(s32 lt_ctx);
|
||||
bool destroy_lookup_transaction_context(s32 ctx_id);
|
||||
|
||||
struct commerce2_ctx
|
||||
{
|
||||
commerce2_ctx(u32 version, vm::cptr<SceNpId> npid, vm::ptr<SceNpCommerce2Handler> handler, vm::ptr<void> arg)
|
||||
{
|
||||
this->version = version;
|
||||
memcpy(&this->npid, npid.get_ptr(), sizeof(SceNpId));
|
||||
this->context_callback = handler;
|
||||
this->context_callback_param = arg;
|
||||
}
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
|
||||
u32 version{};
|
||||
SceNpId npid{};
|
||||
vm::ptr<SceNpCommerce2Handler> context_callback{};
|
||||
vm::ptr<void> context_callback_param{};
|
||||
};
|
||||
s32 create_commerce2_context(u32 version, vm::cptr<SceNpId> npid, vm::ptr<SceNpCommerce2Handler> handler, vm::ptr<void> arg);
|
||||
std::shared_ptr<commerce2_ctx> get_commerce2_context(u16 ctx_id);
|
||||
bool destroy_commerce2_context(s32 ctx_id);
|
||||
|
||||
struct signaling_ctx
|
||||
{
|
||||
signaling_ctx(vm::ptr<SceNpId> npid, vm::ptr<SceNpSignalingHandler> handler, vm::ptr<void> arg)
|
||||
{
|
||||
memcpy(&this->npid, npid.get_ptr(), sizeof(SceNpId));
|
||||
this->handler = handler;
|
||||
this->arg = arg;
|
||||
}
|
||||
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = 32;
|
||||
|
||||
SceNpId npid{};
|
||||
vm::ptr<SceNpSignalingHandler> handler{};
|
||||
vm::ptr<void> arg{};
|
||||
};
|
||||
s32 create_signaling_context(vm::ptr<SceNpId> npid, vm::ptr<SceNpSignalingHandler> handler, vm::ptr<void> arg);
|
||||
bool destroy_signaling_context(s32 ctx_id);
|
||||
|
||||
// Synchronous requests
|
||||
std::vector<SceNpMatching2ServerId> get_match2_server_list(SceNpMatching2ContextId);
|
||||
// Asynchronous requests
|
||||
|
@ -64,6 +64,10 @@ namespace extra_nps
|
||||
sceNp2.warning("flagAttr: 0x%x", req->flagAttr);
|
||||
sceNp2.warning("roomBinAttrInternal: *0x%x", req->roomBinAttrInternal);
|
||||
sceNp2.warning("roomBinAttrInternalNum: %d", req->roomBinAttrInternalNum);
|
||||
|
||||
for (u32 i = 0; i < req->roomBinAttrInternalNum; i++)
|
||||
print_bin_attr(&req->roomBinAttrInternal[i]);
|
||||
|
||||
sceNp2.warning("roomSearchableIntAttrExternal: *0x%x", req->roomSearchableIntAttrExternal);
|
||||
sceNp2.warning("roomSearchableIntAttrExternalNum: %d", req->roomSearchableIntAttrExternalNum);
|
||||
sceNp2.warning("roomSearchableBinAttrExternal: *0x%x", req->roomSearchableBinAttrExternal);
|
||||
|
@ -33,8 +33,9 @@
|
||||
|
||||
LOG_CHANNEL(rpcn_log, "rpcn");
|
||||
|
||||
#define RPCN_PROTOCOL_VERSION 9
|
||||
#define RPCN_PROTOCOL_VERSION 10
|
||||
#define RPCN_HEADER_SIZE 9
|
||||
#define COMMUNICATION_ID_SIZE 9
|
||||
|
||||
rpcn_client::rpcn_client(bool in_config)
|
||||
: in_config(in_config)
|
||||
@ -570,11 +571,10 @@ bool rpcn_client::get_reply(const u32 expected_id, std::vector<u8>& data)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool rpcn_client::get_server_list(u32 req_id, const std::string& communication_id, std::vector<u16>& server_list)
|
||||
bool rpcn_client::get_server_list(u32 req_id, const SceNpCommunicationId& communication_id, std::vector<u16>& server_list)
|
||||
{
|
||||
std::vector<u8> data{}, reply_data{};
|
||||
std::copy(communication_id.begin(), communication_id.end(), std::back_inserter(data));
|
||||
data.push_back(0);
|
||||
std::vector<u8> data(COMMUNICATION_ID_SIZE), reply_data{};
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
|
||||
if (!forge_send_reply(CommandType::GetServerList, req_id, data, reply_data))
|
||||
return false;
|
||||
@ -596,10 +596,11 @@ bool rpcn_client::get_server_list(u32 req_id, const std::string& communication_i
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpcn_client::get_world_list(u32 req_id, u16 server_id)
|
||||
bool rpcn_client::get_world_list(u32 req_id, const SceNpCommunicationId& communication_id, u16 server_id)
|
||||
{
|
||||
std::vector<u8> data(2);
|
||||
reinterpret_cast<le_t<u16>&>(data[0]) = server_id;
|
||||
std::vector<u8> data(COMMUNICATION_ID_SIZE + sizeof(u16));
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
reinterpret_cast<le_t<u16>&>(data[COMMUNICATION_ID_SIZE]) = server_id;
|
||||
|
||||
if (!forge_send(CommandType::GetWorldList, req_id, data))
|
||||
return false;
|
||||
@ -607,7 +608,7 @@ bool rpcn_client::get_world_list(u32 req_id, u16 server_id)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpcn_client::createjoin_room(u32 req_id, const SceNpMatching2CreateJoinRoomRequest* req)
|
||||
bool rpcn_client::createjoin_room(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2CreateJoinRoomRequest* req)
|
||||
{
|
||||
std::vector<u8> data{};
|
||||
|
||||
@ -674,7 +675,7 @@ bool rpcn_client::createjoin_room(u32 req_id, const SceNpMatching2CreateJoinRoom
|
||||
final_groupconfigs_vec = builder.CreateVector(davec);
|
||||
}
|
||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> final_allowedusers_vec;
|
||||
if (req->allowedUserNum)
|
||||
if (req->allowedUserNum && req->allowedUser)
|
||||
{
|
||||
std::vector<flatbuffers::Offset<flatbuffers::String>> davec;
|
||||
for (u32 i = 0; i < req->allowedUserNum; i++)
|
||||
@ -724,10 +725,11 @@ bool rpcn_client::createjoin_room(u32 req_id, const SceNpMatching2CreateJoinRoom
|
||||
builder.Finish(req_finished);
|
||||
u8* buf = builder.GetBufferPointer();
|
||||
size_t bufsize = builder.GetSize();
|
||||
data.resize(sizeof(u32) + bufsize);
|
||||
data.resize(COMMUNICATION_ID_SIZE + sizeof(u32) + bufsize);
|
||||
|
||||
reinterpret_cast<le_t<u32>&>(data[0]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + sizeof(u32), buf, bufsize);
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
reinterpret_cast<le_t<u32>&>(data[COMMUNICATION_ID_SIZE]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + COMMUNICATION_ID_SIZE + sizeof(u32), buf, bufsize);
|
||||
|
||||
if (!forge_send(CommandType::CreateRoom, req_id, data))
|
||||
return false;
|
||||
@ -735,7 +737,7 @@ bool rpcn_client::createjoin_room(u32 req_id, const SceNpMatching2CreateJoinRoom
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpcn_client::join_room(u32 req_id, const SceNpMatching2JoinRoomRequest* req)
|
||||
bool rpcn_client::join_room(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2JoinRoomRequest* req)
|
||||
{
|
||||
std::vector<u8> data{};
|
||||
|
||||
@ -767,10 +769,11 @@ bool rpcn_client::join_room(u32 req_id, const SceNpMatching2JoinRoomRequest* req
|
||||
builder.Finish(req_finished);
|
||||
u8* buf = builder.GetBufferPointer();
|
||||
size_t bufsize = builder.GetSize();
|
||||
data.resize(sizeof(u32) + bufsize);
|
||||
data.resize(COMMUNICATION_ID_SIZE + sizeof(u32) + bufsize);
|
||||
|
||||
reinterpret_cast<le_t<u32>&>(data[0]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + sizeof(u32), buf, bufsize);
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
reinterpret_cast<le_t<u32>&>(data[COMMUNICATION_ID_SIZE]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + COMMUNICATION_ID_SIZE + sizeof(u32), buf, bufsize);
|
||||
|
||||
if (!forge_send(CommandType::JoinRoom, req_id, data))
|
||||
return false;
|
||||
@ -778,7 +781,7 @@ bool rpcn_client::join_room(u32 req_id, const SceNpMatching2JoinRoomRequest* req
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpcn_client::leave_room(u32 req_id, const SceNpMatching2LeaveRoomRequest* req)
|
||||
bool rpcn_client::leave_room(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2LeaveRoomRequest* req)
|
||||
{
|
||||
std::vector<u8> data{};
|
||||
|
||||
@ -788,10 +791,11 @@ bool rpcn_client::leave_room(u32 req_id, const SceNpMatching2LeaveRoomRequest* r
|
||||
builder.Finish(req_finished);
|
||||
u8* buf = builder.GetBufferPointer();
|
||||
size_t bufsize = builder.GetSize();
|
||||
data.resize(sizeof(u32) + bufsize);
|
||||
data.resize(COMMUNICATION_ID_SIZE + sizeof(u32) + bufsize);
|
||||
|
||||
reinterpret_cast<le_t<u32>&>(data[0]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + sizeof(u32), buf, bufsize);
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
reinterpret_cast<le_t<u32>&>(data[COMMUNICATION_ID_SIZE]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + COMMUNICATION_ID_SIZE + sizeof(u32), buf, bufsize);
|
||||
|
||||
if (!forge_send(CommandType::LeaveRoom, req_id, data))
|
||||
return false;
|
||||
@ -799,7 +803,7 @@ bool rpcn_client::leave_room(u32 req_id, const SceNpMatching2LeaveRoomRequest* r
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpcn_client::search_room(u32 req_id, const SceNpMatching2SearchRoomRequest* req)
|
||||
bool rpcn_client::search_room(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SearchRoomRequest* req)
|
||||
{
|
||||
std::vector<u8> data{};
|
||||
|
||||
@ -853,10 +857,11 @@ bool rpcn_client::search_room(u32 req_id, const SceNpMatching2SearchRoomRequest*
|
||||
builder.Finish(req_finished);
|
||||
u8* buf = builder.GetBufferPointer();
|
||||
size_t bufsize = builder.GetSize();
|
||||
data.resize(bufsize + sizeof(u32));
|
||||
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
|
||||
|
||||
reinterpret_cast<le_t<u32>&>(data[0]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + sizeof(u32), buf, bufsize);
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
reinterpret_cast<le_t<u32>&>(data[COMMUNICATION_ID_SIZE]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + COMMUNICATION_ID_SIZE + sizeof(u32), buf, bufsize);
|
||||
|
||||
if (!forge_send(CommandType::SearchRoom, req_id, data))
|
||||
return false;
|
||||
@ -864,7 +869,7 @@ bool rpcn_client::search_room(u32 req_id, const SceNpMatching2SearchRoomRequest*
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpcn_client::set_roomdata_external(u32 req_id, const SceNpMatching2SetRoomDataExternalRequest* req)
|
||||
bool rpcn_client::set_roomdata_external(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SetRoomDataExternalRequest* req)
|
||||
{
|
||||
std::vector<u8> data{};
|
||||
|
||||
@ -907,10 +912,11 @@ bool rpcn_client::set_roomdata_external(u32 req_id, const SceNpMatching2SetRoomD
|
||||
builder.Finish(req_finished);
|
||||
u8* buf = builder.GetBufferPointer();
|
||||
size_t bufsize = builder.GetSize();
|
||||
data.resize(sizeof(u32) + bufsize);
|
||||
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
|
||||
|
||||
reinterpret_cast<le_t<u32>&>(data[0]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + sizeof(u32), buf, bufsize);
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
reinterpret_cast<le_t<u32>&>(data[COMMUNICATION_ID_SIZE]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + COMMUNICATION_ID_SIZE + sizeof(u32), buf, bufsize);
|
||||
|
||||
if (!forge_send(CommandType::SetRoomDataExternal, req_id, data))
|
||||
return false;
|
||||
@ -918,7 +924,7 @@ bool rpcn_client::set_roomdata_external(u32 req_id, const SceNpMatching2SetRoomD
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpcn_client::get_roomdata_internal(u32 req_id, const SceNpMatching2GetRoomDataInternalRequest* req)
|
||||
bool rpcn_client::get_roomdata_internal(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2GetRoomDataInternalRequest* req)
|
||||
{
|
||||
std::vector<u8> data{}, reply_data{};
|
||||
|
||||
@ -933,10 +939,11 @@ bool rpcn_client::get_roomdata_internal(u32 req_id, const SceNpMatching2GetRoomD
|
||||
builder.Finish(req_finished);
|
||||
u8* buf = builder.GetBufferPointer();
|
||||
size_t bufsize = builder.GetSize();
|
||||
data.resize(sizeof(u32) + bufsize);
|
||||
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
|
||||
|
||||
reinterpret_cast<le_t<u32>&>(data[0]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + sizeof(u32), buf, bufsize);
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
reinterpret_cast<le_t<u32>&>(data[COMMUNICATION_ID_SIZE]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + COMMUNICATION_ID_SIZE + sizeof(u32), buf, bufsize);
|
||||
|
||||
if (!forge_send(CommandType::GetRoomDataInternal, req_id, data))
|
||||
return false;
|
||||
@ -944,7 +951,7 @@ bool rpcn_client::get_roomdata_internal(u32 req_id, const SceNpMatching2GetRoomD
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpcn_client::set_roomdata_internal(u32 req_id, const SceNpMatching2SetRoomDataInternalRequest* req)
|
||||
bool rpcn_client::set_roomdata_internal(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SetRoomDataInternalRequest* req)
|
||||
{
|
||||
std::vector<u8> data{};
|
||||
|
||||
@ -987,10 +994,11 @@ bool rpcn_client::set_roomdata_internal(u32 req_id, const SceNpMatching2SetRoomD
|
||||
builder.Finish(req_finished);
|
||||
u8* buf = builder.GetBufferPointer();
|
||||
size_t bufsize = builder.GetSize();
|
||||
data.resize(sizeof(u32) + bufsize);
|
||||
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
|
||||
|
||||
reinterpret_cast<le_t<u32>&>(data[0]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + sizeof(u32), buf, bufsize);
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
reinterpret_cast<le_t<u32>&>(data[COMMUNICATION_ID_SIZE]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + COMMUNICATION_ID_SIZE + sizeof(u32), buf, bufsize);
|
||||
|
||||
if (!forge_send(CommandType::SetRoomDataInternal, req_id, data))
|
||||
return false;
|
||||
@ -998,12 +1006,14 @@ bool rpcn_client::set_roomdata_internal(u32 req_id, const SceNpMatching2SetRoomD
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpcn_client::ping_room_owner(u32 req_id, u64 room_id)
|
||||
bool rpcn_client::ping_room_owner(u32 req_id, const SceNpCommunicationId& communication_id, u64 room_id)
|
||||
{
|
||||
std::vector<u8> data{};
|
||||
|
||||
data.resize(8);
|
||||
reinterpret_cast<le_t<u64>&>(data[0]) = room_id;
|
||||
data.resize(COMMUNICATION_ID_SIZE + sizeof(u64));
|
||||
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
reinterpret_cast<le_t<u64>&>(data[COMMUNICATION_ID_SIZE]) = room_id;
|
||||
|
||||
if (!forge_send(CommandType::PingRoomOwner, req_id, data))
|
||||
return false;
|
||||
@ -1011,7 +1021,7 @@ bool rpcn_client::ping_room_owner(u32 req_id, u64 room_id)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpcn_client::send_room_message(u32 req_id, const SceNpMatching2SendRoomMessageRequest* req)
|
||||
bool rpcn_client::send_room_message(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SendRoomMessageRequest* req)
|
||||
{
|
||||
std::vector<u8> data{};
|
||||
flatbuffers::FlatBufferBuilder builder(1024);
|
||||
@ -1043,10 +1053,11 @@ bool rpcn_client::send_room_message(u32 req_id, const SceNpMatching2SendRoomMess
|
||||
builder.Finish(req_finished);
|
||||
u8* buf = builder.GetBufferPointer();
|
||||
size_t bufsize = builder.GetSize();
|
||||
data.resize(sizeof(u32) + bufsize);
|
||||
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
|
||||
|
||||
reinterpret_cast<le_t<u32>&>(data[0]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + sizeof(u32), buf, bufsize);
|
||||
memcpy(data.data(), communication_id.data, COMMUNICATION_ID_SIZE);
|
||||
reinterpret_cast<le_t<u32>&>(data[COMMUNICATION_ID_SIZE]) = static_cast<u32>(bufsize);
|
||||
memcpy(data.data() + COMMUNICATION_ID_SIZE + sizeof(u32), buf, bufsize);
|
||||
|
||||
if (!forge_send(CommandType::SendRoomMessage, req_id, data))
|
||||
return false;
|
||||
|
@ -143,6 +143,7 @@ class rpcn_client
|
||||
ErrorLogin,
|
||||
ErrorCreate,
|
||||
AlreadyLoggedIn,
|
||||
AlreadyJoined,
|
||||
DbFail,
|
||||
NotFound,
|
||||
Unsupported,
|
||||
@ -163,18 +164,18 @@ public:
|
||||
void abort();
|
||||
|
||||
// Synchronous requests
|
||||
bool get_server_list(u32 req_id, const std::string& communication_id, std::vector<u16>& server_list);
|
||||
bool get_server_list(u32 req_id, const SceNpCommunicationId& communication_id, std::vector<u16>& server_list);
|
||||
// Asynchronous requests
|
||||
bool get_world_list(u32 req_id, u16 server_id);
|
||||
bool createjoin_room(u32 req_id, const SceNpMatching2CreateJoinRoomRequest* req);
|
||||
bool join_room(u32 req_id, const SceNpMatching2JoinRoomRequest* req);
|
||||
bool leave_room(u32 req_id, const SceNpMatching2LeaveRoomRequest* req);
|
||||
bool search_room(u32 req_id, const SceNpMatching2SearchRoomRequest* req);
|
||||
bool set_roomdata_external(u32 req_id, const SceNpMatching2SetRoomDataExternalRequest* req);
|
||||
bool get_roomdata_internal(u32 req_id, const SceNpMatching2GetRoomDataInternalRequest* req);
|
||||
bool set_roomdata_internal(u32 req_id, const SceNpMatching2SetRoomDataInternalRequest* req);
|
||||
bool ping_room_owner(u32 req_id, u64 room_id);
|
||||
bool send_room_message(u32 req_id, const SceNpMatching2SendRoomMessageRequest* req);
|
||||
bool get_world_list(u32 req_id, const SceNpCommunicationId& communication_id, u16 server_id);
|
||||
bool createjoin_room(u32 req_id,const SceNpCommunicationId& communication_id, const SceNpMatching2CreateJoinRoomRequest* req);
|
||||
bool join_room(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2JoinRoomRequest* req);
|
||||
bool leave_room(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2LeaveRoomRequest* req);
|
||||
bool search_room(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SearchRoomRequest* req);
|
||||
bool set_roomdata_external(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SetRoomDataExternalRequest* req);
|
||||
bool get_roomdata_internal(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2GetRoomDataInternalRequest* req);
|
||||
bool set_roomdata_internal(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SetRoomDataInternalRequest* req);
|
||||
bool ping_room_owner(u32 req_id, const SceNpCommunicationId& communication_id, u64 room_id);
|
||||
bool send_room_message(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SendRoomMessageRequest* req);
|
||||
bool req_sign_infos(u32 req_id, const std::string& npid);
|
||||
bool req_ticket(u32 req_id, const std::string& service_id);
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
cfg_rpcn g_cfg_rpcn;
|
||||
|
||||
LOG_CHANNEL(rpcn_cfg_log, "rpcn config");
|
||||
LOG_CHANNEL(rpcn_log, "rpcn");
|
||||
|
||||
void cfg_rpcn::load()
|
||||
{
|
||||
@ -21,7 +21,7 @@ void cfg_rpcn::save() const
|
||||
const std::string path_to_cfg = fs::get_config_dir() + "config/";
|
||||
if (!fs::create_path(path_to_cfg))
|
||||
{
|
||||
rpcn_cfg_log.error("Could not create path: %s", path_to_cfg);
|
||||
rpcn_log.error("Could not create path: %s", path_to_cfg);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -32,7 +32,7 @@ void cfg_rpcn::save() const
|
||||
}
|
||||
else
|
||||
{
|
||||
rpcn_cfg_log.error("Could not save config: %s", cfg_rpcn::get_path());
|
||||
rpcn_log.error("Could not save config: %s", cfg_rpcn::get_path());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
#include "Utilities/Config.h"
|
||||
|
||||
LOG_CHANNEL(rpcn_cfg, "RPCN Config");
|
||||
|
||||
struct cfg_rpcn : cfg::node
|
||||
{
|
||||
cfg::string host{this, "Host", "np.rpcs3.net"};
|
||||
|
@ -630,5 +630,15 @@ void signaling_handler::set_sig2_infos(u64 room_id, u16 member_id, s32 status, u
|
||||
signaling_info signaling_handler::get_sig2_infos(u64 room_id, u16 member_id)
|
||||
{
|
||||
std::lock_guard lock(data_mutex);
|
||||
|
||||
if (!sig2_peers[room_id][member_id])
|
||||
{
|
||||
sig2_peers[room_id][member_id] = std::make_shared<signaling_info>();
|
||||
auto& peer = sig2_peers[room_id][member_id];
|
||||
peer->room_id = room_id;
|
||||
peer->member_id = member_id;
|
||||
peer->version = 2;
|
||||
}
|
||||
|
||||
return *sig2_peers[room_id][member_id];
|
||||
}
|
||||
|
@ -112,6 +112,7 @@
|
||||
<ClCompile Include="Emu\title.cpp" />
|
||||
<ClCompile Include="Emu\system_config.cpp" />
|
||||
<ClCompile Include="Emu\NP\fb_helpers.cpp" />
|
||||
<ClCompile Include="Emu\NP\np_contexts.cpp" />
|
||||
<ClCompile Include="Emu\NP\np_handler.cpp" />
|
||||
<ClCompile Include="Emu\NP\signaling_handler.cpp" />
|
||||
<ClCompile Include="Emu\NP\np_structs_extra.cpp" />
|
||||
|
@ -926,6 +926,9 @@
|
||||
<ClCompile Include="Emu\NP\fb_helpers.cpp">
|
||||
<Filter>Emu\NP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\NP\np_contexts.cpp">
|
||||
<Filter>Emu\NP</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\NP\np_handler.cpp">
|
||||
<Filter>Emu\NP</Filter>
|
||||
</ClCompile>
|
||||
|
Loading…
x
Reference in New Issue
Block a user