From 7d30ac0cd85821e3be3b73e9866f5255d969a67e Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 11 May 2022 23:15:56 +0100 Subject: [PATCH] Add additional nifm stubs --- app/CMakeLists.txt | 1 + .../skyline/services/nifm/IGeneralService.cpp | 12 ++++++++++++ .../cpp/skyline/services/nifm/IGeneralService.h | 15 +++++++++++++-- .../cpp/skyline/services/nifm/IScanRequest.cpp | 8 ++++++++ .../cpp/skyline/services/nifm/IScanRequest.h | 17 +++++++++++++++++ 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 app/src/main/cpp/skyline/services/nifm/IScanRequest.cpp create mode 100644 app/src/main/cpp/skyline/services/nifm/IScanRequest.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 7d04cd0c..6f7bfde4 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -317,6 +317,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/nfp/IUser.cpp ${source_DIR}/skyline/services/nifm/IStaticService.cpp ${source_DIR}/skyline/services/nifm/IGeneralService.cpp + ${source_DIR}/skyline/services/nifm/IScanRequest.cpp ${source_DIR}/skyline/services/nifm/IRequest.cpp ${source_DIR}/skyline/services/socket/bsd/IClient.cpp ${source_DIR}/skyline/services/spl/IRandomInterface.cpp diff --git a/app/src/main/cpp/skyline/services/nifm/IGeneralService.cpp b/app/src/main/cpp/skyline/services/nifm/IGeneralService.cpp index 50506538..4b33bc2f 100644 --- a/app/src/main/cpp/skyline/services/nifm/IGeneralService.cpp +++ b/app/src/main/cpp/skyline/services/nifm/IGeneralService.cpp @@ -1,14 +1,26 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) +#include "IScanRequest.h" #include "IRequest.h" #include "IGeneralService.h" namespace skyline::service::nifm { IGeneralService::IGeneralService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + Result IGeneralService::CreateScanRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + manager.RegisterService(SRVREG(IScanRequest), session, response); + return {}; + } + Result IGeneralService::CreateRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { manager.RegisterService(SRVREG(IRequest), session, response); return {}; } + + Result IGeneralService::IsAnyInternetRequestAccepted(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + // We don't emulate networking so always return false + response.Push(false); + return {}; + } } diff --git a/app/src/main/cpp/skyline/services/nifm/IGeneralService.h b/app/src/main/cpp/skyline/services/nifm/IGeneralService.h index c23536cc..af51ba57 100644 --- a/app/src/main/cpp/skyline/services/nifm/IGeneralService.h +++ b/app/src/main/cpp/skyline/services/nifm/IGeneralService.h @@ -15,13 +15,24 @@ namespace skyline::service::nifm { IGeneralService(const DeviceState &state, ServiceManager &manager); /** - * @brief Creates an IRequest instance that can be used to bring up the network + * @url https://switchbrew.org/wiki/Network_Interface_services#CreateScanRequest + */ + Result CreateScanRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + /** * @url https://switchbrew.org/wiki/Network_Interface_services#CreateRequest */ Result CreateRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + /** + * @url https://switchbrew.org/wiki/Network_Interface_services#IsAnyInternetRequestAccepted + */ + Result IsAnyInternetRequestAccepted(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + SERVICE_DECL( - SFUNC(0x4, IGeneralService, CreateRequest) + SFUNC(0x1, IGeneralService, CreateScanRequest), + SFUNC(0x4, IGeneralService, CreateRequest), + SFUNC(0x15, IGeneralService, IsAnyInternetRequestAccepted) ) }; } diff --git a/app/src/main/cpp/skyline/services/nifm/IScanRequest.cpp b/app/src/main/cpp/skyline/services/nifm/IScanRequest.cpp new file mode 100644 index 00000000..3a0e7b72 --- /dev/null +++ b/app/src/main/cpp/skyline/services/nifm/IScanRequest.cpp @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IScanRequest.h" + +namespace skyline::service::nifm { + IScanRequest::IScanRequest(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} +} \ No newline at end of file diff --git a/app/src/main/cpp/skyline/services/nifm/IScanRequest.h b/app/src/main/cpp/skyline/services/nifm/IScanRequest.h new file mode 100644 index 00000000..d0f9157a --- /dev/null +++ b/app/src/main/cpp/skyline/services/nifm/IScanRequest.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::service::nifm { + /** + * @brief IScanRequest is used by applications to scan for networks + * @url https://switchbrew.org/wiki/Network_Interface_services#IScanRequest + */ + class IScanRequest : public BaseService { + public: + IScanRequest(const DeviceState &state, ServiceManager &manager); + }; +}