Misc NP fixes

This commit is contained in:
RipleyTom 2024-01-08 00:48:16 +01:00 committed by Megamouse
parent 0b984e9a23
commit 485fca34b0
3 changed files with 13 additions and 5 deletions

View File

@ -965,7 +965,7 @@ error_code sceNpBasicSetPresenceDetails2(vm::cptr<SceNpBasicPresenceDetails2> pr
error_code sceNpBasicSendMessage(vm::cptr<SceNpId> to, vm::cptr<void> data, u32 size) error_code sceNpBasicSendMessage(vm::cptr<SceNpId> to, vm::cptr<void> data, u32 size)
{ {
sceNp.todo("sceNpBasicSendMessage(to=*0x%x, data=*0x%x, size=%d)", to, data, size); sceNp.warning("sceNpBasicSendMessage(to=*0x%x, data=*0x%x, size=%d)", to, data, size);
auto& nph = g_fxo->get<named_thread<np::np_handler>>(); auto& nph = g_fxo->get<named_thread<np::np_handler>>();
@ -2742,10 +2742,14 @@ error_code sceNpLookupNpId(s32 transId, vm::cptr<SceNpOnlineId> onlineId, vm::pt
return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID;
} }
// Hack - better than nothing for now
memset(npId.get_ptr(), 0, sizeof(SceNpId));
memcpy(npId->handle.data, onlineId->data, sizeof(npId->handle.data) - 1);
return CELL_OK; return CELL_OK;
} }
error_code sceNpLookupNpIdAsync(s32 transId, vm::ptr<SceNpOnlineId> onlineId, vm::ptr<SceNpId> npId, s32 prio, vm::ptr<void> option) error_code sceNpLookupNpIdAsync(s32 transId, vm::cptr<SceNpOnlineId> onlineId, vm::ptr<SceNpId> npId, s32 prio, vm::ptr<void> option)
{ {
sceNp.todo("sceNpLookupNpIdAsync(transId=%d, onlineId=*0x%x, npId=*0x%x, prio=%d, option=*0x%x)", transId, onlineId, npId, prio, option); sceNp.todo("sceNpLookupNpIdAsync(transId=%d, onlineId=*0x%x, npId=*0x%x, prio=%d, option=*0x%x)", transId, onlineId, npId, prio, option);
@ -2771,6 +2775,10 @@ error_code sceNpLookupNpIdAsync(s32 transId, vm::ptr<SceNpOnlineId> onlineId, vm
return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID; return SCE_NP_COMMUNITY_ERROR_INVALID_ONLINE_ID;
} }
// Hack - better than nothing for now
memset(npId.get_ptr(), 0, sizeof(SceNpId));
memcpy(npId->handle.data, onlineId->data, sizeof(npId->handle.data) - 1);
return CELL_OK; return CELL_OK;
} }

View File

@ -1124,7 +1124,7 @@ namespace np
basic_event to_add{}; basic_event to_add{};
to_add.event = event; to_add.event = event;
to_add.data = std::move(msg->second.data); to_add.data = msg->second.data;
strcpy_trunc(to_add.from.userId.handle.data, msg->first); strcpy_trunc(to_add.from.userId.handle.data, msg->first);
strcpy_trunc(to_add.from.name.data, msg->first); strcpy_trunc(to_add.from.name.data, msg->first);

View File

@ -964,7 +964,7 @@ namespace rpcn
} }
friend_online_data infos(online, std::move(pr_com_id), std::move(pr_title), std::move(pr_status), std::move(pr_comment), std::move(pr_data)); friend_online_data infos(online, std::move(pr_com_id), std::move(pr_title), std::move(pr_status), std::move(pr_comment), std::move(pr_data));
friends.insert(std::make_pair(std::move(friend_name), std::move(infos))); friends.insert_or_assign(std::move(friend_name), std::move(infos));
} }
}; };
@ -2262,7 +2262,7 @@ namespace rpcn
friend_infos.requests_received.erase(username); friend_infos.requests_received.erase(username);
friend_infos.requests_sent.erase(username); friend_infos.requests_sent.erase(username);
friend_infos.friends.insert(std::make_pair(username, friend_online_data(online, 0))); friend_infos.friends.insert_or_assign(username, friend_online_data(online, 0));
call_callbacks(ntype, username, online); call_callbacks(ntype, username, online);
break; break;