From 9e094fded6dec4b8ec7fcca501b09d992b52a9cd Mon Sep 17 00:00:00 2001 From: Silent Date: Wed, 17 Jul 2024 19:00:01 +0200 Subject: [PATCH] Do not set the data size in sceNpBasicGetEvent for SCE_NP_BASIC_EVENT_OFFLINE There is no data associated with this event, size is not supposed to be set. --- rpcs3/Emu/NP/np_handler.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/rpcs3/Emu/NP/np_handler.cpp b/rpcs3/Emu/NP/np_handler.cpp index 8cb9be53c6..923babde59 100644 --- a/rpcs3/Emu/NP/np_handler.cpp +++ b/rpcs3/Emu/NP/np_handler.cpp @@ -978,17 +978,20 @@ namespace np queue_basic_events.pop(); } - const u32 size_avail = *size; - u32 res_size = std::min(static_cast(cur_event.data.size()), size_avail); - *event = cur_event.event; memcpy(from.get_ptr(), &cur_event.from, sizeof(cur_event.from)); - memcpy(data.get_ptr(), cur_event.data.data(), res_size); - *size = res_size; - - if (res_size < cur_event.data.size()) + if (cur_event.event != SCE_NP_BASIC_EVENT_OFFLINE) { - return SCE_NP_BASIC_ERROR_DATA_LOST; + const u32 size_avail = *size; + const u32 res_size = std::min(static_cast(cur_event.data.size()), size_avail); + + memcpy(data.get_ptr(), cur_event.data.data(), res_size); + *size = res_size; + + if (res_size < cur_event.data.size()) + { + return SCE_NP_BASIC_ERROR_DATA_LOST; + } } nph_log.notice("basic_event: event:%d, from:%s(%s), size:%d", *event, static_cast(from->userId.handle.data), static_cast(from->name.data), *size);