diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/nifm/nifm.cpp | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 5d32adf64..0c042f412 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -2,10 +2,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "core/core.h" -#include "core/hle/ipc_helpers.h" #include "core/hle/kernel/k_event.h" +#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/kernel_helpers.h" #include "core/hle/service/nifm/nifm.h" +#include "core/hle/service/server_manager.h" namespace { @@ -216,7 +217,7 @@ public: } private: - void Submit(Kernel::HLERequestContext& ctx) { + void Submit(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); if (state == RequestState::NotSubmitted) { @@ -227,7 +228,7 @@ private: rb.Push(ResultSuccess); } - void GetRequestState(Kernel::HLERequestContext& ctx) { + void GetRequestState(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -235,7 +236,7 @@ private: rb.PushEnum(state); } - void GetResult(Kernel::HLERequestContext& ctx) { + void GetResult(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); const auto result = [this] { @@ -260,7 +261,7 @@ private: rb.Push(result); } - void GetSystemEventReadableHandles(Kernel::HLERequestContext& ctx) { + void GetSystemEventReadableHandles(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2, 2}; @@ -268,21 +269,21 @@ private: rb.PushCopyObjects(event1->GetReadableEvent(), event2->GetReadableEvent()); } - void Cancel(Kernel::HLERequestContext& ctx) { + void Cancel(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } - void SetConnectionConfirmationOption(Kernel::HLERequestContext& ctx) { + void SetConnectionConfirmationOption(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } - void GetAppletInfo(Kernel::HLERequestContext& ctx) { + void GetAppletInfo(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); std::vector<u8> out_buffer(ctx.GetWriteBufferSize()); @@ -321,7 +322,7 @@ public: } }; -void IGeneralService::GetClientId(Kernel::HLERequestContext& ctx) { +void IGeneralService::GetClientId(HLERequestContext& ctx) { static constexpr u32 client_id = 1; LOG_WARNING(Service_NIFM, "(STUBBED) called"); @@ -330,7 +331,7 @@ void IGeneralService::GetClientId(Kernel::HLERequestContext& ctx) { rb.Push<u64>(client_id); // Client ID needs to be non zero otherwise it's considered invalid } -void IGeneralService::CreateScanRequest(Kernel::HLERequestContext& ctx) { +void IGeneralService::CreateScanRequest(HLERequestContext& ctx) { LOG_DEBUG(Service_NIFM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -339,7 +340,7 @@ void IGeneralService::CreateScanRequest(Kernel::HLERequestContext& ctx) { rb.PushIpcInterface<IScanRequest>(system); } -void IGeneralService::CreateRequest(Kernel::HLERequestContext& ctx) { +void IGeneralService::CreateRequest(HLERequestContext& ctx) { LOG_DEBUG(Service_NIFM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -348,7 +349,7 @@ void IGeneralService::CreateRequest(Kernel::HLERequestContext& ctx) { rb.PushIpcInterface<IRequest>(system); } -void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) { +void IGeneralService::GetCurrentNetworkProfile(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); const auto net_iface = Network::GetSelectedNetworkInterface(); @@ -407,14 +408,14 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void IGeneralService::RemoveNetworkProfile(Kernel::HLERequestContext& ctx) { +void IGeneralService::RemoveNetworkProfile(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } -void IGeneralService::GetCurrentIpAddress(Kernel::HLERequestContext& ctx) { +void IGeneralService::GetCurrentIpAddress(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); auto ipv4 = Network::GetHostIPv4Address(); @@ -435,7 +436,7 @@ void IGeneralService::GetCurrentIpAddress(Kernel::HLERequestContext& ctx) { rb.PushRaw(*ipv4); } -void IGeneralService::CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx) { +void IGeneralService::CreateTemporaryNetworkProfile(HLERequestContext& ctx) { LOG_DEBUG(Service_NIFM, "called"); ASSERT_MSG(ctx.GetReadBufferSize() == 0x17c, "SfNetworkProfileData is not the correct size"); @@ -450,7 +451,7 @@ void IGeneralService::CreateTemporaryNetworkProfile(Kernel::HLERequestContext& c rb.PushRaw<u128>(uuid); } -void IGeneralService::GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx) { +void IGeneralService::GetCurrentIpConfigInfo(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); struct IpConfigInfo { @@ -494,7 +495,7 @@ void IGeneralService::GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx) { rb.PushRaw<IpConfigInfo>(ip_config_info); } -void IGeneralService::IsWirelessCommunicationEnabled(Kernel::HLERequestContext& ctx) { +void IGeneralService::IsWirelessCommunicationEnabled(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -502,7 +503,7 @@ void IGeneralService::IsWirelessCommunicationEnabled(Kernel::HLERequestContext& rb.Push<u8>(1); } -void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx) { +void IGeneralService::GetInternetConnectionStatus(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); struct Output { @@ -519,7 +520,7 @@ void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx rb.PushRaw(out); } -void IGeneralService::IsEthernetCommunicationEnabled(Kernel::HLERequestContext& ctx) { +void IGeneralService::IsEthernetCommunicationEnabled(HLERequestContext& ctx) { LOG_WARNING(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -531,7 +532,7 @@ void IGeneralService::IsEthernetCommunicationEnabled(Kernel::HLERequestContext& } } -void IGeneralService::IsAnyInternetRequestAccepted(Kernel::HLERequestContext& ctx) { +void IGeneralService::IsAnyInternetRequestAccepted(HLERequestContext& ctx) { LOG_ERROR(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -609,7 +610,7 @@ public: } private: - void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) { + void CreateGeneralServiceOld(HLERequestContext& ctx) { LOG_DEBUG(Service_NIFM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -617,7 +618,7 @@ private: rb.PushIpcInterface<IGeneralService>(system); } - void CreateGeneralService(Kernel::HLERequestContext& ctx) { + void CreateGeneralService(HLERequestContext& ctx) { LOG_DEBUG(Service_NIFM, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -626,10 +627,16 @@ private: } }; -void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { - std::make_shared<NetworkInterface>("nifm:a", system)->InstallAsService(service_manager); - std::make_shared<NetworkInterface>("nifm:s", system)->InstallAsService(service_manager); - std::make_shared<NetworkInterface>("nifm:u", system)->InstallAsService(service_manager); +void LoopProcess(Core::System& system) { + auto server_manager = std::make_unique<ServerManager>(system); + + server_manager->RegisterNamedService("nifm:a", + std::make_shared<NetworkInterface>("nifm:a", system)); + server_manager->RegisterNamedService("nifm:s", + std::make_shared<NetworkInterface>("nifm:s", system)); + server_manager->RegisterNamedService("nifm:u", + std::make_shared<NetworkInterface>("nifm:u", system)); + ServerManager::RunServer(std::move(server_manager)); } } // namespace Service::NIFM |