From 092dcb18c8da4d33f1948c4dea23472ffa63e495 Mon Sep 17 00:00:00 2001 From: lynxnb Date: Mon, 13 Dec 2021 13:26:59 +0100 Subject: [PATCH] Stub `ectx:w` and `ectx:aw` Glue services --- app/CMakeLists.txt | 1 + .../skyline/services/glue/IContextRegistrar.h | 17 ++++++++++++++ .../services/glue/IWriterForSystem.cpp | 15 ++++++++++++ .../skyline/services/glue/IWriterForSystem.h | 23 +++++++++++++++++++ .../main/cpp/skyline/services/serviceman.cpp | 3 +++ 5 files changed, 59 insertions(+) create mode 100644 app/src/main/cpp/skyline/services/glue/IContextRegistrar.h create mode 100644 app/src/main/cpp/skyline/services/glue/IWriterForSystem.cpp create mode 100644 app/src/main/cpp/skyline/services/glue/IWriterForSystem.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 96a91081..d744ab3d 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -220,6 +220,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/timesrv/ITimeZoneService.cpp ${source_DIR}/skyline/services/glue/IStaticService.cpp ${source_DIR}/skyline/services/glue/ITimeZoneService.cpp + ${source_DIR}/skyline/services/glue/IWriterForSystem.cpp ${source_DIR}/skyline/services/fssrv/IFileSystemProxy.cpp ${source_DIR}/skyline/services/fssrv/IFileSystem.cpp ${source_DIR}/skyline/services/fssrv/IFile.cpp diff --git a/app/src/main/cpp/skyline/services/glue/IContextRegistrar.h b/app/src/main/cpp/skyline/services/glue/IContextRegistrar.h new file mode 100644 index 00000000..cbaa4ae3 --- /dev/null +++ b/app/src/main/cpp/skyline/services/glue/IContextRegistrar.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::glue { + /** + * @brief Stub implementation for IContextRegistrar + * @url https://switchbrew.org/wiki/Glue_services#IContextRegistrar + */ + class IContextRegistrar : public BaseService { + public: + IContextRegistrar(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + }; +} diff --git a/app/src/main/cpp/skyline/services/glue/IWriterForSystem.cpp b/app/src/main/cpp/skyline/services/glue/IWriterForSystem.cpp new file mode 100644 index 00000000..b0fa5436 --- /dev/null +++ b/app/src/main/cpp/skyline/services/glue/IWriterForSystem.cpp @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include +#include "IWriterForSystem.h" +#include "IContextRegistrar.h" + +namespace skyline::service::glue { + IWriterForSystem::IWriterForSystem(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + + Result IWriterForSystem::CreateContextRegistrar(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + manager.RegisterService(std::make_shared(state, manager), session, response); + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/glue/IWriterForSystem.h b/app/src/main/cpp/skyline/services/glue/IWriterForSystem.h new file mode 100644 index 00000000..a8dec5ef --- /dev/null +++ b/app/src/main/cpp/skyline/services/glue/IWriterForSystem.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::glue { + /** + * @brief Stub implementation for IWriterForSystem + * @url https://switchbrew.org/wiki/Glue_services#ectx:w + */ + class IWriterForSystem : public BaseService { + public: + IWriterForSystem(const DeviceState &state, ServiceManager &manager); + + Result CreateContextRegistrar(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IWriterForSystem, CreateContextRegistrar), + ) + }; +} diff --git a/app/src/main/cpp/skyline/services/serviceman.cpp b/app/src/main/cpp/skyline/services/serviceman.cpp index 76318cd0..86720a2d 100644 --- a/app/src/main/cpp/skyline/services/serviceman.cpp +++ b/app/src/main/cpp/skyline/services/serviceman.cpp @@ -16,6 +16,7 @@ #include "hid/IHidServer.h" #include "timesrv/IStaticService.h" #include "glue/IStaticService.h" +#include "glue/IWriterForSystem.h" #include "services/timesrv/core.h" #include "fssrv/IFileSystemProxy.h" #include "nvdrv/INvDrvServices.h" @@ -79,6 +80,8 @@ namespace skyline::service { SERVICE_CASE(glue::IStaticService, "time:a", globalServiceState->timesrv.managerServer.GetStaticServiceAsAdmin(state, *this), globalServiceState->timesrv, timesrv::constant::StaticServiceAdminPermissions) SERVICE_CASE(glue::IStaticService, "time:r", globalServiceState->timesrv.managerServer.GetStaticServiceAsRepair(state, *this), globalServiceState->timesrv, timesrv::constant::StaticServiceRepairPermissions) SERVICE_CASE(glue::IStaticService, "time:u", globalServiceState->timesrv.managerServer.GetStaticServiceAsUser(state, *this), globalServiceState->timesrv, timesrv::constant::StaticServiceUserPermissions) + SERVICE_CASE(glue::IWriterForSystem, "ectx:w") + SERVICE_CASE(glue::IWriterForSystem, "ectx:aw") SERVICE_CASE(fssrv::IFileSystemProxy, "fsp-srv") SERVICE_CASE(nvdrv::INvDrvServices, "nvdrv", globalServiceState->nvdrv, nvdrv::ApplicationSessionPermissions) SERVICE_CASE(nvdrv::INvDrvServices, "nvdrv:a", globalServiceState->nvdrv, nvdrv::AppletSessionPermissions)