From f67a8d87a0d5e2b0b95289af91ea4478b6adbb6f Mon Sep 17 00:00:00 2001 From: mailwl Date: Fri, 2 Feb 2018 14:31:27 +0300 Subject: Service:nifm: add nifm:a, nifm:s and nifm:u services --- src/core/CMakeLists.txt | 8 ++ src/core/hle/service/nifm/nifm.cpp | 161 +++++++++++++++++++++++++++++++++++ src/core/hle/service/nifm/nifm.h | 27 ++++++ src/core/hle/service/nifm/nifm_a.cpp | 36 ++++++++ src/core/hle/service/nifm/nifm_a.h | 24 ++++++ src/core/hle/service/nifm/nifm_s.cpp | 36 ++++++++ src/core/hle/service/nifm/nifm_s.h | 24 ++++++ src/core/hle/service/nifm/nifm_u.cpp | 36 ++++++++ src/core/hle/service/nifm/nifm_u.h | 24 ++++++ src/core/hle/service/service.cpp | 2 + 10 files changed, 378 insertions(+) create mode 100644 src/core/hle/service/nifm/nifm.cpp create mode 100644 src/core/hle/service/nifm/nifm.h create mode 100644 src/core/hle/service/nifm/nifm_a.cpp create mode 100644 src/core/hle/service/nifm/nifm_a.h create mode 100644 src/core/hle/service/nifm/nifm_s.cpp create mode 100644 src/core/hle/service/nifm/nifm_s.h create mode 100644 src/core/hle/service/nifm/nifm_u.cpp create mode 100644 src/core/hle/service/nifm/nifm_u.h (limited to 'src/core') diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 848b17b18..951bc37b5 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -114,6 +114,14 @@ add_library(core STATIC hle/service/hid/hid.h hle/service/lm/lm.cpp hle/service/lm/lm.h + hle/service/nifm/nifm.cpp + hle/service/nifm/nifm.h + hle/service/nifm/nifm_a.cpp + hle/service/nifm/nifm_a.h + hle/service/nifm/nifm_s.cpp + hle/service/nifm/nifm_s.h + hle/service/nifm/nifm_u.cpp + hle/service/nifm/nifm_u.h hle/service/nvdrv/devices/nvdevice.h hle/service/nvdrv/devices/nvdisp_disp0.cpp hle/service/nvdrv/devices/nvdisp_disp0.h diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp new file mode 100644 index 000000000..f91571eb4 --- /dev/null +++ b/src/core/hle/service/nifm/nifm.cpp @@ -0,0 +1,161 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/ipc_helpers.h" +#include "core/hle/service/nifm/nifm.h" +#include "core/hle/service/nifm/nifm_a.h" +#include "core/hle/service/nifm/nifm_s.h" +#include "core/hle/service/nifm/nifm_u.h" + +namespace Service { +namespace NIFM { + +class IScanRequest final : public ServiceFramework { +public: + explicit IScanRequest() : ServiceFramework("IScanRequest") { + static const FunctionInfo functions[] = { + {0, nullptr, "Submit"}, + {1, nullptr, "IsProcessing"}, + {2, nullptr, "GetResult"}, + {3, nullptr, "GetSystemEventReadableHandle"}, + }; + RegisterHandlers(functions); + } +}; + +class IRequest final : public ServiceFramework { +public: + explicit IRequest() : ServiceFramework("IRequest") { + static const FunctionInfo functions[] = { + {0, nullptr, "GetRequestState"}, + {1, nullptr, "GetResult"}, + {2, nullptr, "GetSystemEventReadableHandles"}, + {3, nullptr, "Cancel"}, + {4, nullptr, "Submit"}, + {5, nullptr, "SetRequirement"}, + {6, nullptr, "SetRequirementPreset"}, + {8, nullptr, "SetPriority"}, + {9, nullptr, "SetNetworkProfileId"}, + {10, nullptr, "SetRejectable"}, + {11, nullptr, "SetConnectionConfirmationOption"}, + {12, nullptr, "SetPersistent"}, + {13, nullptr, "SetInstant"}, + {14, nullptr, "SetSustainable"}, + {15, nullptr, "SetRawPriority"}, + {16, nullptr, "SetGreedy"}, + {17, nullptr, "SetSharable"}, + {18, nullptr, "SetRequirementByRevision"}, + {19, nullptr, "GetRequirement"}, + {20, nullptr, "GetRevision"}, + {21, nullptr, "GetAppletInfo"}, + {22, nullptr, "GetAdditionalInfo"}, + {23, nullptr, "SetKeptInSleep"}, + {24, nullptr, "RegisterSocketDescriptor"}, + {25, nullptr, "UnregisterSocketDescriptor"}, + }; + RegisterHandlers(functions); + } +}; + +class INetworkProfile final : public ServiceFramework { +public: + explicit INetworkProfile() : ServiceFramework("INetworkProfile") { + static const FunctionInfo functions[] = { + {0, nullptr, "Update"}, + {1, nullptr, "PersistOld"}, + {2, nullptr, "Persist"}, + }; + RegisterHandlers(functions); + } +}; + +IGeneralService::IGeneralService() : ServiceFramework("IGeneralService") { + static const FunctionInfo functions[] = { + {1, &IGeneralService::GetClientId, "GetClientId"}, + {2, &IGeneralService::CreateScanRequest, "CreateScanRequest"}, + {4, &IGeneralService::CreateRequest, "CreateRequest"}, + {6, nullptr, "GetCurrentNetworkProfile"}, + {7, nullptr, "EnumerateNetworkInterfaces"}, + {8, nullptr, "GetNetworkProfile"}, + {9, nullptr, "SetNetworkProfile"}, + {10, &IGeneralService::RemoveNetworkProfile, "RemoveNetworkProfile"}, + {11, nullptr, "GetScanDataOld"}, + {12, nullptr, "GetCurrentIpAddress"}, + {13, nullptr, "GetCurrentAccessPointOld"}, + {14, &IGeneralService::CreateTemporaryNetworkProfile, "CreateTemporaryNetworkProfile"}, + {15, nullptr, "GetCurrentIpConfigInfo"}, + {16, nullptr, "SetWirelessCommunicationEnabled"}, + {17, nullptr, "IsWirelessCommunicationEnabled"}, + {18, nullptr, "GetInternetConnectionStatus"}, + {19, nullptr, "SetEthernetCommunicationEnabled"}, + {20, nullptr, "IsEthernetCommunicationEnabled"}, + {21, nullptr, "IsAnyInternetRequestAccepted"}, + {22, nullptr, "IsAnyForegroundRequestAccepted"}, + {23, nullptr, "PutToSleep"}, + {24, nullptr, "WakeUp"}, + {25, nullptr, "GetSsidListVersion"}, + {26, nullptr, "SetExclusiveClient"}, + {27, nullptr, "GetDefaultIpSetting"}, + {28, nullptr, "SetDefaultIpSetting"}, + {29, nullptr, "SetWirelessCommunicationEnabledForTest"}, + {30, nullptr, "SetEthernetCommunicationEnabledForTest"}, + {31, nullptr, "GetTelemetorySystemEventReadableHandle"}, + {32, nullptr, "GetTelemetryInfo"}, + {33, nullptr, "ConfirmSystemAvailability"}, + {34, nullptr, "SetBackgroundRequestEnabled"}, + {35, nullptr, "GetScanData"}, + {36, nullptr, "GetCurrentAccessPoint"}, + {37, nullptr, "Shutdown"}, + }; + RegisterHandlers(functions); +} + +void IGeneralService::GetClientId(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(RESULT_SUCCESS); + rb.Push(0); +} + +void IGeneralService::CreateScanRequest(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + + LOG_DEBUG(Service, "called"); +} + +void IGeneralService::CreateRequest(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + + LOG_DEBUG(Service, "called"); +} + +void IGeneralService::RemoveNetworkProfile(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); +} + +void IGeneralService::CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + + LOG_DEBUG(Service, "called"); +} + +void InstallInterfaces(SM::ServiceManager& service_manager) { + std::make_shared()->InstallAsService(service_manager); + std::make_shared()->InstallAsService(service_manager); + std::make_shared()->InstallAsService(service_manager); +} + +} // namespace NIFM +} // namespace Service diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h new file mode 100644 index 000000000..6edbfe4a4 --- /dev/null +++ b/src/core/hle/service/nifm/nifm.h @@ -0,0 +1,27 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service { +namespace NIFM { + +class IGeneralService final : public ServiceFramework { +public: + IGeneralService(); + +private: + void GetClientId(Kernel::HLERequestContext& ctx); + void CreateScanRequest(Kernel::HLERequestContext& ctx); + void CreateRequest(Kernel::HLERequestContext& ctx); + void RemoveNetworkProfile(Kernel::HLERequestContext& ctx); + void CreateTemporaryNetworkProfile(Kernel::HLERequestContext& ctx); +}; + +void InstallInterfaces(SM::ServiceManager& service_manager); + +} // namespace NIFM +} // namespace Service diff --git a/src/core/hle/service/nifm/nifm_a.cpp b/src/core/hle/service/nifm/nifm_a.cpp new file mode 100644 index 000000000..3835a87bf --- /dev/null +++ b/src/core/hle/service/nifm/nifm_a.cpp @@ -0,0 +1,36 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/hle/ipc_helpers.h" +#include "core/hle/service/nifm/nifm.h" +#include "core/hle/service/nifm/nifm_a.h" + +namespace Service { +namespace NIFM { + +void NIFM_A::CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + LOG_DEBUG(Service, "called"); +} + +void NIFM_A::CreateGeneralService(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + LOG_DEBUG(Service, "called"); +} + +NIFM_A::NIFM_A() : ServiceFramework("nifm:a") { + static const FunctionInfo functions[] = { + {4, &NIFM_A::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, + {5, &NIFM_A::CreateGeneralService, "CreateGeneralService"}, + }; + RegisterHandlers(functions); +} + +} // namespace NIFM +} // namespace Service diff --git a/src/core/hle/service/nifm/nifm_a.h b/src/core/hle/service/nifm/nifm_a.h new file mode 100644 index 000000000..06a92a93c --- /dev/null +++ b/src/core/hle/service/nifm/nifm_a.h @@ -0,0 +1,24 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/kernel/hle_ipc.h" +#include "core/hle/service/service.h" + +namespace Service { +namespace NIFM { + +class NIFM_A final : public ServiceFramework { +public: + NIFM_A(); + ~NIFM_A() = default; + +private: + void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx); + void CreateGeneralService(Kernel::HLERequestContext& ctx); +}; + +} // namespace NIFM +} // namespace Service diff --git a/src/core/hle/service/nifm/nifm_s.cpp b/src/core/hle/service/nifm/nifm_s.cpp new file mode 100644 index 000000000..cbb42891c --- /dev/null +++ b/src/core/hle/service/nifm/nifm_s.cpp @@ -0,0 +1,36 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/hle/ipc_helpers.h" +#include "core/hle/service/nifm/nifm.h" +#include "core/hle/service/nifm/nifm_s.h" + +namespace Service { +namespace NIFM { + +void NIFM_S::CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + LOG_DEBUG(Service, "called"); +} + +void NIFM_S::CreateGeneralService(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + LOG_DEBUG(Service, "called"); +} + +NIFM_S::NIFM_S() : ServiceFramework("nifm:s") { + static const FunctionInfo functions[] = { + {4, &NIFM_S::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, + {5, &NIFM_S::CreateGeneralService, "CreateGeneralService"}, + }; + RegisterHandlers(functions); +} + +} // namespace NIFM +} // namespace Service diff --git a/src/core/hle/service/nifm/nifm_s.h b/src/core/hle/service/nifm/nifm_s.h new file mode 100644 index 000000000..d11a1ec29 --- /dev/null +++ b/src/core/hle/service/nifm/nifm_s.h @@ -0,0 +1,24 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/kernel/hle_ipc.h" +#include "core/hle/service/service.h" + +namespace Service { +namespace NIFM { + +class NIFM_S final : public ServiceFramework { +public: + NIFM_S(); + ~NIFM_S() = default; + +private: + void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx); + void CreateGeneralService(Kernel::HLERequestContext& ctx); +}; + +} // namespace NIFM +} // namespace Service diff --git a/src/core/hle/service/nifm/nifm_u.cpp b/src/core/hle/service/nifm/nifm_u.cpp new file mode 100644 index 000000000..c6de14744 --- /dev/null +++ b/src/core/hle/service/nifm/nifm_u.cpp @@ -0,0 +1,36 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/hle/ipc_helpers.h" +#include "core/hle/service/nifm/nifm.h" +#include "core/hle/service/nifm/nifm_u.h" + +namespace Service { +namespace NIFM { + +void NIFM_U::CreateGeneralServiceOld(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + LOG_DEBUG(Service, "called"); +} + +void NIFM_U::CreateGeneralService(Kernel::HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(); + LOG_DEBUG(Service, "called"); +} + +NIFM_U::NIFM_U() : ServiceFramework("nifm:u") { + static const FunctionInfo functions[] = { + {4, &NIFM_U::CreateGeneralServiceOld, "CreateGeneralServiceOld"}, + {5, &NIFM_U::CreateGeneralService, "CreateGeneralService"}, + }; + RegisterHandlers(functions); +} + +} // namespace NIFM +} // namespace Service diff --git a/src/core/hle/service/nifm/nifm_u.h b/src/core/hle/service/nifm/nifm_u.h new file mode 100644 index 000000000..da40b604f --- /dev/null +++ b/src/core/hle/service/nifm/nifm_u.h @@ -0,0 +1,24 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/kernel/hle_ipc.h" +#include "core/hle/service/service.h" + +namespace Service { +namespace NIFM { + +class NIFM_U final : public ServiceFramework { +public: + NIFM_U(); + ~NIFM_U() = default; + +private: + void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx); + void CreateGeneralService(Kernel::HLERequestContext& ctx); +}; + +} // namespace NIFM +} // namespace Service diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 294351b76..1dd04a12f 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -22,6 +22,7 @@ #include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/hid/hid.h" #include "core/hle/service/lm/lm.h" +#include "core/hle/service/nifm/nifm.h" #include "core/hle/service/nvdrv/nvdrv.h" #include "core/hle/service/pctl/pctl.h" #include "core/hle/service/service.h" @@ -180,6 +181,7 @@ void Init() { FileSystem::InstallInterfaces(*SM::g_service_manager); HID::InstallInterfaces(*SM::g_service_manager); LM::InstallInterfaces(*SM::g_service_manager); + NIFM::InstallInterfaces(*SM::g_service_manager); Nvidia::InstallInterfaces(*SM::g_service_manager); PCTL::InstallInterfaces(*SM::g_service_manager); Sockets::InstallInterfaces(*SM::g_service_manager); -- cgit v1.2.3