1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
4 Convert SCE PSN Matching2 request, signaling and room responses into an internal format that we can pass between threads.
5 Memory is allocated in Memento, so be sure to clean it when you don't need it.
8 #ifndef __CRYPSN2_RESPONSE_H__
9 #define __CRYPSN2_RESPONSE_H__
12 #if CRY_PLATFORM_ORBIS
15 #define MAX_ROOM_EXTERNAL_BIN_ATTRIBUTES (SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_NUM)
16 #define MAX_ROOM_INTERNAL_BIN_ATTRIBUTES (SCE_NP_MATCHING2_ROOM_BIN_ATTR_INTERNAL_NUM)
17 #define MAX_ROOM_SEARCHABLE_BIN_ATTRIBUTES (SCE_NP_MATCHING2_ROOM_SEARCHABLE_BIN_ATTR_EXTERNAL_NUM)
18 #define MAX_ROOM_SEARCHABLE_UINT_ATTRIBUTES (SCE_NP_MATCHING2_ROOM_SEARCHABLE_INT_ATTR_EXTERNAL_NUM)
19 #define MAX_MEMBER_INTERNAL_BIN_ATTRIBUTES (SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_NUM)
20 #define MAX_BIN_ATTRIBUTE_SIZE (256) // use largest of SCE_NP_MATCHING2_ROOM_BIN_ATTR_INTERNAL_MAX_SIZE,
21 // SCE_NP_MATCHING2_ROOM_BIN_ATTR_EXTERNAL_MAX_SIZE,
22 // SCE_NP_MATCHING2_ROOMMEMBER_BIN_ATTR_INTERNAL_MAX_SIZE,
23 // SCE_NP_MATCHING2_ROOM_SEARCHABLE_BIN_ATTR_EXTERNAL_MAX_SIZE
25 #define REQUEST_EVENT_GET_WORLD_INFO_LIST (SCE_NP_MATCHING2_REQUEST_EVENT_GET_WORLD_INFO_LIST)
26 #define REQUEST_EVENT_LEAVE_ROOM (SCE_NP_MATCHING2_REQUEST_EVENT_LEAVE_ROOM)
27 #define REQUEST_EVENT_SET_ROOM_MEMBER_DATA_INTERNAL (SCE_NP_MATCHING2_REQUEST_EVENT_SET_ROOM_MEMBER_DATA_INTERNAL)
28 #define REQUEST_EVENT_SET_ROOM_DATA_EXTERNAL (SCE_NP_MATCHING2_REQUEST_EVENT_SET_ROOM_DATA_EXTERNAL)
29 #define REQUEST_EVENT_SET_ROOM_DATA_INTERNAL (SCE_NP_MATCHING2_REQUEST_EVENT_SET_ROOM_DATA_INTERNAL)
30 #define REQUEST_EVENT_GET_ROOM_DATA_EXTERNAL_LIST (SCE_NP_MATCHING2_REQUEST_EVENT_GET_ROOM_DATA_EXTERNAL_LIST)
31 #define REQUEST_EVENT_SEARCH_ROOM (SCE_NP_MATCHING2_REQUEST_EVENT_SEARCH_ROOM)
32 #define REQUEST_EVENT_SIGNALING_GET_PING_INFO (SCE_NP_MATCHING2_REQUEST_EVENT_SIGNALING_GET_PING_INFO)
33 #define REQUEST_EVENT_JOIN_ROOM (SCE_NP_MATCHING2_REQUEST_EVENT_JOIN_ROOM)
34 #define REQUEST_EVENT_CREATE_JOIN_ROOM (SCE_NP_MATCHING2_REQUEST_EVENT_CREATE_JOIN_ROOM)
35 #define REQUEST_EVENT_GRANT_ROOM_OWNER (SCE_NP_MATCHING2_REQUEST_EVENT_GRANT_ROOM_OWNER)
36 #define ROOM_EVENT_MEMBER_JOINED (SCE_NP_MATCHING2_ROOM_EVENT_MEMBER_JOINED)
37 #define ROOM_EVENT_MEMBER_LEFT (SCE_NP_MATCHING2_ROOM_EVENT_MEMBER_LEFT)
38 #define ROOM_EVENT_ROOM_OWNER_CHANGED (SCE_NP_MATCHING2_ROOM_EVENT_ROOM_OWNER_CHANGED)
39 #define ROOM_EVENT_KICKED_OUT (SCE_NP_MATCHING2_ROOM_EVENT_KICKEDOUT)
40 #define ROOM_EVENT_ROOM_DESTROYED (SCE_NP_MATCHING2_ROOM_EVENT_ROOM_DESTROYED)
41 #define ROOM_EVENT_UPDATED_ROOM_DATA_INTERNAL (SCE_NP_MATCHING2_ROOM_EVENT_UPDATED_ROOM_DATA_INTERNAL)
42 #define ROOM_EVENT_UPDATED_ROOM_MEMBER_DATA_INTERNAL (SCE_NP_MATCHING2_ROOM_EVENT_UPDATED_ROOM_MEMBER_DATA_INTERNAL)
43 #define ROOM_EVENT_UPDATED_SIGNALING_OPT_PARAM (SCE_NP_MATCHING2_ROOM_EVENT_UPDATED_SIGNALING_OPT_PARAM)
44 #define SIGNALING_EVENT_DEAD (SCE_NP_MATCHING2_SIGNALING_EVENT_DEAD)
45 #define SIGNALING_EVENT_CONNECTED (SCE_NP_MATCHING2_SIGNALING_EVENT_ESTABLISHED)
46 #define SIGNALING_EVENT_NETINFO_RESULT (SCE_NP_MATCHING2_SIGNALING_EVENT_NETINFO_RESULT)
48 struct SCryPSNServerInfoResponse
52 SceNpMatching2ServerId serverId
;
57 struct SCryPSNBinAttribute
59 SceNpMatching2AttributeId m_id
;
60 uint8 m_data
[MAX_BIN_ATTRIBUTE_SIZE
];
63 bool Clone(CCryLobby
* pLobby
, SceNpMatching2RoomMemberBinAttrInternal
& memberBinAttrInternal
);
64 bool Clone(CCryLobby
* pLobby
, SceNpMatching2RoomBinAttrInternal
& roomBinAttrInternal
);
65 bool Clone(CCryLobby
* pLobby
, SceNpMatching2BinAttr
& binAttr
);
66 void Release(CCryLobby
* pLobby
) {};
69 struct SCryPSNUIntAttribute
71 SceNpMatching2AttributeId m_id
;
74 bool Clone(CCryLobby
* pLobby
, SceNpMatching2IntAttr
& intAttr
);
75 void Release(CCryLobby
* pLobby
) {};
83 SORT_WORLD_NEEDS_SORTING
,
87 SceNpMatching2WorldId m_worldId
;
89 uint32 m_numTotalRoomMembers
;
93 bool Clone(CCryLobby
* pLobby
, SceNpMatching2World
& world
);
94 void Release(CCryLobby
* pLobby
) {};
97 struct SCryPSNRoomMemberDataInternal
100 SceNpMatching2RoomMemberId m_memberId
;
101 SceNpMatching2FlagAttr m_flagAttr
;
102 SceNpMatching2NatType m_natType
;
104 SCryPSNBinAttribute m_binAttributes
[MAX_MEMBER_INTERNAL_BIN_ATTRIBUTES
];
105 uint16 m_numBinAttributes
;
107 bool Clone(CCryLobby
* pLobby
, SceNpMatching2RoomMemberDataInternalA
& member
);
108 void Release(CCryLobby
* pLobby
);
111 struct SCryPSNRoomDataExternal
113 SceNpMatching2ServerId m_serverId
;
114 SceNpMatching2WorldId m_worldId
;
115 SceNpMatching2RoomId m_roomId
;
117 SceNpMatching2FlagAttr m_flagAttr
;
121 SCryPSNBinAttribute m_binAttributes
[MAX_ROOM_EXTERNAL_BIN_ATTRIBUTES
];
122 SCryPSNBinAttribute m_searchableBinAttributes
[MAX_ROOM_SEARCHABLE_BIN_ATTRIBUTES
];
123 SCryPSNUIntAttribute m_searchableUIntAttributes
[MAX_ROOM_SEARCHABLE_UINT_ATTRIBUTES
];
124 uint16 m_numBinAttributes
;
125 uint16 m_numSearchableBinAttributes
;
126 uint16 m_numSearchableUIntAttributes
;
129 uint16 m_numPublicSlots
;
130 uint16 m_numPrivateSlots
;
131 uint16 m_numOpenPublicSlots
;
132 uint16 m_numOpenPrivateSlots
;
133 uint16 m_numRoomMembers
;
135 bool Clone(CCryLobby
* pLobby
, SceNpMatching2RoomDataExternalA
& roomDataExternal
);
136 void Release(CCryLobby
* pLobby
);
139 struct SCryPSNRoomDataInternal
141 SceNpMatching2ServerId m_serverId
;
142 SceNpMatching2WorldId m_worldId
;
143 SceNpMatching2RoomId m_roomId
;
145 SceNpMatching2FlagAttr m_flagAttr
;
147 SCryPSNBinAttribute m_binAttributes
[MAX_ROOM_INTERNAL_BIN_ATTRIBUTES
];
148 uint16 m_numBinAttributes
;
151 uint16 m_numPublicSlots
;
152 uint16 m_numPrivateSlots
;
153 uint16 m_numOpenPublicSlots
;
154 uint16 m_numOpenPrivateSlots
;
156 bool Clone(CCryLobby
* pLobby
, SceNpMatching2RoomDataInternal
& roomDataInternal
);
157 void Release(CCryLobby
* pLobby
);
160 struct SCryPSNRoomMemberDataInternalList
163 SCryPSNRoomMemberDataInternal
* m_pRoomMembers
;
164 uint16 m_numRoomMembers
;
168 bool Clone(CCryLobby
* pLobby
, SceNpMatching2RoomMemberDataInternalListA
& memberList
);
169 void Release(CCryLobby
* pLobby
);
172 struct SCryPSNGetWorldInfoListResponse
175 SCryPSNWorld
* m_pWorlds
;
178 bool Clone(CCryLobby
* pLobby
, SceNpMatching2GetWorldInfoListResponse
* pResponse
);
179 void Release(CCryLobby
* pLobby
);
182 struct SCryPSNCreateJoinRoomResponse
184 SCryPSNRoomDataInternal m_roomInfo
;
185 SCryPSNRoomMemberDataInternalList m_roomMembers
;
187 bool Clone(CCryLobby
* pLobby
, SceNpMatching2CreateJoinRoomResponseA
* pResponse
);
188 void Release(CCryLobby
* pLobby
);
191 struct SCryPSNJoinRoomResponse
193 SCryPSNRoomDataInternal m_roomInfo
;
194 SCryPSNRoomMemberDataInternalList m_roomMembers
;
196 bool Clone(CCryLobby
* pLobby
, SceNpMatching2JoinRoomResponseA
* pResponse
);
197 void Release(CCryLobby
* pLobby
);
200 struct SCryPSNSearchRoomResponse
203 SCryPSNRoomDataExternal
* m_pRooms
;
206 bool Clone(CCryLobby
* pLobby
, SceNpMatching2SearchRoomResponseA
* pResponse
);
207 bool Clone(CCryLobby
* pLobby
, SceNpMatching2GetRoomDataExternalListResponseA
* pResponse
);
208 void Release(CCryLobby
* pLobby
);
211 struct SCryPSNLeaveRoomResponse
213 SceNpMatching2RoomId m_roomId
;
215 bool Clone(CCryLobby
* pLobby
, SceNpMatching2LeaveRoomResponse
* pResponse
);
216 void Release(CCryLobby
* pLobby
);
219 struct SCryPSNSignalingGetPingInfoResponse
221 SceNpMatching2ServerId m_serverId
;
222 SceNpMatching2WorldId m_worldId
;
223 SceNpMatching2RoomId m_roomId
;
226 bool Clone(CCryLobby
* pLobby
, SceNpMatching2SignalingGetPingInfoResponse
* pResponse
);
227 void Release(CCryLobby
* pLobby
) {};
230 struct SCryPSNRoomMemberUpdateInfoResponse
232 SCryPSNRoomMemberDataInternal m_member
;
233 SceNpMatching2EventCause m_eventCause
;
235 bool Clone(CCryLobby
* pLobby
, SceNpMatching2RoomMemberUpdateInfoA
* pResponse
);
236 bool Clone(CCryLobby
* pLobby
, SceNpMatching2RoomMemberDataInternalUpdateInfoA
* pResponse
);
237 void Release(CCryLobby
* pLobby
);
240 struct SCryPSNRoomOwnerUpdateInfoResponse
242 SceNpMatching2RoomMemberId m_prevOwner
;
243 SceNpMatching2RoomMemberId m_newOwner
;
244 SceNpMatching2EventCause m_eventCause
;
246 bool Clone(CCryLobby
* pLobby
, SceNpMatching2RoomOwnerUpdateInfo
* pResponse
);
247 void Release(CCryLobby
* pLobby
) {};
250 struct SCryPSNRoomUpdateInfoResponse
252 SceNpMatching2EventCause m_eventCause
;
255 bool Clone(CCryLobby
* pLobby
, SceNpMatching2RoomUpdateInfo
* pResponse
);
256 void Release(CCryLobby
* pLobby
) {};
260 #endif // CRY_PLATFORM_ORBIS
262 #endif // __CRYPSN2_RESPONSE_H__