diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index a9630666..c10db1cf 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -322,6 +322,10 @@ add_library(skyline SHARED ${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/nim/IShopServiceAccessor.cpp + ${source_DIR}/skyline/services/nim/IShopServiceAccessServer.cpp + ${source_DIR}/skyline/services/nim/IShopServiceAccessServerInterface.cpp + ${source_DIR}/skyline/services/nim/IShopServiceAsync.cpp ${source_DIR}/skyline/services/socket/bsd/IClient.cpp ${source_DIR}/skyline/services/spl/IRandomInterface.cpp ${source_DIR}/skyline/services/ssl/ISslService.cpp diff --git a/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServer.cpp b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServer.cpp new file mode 100644 index 00000000..d08c11ed --- /dev/null +++ b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServer.cpp @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IShopServiceAccessor.h" +#include "IShopServiceAccessServer.h" + +namespace skyline::service::nim { + IShopServiceAccessServer::IShopServiceAccessServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + + Result IShopServiceAccessServer::CreateAccessorInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + manager.RegisterService(SRVREG(IShopServiceAccessor), session, response); + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServer.h b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServer.h new file mode 100644 index 00000000..065438f6 --- /dev/null +++ b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServer.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::service::nim { + /** + * @brief IShopServiceAccessServer is used by applications to interface with the Nintendo eShop + * @url https://switchbrew.org/wiki/NIM_services#IShopServiceAccessServer + */ + class IShopServiceAccessServer : public BaseService { + public: + IShopServiceAccessServer(const DeviceState &state, ServiceManager &manager); + + Result CreateAccessorInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IShopServiceAccessServer, CreateAccessorInterface), + ) + }; +} diff --git a/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServerInterface.cpp b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServerInterface.cpp new file mode 100644 index 00000000..d36ead8c --- /dev/null +++ b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServerInterface.cpp @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IShopServiceAccessServer.h" +#include "IShopServiceAccessServerInterface.h" + +namespace skyline::service::nim { + IShopServiceAccessServerInterface::IShopServiceAccessServerInterface(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + + Result IShopServiceAccessServerInterface::CreateServerInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + manager.RegisterService(SRVREG(IShopServiceAccessServer), session, response); + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServerInterface.h b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServerInterface.h new file mode 100644 index 00000000..00dcc9f2 --- /dev/null +++ b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessServerInterface.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::service::nim { + /** + * @brief IShopServiceAccessServerInterface or nim:eca is used by applications to open a channel to communicate with the Nintendo eShop + * @url https://switchbrew.org/wiki/NIM_services#nim:eca + */ + class IShopServiceAccessServerInterface : public BaseService { + public: + IShopServiceAccessServerInterface(const DeviceState &state, ServiceManager &manager); + + Result CreateServerInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IShopServiceAccessServerInterface, CreateServerInterface) + ) + }; +} diff --git a/app/src/main/cpp/skyline/services/nim/IShopServiceAccessor.cpp b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessor.cpp new file mode 100644 index 00000000..c3712bb7 --- /dev/null +++ b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessor.cpp @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IShopServiceAsync.h" +#include "IShopServiceAccessor.h" + +namespace skyline::service::nim { + IShopServiceAccessor::IShopServiceAccessor(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + + Result IShopServiceAccessor::CreateAsyncInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + manager.RegisterService(SRVREG(IShopServiceAsync), session, response); + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/nim/IShopServiceAccessor.h b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessor.h new file mode 100644 index 00000000..dfd80a8a --- /dev/null +++ b/app/src/main/cpp/skyline/services/nim/IShopServiceAccessor.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::service::nim { + /** + * @brief IShopServiceAccessor is used by applications to communicate with the Nintendo eShop + * @url https://switchbrew.org/wiki/NIM_services#IShopServiceAccessor + */ + class IShopServiceAccessor : public BaseService { + public: + IShopServiceAccessor(const DeviceState &state, ServiceManager &manager); + + Result CreateAsyncInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IShopServiceAccessor, CreateAsyncInterface) + ) + }; +} diff --git a/app/src/main/cpp/skyline/services/nim/IShopServiceAsync.cpp b/app/src/main/cpp/skyline/services/nim/IShopServiceAsync.cpp new file mode 100644 index 00000000..5ba3f35c --- /dev/null +++ b/app/src/main/cpp/skyline/services/nim/IShopServiceAsync.cpp @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IShopServiceAsync.h" + +namespace skyline::service::nim { + IShopServiceAsync::IShopServiceAsync(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} +} diff --git a/app/src/main/cpp/skyline/services/nim/IShopServiceAsync.h b/app/src/main/cpp/skyline/services/nim/IShopServiceAsync.h new file mode 100644 index 00000000..937fe943 --- /dev/null +++ b/app/src/main/cpp/skyline/services/nim/IShopServiceAsync.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::service::nim { + /** + * @brief IShopServiceAsync is used by applications to directly communicate with the Nintendo eShop + * @url https://switchbrew.org/wiki/NIM_services#IShopServiceAsync + */ + class IShopServiceAsync : public BaseService { + public: + IShopServiceAsync(const DeviceState &state, ServiceManager &manager); + }; +} diff --git a/app/src/main/cpp/skyline/services/serviceman.cpp b/app/src/main/cpp/skyline/services/serviceman.cpp index 92a2c24a..b9e5bc35 100644 --- a/app/src/main/cpp/skyline/services/serviceman.cpp +++ b/app/src/main/cpp/skyline/services/serviceman.cpp @@ -37,6 +37,7 @@ #include "friends/IServiceCreator.h" #include "nfp/IUserManager.h" #include "nifm/IStaticService.h" +#include "nim/IShopServiceAccessServerInterface.h" #include "socket/bsd/IClient.h" #include "spl/IRandomInterface.h" #include "ssl/ISslService.h" @@ -115,6 +116,7 @@ namespace skyline::service { SERVICE_CASE(bcat::IServiceCreator, "bcat:u") SERVICE_CASE(bt::IBluetoothUser, "bt") SERVICE_CASE(btm::IBtmUser, "btm:u") + SERVICE_CASE(nim::IShopServiceAccessServerInterface, "nim:eca") default: std::string_view nameString(span(reinterpret_cast(&name), sizeof(name)).as_string(true)); throw std::out_of_range(fmt::format("CreateService called with an unknown service name: {}", nameString));