Add overlay notification for received messages

This commit is contained in:
RipleyTom 2026-03-20 15:40:09 +01:00 committed by Megamouse
parent c6407b37a5
commit 2ba7756c0e
3 changed files with 19 additions and 8 deletions

View File

@ -1228,16 +1228,22 @@ namespace np
}
auto messages = rpcn->get_new_messages();
if (basic_handler_registered)
for (const auto msg_id : messages)
{
for (const auto msg_id : messages)
const auto opt_msg = rpcn->get_message(msg_id);
if (!opt_msg)
{
continue;
}
const auto& msg = opt_msg.value();
const localized_string_id loc_id = (msg->second.mainType == SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE) ? localized_string_id::CELL_NP_MESSAGE_INVITE_RECEIVED : localized_string_id::CELL_NP_MESSAGE_OTHER_RECEIVED;
rsx::overlays::queue_message(get_localized_string(loc_id, msg->first.c_str()), 6'000'000);
if (basic_handler_registered)
{
const auto opt_msg = rpcn->get_message(msg_id);
if (!opt_msg)
{
continue;
}
const auto& msg = opt_msg.value();
if (strncmp(msg->second.commId.data, basic_handler.context.data, sizeof(basic_handler.context.data) - 1) == 0)
{
u32 event;

View File

@ -158,6 +158,9 @@ enum class localized_string_id
CELL_NP_SENDMESSAGE_DIALOG_CONFIRMATION_INVITE,
CELL_NP_SENDMESSAGE_DIALOG_CONFIRMATION_ADD_FRIEND,
CELL_NP_MESSAGE_INVITE_RECEIVED,
CELL_NP_MESSAGE_OTHER_RECEIVED,
RECORDING_ABORTED,
RPCN_NO_ERROR,

View File

@ -181,6 +181,8 @@ private:
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_CONFIRMATION: return tr("Send message to %0 ?\n\nSubject:", "SENDMESSAGE_DIALOG").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_CONFIRMATION_INVITE: return tr("Send invite to %0 ?\n\nSubject:", "SENDMESSAGE_DIALOG").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_CONFIRMATION_ADD_FRIEND: return tr("Send friend request to %0 ?\n\nSubject:", "SENDMESSAGE_DIALOG").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_NP_MESSAGE_INVITE_RECEIVED: return tr("Received an invite from %0").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_NP_MESSAGE_OTHER_RECEIVED: return tr("Received a message from %0").arg(std::forward<Args>(args)...);
case localized_string_id::RECORDING_ABORTED: return tr("Recording aborted!");
case localized_string_id::RPCN_NO_ERROR: return tr("RPCN: No Error");
case localized_string_id::RPCN_ERROR_INVALID_INPUT: return tr("RPCN: Invalid Input (Wrong Host/Port)");