mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-07-10 01:34:42 -06:00
Matching2 fixup 2, I'll take all the buffer I want. (#4650)
* matching2 fixup - joinroom * Matching2 fixup 2, I'll take all the buffer I want. Fixed what appeared to be a overflow caused by context movement from terminate calls.
This commit is contained in:
parent
91dfa4a958
commit
dacd29077a
@ -298,7 +298,7 @@ s32 ContextManager::CreateContext(const OrbisNpId* owner_np_id, OrbisNpServiceLa
|
||||
m_next_id = static_cast<OrbisNpMatching2ContextId>((id % kMaxContexts) + 1);
|
||||
|
||||
ContextObject& ctx = m_contexts[id];
|
||||
ctx = ContextObject{};
|
||||
ctx.Reset();
|
||||
ctx.ctx_id = id;
|
||||
ctx.service_label = service_label;
|
||||
if (owner_np_id) {
|
||||
@ -330,7 +330,7 @@ bool ContextManager::Destroy(OrbisNpMatching2ContextId ctx_id) {
|
||||
if (!GetLocked(ctx_id)) {
|
||||
return false;
|
||||
}
|
||||
m_contexts[ctx_id] = ContextObject{};
|
||||
m_contexts[ctx_id].Reset();
|
||||
m_used[ctx_id] = false;
|
||||
LOG_DEBUG(Lib_NpMatching2, "context destroyed: id={}", ctx_id);
|
||||
return true;
|
||||
@ -378,7 +378,9 @@ void ContextManager::ApplyContextCallback(OrbisNpMatching2ContextCallback callba
|
||||
|
||||
void ContextManager::Reset() {
|
||||
std::lock_guard lock(m_mutex);
|
||||
m_contexts = {};
|
||||
for (auto& ctx : m_contexts) {
|
||||
ctx.Reset();
|
||||
}
|
||||
m_used = {};
|
||||
m_next_id = 1;
|
||||
m_pending_context_callback = nullptr;
|
||||
|
||||
@ -87,8 +87,33 @@ struct CallbackPayload {
|
||||
std::unique_ptr<OrbisNpMatching2RoomMemberDataInternal> event_member;
|
||||
void* room_event_data = nullptr;
|
||||
|
||||
CallbackPayload() = default;
|
||||
CallbackPayload(const CallbackPayload&) = delete;
|
||||
CallbackPayload& operator=(const CallbackPayload&) = delete;
|
||||
CallbackPayload(CallbackPayload&&) = delete;
|
||||
CallbackPayload& operator=(CallbackPayload&&) = delete;
|
||||
|
||||
void Reset() {
|
||||
*this = CallbackPayload{};
|
||||
room_data.reset();
|
||||
create_join_response.reset();
|
||||
search_room_response.reset();
|
||||
world_info_response.reset();
|
||||
world_list.clear();
|
||||
member_data.clear();
|
||||
room_groups.clear();
|
||||
room_bin_attrs.clear();
|
||||
member_bin_attrs.clear();
|
||||
room_data_external.clear();
|
||||
bin_buffers.clear();
|
||||
ext_int_attrs.clear();
|
||||
ext_bin_attrs.clear();
|
||||
ext_room_groups.clear();
|
||||
ext_owner_npids.clear();
|
||||
request_data = nullptr;
|
||||
room_member_update.reset();
|
||||
room_update.reset();
|
||||
event_member.reset();
|
||||
room_event_data = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
@ -137,6 +162,45 @@ struct ContextObject {
|
||||
void* lobby_message_callback_arg = nullptr;
|
||||
OrbisNpMatching2SignalingCallback signaling_callback = nullptr;
|
||||
void* signaling_callback_arg = nullptr;
|
||||
|
||||
void Reset() {
|
||||
ctx_id = 0;
|
||||
started = false;
|
||||
server_id = 1;
|
||||
service_label = 0;
|
||||
owner_np_id = {};
|
||||
online_id = {};
|
||||
signaling_addr.clear();
|
||||
signaling_port = 0;
|
||||
handler_registration_generation = 1;
|
||||
world_id = 0;
|
||||
lobby_id = 0;
|
||||
room_id = 0;
|
||||
my_member_id = 0;
|
||||
is_room_owner = false;
|
||||
max_slot = 5;
|
||||
flag_attr = 0;
|
||||
peers.clear();
|
||||
room_cache.clear();
|
||||
request_payload.Reset();
|
||||
room_event_payload.Reset();
|
||||
context_callback = nullptr;
|
||||
context_callback_arg = nullptr;
|
||||
default_request_callback = nullptr;
|
||||
default_request_callback_arg = nullptr;
|
||||
per_request_callback = nullptr;
|
||||
per_request_callback_arg = nullptr;
|
||||
room_event_callback = nullptr;
|
||||
room_event_callback_arg = nullptr;
|
||||
room_message_callback = nullptr;
|
||||
room_message_callback_arg = nullptr;
|
||||
lobby_event_callback = nullptr;
|
||||
lobby_event_callback_arg = nullptr;
|
||||
lobby_message_callback = nullptr;
|
||||
lobby_message_callback_arg = nullptr;
|
||||
signaling_callback = nullptr;
|
||||
signaling_callback_arg = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
class ContextManager {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user