1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

The Velocity Improvements: RoomData/RoomMemberData commands & fixes

modules/np2: Correct some SceNpMaching2 ptr type endianness
np/handler: Use STL .contains() method
Ignore USECRYPTO & USESIGNATURE in recvfrom/sendto
Implement RoomData/RoomMemberData commands
This commit is contained in:
Nick Renieris 2021-07-25 21:40:35 +03:00 committed by kd-11
parent 53f2594983
commit b70f08d850
12 changed files with 755 additions and 129 deletions

View File

@ -663,7 +663,7 @@ error_code sceNpMatching2SignalingGetConnectionInfo(
error_code sceNpMatching2SendRoomMessage(
SceNpMatching2ContextId ctxId, vm::cptr<SceNpMatching2SendRoomMessageRequest> reqParam, vm::cptr<SceNpMatching2RequestOptParam> optParam, vm::ptr<SceNpMatching2RequestId> assignedReqId)
{
sceNp2.todo("sceNpMatching2SendRoomMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
sceNp2.warning("sceNpMatching2SendRoomMessage(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
auto& nph = g_fxo->get<named_thread<np_handler>>();
if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK)
@ -958,7 +958,7 @@ error_code sceNpMatching2SendRoomChatMessage(
error_code sceNpMatching2SetRoomDataInternal(
SceNpMatching2ContextId ctxId, vm::cptr<SceNpMatching2SetRoomDataInternalRequest> reqParam, vm::cptr<SceNpMatching2RequestOptParam> optParam, vm::ptr<SceNpMatching2RequestId> assignedReqId)
{
sceNp2.todo("sceNpMatching2SetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
sceNp2.warning("sceNpMatching2SetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
auto& nph = g_fxo->get<named_thread<np_handler>>();
if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK)
@ -974,7 +974,7 @@ error_code sceNpMatching2SetRoomDataInternal(
error_code sceNpMatching2GetRoomDataInternal(
SceNpMatching2ContextId ctxId, vm::cptr<SceNpMatching2GetRoomDataInternalRequest> reqParam, vm::cptr<SceNpMatching2RequestOptParam> optParam, vm::ptr<SceNpMatching2RequestId> assignedReqId)
{
sceNp2.todo("sceNpMatching2GetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
sceNp2.warning("sceNpMatching2GetRoomDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
auto& nph = g_fxo->get<named_thread<np_handler>>();
if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK)
@ -1164,7 +1164,7 @@ error_code sceNpMatching2GetRoomMemberDataInternal(
error_code sceNpMatching2SetRoomMemberDataInternal(
SceNpMatching2ContextId ctxId, vm::cptr<SceNpMatching2SetRoomMemberDataInternalRequest> reqParam, vm::cptr<SceNpMatching2RequestOptParam> optParam, vm::ptr<SceNpMatching2RequestId> assignedReqId)
{
sceNp2.todo("sceNpMatching2SetRoomMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
sceNp2.warning("sceNpMatching2SetRoomMemberDataInternal(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
auto& nph = g_fxo->get<named_thread<np_handler>>();
if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK)
@ -1172,6 +1172,8 @@ error_code sceNpMatching2SetRoomMemberDataInternal(
return res;
}
*assignedReqId = nph.set_roommemberdata_internal(ctxId, optParam, reqParam.get_ptr());
return CELL_OK;
}
@ -1280,7 +1282,7 @@ error_code sceNpMatching2GetRoomPasswordLocal(SceNpMatching2ContextId ctxId, Sce
error_code sceNpMatching2GetRoomDataExternalList(
SceNpMatching2ContextId ctxId, vm::cptr<SceNpMatching2GetRoomDataExternalListRequest> reqParam, vm::cptr<SceNpMatching2RequestOptParam> optParam, vm::ptr<SceNpMatching2RequestId> assignedReqId)
{
sceNp2.todo("sceNpMatching2GetRoomDataExternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
sceNp2.warning("sceNpMatching2GetRoomDataExternalList(ctxId=%d, reqParam=*0x%x, optParam=*0x%x, assignedReqId=*0x%x)", ctxId, reqParam, optParam, assignedReqId);
auto& nph = g_fxo->get<named_thread<np_handler>>();
if (auto res = generic_match2_error_check(nph, ctxId, reqParam, assignedReqId); res != CELL_OK)

View File

@ -1388,9 +1388,9 @@ struct SceNpMatching2RoomDataInternalUpdateInfo
vm::bptr<SceNpMatching2FlagAttr> prevFlagAttr;
vm::bptr<SceNpMatching2RoomPasswordSlotMask> newRoomPasswordSlotMask;
vm::bptr<SceNpMatching2RoomPasswordSlotMask> prevRoomPasswordSlotMask;
vm::pptr<SceNpMatching2RoomGroup> newRoomGroup;
vm::bpptr<SceNpMatching2RoomGroup> newRoomGroup;
be_t<u32> newRoomGroupNum;
vm::pptr<SceNpMatching2RoomBinAttrInternal> newRoomBinAttrInternal;
vm::bpptr<SceNpMatching2RoomBinAttrInternal> newRoomBinAttrInternal;
be_t<u32> newRoomBinAttrInternalNum;
};
@ -1401,7 +1401,7 @@ struct SceNpMatching2RoomMemberDataInternalUpdateInfo
vm::bptr<SceNpMatching2FlagAttr> newFlagAttr;
vm::bptr<SceNpMatching2FlagAttr> prevFlagAttr;
vm::bptr<SceNpMatching2TeamId> newTeamId;
vm::pptr<SceNpMatching2RoomMemberBinAttrInternal> newRoomMemberBinAttrInternal;
vm::bpptr<SceNpMatching2RoomMemberBinAttrInternal> newRoomMemberBinAttrInternal;
be_t<u32> newRoomMemberBinAttrInternalNum;
};

View File

@ -2255,7 +2255,7 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr<void> buf, u32
return -SYS_NET_EINVAL;
}
if (flags & ~(SYS_NET_MSG_PEEK | SYS_NET_MSG_DONTWAIT | SYS_NET_MSG_WAITALL))
if (flags & ~(SYS_NET_MSG_PEEK | SYS_NET_MSG_DONTWAIT | SYS_NET_MSG_WAITALL | SYS_NET_MSG_USECRYPTO | SYS_NET_MSG_USESIGNATURE))
{
fmt::throw_exception("sys_net_bnet_recvfrom(s=%d): unknown flags (0x%x)", flags);
}
@ -2580,7 +2580,7 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr<void> buf, u32 l
sys_net.warning("sys_net_bnet_sendto(s=%d, buf=*0x%x, len=%u, flags=0x%x, addr=*0x%x, addrlen=%u)", s, buf, len, flags, addr, addrlen);
if (flags & ~(SYS_NET_MSG_DONTWAIT | SYS_NET_MSG_WAITALL))
if (flags & ~(SYS_NET_MSG_DONTWAIT | SYS_NET_MSG_WAITALL | SYS_NET_MSG_USECRYPTO | SYS_NET_MSG_USESIGNATURE))
{
fmt::throw_exception("sys_net_bnet_sendto(s=%d): unknown flags (0x%x)", flags);
}

View File

@ -3,22 +3,42 @@
LOG_CHANNEL(rpcn_log, "rpcn");
void np_handler::BinAttr_to_SceNpMatching2BinAttr(const flatbuffers::Vector<flatbuffers::Offset<BinAttr>>* fb_attr, vm::ptr<SceNpMatching2BinAttr> binattr_info)
void np_handler::BinAttr_to_SceNpMatching2BinAttr(const BinAttr* bin_attr, SceNpMatching2BinAttr* binattr_info)
{
for (flatbuffers::uoffset_t i = 0; i < fb_attr->size(); i++)
binattr_info->id = bin_attr->id();
binattr_info->size = bin_attr->data()->size();
binattr_info->ptr = allocate(binattr_info->size);
for (flatbuffers::uoffset_t i = 0; i < bin_attr->data()->size(); i++)
{
auto bin_attr = fb_attr->Get(i);
binattr_info[i].id = bin_attr->id();
binattr_info[i].size = bin_attr->data()->size();
binattr_info[i].ptr = allocate(binattr_info[i].size);
for (flatbuffers::uoffset_t tmp_index = 0; tmp_index < bin_attr->data()->size(); tmp_index++)
{
binattr_info[i].ptr[tmp_index] = bin_attr->data()->Get(tmp_index);
}
binattr_info->ptr[i] = bin_attr->data()->Get(i);
}
}
void np_handler::RoomGroup_to_SceNpMatching2RoomGroup(const flatbuffers::Vector<flatbuffers::Offset<RoomGroup>>* fb_group, vm::ptr<SceNpMatching2RoomGroup> group_info)
void np_handler::BinAttrs_to_SceNpMatching2BinAttr(const flatbuffers::Vector<flatbuffers::Offset<BinAttr>>* fb_attr, vm::ptr<SceNpMatching2BinAttr> binattr_info)
{
for (flatbuffers::uoffset_t i = 0; i < fb_attr->size(); i++)
{
auto fb_attr_this = fb_attr->Get(i);
auto binattr_info_this = binattr_info + i;
BinAttr_to_SceNpMatching2BinAttr(fb_attr_this, binattr_info_this.get_ptr());
}
}
void np_handler::RoomMemberBinAttrInternal_to_SceNpMatching2RoomMemberBinAttrInternal(const RoomMemberBinAttrInternal* fb_attr, vm::ptr<SceNpMatching2RoomMemberBinAttrInternal> binattr_info)
{
binattr_info->updateDate.tick = fb_attr->updateDate();
BinAttr_to_SceNpMatching2BinAttr(fb_attr->data(), &binattr_info->data);
}
void np_handler::RoomBinAttrInternal_to_SceNpMatching2RoomBinAttrInternal(const BinAttrInternal* fb_attr, vm::ptr<SceNpMatching2RoomBinAttrInternal> binattr_info)
{
binattr_info->updateDate.tick = fb_attr->updateDate();
binattr_info->updateMemberId = fb_attr->updateMemberId();
BinAttr_to_SceNpMatching2BinAttr(fb_attr->data(), &binattr_info->data);
}
void np_handler::RoomGroups_to_SceNpMatching2RoomGroup(const flatbuffers::Vector<flatbuffers::Offset<RoomGroup>>* fb_group, vm::ptr<SceNpMatching2RoomGroup> group_info)
{
for (flatbuffers::uoffset_t i = 0; i < fb_group->size(); i++)
{
@ -68,7 +88,7 @@ void np_handler::RoomDataExternal_to_SceNpMatching2RoomDataExternal(const RoomDa
room_info->openPrivateSlotNum = room->openPrivateSlotNum();
room_info->curMemberNum = room->curMemberNum();
room_info->passwordSlotMask = room->passwordSlotMask();
if (auto owner = room->owner())
{
vm::ptr<SceNpUserInfo2> owner_info(allocate(sizeof(SceNpUserInfo2)));
@ -80,7 +100,7 @@ void np_handler::RoomDataExternal_to_SceNpMatching2RoomDataExternal(const RoomDa
{
room_info->roomGroupNum = room->roomGroup()->size();
vm::ptr<SceNpMatching2RoomGroup> group_info(allocate(sizeof(SceNpMatching2RoomGroup) * room_info->roomGroupNum));
RoomGroup_to_SceNpMatching2RoomGroup(room->roomGroup(), group_info);
RoomGroups_to_SceNpMatching2RoomGroup(room->roomGroup(), group_info);
room_info->roomGroup = group_info;
}
@ -103,7 +123,7 @@ void np_handler::RoomDataExternal_to_SceNpMatching2RoomDataExternal(const RoomDa
{
room_info->roomSearchableBinAttrExternalNum = room->roomSearchableBinAttrExternal()->size();
vm::ptr<SceNpMatching2BinAttr> binattr_info(allocate(sizeof(SceNpMatching2BinAttr) * room_info->roomSearchableBinAttrExternalNum));
BinAttr_to_SceNpMatching2BinAttr(room->roomSearchableBinAttrExternal(), binattr_info);
BinAttrs_to_SceNpMatching2BinAttr(room->roomSearchableBinAttrExternal(), binattr_info);
room_info->roomSearchableBinAttrExternal = binattr_info;
}
@ -111,7 +131,7 @@ void np_handler::RoomDataExternal_to_SceNpMatching2RoomDataExternal(const RoomDa
{
room_info->roomBinAttrExternalNum = room->roomBinAttrExternal()->size();
vm::ptr<SceNpMatching2BinAttr> binattr_info(allocate(sizeof(SceNpMatching2BinAttr) * room_info->roomBinAttrExternalNum));
BinAttr_to_SceNpMatching2BinAttr(room->roomBinAttrExternal(), binattr_info);
BinAttrs_to_SceNpMatching2BinAttr(room->roomBinAttrExternal(), binattr_info);
room_info->roomBinAttrExternal = binattr_info;
}
}
@ -193,7 +213,7 @@ u16 np_handler::RoomDataInternal_to_SceNpMatching2RoomDataInternal(const RoomDat
{
room_info->roomGroupNum = resp->roomGroup()->size();
vm::ptr<SceNpMatching2RoomGroup> group_info(allocate(sizeof(SceNpMatching2RoomGroup) * room_info->roomGroupNum));
RoomGroup_to_SceNpMatching2RoomGroup(resp->roomGroup(), group_info);
RoomGroups_to_SceNpMatching2RoomGroup(resp->roomGroup(), group_info);
room_info->roomGroup = group_info;
}
@ -214,49 +234,7 @@ u16 np_handler::RoomDataInternal_to_SceNpMatching2RoomDataInternal(const RoomDat
}
prev_member = member_info;
UserInfo2_to_SceNpUserInfo2(member->userInfo(), &member_info->userInfo);
member_info->joinDate.tick = member->joinDate();
member_info->memberId = member->memberId();
member_info->teamId = member->teamId();
// Look for id
if (member->roomGroup() != 0)
{
bool found = false;
for (u32 g_index = 0; g_index < room_info->roomGroupNum; g_index++)
{
if (room_info->roomGroup[g_index].groupId == member->roomGroup())
{
member_info->roomGroup = vm::cast(room_info->roomGroup.addr() + (u32{sizeof(SceNpMatching2RoomGroup)} * g_index));
found = true;
}
}
ensure(found);
}
member_info->natType = member->natType();
member_info->flagAttr = member->flagAttr();
if (member->roomMemberBinAttrInternal() && member->roomMemberBinAttrInternal()->size() != 0)
{
member_info->roomMemberBinAttrInternalNum = member->roomMemberBinAttrInternal()->size();
vm::ptr<SceNpMatching2RoomMemberBinAttrInternal> binattr_info(allocate(sizeof(SceNpMatching2RoomMemberBinAttrInternal) * member_info->roomMemberBinAttrInternalNum));
for (u32 b_index = 0; b_index < member_info->roomMemberBinAttrInternalNum; b_index++)
{
const auto battr = member->roomMemberBinAttrInternal()->Get(b_index);
binattr_info[b_index].updateDate.tick = battr->updateDate();
binattr_info[b_index].data.id = battr->data()->id();
binattr_info[b_index].data.size = battr->data()->data()->size();
binattr_info[b_index].data.ptr = allocate(binattr_info[b_index].data.size);
for (flatbuffers::uoffset_t tmp_index = 0; tmp_index < binattr_info[b_index].data.size; tmp_index++)
{
binattr_info[b_index].data.ptr[tmp_index] = battr->data()->data()->Get(tmp_index);
}
}
member_info->roomMemberBinAttrInternal = binattr_info;
}
RoomMemberDataInternal_to_SceNpMatching2RoomMemberDataInternal(member, room_info, member_info.get_ptr());
}
vm::ptr<SceNpMatching2RoomMemberDataInternal> ptr = room_info->memberList.members;
@ -310,6 +288,53 @@ u16 np_handler::RoomDataInternal_to_SceNpMatching2RoomDataInternal(const RoomDat
return member_id;
}
void np_handler::RoomMemberDataInternal_to_SceNpMatching2RoomMemberDataInternal(const RoomMemberDataInternal* member_data, const SceNpMatching2RoomDataInternal* room_info, SceNpMatching2RoomMemberDataInternal* sce_member_data)
{
UserInfo2_to_SceNpUserInfo2(member_data->userInfo(), &sce_member_data->userInfo);
sce_member_data->joinDate.tick = member_data->joinDate();
sce_member_data->memberId = member_data->memberId();
sce_member_data->teamId = member_data->teamId();
// Look for id
if (member_data->roomGroup() != 0 && room_info)
{
bool found = false;
for (u32 g_index = 0; g_index < room_info->roomGroupNum; g_index++)
{
if (room_info->roomGroup[g_index].groupId == member_data->roomGroup())
{
sce_member_data->roomGroup = vm::cast(room_info->roomGroup.addr() + (u32{sizeof(SceNpMatching2RoomGroup)} * g_index));
found = true;
break;
}
}
ensure(found);
}
sce_member_data->natType = member_data->natType();
sce_member_data->flagAttr = member_data->flagAttr();
if (member_data->roomMemberBinAttrInternal() && member_data->roomMemberBinAttrInternal()->size() != 0)
{
sce_member_data->roomMemberBinAttrInternalNum = member_data->roomMemberBinAttrInternal()->size();
vm::ptr<SceNpMatching2RoomMemberBinAttrInternal> binattr_info(allocate(sizeof(SceNpMatching2RoomMemberBinAttrInternal) * sce_member_data->roomMemberBinAttrInternalNum));
for (u32 b_index = 0; b_index < sce_member_data->roomMemberBinAttrInternalNum; b_index++)
{
const auto battr = member_data->roomMemberBinAttrInternal()->Get(b_index);
binattr_info[b_index].updateDate.tick = battr->updateDate();
binattr_info[b_index].data.id = battr->data()->id();
binattr_info[b_index].data.size = battr->data()->data()->size();
binattr_info[b_index].data.ptr = allocate(binattr_info[b_index].data.size);
for (flatbuffers::uoffset_t tmp_index = 0; tmp_index < binattr_info[b_index].data.size; tmp_index++)
{
binattr_info[b_index].data.ptr[tmp_index] = battr->data()->data()->Get(tmp_index);
}
}
sce_member_data->roomMemberBinAttrInternal = binattr_info;
}
}
void np_handler::RoomMemberUpdateInfo_to_SceNpMatching2RoomMemberUpdateInfo(const RoomMemberUpdateInfo* update_info, SceNpMatching2RoomMemberUpdateInfo* sce_update_info)
{
sce_update_info->eventCause = 0;
@ -328,36 +353,8 @@ void np_handler::RoomMemberUpdateInfo_to_SceNpMatching2RoomMemberUpdateInfo(cons
vm::ptr<SceNpMatching2RoomMemberDataInternal> member_info(allocate(sizeof(SceNpMatching2RoomMemberDataInternal)));
sce_update_info->roomMemberDataInternal = member_info;
UserInfo2_to_SceNpUserInfo2(member->userInfo(), &member_info->userInfo);
member_info->joinDate.tick = member->joinDate();
member_info->memberId = member->memberId();
member_info->teamId = member->teamId();
// Look for id
// TODO
member_info->natType = member->natType();
member_info->flagAttr = member->flagAttr();
if (member->roomMemberBinAttrInternal() && member->roomMemberBinAttrInternal()->size() != 0)
{
member_info->roomMemberBinAttrInternalNum = member->roomMemberBinAttrInternal()->size();
vm::ptr<SceNpMatching2RoomMemberBinAttrInternal> binattr_info(allocate(sizeof(SceNpMatching2RoomMemberBinAttrInternal) * member_info->roomMemberBinAttrInternalNum));
for (u32 b_index = 0; b_index < member_info->roomMemberBinAttrInternalNum; b_index++)
{
const auto battr = member->roomMemberBinAttrInternal()->Get(b_index);
binattr_info[b_index].updateDate.tick = battr->updateDate();
binattr_info[b_index].data.id = battr->data()->id();
binattr_info[b_index].data.size = battr->data()->data()->size();
binattr_info[b_index].data.ptr = allocate(binattr_info[b_index].data.size);
for (flatbuffers::uoffset_t tmp_index = 0; tmp_index < binattr_info[b_index].data.size; tmp_index++)
{
binattr_info[b_index].data.ptr[tmp_index] = battr->data()->data()->Get(tmp_index);
}
}
member_info->roomMemberBinAttrInternal = binattr_info;
}
// TODO: Pass room_info
RoomMemberDataInternal_to_SceNpMatching2RoomMemberDataInternal(member, nullptr, member_info.get_ptr());
}
}
@ -375,6 +372,100 @@ void np_handler::RoomUpdateInfo_to_SceNpMatching2RoomUpdateInfo(const RoomUpdate
}
}
void np_handler::RoomDataInternalUpdateInfo_to_SceNpMatching2RoomDataInternalUpdateInfo(const RoomDataInternalUpdateInfo* update_info, SceNpMatching2RoomDataInternalUpdateInfo* sce_update_info, const SceNpId& npid)
{
vm::ptr<SceNpMatching2RoomDataInternal> room_data(allocate(sizeof(SceNpMatching2RoomDataInternal)));
sce_update_info->newRoomDataInternal = room_data;
RoomDataInternal_to_SceNpMatching2RoomDataInternal(update_info->newRoomDataInternal(), sce_update_info->newRoomDataInternal.get_ptr(), npid);
if (update_info->newFlagAttr() == update_info->prevFlagAttr())
{
sce_update_info->newFlagAttr.set(0);
sce_update_info->prevFlagAttr.set(0);
}
else
{
sce_update_info->newFlagAttr = sce_update_info->newRoomDataInternal.ptr(&SceNpMatching2RoomDataInternal::flagAttr);
vm::ptr<SceNpMatching2FlagAttr> prev_flag_attr(allocate(sizeof(SceNpMatching2FlagAttr)));
*prev_flag_attr = update_info->prevFlagAttr();
sce_update_info->prevFlagAttr = prev_flag_attr;
}
if (update_info->newRoomPasswordSlotMask() == update_info->prevRoomPasswordSlotMask())
{
sce_update_info->newRoomPasswordSlotMask.set(0);
sce_update_info->prevRoomPasswordSlotMask.set(0);
}
else
{
sce_update_info->newRoomPasswordSlotMask = sce_update_info->newRoomDataInternal.ptr(&SceNpMatching2RoomDataInternal::passwordSlotMask);
vm::ptr<SceNpMatching2RoomPasswordSlotMask> prev_room_password_slot_mask(allocate(sizeof(SceNpMatching2RoomPasswordSlotMask)));
*prev_room_password_slot_mask = update_info->prevRoomPasswordSlotMask();
sce_update_info->prevRoomPasswordSlotMask = prev_room_password_slot_mask;
}
if (update_info->newRoomGroup() && update_info->newRoomGroup()->size() != 0)
{
rpcn_log.todo("RoomDataInternalUpdateInfo::newRoomGroup");
// TODO
//sce_update_info->newRoomGroupNum = update_info->newRoomGroup()->size();
//vm::ptr<SceNpMatching2RoomGroup> group_info(allocate(sizeof(SceNpMatching2RoomGroup) * sce_update_info->newRoomGroupNum));
//RoomGroups_to_SceNpMatching2RoomGroup(update_info->newRoomGroup(), group_info);
//sce_update_info->newRoomGroup = group_info;
}
if (update_info->newRoomBinAttrInternal() && update_info->newRoomBinAttrInternal()->size() != 0)
{
sce_update_info->newRoomBinAttrInternalNum = update_info->newRoomBinAttrInternal()->size();
vm::bpptr<SceNpMatching2RoomBinAttrInternal> binattr_info_array(allocate(4 * sce_update_info->newRoomBinAttrInternalNum));
for (uint i = 0; i < sce_update_info->newRoomBinAttrInternalNum; ++i)
{
vm::ptr<SceNpMatching2RoomBinAttrInternal> binattr_info = allocate(sizeof(SceNpMatching2RoomBinAttrInternal) * sce_update_info->newRoomBinAttrInternalNum);
binattr_info_array[i] = binattr_info;
RoomBinAttrInternal_to_SceNpMatching2RoomBinAttrInternal(update_info->newRoomBinAttrInternal()->Get(i), binattr_info);
}
sce_update_info->newRoomBinAttrInternal = binattr_info_array;
}
}
void np_handler::RoomMemberDataInternalUpdateInfo_to_SceNpMatching2RoomMemberDataInternalUpdateInfo(const RoomMemberDataInternalUpdateInfo* update_info, SceNpMatching2RoomMemberDataInternalUpdateInfo* sce_update_info)
{
vm::ptr<SceNpMatching2RoomMemberDataInternal> room_member_data(allocate(sizeof(SceNpMatching2RoomMemberDataInternal)));
sce_update_info->newRoomMemberDataInternal = room_member_data;
RoomMemberDataInternal_to_SceNpMatching2RoomMemberDataInternal(update_info->newRoomMemberDataInternal(), nullptr, sce_update_info->newRoomMemberDataInternal.get_ptr());
if (update_info->newFlagAttr() == update_info->prevFlagAttr())
{
sce_update_info->newFlagAttr.set(0);
sce_update_info->prevFlagAttr.set(0);
}
else
{
sce_update_info->newFlagAttr = sce_update_info->newRoomMemberDataInternal.ptr(&SceNpMatching2RoomMemberDataInternal::flagAttr);
vm::ptr<SceNpMatching2FlagAttr> prev_flag_attr(allocate(sizeof(SceNpMatching2FlagAttr)));
*prev_flag_attr = update_info->prevFlagAttr();
sce_update_info->prevFlagAttr = prev_flag_attr;
}
sce_update_info->newTeamId = sce_update_info->newRoomMemberDataInternal.ptr(&SceNpMatching2RoomMemberDataInternal::teamId);
if (update_info->newRoomMemberBinAttrInternal() && update_info->newRoomMemberBinAttrInternal()->size() != 0)
{
sce_update_info->newRoomMemberBinAttrInternalNum = update_info->newRoomMemberBinAttrInternal()->size();
vm::bpptr<SceNpMatching2RoomMemberBinAttrInternal> binattr_info_array(allocate(4 * sce_update_info->newRoomMemberBinAttrInternalNum));
for (uint i = 0; i < sce_update_info->newRoomMemberBinAttrInternalNum; ++i)
{
vm::ptr<SceNpMatching2RoomMemberBinAttrInternal> binattr_info = allocate(sizeof(SceNpMatching2RoomMemberBinAttrInternal) * sce_update_info->newRoomMemberBinAttrInternalNum);
binattr_info_array[i] = binattr_info;
RoomMemberBinAttrInternal_to_SceNpMatching2RoomMemberBinAttrInternal(update_info->newRoomMemberBinAttrInternal()->Get(i), binattr_info);
}
sce_update_info->newRoomMemberBinAttrInternal = binattr_info_array;
}
}
void np_handler::GetPingInfoResponse_to_SceNpMatching2SignalingGetPingInfoResponse(const GetPingInfoResponse* resp, SceNpMatching2SignalingGetPingInfoResponse* sce_resp)
{
sce_resp->serverId = resp->serverId();

View File

@ -8,7 +8,7 @@ table IntAttr {
num:uint32;
}
table MemberBinAttrInternal {
table RoomMemberBinAttrInternal {
updateDate:uint64;
data:BinAttr;
}
@ -46,7 +46,7 @@ table RoomMemberDataInternal {
roomGroup:uint8;
natType:uint8;
flagAttr:uint32;
roomMemberBinAttrInternal:[MemberBinAttrInternal];
roomMemberBinAttrInternal:[RoomMemberBinAttrInternal];
}
table RoomGroup {
@ -193,6 +193,15 @@ table SetRoomDataInternalRequest {
ownerPrivilegeRank:[uint16];
}
table SetRoomMemberDataInternalRequest {
roomId:uint64;
memberId:uint16;
teamId:uint8;
flagFilter:uint32;
flagAttr:uint32;
roomMemberBinAttrInternal:[BinAttr];
}
table GetRoomDataInternalRequest {
roomId:uint64;
attrId:[uint16];
@ -210,6 +219,24 @@ table RoomUpdateInfo {
optData:PresenceOptionData;
}
table RoomDataInternalUpdateInfo {
newRoomDataInternal:RoomDataInternal;
newFlagAttr:uint32;
prevFlagAttr:uint32;
newRoomPasswordSlotMask:uint64;
prevRoomPasswordSlotMask:uint64;
newRoomGroup:[RoomGroup];
newRoomBinAttrInternal:[BinAttrInternal];
}
table RoomMemberDataInternalUpdateInfo {
newRoomMemberDataInternal:RoomMemberDataInternal;
newFlagAttr:uint32;
prevFlagAttr:uint32;
newTeamId:uint8;
newRoomMemberBinAttrInternal:[RoomMemberBinAttrInternal];
}
table GetPingInfoResponse {
serverId:uint16;
worldId:uint32;

View File

@ -12,8 +12,8 @@ struct BinAttrBuilder;
struct IntAttr;
struct IntAttrBuilder;
struct MemberBinAttrInternal;
struct MemberBinAttrInternalBuilder;
struct RoomMemberBinAttrInternal;
struct RoomMemberBinAttrInternalBuilder;
struct BinAttrInternal;
struct BinAttrInternalBuilder;
@ -78,6 +78,9 @@ struct SetRoomDataExternalRequestBuilder;
struct SetRoomDataInternalRequest;
struct SetRoomDataInternalRequestBuilder;
struct SetRoomMemberDataInternalRequest;
struct SetRoomMemberDataInternalRequestBuilder;
struct GetRoomDataInternalRequest;
struct GetRoomDataInternalRequestBuilder;
@ -87,6 +90,12 @@ struct RoomMemberUpdateInfoBuilder;
struct RoomUpdateInfo;
struct RoomUpdateInfoBuilder;
struct RoomDataInternalUpdateInfo;
struct RoomDataInternalUpdateInfoBuilder;
struct RoomMemberDataInternalUpdateInfo;
struct RoomMemberDataInternalUpdateInfoBuilder;
struct GetPingInfoResponse;
struct GetPingInfoResponseBuilder;
@ -216,8 +225,8 @@ inline flatbuffers::Offset<IntAttr> CreateIntAttr(
return builder_.Finish();
}
struct MemberBinAttrInternal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef MemberBinAttrInternalBuilder Builder;
struct RoomMemberBinAttrInternal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef RoomMemberBinAttrInternalBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_UPDATEDATE = 4,
VT_DATA = 6
@ -237,32 +246,32 @@ struct MemberBinAttrInternal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tabl
}
};
struct MemberBinAttrInternalBuilder {
typedef MemberBinAttrInternal Table;
struct RoomMemberBinAttrInternalBuilder {
typedef RoomMemberBinAttrInternal Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_updateDate(uint64_t updateDate) {
fbb_.AddElement<uint64_t>(MemberBinAttrInternal::VT_UPDATEDATE, updateDate, 0);
fbb_.AddElement<uint64_t>(RoomMemberBinAttrInternal::VT_UPDATEDATE, updateDate, 0);
}
void add_data(flatbuffers::Offset<BinAttr> data) {
fbb_.AddOffset(MemberBinAttrInternal::VT_DATA, data);
fbb_.AddOffset(RoomMemberBinAttrInternal::VT_DATA, data);
}
explicit MemberBinAttrInternalBuilder(flatbuffers::FlatBufferBuilder &_fbb)
explicit RoomMemberBinAttrInternalBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
flatbuffers::Offset<MemberBinAttrInternal> Finish() {
flatbuffers::Offset<RoomMemberBinAttrInternal> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<MemberBinAttrInternal>(end);
auto o = flatbuffers::Offset<RoomMemberBinAttrInternal>(end);
return o;
}
};
inline flatbuffers::Offset<MemberBinAttrInternal> CreateMemberBinAttrInternal(
inline flatbuffers::Offset<RoomMemberBinAttrInternal> CreateRoomMemberBinAttrInternal(
flatbuffers::FlatBufferBuilder &_fbb,
uint64_t updateDate = 0,
flatbuffers::Offset<BinAttr> data = 0) {
MemberBinAttrInternalBuilder builder_(_fbb);
RoomMemberBinAttrInternalBuilder builder_(_fbb);
builder_.add_updateDate(updateDate);
builder_.add_data(data);
return builder_.Finish();
@ -590,8 +599,8 @@ struct RoomMemberDataInternal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Tab
uint32_t flagAttr() const {
return GetField<uint32_t>(VT_FLAGATTR, 0);
}
const flatbuffers::Vector<flatbuffers::Offset<MemberBinAttrInternal>> *roomMemberBinAttrInternal() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MemberBinAttrInternal>> *>(VT_ROOMMEMBERBINATTRINTERNAL);
const flatbuffers::Vector<flatbuffers::Offset<RoomMemberBinAttrInternal>> *roomMemberBinAttrInternal() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<RoomMemberBinAttrInternal>> *>(VT_ROOMMEMBERBINATTRINTERNAL);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
@ -635,7 +644,7 @@ struct RoomMemberDataInternalBuilder {
void add_flagAttr(uint32_t flagAttr) {
fbb_.AddElement<uint32_t>(RoomMemberDataInternal::VT_FLAGATTR, flagAttr, 0);
}
void add_roomMemberBinAttrInternal(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MemberBinAttrInternal>>> roomMemberBinAttrInternal) {
void add_roomMemberBinAttrInternal(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<RoomMemberBinAttrInternal>>> roomMemberBinAttrInternal) {
fbb_.AddOffset(RoomMemberDataInternal::VT_ROOMMEMBERBINATTRINTERNAL, roomMemberBinAttrInternal);
}
explicit RoomMemberDataInternalBuilder(flatbuffers::FlatBufferBuilder &_fbb)
@ -658,7 +667,7 @@ inline flatbuffers::Offset<RoomMemberDataInternal> CreateRoomMemberDataInternal(
uint8_t roomGroup = 0,
uint8_t natType = 0,
uint32_t flagAttr = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MemberBinAttrInternal>>> roomMemberBinAttrInternal = 0) {
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<RoomMemberBinAttrInternal>>> roomMemberBinAttrInternal = 0) {
RoomMemberDataInternalBuilder builder_(_fbb);
builder_.add_joinDate(joinDate);
builder_.add_roomMemberBinAttrInternal(roomMemberBinAttrInternal);
@ -680,8 +689,8 @@ inline flatbuffers::Offset<RoomMemberDataInternal> CreateRoomMemberDataInternalD
uint8_t roomGroup = 0,
uint8_t natType = 0,
uint32_t flagAttr = 0,
const std::vector<flatbuffers::Offset<MemberBinAttrInternal>> *roomMemberBinAttrInternal = nullptr) {
auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<flatbuffers::Offset<MemberBinAttrInternal>>(*roomMemberBinAttrInternal) : 0;
const std::vector<flatbuffers::Offset<RoomMemberBinAttrInternal>> *roomMemberBinAttrInternal = nullptr) {
auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<flatbuffers::Offset<RoomMemberBinAttrInternal>>(*roomMemberBinAttrInternal) : 0;
return CreateRoomMemberDataInternal(
_fbb,
userInfo,
@ -2499,6 +2508,118 @@ inline flatbuffers::Offset<SetRoomDataInternalRequest> CreateSetRoomDataInternal
ownerPrivilegeRank__);
}
struct SetRoomMemberDataInternalRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef SetRoomMemberDataInternalRequestBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_ROOMID = 4,
VT_MEMBERID = 6,
VT_TEAMID = 8,
VT_FLAGFILTER = 10,
VT_FLAGATTR = 12,
VT_ROOMMEMBERBINATTRINTERNAL = 14
};
uint64_t roomId() const {
return GetField<uint64_t>(VT_ROOMID, 0);
}
uint16_t memberId() const {
return GetField<uint16_t>(VT_MEMBERID, 0);
}
uint8_t teamId() const {
return GetField<uint8_t>(VT_TEAMID, 0);
}
uint32_t flagFilter() const {
return GetField<uint32_t>(VT_FLAGFILTER, 0);
}
uint32_t flagAttr() const {
return GetField<uint32_t>(VT_FLAGATTR, 0);
}
const flatbuffers::Vector<flatbuffers::Offset<BinAttr>> *roomMemberBinAttrInternal() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<BinAttr>> *>(VT_ROOMMEMBERBINATTRINTERNAL);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<uint64_t>(verifier, VT_ROOMID) &&
VerifyField<uint16_t>(verifier, VT_MEMBERID) &&
VerifyField<uint8_t>(verifier, VT_TEAMID) &&
VerifyField<uint32_t>(verifier, VT_FLAGFILTER) &&
VerifyField<uint32_t>(verifier, VT_FLAGATTR) &&
VerifyOffset(verifier, VT_ROOMMEMBERBINATTRINTERNAL) &&
verifier.VerifyVector(roomMemberBinAttrInternal()) &&
verifier.VerifyVectorOfTables(roomMemberBinAttrInternal()) &&
verifier.EndTable();
}
};
struct SetRoomMemberDataInternalRequestBuilder {
typedef SetRoomMemberDataInternalRequest Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_roomId(uint64_t roomId) {
fbb_.AddElement<uint64_t>(SetRoomMemberDataInternalRequest::VT_ROOMID, roomId, 0);
}
void add_memberId(uint16_t memberId) {
fbb_.AddElement<uint16_t>(SetRoomMemberDataInternalRequest::VT_MEMBERID, memberId, 0);
}
void add_teamId(uint8_t teamId) {
fbb_.AddElement<uint8_t>(SetRoomMemberDataInternalRequest::VT_TEAMID, teamId, 0);
}
void add_flagFilter(uint32_t flagFilter) {
fbb_.AddElement<uint32_t>(SetRoomMemberDataInternalRequest::VT_FLAGFILTER, flagFilter, 0);
}
void add_flagAttr(uint32_t flagAttr) {
fbb_.AddElement<uint32_t>(SetRoomMemberDataInternalRequest::VT_FLAGATTR, flagAttr, 0);
}
void add_roomMemberBinAttrInternal(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<BinAttr>>> roomMemberBinAttrInternal) {
fbb_.AddOffset(SetRoomMemberDataInternalRequest::VT_ROOMMEMBERBINATTRINTERNAL, roomMemberBinAttrInternal);
}
explicit SetRoomMemberDataInternalRequestBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
flatbuffers::Offset<SetRoomMemberDataInternalRequest> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<SetRoomMemberDataInternalRequest>(end);
return o;
}
};
inline flatbuffers::Offset<SetRoomMemberDataInternalRequest> CreateSetRoomMemberDataInternalRequest(
flatbuffers::FlatBufferBuilder &_fbb,
uint64_t roomId = 0,
uint16_t memberId = 0,
uint8_t teamId = 0,
uint32_t flagFilter = 0,
uint32_t flagAttr = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<BinAttr>>> roomMemberBinAttrInternal = 0) {
SetRoomMemberDataInternalRequestBuilder builder_(_fbb);
builder_.add_roomId(roomId);
builder_.add_roomMemberBinAttrInternal(roomMemberBinAttrInternal);
builder_.add_flagAttr(flagAttr);
builder_.add_flagFilter(flagFilter);
builder_.add_memberId(memberId);
builder_.add_teamId(teamId);
return builder_.Finish();
}
inline flatbuffers::Offset<SetRoomMemberDataInternalRequest> CreateSetRoomMemberDataInternalRequestDirect(
flatbuffers::FlatBufferBuilder &_fbb,
uint64_t roomId = 0,
uint16_t memberId = 0,
uint8_t teamId = 0,
uint32_t flagFilter = 0,
uint32_t flagAttr = 0,
const std::vector<flatbuffers::Offset<BinAttr>> *roomMemberBinAttrInternal = nullptr) {
auto roomMemberBinAttrInternal__ = roomMemberBinAttrInternal ? _fbb.CreateVector<flatbuffers::Offset<BinAttr>>(*roomMemberBinAttrInternal) : 0;
return CreateSetRoomMemberDataInternalRequest(
_fbb,
roomId,
memberId,
teamId,
flagFilter,
flagAttr,
roomMemberBinAttrInternal__);
}
struct GetRoomDataInternalRequest FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef GetRoomDataInternalRequestBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
@ -2687,6 +2808,235 @@ inline flatbuffers::Offset<RoomUpdateInfo> CreateRoomUpdateInfo(
return builder_.Finish();
}
struct RoomDataInternalUpdateInfo FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef RoomDataInternalUpdateInfoBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_NEWROOMDATAINTERNAL = 4,
VT_NEWFLAGATTR = 6,
VT_PREVFLAGATTR = 8,
VT_NEWROOMPASSWORDSLOTMASK = 10,
VT_PREVROOMPASSWORDSLOTMASK = 12,
VT_NEWROOMGROUP = 14,
VT_NEWROOMBINATTRINTERNAL = 16
};
const RoomDataInternal *newRoomDataInternal() const {
return GetPointer<const RoomDataInternal *>(VT_NEWROOMDATAINTERNAL);
}
uint32_t newFlagAttr() const {
return GetField<uint32_t>(VT_NEWFLAGATTR, 0);
}
uint32_t prevFlagAttr() const {
return GetField<uint32_t>(VT_PREVFLAGATTR, 0);
}
uint64_t newRoomPasswordSlotMask() const {
return GetField<uint64_t>(VT_NEWROOMPASSWORDSLOTMASK, 0);
}
uint64_t prevRoomPasswordSlotMask() const {
return GetField<uint64_t>(VT_PREVROOMPASSWORDSLOTMASK, 0);
}
const flatbuffers::Vector<flatbuffers::Offset<RoomGroup>> *newRoomGroup() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<RoomGroup>> *>(VT_NEWROOMGROUP);
}
const flatbuffers::Vector<flatbuffers::Offset<BinAttrInternal>> *newRoomBinAttrInternal() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<BinAttrInternal>> *>(VT_NEWROOMBINATTRINTERNAL);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_NEWROOMDATAINTERNAL) &&
verifier.VerifyTable(newRoomDataInternal()) &&
VerifyField<uint32_t>(verifier, VT_NEWFLAGATTR) &&
VerifyField<uint32_t>(verifier, VT_PREVFLAGATTR) &&
VerifyField<uint64_t>(verifier, VT_NEWROOMPASSWORDSLOTMASK) &&
VerifyField<uint64_t>(verifier, VT_PREVROOMPASSWORDSLOTMASK) &&
VerifyOffset(verifier, VT_NEWROOMGROUP) &&
verifier.VerifyVector(newRoomGroup()) &&
verifier.VerifyVectorOfTables(newRoomGroup()) &&
VerifyOffset(verifier, VT_NEWROOMBINATTRINTERNAL) &&
verifier.VerifyVector(newRoomBinAttrInternal()) &&
verifier.VerifyVectorOfTables(newRoomBinAttrInternal()) &&
verifier.EndTable();
}
};
struct RoomDataInternalUpdateInfoBuilder {
typedef RoomDataInternalUpdateInfo Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_newRoomDataInternal(flatbuffers::Offset<RoomDataInternal> newRoomDataInternal) {
fbb_.AddOffset(RoomDataInternalUpdateInfo::VT_NEWROOMDATAINTERNAL, newRoomDataInternal);
}
void add_newFlagAttr(uint32_t newFlagAttr) {
fbb_.AddElement<uint32_t>(RoomDataInternalUpdateInfo::VT_NEWFLAGATTR, newFlagAttr, 0);
}
void add_prevFlagAttr(uint32_t prevFlagAttr) {
fbb_.AddElement<uint32_t>(RoomDataInternalUpdateInfo::VT_PREVFLAGATTR, prevFlagAttr, 0);
}
void add_newRoomPasswordSlotMask(uint64_t newRoomPasswordSlotMask) {
fbb_.AddElement<uint64_t>(RoomDataInternalUpdateInfo::VT_NEWROOMPASSWORDSLOTMASK, newRoomPasswordSlotMask, 0);
}
void add_prevRoomPasswordSlotMask(uint64_t prevRoomPasswordSlotMask) {
fbb_.AddElement<uint64_t>(RoomDataInternalUpdateInfo::VT_PREVROOMPASSWORDSLOTMASK, prevRoomPasswordSlotMask, 0);
}
void add_newRoomGroup(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<RoomGroup>>> newRoomGroup) {
fbb_.AddOffset(RoomDataInternalUpdateInfo::VT_NEWROOMGROUP, newRoomGroup);
}
void add_newRoomBinAttrInternal(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<BinAttrInternal>>> newRoomBinAttrInternal) {
fbb_.AddOffset(RoomDataInternalUpdateInfo::VT_NEWROOMBINATTRINTERNAL, newRoomBinAttrInternal);
}
explicit RoomDataInternalUpdateInfoBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
flatbuffers::Offset<RoomDataInternalUpdateInfo> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<RoomDataInternalUpdateInfo>(end);
return o;
}
};
inline flatbuffers::Offset<RoomDataInternalUpdateInfo> CreateRoomDataInternalUpdateInfo(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<RoomDataInternal> newRoomDataInternal = 0,
uint32_t newFlagAttr = 0,
uint32_t prevFlagAttr = 0,
uint64_t newRoomPasswordSlotMask = 0,
uint64_t prevRoomPasswordSlotMask = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<RoomGroup>>> newRoomGroup = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<BinAttrInternal>>> newRoomBinAttrInternal = 0) {
RoomDataInternalUpdateInfoBuilder builder_(_fbb);
builder_.add_prevRoomPasswordSlotMask(prevRoomPasswordSlotMask);
builder_.add_newRoomPasswordSlotMask(newRoomPasswordSlotMask);
builder_.add_newRoomBinAttrInternal(newRoomBinAttrInternal);
builder_.add_newRoomGroup(newRoomGroup);
builder_.add_prevFlagAttr(prevFlagAttr);
builder_.add_newFlagAttr(newFlagAttr);
builder_.add_newRoomDataInternal(newRoomDataInternal);
return builder_.Finish();
}
inline flatbuffers::Offset<RoomDataInternalUpdateInfo> CreateRoomDataInternalUpdateInfoDirect(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<RoomDataInternal> newRoomDataInternal = 0,
uint32_t newFlagAttr = 0,
uint32_t prevFlagAttr = 0,
uint64_t newRoomPasswordSlotMask = 0,
uint64_t prevRoomPasswordSlotMask = 0,
const std::vector<flatbuffers::Offset<RoomGroup>> *newRoomGroup = nullptr,
const std::vector<flatbuffers::Offset<BinAttrInternal>> *newRoomBinAttrInternal = nullptr) {
auto newRoomGroup__ = newRoomGroup ? _fbb.CreateVector<flatbuffers::Offset<RoomGroup>>(*newRoomGroup) : 0;
auto newRoomBinAttrInternal__ = newRoomBinAttrInternal ? _fbb.CreateVector<flatbuffers::Offset<BinAttrInternal>>(*newRoomBinAttrInternal) : 0;
return CreateRoomDataInternalUpdateInfo(
_fbb,
newRoomDataInternal,
newFlagAttr,
prevFlagAttr,
newRoomPasswordSlotMask,
prevRoomPasswordSlotMask,
newRoomGroup__,
newRoomBinAttrInternal__);
}
struct RoomMemberDataInternalUpdateInfo FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef RoomMemberDataInternalUpdateInfoBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_NEWROOMMEMBERDATAINTERNAL = 4,
VT_NEWFLAGATTR = 6,
VT_PREVFLAGATTR = 8,
VT_NEWTEAMID = 10,
VT_NEWROOMMEMBERBINATTRINTERNAL = 12
};
const RoomMemberDataInternal *newRoomMemberDataInternal() const {
return GetPointer<const RoomMemberDataInternal *>(VT_NEWROOMMEMBERDATAINTERNAL);
}
uint32_t newFlagAttr() const {
return GetField<uint32_t>(VT_NEWFLAGATTR, 0);
}
uint32_t prevFlagAttr() const {
return GetField<uint32_t>(VT_PREVFLAGATTR, 0);
}
uint8_t newTeamId() const {
return GetField<uint8_t>(VT_NEWTEAMID, 0);
}
const flatbuffers::Vector<flatbuffers::Offset<RoomMemberBinAttrInternal>> *newRoomMemberBinAttrInternal() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<RoomMemberBinAttrInternal>> *>(VT_NEWROOMMEMBERBINATTRINTERNAL);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyOffset(verifier, VT_NEWROOMMEMBERDATAINTERNAL) &&
verifier.VerifyTable(newRoomMemberDataInternal()) &&
VerifyField<uint32_t>(verifier, VT_NEWFLAGATTR) &&
VerifyField<uint32_t>(verifier, VT_PREVFLAGATTR) &&
VerifyField<uint8_t>(verifier, VT_NEWTEAMID) &&
VerifyOffset(verifier, VT_NEWROOMMEMBERBINATTRINTERNAL) &&
verifier.VerifyVector(newRoomMemberBinAttrInternal()) &&
verifier.VerifyVectorOfTables(newRoomMemberBinAttrInternal()) &&
verifier.EndTable();
}
};
struct RoomMemberDataInternalUpdateInfoBuilder {
typedef RoomMemberDataInternalUpdateInfo Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_newRoomMemberDataInternal(flatbuffers::Offset<RoomMemberDataInternal> newRoomMemberDataInternal) {
fbb_.AddOffset(RoomMemberDataInternalUpdateInfo::VT_NEWROOMMEMBERDATAINTERNAL, newRoomMemberDataInternal);
}
void add_newFlagAttr(uint32_t newFlagAttr) {
fbb_.AddElement<uint32_t>(RoomMemberDataInternalUpdateInfo::VT_NEWFLAGATTR, newFlagAttr, 0);
}
void add_prevFlagAttr(uint32_t prevFlagAttr) {
fbb_.AddElement<uint32_t>(RoomMemberDataInternalUpdateInfo::VT_PREVFLAGATTR, prevFlagAttr, 0);
}
void add_newTeamId(uint8_t newTeamId) {
fbb_.AddElement<uint8_t>(RoomMemberDataInternalUpdateInfo::VT_NEWTEAMID, newTeamId, 0);
}
void add_newRoomMemberBinAttrInternal(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<RoomMemberBinAttrInternal>>> newRoomMemberBinAttrInternal) {
fbb_.AddOffset(RoomMemberDataInternalUpdateInfo::VT_NEWROOMMEMBERBINATTRINTERNAL, newRoomMemberBinAttrInternal);
}
explicit RoomMemberDataInternalUpdateInfoBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
flatbuffers::Offset<RoomMemberDataInternalUpdateInfo> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<RoomMemberDataInternalUpdateInfo>(end);
return o;
}
};
inline flatbuffers::Offset<RoomMemberDataInternalUpdateInfo> CreateRoomMemberDataInternalUpdateInfo(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<RoomMemberDataInternal> newRoomMemberDataInternal = 0,
uint32_t newFlagAttr = 0,
uint32_t prevFlagAttr = 0,
uint8_t newTeamId = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<RoomMemberBinAttrInternal>>> newRoomMemberBinAttrInternal = 0) {
RoomMemberDataInternalUpdateInfoBuilder builder_(_fbb);
builder_.add_newRoomMemberBinAttrInternal(newRoomMemberBinAttrInternal);
builder_.add_prevFlagAttr(prevFlagAttr);
builder_.add_newFlagAttr(newFlagAttr);
builder_.add_newRoomMemberDataInternal(newRoomMemberDataInternal);
builder_.add_newTeamId(newTeamId);
return builder_.Finish();
}
inline flatbuffers::Offset<RoomMemberDataInternalUpdateInfo> CreateRoomMemberDataInternalUpdateInfoDirect(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<RoomMemberDataInternal> newRoomMemberDataInternal = 0,
uint32_t newFlagAttr = 0,
uint32_t prevFlagAttr = 0,
uint8_t newTeamId = 0,
const std::vector<flatbuffers::Offset<RoomMemberBinAttrInternal>> *newRoomMemberBinAttrInternal = nullptr) {
auto newRoomMemberBinAttrInternal__ = newRoomMemberBinAttrInternal ? _fbb.CreateVector<flatbuffers::Offset<RoomMemberBinAttrInternal>>(*newRoomMemberBinAttrInternal) : 0;
return CreateRoomMemberDataInternalUpdateInfo(
_fbb,
newRoomMemberDataInternal,
newFlagAttr,
prevFlagAttr,
newTeamId,
newRoomMemberBinAttrInternal__);
}
struct GetPingInfoResponse FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef GetPingInfoResponseBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {

View File

@ -622,6 +622,19 @@ u32 np_handler::set_roomdata_internal(SceNpMatching2ContextId ctx_id, vm::cptr<S
return req_id;
}
u32 np_handler::set_roommemberdata_internal(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatching2RequestOptParam> optParam, const SceNpMatching2SetRoomMemberDataInternalRequest* req)
{
u32 req_id = generate_callback_info(ctx_id, optParam);
if (!rpcn->set_roommemberdata_internal(req_id, get_match2_context(ctx_id)->communicationId, req))
{
rpcn_log.error("Disconnecting from RPCN!");
is_psn_active = false;
}
return req_id;
}
u32 np_handler::get_ping_info(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatching2RequestOptParam> optParam, const SceNpMatching2SignalingGetPingInfoRequest* req)
{
u32 req_id = generate_callback_info(ctx_id, optParam);
@ -684,7 +697,7 @@ u32 np_handler::get_match2_event(SceNpMatching2EventKey event_key, u8* dest, u32
{
std::lock_guard lock(mutex_req_results);
if (!match2_req_results.count(event_key))
if (!match2_req_results.contains(event_key))
return 0;
u32 size_copied = std::min(size, static_cast<u32>(match2_req_results.at(event_key).size()));
@ -784,6 +797,7 @@ void np_handler::operator()()
case rpcn::CommandType::SetRoomDataExternal: reply_set_roomdata_external(req_id, data); break;
case rpcn::CommandType::GetRoomDataInternal: reply_get_roomdata_internal(req_id, data); break;
case rpcn::CommandType::SetRoomDataInternal: reply_set_roomdata_internal(req_id, data); break;
case rpcn::CommandType::SetRoomMemberDataInternal: reply_set_roommemberdata_internal(req_id, data); break;
case rpcn::CommandType::PingRoomOwner: reply_get_ping_info(req_id, data); break;
case rpcn::CommandType::SendRoomMessage: reply_send_room_message(req_id, data); break;
case rpcn::CommandType::RequestSignalingInfos: reply_req_sign_infos(req_id, data); break;
@ -800,6 +814,8 @@ void np_handler::operator()()
case rpcn::NotificationType::UserJoinedRoom: notif_user_joined_room(notif.second); break;
case rpcn::NotificationType::UserLeftRoom: notif_user_left_room(notif.second); break;
case rpcn::NotificationType::RoomDestroyed: notif_room_destroyed(notif.second); break;
case rpcn::NotificationType::UpdatedRoomDataInternal: notif_updated_room_data_internal(notif.second); break;
case rpcn::NotificationType::UpdatedRoomMemberDataInternal: notif_updated_room_member_data_internal(notif.second); break;
case rpcn::NotificationType::SignalP2PConnect: notif_p2p_connect(notif.second); break;
case rpcn::NotificationType::RoomMessageReceived: notif_room_message_received(notif.second); break;
default: rpcn_log.error("Unknown notification(%d) received!", notif.first); break;
@ -1121,6 +1137,21 @@ bool np_handler::reply_set_roomdata_internal(u32 req_id, std::vector<u8>& /*repl
return true;
}
bool np_handler::reply_set_roommemberdata_internal(u32 req_id, std::vector<u8>& /*reply_data*/)
{
const auto cb_info = take_pending_request(req_id);
u32 event_key = get_event_key(); // Unsure if necessary if there is no data
sysutil_register_cb([=](ppu_thread& cb_ppu) -> s32
{
cb_info.cb(cb_ppu, cb_info.ctx_id, req_id, SCE_NP_MATCHING2_REQUEST_EVENT_SetRoomMemberDataInternal, event_key, 0, 0, cb_info.cb_arg);
return 0;
});
return true;
}
bool np_handler::reply_get_ping_info(u32 req_id, std::vector<u8>& reply_data)
{
const auto cb_info = take_pending_request(req_id);
@ -1291,6 +1322,67 @@ void np_handler::notif_room_destroyed(std::vector<u8>& data)
});
}
void np_handler::notif_updated_room_data_internal(std::vector<u8>& data)
{
vec_stream noti(data);
SceNpMatching2RoomId room_id = noti.get<u64>();
auto update_info_raw = noti.get_rawdata();
if (noti.is_error())
{
rpcn_log.error("Received faulty UpdatedRoomDataInternal notification");
return;
}
u32 event_key = get_event_key();
auto update_info = flatbuffers::GetRoot<RoomDataInternalUpdateInfo>(update_info_raw.data());
SceNpMatching2RoomDataInternalUpdateInfo* notif_data = reinterpret_cast<SceNpMatching2RoomDataInternalUpdateInfo*>(allocate_req_result(event_key, sizeof(SceNpMatching2RoomDataInternalUpdateInfo)));
RoomDataInternalUpdateInfo_to_SceNpMatching2RoomDataInternalUpdateInfo(update_info, notif_data, npid);
extra_nps::print_room_data_internal(notif_data->newRoomDataInternal.get_ptr());
rpcn_log.notice("Received notification that room(%d)'s data was updated", room_id);
auto& sigh = g_fxo->get<named_thread<signaling_handler>>();
sigh.disconnect_sig2_users(room_id);
sysutil_register_cb([room_event_cb = this->room_event_cb, room_event_cb_ctx = this->room_event_cb_ctx, room_id, event_key, room_event_cb_arg = this->room_event_cb_arg](ppu_thread& cb_ppu) -> s32
{
room_event_cb(cb_ppu, room_event_cb_ctx, room_id, SCE_NP_MATCHING2_ROOM_EVENT_UpdatedRoomDataInternal, event_key, 0, sizeof(SceNpMatching2RoomDataInternalUpdateInfo), room_event_cb_arg);
return 0;
});
}
void np_handler::notif_updated_room_member_data_internal(std::vector<u8>& data)
{
vec_stream noti(data);
SceNpMatching2RoomId room_id = noti.get<u64>();
auto update_info_raw = noti.get_rawdata();
if (noti.is_error())
{
rpcn_log.error("Received faulty UpdatedRoomMemberDataInternal notification");
return;
}
u32 event_key = get_event_key();
auto update_info = flatbuffers::GetRoot<RoomMemberDataInternalUpdateInfo>(update_info_raw.data());
SceNpMatching2RoomMemberDataInternalUpdateInfo* notif_data = reinterpret_cast<SceNpMatching2RoomMemberDataInternalUpdateInfo*>(allocate_req_result(event_key, sizeof(SceNpMatching2RoomMemberDataInternalUpdateInfo)));
RoomMemberDataInternalUpdateInfo_to_SceNpMatching2RoomMemberDataInternalUpdateInfo(update_info, notif_data);
rpcn_log.notice("Received notification that user's %s(%d) room (%d) data was updated", notif_data->newRoomMemberDataInternal->userInfo.npId.handle.data, notif_data->newRoomMemberDataInternal->memberId, room_id);
extra_nps::print_room_member_data_internal(notif_data->newRoomMemberDataInternal.get_ptr());
sysutil_register_cb([room_event_cb = this->room_event_cb, room_event_cb_ctx = this->room_event_cb_ctx, room_id, event_key, room_event_cb_arg = this->room_event_cb_arg](ppu_thread& cb_ppu) -> s32
{
room_event_cb(cb_ppu, room_event_cb_ctx, room_id, SCE_NP_MATCHING2_ROOM_EVENT_UpdatedRoomMemberDataInternal, event_key, 0, sizeof(SceNpMatching2RoomMemberDataInternalUpdateInfo), room_event_cb_arg);
return 0;
});
}
void np_handler::notif_p2p_connect(std::vector<u8>& data)
{
if (data.size() != 16)
@ -1355,7 +1447,7 @@ void np_handler::remove_dns_spy(u32 sock)
bool np_handler::is_dns(u32 sock) const
{
return dns_spylist.count(sock) != 0;
return dns_spylist.contains(sock);
}
bool np_handler::is_dns_queue(u32 sock) const
@ -1442,7 +1534,7 @@ s32 np_handler::analyze_dns_packet(s32 s, const u8* buf, u32 len)
sys_net.warning("DNS query for %s", host);
if (switch_map.count(host))
if (switch_map.contains(host))
{
// design fake packet
std::vector<u8> fake(len);

View File

@ -109,6 +109,7 @@ public:
u32 set_roomdata_external(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatching2RequestOptParam> optParam, const SceNpMatching2SetRoomDataExternalRequest* req);
u32 get_roomdata_internal(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatching2RequestOptParam> optParam, const SceNpMatching2GetRoomDataInternalRequest* req);
u32 set_roomdata_internal(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatching2RequestOptParam> optParam, const SceNpMatching2SetRoomDataInternalRequest* req);
u32 set_roommemberdata_internal(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatching2RequestOptParam> optParam, const SceNpMatching2SetRoomMemberDataInternalRequest* req);
u32 get_ping_info(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatching2RequestOptParam> optParam, const SceNpMatching2SignalingGetPingInfoRequest* req);
u32 send_room_message(SceNpMatching2ContextId ctx_id, vm::cptr<SceNpMatching2RequestOptParam> optParam, const SceNpMatching2SendRoomMessageRequest* req);
@ -144,6 +145,8 @@ private:
void notif_user_joined_room(std::vector<u8>& data);
void notif_user_left_room(std::vector<u8>& data);
void notif_room_destroyed(std::vector<u8>& data);
void notif_updated_room_data_internal(std::vector<u8>& data);
void notif_updated_room_member_data_internal(std::vector<u8>& data);
void notif_p2p_connect(std::vector<u8>& data);
void notif_room_message_received(std::vector<u8>& data);
@ -157,23 +160,30 @@ private:
bool reply_set_roomdata_external(u32 req_id, std::vector<u8>& reply_data);
bool reply_get_roomdata_internal(u32 req_id, std::vector<u8>& reply_data);
bool reply_set_roomdata_internal(u32 req_id, std::vector<u8>& reply_data);
bool reply_set_roommemberdata_internal(u32 req_id, std::vector<u8>& reply_data);
bool reply_get_ping_info(u32 req_id, std::vector<u8>& reply_data);
bool reply_send_room_message(u32 req_id, std::vector<u8>& reply_data);
bool reply_req_sign_infos(u32 req_id, std::vector<u8>& reply_data);
bool reply_req_ticket(u32 req_id, std::vector<u8>& reply_data);
// Helper functions(fb=>np2)
void BinAttr_to_SceNpMatching2BinAttr(const flatbuffers::Vector<flatbuffers::Offset<BinAttr>>* fb_attr, vm::ptr<SceNpMatching2BinAttr> binattr_info);
void RoomGroup_to_SceNpMatching2RoomGroup(const flatbuffers::Vector<flatbuffers::Offset<RoomGroup>>* fb_group, vm::ptr<SceNpMatching2RoomGroup> group_info);
void BinAttr_to_SceNpMatching2BinAttr(const BinAttr* bin_attr, SceNpMatching2BinAttr* binattr_info);
void BinAttrs_to_SceNpMatching2BinAttr(const flatbuffers::Vector<flatbuffers::Offset<BinAttr>>* fb_attr, vm::ptr<SceNpMatching2BinAttr> binattr_info);
void RoomMemberBinAttrInternal_to_SceNpMatching2RoomMemberBinAttrInternal(const RoomMemberBinAttrInternal* fb_attr, vm::ptr<SceNpMatching2RoomMemberBinAttrInternal> binattr_info);
void RoomBinAttrInternal_to_SceNpMatching2RoomBinAttrInternal(const BinAttrInternal* fb_attr, vm::ptr<SceNpMatching2RoomBinAttrInternal> binattr_info);
void RoomGroups_to_SceNpMatching2RoomGroup(const flatbuffers::Vector<flatbuffers::Offset<RoomGroup>>* fb_group, vm::ptr<SceNpMatching2RoomGroup> group_info);
void UserInfo2_to_SceNpUserInfo2(const UserInfo2* user, SceNpUserInfo2* user_info);
void RoomDataExternal_to_SceNpMatching2RoomDataExternal(const RoomDataExternal* room, SceNpMatching2RoomDataExternal* room_info);
void SearchRoomResponse_to_SceNpMatching2SearchRoomResponse(const SearchRoomResponse* resp, SceNpMatching2SearchRoomResponse* search_resp);
void GetRoomDataExternalListResponse_to_SceNpMatching2GetRoomDataExternalListResponse(const GetRoomDataExternalListResponse* resp, SceNpMatching2GetRoomDataExternalListResponse* get_resp);
u16 RoomDataInternal_to_SceNpMatching2RoomDataInternal(const RoomDataInternal* resp, SceNpMatching2RoomDataInternal* room_resp, const SceNpId& npid);
void RoomMemberDataInternal_to_SceNpMatching2RoomMemberDataInternal(const RoomMemberDataInternal* member_data, const SceNpMatching2RoomDataInternal* room_info, SceNpMatching2RoomMemberDataInternal* sce_member_data);
void RoomMemberUpdateInfo_to_SceNpMatching2RoomMemberUpdateInfo(const RoomMemberUpdateInfo* resp, SceNpMatching2RoomMemberUpdateInfo* room_info);
void RoomUpdateInfo_to_SceNpMatching2RoomUpdateInfo(const RoomUpdateInfo* update_info, SceNpMatching2RoomUpdateInfo* sce_update_info);
void GetPingInfoResponse_to_SceNpMatching2SignalingGetPingInfoResponse(const GetPingInfoResponse* resp, SceNpMatching2SignalingGetPingInfoResponse* sce_resp);
void RoomMessageInfo_to_SceNpMatching2RoomMessageInfo(const RoomMessageInfo* mi, SceNpMatching2RoomMessageInfo* sce_mi);
void RoomDataInternalUpdateInfo_to_SceNpMatching2RoomDataInternalUpdateInfo(const RoomDataInternalUpdateInfo* update_info, SceNpMatching2RoomDataInternalUpdateInfo* sce_update_info, const SceNpId& npid);
void RoomMemberDataInternalUpdateInfo_to_SceNpMatching2RoomMemberDataInternalUpdateInfo(const RoomMemberDataInternalUpdateInfo* update_info, SceNpMatching2RoomMemberDataInternalUpdateInfo* sce_update_info);
struct callback_info
{

View File

@ -182,11 +182,11 @@ namespace extra_nps
print_bin_attr_internal(&room->roomBinAttrInternal[i]);
}
void print_create_room_resp(const SceNpMatching2CreateJoinRoomResponse *resp)
void print_create_room_resp(const SceNpMatching2CreateJoinRoomResponse* resp)
{
sceNp2.warning("SceNpMatching2CreateJoinRoomResponse:");
sceNp2.warning("roomDataInternal: *0x%x", resp->roomDataInternal);
if(resp->roomDataInternal)
if (resp->roomDataInternal)
print_room_data_internal(resp->roomDataInternal.get_ptr());
}
@ -217,4 +217,18 @@ namespace extra_nps
sceNp2.warning("ownerPrivilegeRankNum: %d", req->ownerPrivilegeRankNum);
}
void print_set_roommemberdata_int_req(const SceNpMatching2SetRoomMemberDataInternalRequest* req)
{
sceNp2.warning("SceNpMatching2SetRoomMemberDataInternalRequest:");
sceNp2.warning("roomId: %d", req->roomId);
sceNp2.warning("memberId: %d", req->memberId);
sceNp2.warning("teamId: %d", req->teamId);
sceNp2.warning("flagFilter: 0x%x", req->flagFilter);
sceNp2.warning("flagAttr: 0x%x", req->flagAttr);
sceNp2.warning("roomMemberBinAttrInternal: *0x%x", req->roomMemberBinAttrInternal);
sceNp2.warning("roomMemberBinAttrInternalNum: %d", req->roomMemberBinAttrInternalNum);
for (u32 i = 0; i < req->roomMemberBinAttrInternalNum; i++)
print_bin_attr(&req->roomMemberBinAttrInternal[i]);
}
} // namespace extra_nps

View File

@ -17,4 +17,5 @@ namespace extra_nps
void print_search_room(const SceNpMatching2SearchRoomRequest* req);
void print_set_roomdata_ext_req(const SceNpMatching2SetRoomDataExternalRequest* req);
void print_set_roomdata_int_req(const SceNpMatching2SetRoomDataInternalRequest* req);
void print_set_roommemberdata_int_req(const SceNpMatching2SetRoomMemberDataInternalRequest* req);
} // namespace extra_nps

View File

@ -41,8 +41,7 @@ std::vector<std::vector<u8>> get_rpcn_msgs();
namespace rpcn
{
constexpr u32 RPCN_PROTOCOL_VERSION = 13;
constexpr u32 RPCN_PROTOCOL_VERSION = 14;
constexpr usz RPCN_HEADER_SIZE = 13;
constexpr usz COMMUNICATION_ID_SIZE = 9;
@ -1472,6 +1471,42 @@ namespace rpcn
return true;
}
bool rpcn_client::set_roommemberdata_internal(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SetRoomMemberDataInternalRequest* req)
{
std::vector<u8> data{};
extra_nps::print_set_roommemberdata_int_req(req);
flatbuffers::FlatBufferBuilder builder(1024);
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<BinAttr>>> final_binattrinternal_vec;
if (req->roomMemberBinAttrInternalNum)
{
std::vector<flatbuffers::Offset<BinAttr>> davec;
for (u32 i = 0; i < req->roomMemberBinAttrInternalNum; i++)
{
auto bin = CreateBinAttr(builder, req->roomMemberBinAttrInternal[i].id, builder.CreateVector(req->roomMemberBinAttrInternal[i].ptr.get_ptr(), req->roomMemberBinAttrInternal[i].size));
davec.push_back(bin);
}
final_binattrinternal_vec = builder.CreateVector(davec);
}
auto req_finished = CreateSetRoomMemberDataInternalRequest(builder, req->roomId, req->memberId, req->teamId, req->flagFilter, req->flagAttr, final_binattrinternal_vec);
builder.Finish(req_finished);
u8* buf = builder.GetBufferPointer();
usz bufsize = builder.GetSize();
data.resize(COMMUNICATION_ID_SIZE + bufsize + sizeof(u32));
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::SetRoomMemberDataInternal, req_id, data))
return false;
return true;
}
bool rpcn_client::ping_room_owner(u32 req_id, const SceNpCommunicationId& communication_id, u64 room_id)
{
std::vector<u8> data;

View File

@ -124,6 +124,7 @@ namespace rpcn
SetRoomDataExternal,
GetRoomDataInternal,
SetRoomDataInternal,
SetRoomMemberDataInternal,
PingRoomOwner,
SendRoomMessage,
RequestSignalingInfos,
@ -136,6 +137,8 @@ namespace rpcn
UserJoinedRoom,
UserLeftRoom,
RoomDestroyed,
UpdatedRoomDataInternal,
UpdatedRoomMemberDataInternal,
SignalP2PConnect,
_SignalP2PDisconnect,
FriendQuery, // Other user sent a friend request
@ -328,6 +331,7 @@ namespace rpcn
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 set_roommemberdata_internal(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SetRoomMemberDataInternalRequest* 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);