From 7c4fdaf528591b271dda01b787bbc6130449d727 Mon Sep 17 00:00:00 2001 From: JPikachu Date: Wed, 26 Mar 2025 22:34:43 +0000 Subject: [PATCH] Update freind, nifm and nim stubs Credit: Antique - [Sudachi] Dev (https://sudachi.emuplace.app/) --- src/core/hle/service/friend/friend.cpp | 38 ++++++++++++++++++++-- src/core/hle/service/nifm/nifm.cpp | 44 +++++++++++++++++++++++--- src/core/hle/service/nifm/nifm.h | 4 +++ src/core/hle/service/nim/nim.cpp | 11 ++++++- 4 files changed, 89 insertions(+), 8 deletions(-) diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index bdee9875d8..4aa92a9f47 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -22,7 +22,7 @@ public: // clang-format off static const FunctionInfo functions[] = { {0, &IFriendService::GetCompletionEvent, "GetCompletionEvent"}, - {1, nullptr, "Cancel"}, + {1, &IFriendService::Cancel, "Cancel"}, {10100, nullptr, "GetFriendListIds"}, {10101, &IFriendService::GetFriendList, "GetFriendList"}, {10102, nullptr, "UpdateFriendInfo"}, @@ -49,7 +49,7 @@ public: {20101, &IFriendService::GetNewlyFriendCount, "GetNewlyFriendCount"}, {20102, nullptr, "GetFriendDetailedInfo"}, {20103, nullptr, "SyncFriendList"}, - {20104, nullptr, "RequestSyncFriendList"}, + {20104, &IFriendService::RequestSyncFriendList, "RequestSyncFriendList"}, {20110, nullptr, "LoadFriendSetting"}, {20200, &IFriendService::GetReceivedFriendRequestCount, "GetReceivedFriendRequestCount"}, {20201, nullptr, "GetFriendRequestList"}, @@ -153,9 +153,20 @@ private: void GetCompletionEvent(HLERequestContext& ctx) { LOG_DEBUG(Service_Friend, "called"); + auto& readable_event = completion_event->GetReadableEvent(); + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(readable_event.Signal()); + rb.PushCopyObjects(readable_event); + } + + void Cancel(HLERequestContext& ctx) { + LOG_DEBUG(Service_Friend, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); - rb.PushCopyObjects(completion_event->GetReadableEvent()); } void GetFriendList(HLERequestContext& ctx) { @@ -247,6 +258,15 @@ private: rb.Push(0); } + void RequestSyncFriendList(HLERequestContext& ctx) { + LOG_DEBUG(Service_Friend, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + void GetReceivedFriendRequestCount(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; [[maybe_unused]] const auto uuid = rp.PopRaw(); @@ -268,6 +288,18 @@ private: rb.Push(ResultSuccess); } + void GetUserPresenceView(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto uuid = rp.PopRaw(); + + LOG_DEBUG(Service_Friend, "(STUBBED) called, uuid={}.", uuid.RawString()); + + // TODO (jarrodnorwell) + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + void GetPlayHistoryStatistics(HLERequestContext& ctx) { LOG_ERROR(Service_Friend, "(STUBBED) called, check in out"); diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 84ad424bb2..0a1658d784 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -419,6 +419,24 @@ void IGeneralService::GetCurrentNetworkProfile(HLERequestContext& ctx) { rb.Push(ResultSuccess); } +void IGeneralService::EnumerateNetworkInterfaces(HLERequestContext& ctx) { + LOG_DEBUG(Service_NIFM, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void IGeneralService::EnumerateNetworkProfiles(HLERequestContext& ctx) { + LOG_DEBUG(Service_NIFM, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void IGeneralService::RemoveNetworkProfile(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); @@ -565,6 +583,24 @@ void IGeneralService::IsAnyForegroundRequestAccepted(HLERequestContext& ctx) { rb.Push(is_accepted); } +void IGeneralService::ConfirmSystemAvailability(HLERequestContext& ctx) { + LOG_DEBUG(Service_NIFM, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void IGeneralService::SetBackgroundRequestEnabled(HLERequestContext& ctx) { + LOG_WARNING(Service_NIFM, "(STUBBED) called."); + + // TODO (jarrodnorwell) + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + IGeneralService::IGeneralService(Core::System& system_) : ServiceFramework{system_, "IGeneralService"}, network{system_.GetRoomNetwork()} { // clang-format off @@ -573,8 +609,8 @@ IGeneralService::IGeneralService(Core::System& system_) {2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, {4, &IGeneralService::CreateRequest, "CreateRequest"}, {5, &IGeneralService::GetCurrentNetworkProfile, "GetCurrentNetworkProfile"}, - {6, nullptr, "EnumerateNetworkInterfaces"}, - {7, nullptr, "EnumerateNetworkProfiles"}, + {6, &IGeneralService::EnumerateNetworkInterfaces, "EnumerateNetworkInterfaces"}, + {7, &IGeneralService::EnumerateNetworkProfiles, "EnumerateNetworkProfiles"}, {8, nullptr, "GetNetworkProfile"}, {9, nullptr, "SetNetworkProfile"}, {10, &IGeneralService::RemoveNetworkProfile, "RemoveNetworkProfile"}, @@ -600,8 +636,8 @@ IGeneralService::IGeneralService(Core::System& system_) {30, nullptr, "SetEthernetCommunicationEnabledForTest"}, {31, nullptr, "GetTelemetorySystemEventReadableHandle"}, {32, nullptr, "GetTelemetryInfo"}, - {33, nullptr, "ConfirmSystemAvailability"}, - {34, nullptr, "SetBackgroundRequestEnabled"}, + {33, &IGeneralService::ConfirmSystemAvailability, "ConfirmSystemAvailability"}, // 2.0.0+ + {34, &IGeneralService::SetBackgroundRequestEnabled, "SetBackgroundRequestEnabled"}, // 4.0.0+ {35, nullptr, "GetScanData"}, {36, nullptr, "GetCurrentAccessPoint"}, {37, nullptr, "Shutdown"}, diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h index b74b664381..95b87443f7 100644 --- a/src/core/hle/service/nifm/nifm.h +++ b/src/core/hle/service/nifm/nifm.h @@ -27,6 +27,8 @@ private: void CreateScanRequest(HLERequestContext& ctx); void CreateRequest(HLERequestContext& ctx); void GetCurrentNetworkProfile(HLERequestContext& ctx); + void EnumerateNetworkInterfaces(HLERequestContext& ctx); + void EnumerateNetworkProfiles(HLERequestContext& ctx); void RemoveNetworkProfile(HLERequestContext& ctx); void GetCurrentIpAddress(HLERequestContext& ctx); void CreateTemporaryNetworkProfile(HLERequestContext& ctx); @@ -36,6 +38,8 @@ private: void IsEthernetCommunicationEnabled(HLERequestContext& ctx); void IsAnyInternetRequestAccepted(HLERequestContext& ctx); void IsAnyForegroundRequestAccepted(HLERequestContext& ctx); + void ConfirmSystemAvailability(HLERequestContext& ctx); + void SetBackgroundRequestEnabled(HLERequestContext& ctx); Network::RoomNetwork& network; }; diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index 42de87f9ae..8210fd92a6 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -232,6 +232,7 @@ public: {2, nullptr, "ClearDebugResponse"}, {3, nullptr, "RegisterDebugResponse"}, {4, &NIM_ECA::IsLargeResourceAvailable, "IsLargeResourceAvailable"}, + {5, &NIM_ECA::CreateServerInterface2, "CreateServerInterface2"} // 17.0.0+ }; // clang-format on @@ -240,7 +241,7 @@ public: private: void CreateServerInterface(HLERequestContext& ctx) { - LOG_WARNING(Service_NIM, "(STUBBED) called"); + LOG_DEBUG(Service_NIM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); rb.PushIpcInterface(system); @@ -257,6 +258,14 @@ private: rb.Push(ResultSuccess); rb.Push(false); } + + void CreateServerInterface2(HLERequestContext& ctx) { + LOG_DEBUG(Service_NIM, "(STUBBED) called."); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } }; class NIM_SHP final : public ServiceFramework {