Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc NP fixes #15041

Merged
merged 1 commit into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion rpcs3/Emu/Cell/Modules/sceNpCommerce2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 20 additions & 4 deletions rpcs3/Emu/NP/fb_helpers.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "np_handler.h"
#include "Emu/Cell/lv2/sys_process.h"

LOG_CHANNEL(rpcn_log, "rpcn");

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/NP/np_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/NP/np_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 5 additions & 0 deletions rpcs3/Emu/NP/rpcn_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions rpcs3/Emu/NP/rpcn_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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{};
Expand Down