Compare commits

...

2 commits

Author SHA1 Message Date
Emma 6009f57335
Merge 1018e6a7dd into e3f5f2d14e 2025-12-03 19:20:30 +01:00
InvoxiPlayGames 1018e6a7dd np: avoid crash with simulated np (req_ticket, friends/block list) 2025-01-19 11:40:53 +00:00
2 changed files with 31 additions and 2 deletions

View file

@ -1487,14 +1487,28 @@ namespace np
}
u32 np_handler::get_num_friends()
{
if (g_cfg.net.psn_status != np_psn_status::psn_rpcn)
{
return 0;
}
else
{
return get_rpcn()->get_num_friends();
}
}
u32 np_handler::get_num_blocks()
{
if (g_cfg.net.psn_status != np_psn_status::psn_rpcn)
{
return 0;
}
else
{
return get_rpcn()->get_num_blocks();
}
}
std::pair<error_code, std::optional<SceNpId>> np_handler::get_friend_by_index(u32 index)
{

View file

@ -843,6 +843,21 @@ namespace np
cookie_vec.assign(cookie, cookie + cookie_size);
}
if (g_cfg.net.psn_status != np_psn_status::psn_rpcn)
{
// TODO(InvoxiPlayGames): generate ticket data that is valid, for games that need to dig into the data
std::vector<u8> ticketdata = {0x41, 0x42, 0x43, 0x44};
current_ticket = ticket(std::move(ticketdata));
auto ticket_size = static_cast<s32>(current_ticket.size());
sysutil_register_cb([manager_cb = this->manager_cb, ticket_size, manager_cb_arg = this->manager_cb_arg](ppu_thread& cb_ppu) -> s32
{
manager_cb(cb_ppu, SCE_NP_MANAGER_EVENT_GOT_TICKET, ticket_size, manager_cb_arg);
return 0;
});
return;
}
if (!get_rpcn()->req_ticket(req_id, service_id_str, cookie_vec))
{
rpcn_log.error("Disconnecting from RPCN!");