Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

Always report command ID in log and implement LoadUserSetting stub

darktuxdf6758244629
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index 38e62761bf..cf7287a87c 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -62,7 +62,7 @@ public:
{20600, nullptr, "GetUserPresenceView"},
{20700, nullptr, "GetPlayHistoryList"},
{20701, &IFriendService::GetPlayHistoryStatistics, "GetPlayHistoryStatistics"},
- {20800, nullptr, "LoadUserSetting"},
+ {20800, &IFriendService::LoadUserSetting, "LoadUserSetting"},
{20801, nullptr, "SyncUserSetting"},
{20900, nullptr, "RequestListSummaryOverlayNotification"},
{21000, nullptr, "GetExternalApplicationCatalog"},
@@ -136,6 +136,17 @@ private:
};
static_assert(sizeof(SizedFriendFilter) == 0x10, "SizedFriendFilter is an invalid size");
+ struct FriendsUserSetting {
+ Common::UUID uuid;
+ u32 presence_permission;
+ u32 play_log_permission;
+ u64 friend_request_reception;
+ char friend_code[0x20];
+ u64 friend_code_next_issuable_time;
+ u8 unk_x48[0x7C8];
+ };
+ static_assert(sizeof(FriendsUserSetting) == 0x810, "FriendsUserSetting is an invalid size");
+
void GetCompletionEvent(HLERequestContext& ctx) {
LOG_DEBUG(Service_Friend, "called");
@@ -248,6 +259,25 @@ private:
rb.Push(ResultSuccess);
}
+ void LoadUserSetting(HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ const auto uuid = rp.PopRaw<Common::UUID>();
+
+ LOG_WARNING(Service_Friend, "(STUBBED) called");
+
+ FriendsUserSetting setting{};
+ setting.uuid = uuid;
+ setting.presence_permission = 2;
+ setting.play_log_permission = 5;
+ setting.friend_request_reception = 1;
+ setting.friend_code_next_issuable_time = 99999999999;
+ strcpy(setting.friend_code, "0000-0000-0000");
+ ctx.WriteBuffer(setting);
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSuccess);
+ }
+
void GetReceivedFriendInvitationCountCache(HLERequestContext& ctx) {
LOG_DEBUG(Service_Friend, "(STUBBED) called, check in out");
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index ce5e3b5b4c..68527ac8ef 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -63,11 +63,11 @@ void ServiceFrameworkBase::RegisterHandlersBaseTipc(const FunctionInfoBase* func
void ServiceFrameworkBase::ReportUnimplementedFunction(HLERequestContext& ctx,
const FunctionInfoBase* info) {
auto cmd_buf = ctx.CommandBuffer();
- std::string function_name = info == nullptr ? fmt::format("{}", ctx.GetCommand()) : info->name;
+ std::string function_name = info == nullptr ? "<unknown>" : info->name;
fmt::memory_buffer buf;
- fmt::format_to(std::back_inserter(buf), "function '{}': port='{}' cmd_buf={{[0]=0x{:X}",
- function_name, service_name, cmd_buf[0]);
+ fmt::format_to(std::back_inserter(buf), "function '{}({})': port='{}' cmd_buf={{[0]=0x{:X}",
+ ctx.GetCommand(), function_name, service_name, cmd_buf[0]);
for (int i = 1; i <= 8; ++i) {
fmt::format_to(std::back_inserter(buf), ", [{}]=0x{:X}", i, cmd_buf[i]);
}