Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc NP fixes #15022

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions rpcs3/Emu/Cell/Modules/sceNp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ error_code sceNpBasicSetPresenceDetails2(vm::cptr<SceNpBasicPresenceDetails2> pr

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>>();

Expand Down Expand Up @@ -2742,10 +2742,14 @@ error_code sceNpLookupNpId(s32 transId, vm::cptr<SceNpOnlineId> onlineId, vm::pt
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;
}

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);

Expand All @@ -2771,6 +2775,10 @@ error_code sceNpLookupNpIdAsync(s32 transId, vm::ptr<SceNpOnlineId> onlineId, vm
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;
}

Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/NP/np_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ namespace np

basic_event to_add{};
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.name.data, msg->first);

Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Emu/NP/rpcn_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
friends.insert(std::make_pair(std::move(friend_name), std::move(infos)));
friends.insert_or_assign(std::move(friend_name), std::move(infos));
}
};

Expand Down Expand Up @@ -2262,7 +2262,7 @@ namespace rpcn

friend_infos.requests_received.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);

break;
Expand Down