Reset presence when terminating NP

This commit is contained in:
RipleyTom 2025-02-18 06:06:35 +01:00 committed by Elad
parent ec3d9a2cae
commit 6074480ffb
2 changed files with 7 additions and 1 deletions

View file

@ -854,6 +854,10 @@ namespace np
room_msg_cb_ctx = 0;
room_msg_cb_arg = {};
presence_self.pr_status = {};
presence_self.pr_data = {};
presence_self.advertised = false;
if (g_cfg.net.psn_status == np_psn_status::psn_rpcn)
{
rpcn_log.notice("Setting RPCN state to disconnected!");
@ -1538,7 +1542,7 @@ namespace np
}
}
if (send_update && is_psn_active)
if (is_psn_active && (!presence_self.advertised || send_update))
{
std::lock_guard lock(mutex_rpcn);
@ -1547,6 +1551,7 @@ namespace np
return;
}
presence_self.advertised = true;
rpcn->send_presence(presence_self.pr_com_id, presence_self.pr_title, presence_self.pr_status, presence_self.pr_comment, presence_self.pr_data);
}
}

View file

@ -509,6 +509,7 @@ namespace np
std::string pr_status;
std::string pr_comment;
std::vector<u8> pr_data;
atomic_t<bool> advertised = false;
} presence_self;
player_history& get_player_and_set_timestamp(const SceNpId& npid, u64 timestamp);