Misc NP fixes

This commit is contained in:
RipleyTom 2024-01-10 16:46:02 +01:00 committed by Megamouse
parent f7fa5aab70
commit 4c36b80300
6 changed files with 33 additions and 6 deletions

View File

@ -214,7 +214,9 @@ error_code sceNpCommerce2InitGetCategoryContentsResult(vm::ptr<SceNpCommerce2Get
error_code sceNpCommerce2GetCategoryInfo(vm::cptr<SceNpCommerce2GetCategoryContentsResult> result, vm::ptr<SceNpCommerce2CategoryInfo> categoryInfo)
{
sceNpCommerce2.todo("sceNpCommerce2GetCategoryInfo(result=*0x%x, categoryInfo=*0x%x)", result, categoryInfo);
return CELL_OK;
// Hack to stop crashes in some games
return SCE_NP_COMMERCE2_ERROR_SERVER_MAINTENANCE;
}
error_code sceNpCommerce2GetContentInfo(vm::cptr<SceNpCommerce2GetCategoryContentsResult> result, u32 index, vm::ptr<SceNpCommerce2ContentInfo> contentInfo)

View File

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "np_handler.h"
#include "Emu/Cell/lv2/sys_process.h"
LOG_CHANNEL(rpcn_log, "rpcn");
@ -87,16 +88,31 @@ namespace np
{
room_info->serverId = room->serverId();
room_info->worldId = room->worldId();
room_info->publicSlotNum = room->publicSlotNum();
room_info->privateSlotNum = room->privateSlotNum();
room_info->lobbyId = room->lobbyId();
room_info->roomId = room->roomId();
room_info->openPublicSlotNum = room->openPublicSlotNum();
room_info->maxSlot = room->maxSlot();
room_info->openPrivateSlotNum = room->openPrivateSlotNum();
room_info->curMemberNum = room->curMemberNum();
room_info->passwordSlotMask = room->passwordSlotMask();
s32 sdk_ver;
process_get_sdk_version(process_getpid(), sdk_ver);
// Structure changed in sdk 3.3.0
if (sdk_ver >= 0x330000)
{
room_info->publicSlotNum = room->publicSlotNum();
room_info->privateSlotNum = room->privateSlotNum();
room_info->openPublicSlotNum = room->openPublicSlotNum();
room_info->openPrivateSlotNum = room->openPrivateSlotNum();
}
else
{
room_info->publicSlotNum = 0;
room_info->privateSlotNum = 0;
room_info->openPublicSlotNum = 0;
room_info->openPrivateSlotNum = 0;
}
if (auto owner = room->owner())
{
auto* ptr_owner = edata.allocate<SceNpUserInfo2>(sizeof(SceNpUserInfo2), room_info->owner);

View File

@ -11,7 +11,7 @@ namespace np
{
memberbin_cache::memberbin_cache(const SceNpMatching2RoomMemberBinAttrInternal* sce_memberbin)
{
ensure(sce_memberbin && (sce_memberbin->data.ptr.get_ptr() || !sce_memberbin->data.size));
ensure(sce_memberbin && (sce_memberbin->data.ptr || !sce_memberbin->data.size));
id = sce_memberbin->data.id;
updateDate.tick = sce_memberbin->updateDate.tick;

View File

@ -852,6 +852,8 @@ namespace np
queue_basic_event(to_add);
send_basic_event(to_add.event, 0, 0);
}
send_basic_event(SCE_NP_BASIC_EVENT_END_OF_INITIAL_PRESENCE, 0, 0);
}
SceNpCommunicationId np_handler::get_basic_handler_context()

View File

@ -79,6 +79,11 @@ namespace rpcn
return get_localized_string(rpcn_state_to_localized_string_id(state));
}
void friend_online_data::dump() const
{
rpcn_log.notice("online: %s, pr_com_id: %s, pr_title: %s, pr_status: %s, pr_comment: %s, pr_data: %s", online ? "true" : "false", pr_com_id.data, pr_title, pr_status, pr_comment, fmt::buf_to_hexstring(pr_data.data(), pr_data.size()));
}
constexpr u32 RPCN_PROTOCOL_VERSION = 21;
constexpr usz RPCN_HEADER_SIZE = 15;

View File

@ -309,6 +309,8 @@ namespace rpcn
friend_online_data(bool online, u64 timestamp)
: online(online), timestamp(timestamp) {}
void dump() const;
bool online = false;
u64 timestamp = 0;
SceNpCommunicationId pr_com_id{};