diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index d45a1570..b3a6ccbb 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -251,6 +251,8 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/am/storage/IStorageAccessor.cpp ${source_DIR}/skyline/services/am/applet/ILibraryAppletAccessor.cpp ${source_DIR}/skyline/services/am/applet/IApplet.cpp + ${source_DIR}/skyline/services/bcat/IServiceCreator.cpp + ${source_DIR}/skyline/services/bcat/IBcatService.cpp ${source_DIR}/skyline/applet/applet_creator.cpp ${source_DIR}/skyline/applet/controller_applet.cpp ${source_DIR}/skyline/services/codec/IHardwareOpusDecoder.cpp diff --git a/app/src/main/cpp/skyline/services/bcat/IBcatService.cpp b/app/src/main/cpp/skyline/services/bcat/IBcatService.cpp new file mode 100644 index 00000000..7621dd39 --- /dev/null +++ b/app/src/main/cpp/skyline/services/bcat/IBcatService.cpp @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IBcatService.h" + +namespace skyline::service::bcat { + IBcatService::IBcatService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} +} diff --git a/app/src/main/cpp/skyline/services/bcat/IBcatService.h b/app/src/main/cpp/skyline/services/bcat/IBcatService.h new file mode 100644 index 00000000..aaa545f0 --- /dev/null +++ b/app/src/main/cpp/skyline/services/bcat/IBcatService.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::bcat { + /** + * @brief IBcatService is used to interact with BCAT (Background Content Asymmetric synchronized delivery and Transmission) + * @url https://switchbrew.org/wiki/BCAT_services#IBcatService + */ + class IBcatService : public BaseService { + public: + IBcatService(const DeviceState &state, ServiceManager &manager); + }; +} diff --git a/app/src/main/cpp/skyline/services/bcat/IServiceCreator.cpp b/app/src/main/cpp/skyline/services/bcat/IServiceCreator.cpp new file mode 100644 index 00000000..0692851b --- /dev/null +++ b/app/src/main/cpp/skyline/services/bcat/IServiceCreator.cpp @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IServiceCreator.h" + +namespace skyline::service::bcat { + IServiceCreator::IServiceCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + + Result IServiceCreator::CreateBcatService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + manager.RegisterService(SRVREG(IBcatService), session, response); + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/bcat/IServiceCreator.h b/app/src/main/cpp/skyline/services/bcat/IServiceCreator.h new file mode 100644 index 00000000..85d3a6a3 --- /dev/null +++ b/app/src/main/cpp/skyline/services/bcat/IServiceCreator.h @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include +#include "IBcatService.h" + +namespace skyline::service::bcat { + /** + * @brief IServiceCreator is used to create per-process/per-title service instances for BCAT + * @url https://switchbrew.org/wiki/BCAT_services#bcat:a.2C_bcat:m.2C_bcat:u.2C_bcat:s + */ + class IServiceCreator : public BaseService { + public: + IServiceCreator(const DeviceState &state, ServiceManager &manager); + + /** + * @brief Takes an input u64 ProcessId, returns an #IBcatService + * @url https://switchbrew.org/wiki/BCAT_services#bcat:a.2C_bcat:m.2C_bcat:u.2C_bcat:s + */ + Result CreateBcatService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IServiceCreator, CreateBcatService) + ) + }; +} diff --git a/app/src/main/cpp/skyline/services/serviceman.cpp b/app/src/main/cpp/skyline/services/serviceman.cpp index d239d16c..e2cc320f 100644 --- a/app/src/main/cpp/skyline/services/serviceman.cpp +++ b/app/src/main/cpp/skyline/services/serviceman.cpp @@ -11,6 +11,7 @@ #include "am/IAllSystemAppletProxiesService.h" #include "audio/IAudioOutManager.h" #include "audio/IAudioRendererManager.h" +#include "bcat/IServiceCreator.h" #include "codec/IHardwareOpusDecoderManager.h" #include "fatalsrv/IService.h" #include "hid/IHidServer.h" @@ -109,6 +110,7 @@ namespace skyline::service { SERVICE_CASE(ssl::ISslService, "ssl") SERVICE_CASE(prepo::IPrepoService, "prepo:u") SERVICE_CASE(mmnv::IRequest, "mm:u") + SERVICE_CASE(bcat::IServiceCreator, "bcat:u") 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));