mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
Impl sceNpBasicSendMessage
This commit is contained in:
parent
80b7fd5f3f
commit
47ae192cf8
@ -974,6 +974,22 @@ error_code sceNpBasicSendMessage(vm::cptr<SceNpId> to, vm::cptr<void> data, u32
|
||||
return SCE_NP_BASIC_ERROR_EXCEEDS_MAX;
|
||||
}
|
||||
|
||||
if (nph.get_psn_status() != SCE_NP_MANAGER_STATUS_ONLINE)
|
||||
{
|
||||
return not_an_error(SCE_NP_BASIC_ERROR_NOT_CONNECTED);
|
||||
}
|
||||
|
||||
message_data msg_data = {
|
||||
.commId = nph.get_basic_handler_context(),
|
||||
.msgId = 0,
|
||||
.mainType = SCE_NP_BASIC_MESSAGE_MAIN_TYPE_GENERAL,
|
||||
.subType = SCE_NP_BASIC_MESSAGE_GENERAL_SUBTYPE_NONE,
|
||||
.msgFeatures = {}};
|
||||
std::set<std::string> npids;
|
||||
npids.insert(std::string(to->handle.data));
|
||||
|
||||
nph.send_message(msg_data, npids);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -970,6 +970,11 @@ namespace np
|
||||
}
|
||||
}
|
||||
|
||||
void np_handler::send_message(const message_data& msg_data, const std::set<std::string>& npids)
|
||||
{
|
||||
get_rpcn()->send_message(msg_data, npids);
|
||||
}
|
||||
|
||||
void np_handler::operator()()
|
||||
{
|
||||
if (g_cfg.net.psn_status != np_psn_status::psn_rpcn)
|
||||
@ -1100,6 +1105,7 @@ namespace np
|
||||
switch (msg->second.mainType)
|
||||
{
|
||||
case SCE_NP_BASIC_MESSAGE_MAIN_TYPE_DATA_ATTACHMENT:
|
||||
case SCE_NP_BASIC_MESSAGE_MAIN_TYPE_URL_ATTACHMENT:
|
||||
event = SCE_NP_BASIC_EVENT_INCOMING_ATTACHMENT;
|
||||
break;
|
||||
case SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE:
|
||||
@ -1109,15 +1115,16 @@ namespace np
|
||||
event = (msg->second.msgFeatures & SCE_NP_BASIC_MESSAGE_FEATURES_BOOTABLE) ? SCE_NP_BASIC_EVENT_INCOMING_BOOTABLE_CUSTOM_DATA_MESSAGE : SCE_NP_BASIC_EVENT_INCOMING_CUSTOM_DATA_MESSAGE;
|
||||
break;
|
||||
case SCE_NP_BASIC_MESSAGE_MAIN_TYPE_GENERAL:
|
||||
case SCE_NP_BASIC_MESSAGE_MAIN_TYPE_ADD_FRIEND:
|
||||
case SCE_NP_BASIC_MESSAGE_MAIN_TYPE_URL_ATTACHMENT:
|
||||
event = SCE_NP_BASIC_EVENT_MESSAGE;
|
||||
break;
|
||||
case SCE_NP_BASIC_MESSAGE_MAIN_TYPE_ADD_FRIEND:
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
basic_event to_add{};
|
||||
to_add.event = event;
|
||||
to_add.data = std::move(msg->second.data);
|
||||
strcpy_trunc(to_add.from.userId.handle.data, msg->first);
|
||||
strcpy_trunc(to_add.from.name.data, msg->first);
|
||||
|
||||
@ -1319,7 +1326,7 @@ namespace np
|
||||
return SCE_NP_BASIC_ERROR_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
auto friend_infos = rpcn->get_friend_presence_by_npid(std::string(reinterpret_cast<const char*>(&npid.handle.data[0])));
|
||||
auto friend_infos = rpcn->get_friend_presence_by_npid(std::string(npid.handle.data));
|
||||
if (!friend_infos)
|
||||
{
|
||||
return SCE_NP_BASIC_ERROR_INVALID_ARGUMENT;
|
||||
|
@ -133,6 +133,7 @@ namespace np
|
||||
void set_message_selected(SceNpBasicAttachmentDataId id, u64 msg_id);
|
||||
std::optional<std::shared_ptr<std::pair<std::string, message_data>>> get_message_selected(SceNpBasicAttachmentDataId id);
|
||||
void clear_message_selected(SceNpBasicAttachmentDataId id);
|
||||
void send_message(const message_data& msg_data, const std::set<std::string>& npids);
|
||||
|
||||
// Those should probably be under match2 ctx
|
||||
vm::ptr<SceNpMatching2RoomEventCallback> room_event_cb{}; // Room events
|
||||
|
@ -1772,7 +1772,7 @@ namespace rpcn
|
||||
return forge_send(CommandType::RequestTicket, req_id, data);
|
||||
}
|
||||
|
||||
bool rpcn_client::sendmessage(const message_data& msg_data, const std::set<std::string>& npids)
|
||||
bool rpcn_client::send_message(const message_data& msg_data, const std::set<std::string>& npids)
|
||||
{
|
||||
flatbuffers::FlatBufferBuilder builder(1024);
|
||||
|
||||
|
@ -464,7 +464,7 @@ namespace rpcn
|
||||
bool send_room_message(u32 req_id, const SceNpCommunicationId& communication_id, const SceNpMatching2SendRoomMessageRequest* req);
|
||||
bool req_sign_infos(u32 req_id, const std::string& npid);
|
||||
bool req_ticket(u32 req_id, const std::string& service_id, const std::vector<u8>& cookie);
|
||||
bool sendmessage(const message_data& msg_data, const std::set<std::string>& npids);
|
||||
bool send_message(const message_data& msg_data, const std::set<std::string>& npids);
|
||||
bool get_board_infos(u32 req_id, const SceNpCommunicationId& communication_id, SceNpScoreBoardId board_id);
|
||||
bool record_score(u32 req_id, const SceNpCommunicationId& communication_id, SceNpScoreBoardId board_id, SceNpScorePcId char_id, SceNpScoreValue score, const std::optional<std::string> comment, const std::optional<std::vector<u8>> score_data);
|
||||
bool get_score_range(u32 req_id, const SceNpCommunicationId& communication_id, SceNpScoreBoardId board_id, u32 start_rank, u32 num_rank, bool with_comment, bool with_gameinfo);
|
||||
|
@ -70,7 +70,7 @@ bool sendmessage_dialog_frame::Exec(message_data& msg_data, std::set<std::string
|
||||
npids.insert(selected[0]->text().toStdString());
|
||||
|
||||
// Send the message
|
||||
result = m_rpcn->sendmessage(msg_data, npids);
|
||||
result = m_rpcn->send_message(msg_data, npids);
|
||||
m_dialog->close();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user