diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index f07e4505..86f4424a 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -296,6 +296,8 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/am/applet/IApplet.cpp ${source_DIR}/skyline/services/bcat/IBcatService.cpp ${source_DIR}/skyline/services/bcat/IDeliveryCacheStorageService.cpp + ${source_DIR}/skyline/services/bcat/IDeliveryCacheFileService.cpp + ${source_DIR}/skyline/services/bcat/IDeliveryCacheDirectoryService.cpp ${source_DIR}/skyline/services/bcat/IServiceCreator.cpp ${source_DIR}/skyline/services/bt/IBluetoothUser.cpp ${source_DIR}/skyline/services/btm/IBtmUser.cpp diff --git a/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheDirectoryService.cpp b/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheDirectoryService.cpp new file mode 100644 index 00000000..d0aed2f8 --- /dev/null +++ b/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheDirectoryService.cpp @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IDeliveryCacheDirectoryService.h" + +namespace skyline::service::bcat { + IDeliveryCacheDirectoryService::IDeliveryCacheDirectoryService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + + Result IDeliveryCacheDirectoryService::Open(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + const auto dir_name{request.PopString(0x20)}; + + Logger::Debug("Directory name = {}", dir_name); + return {}; + } + + Result IDeliveryCacheDirectoryService::GetCount(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + response.Push(static_cast(0)); + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheDirectoryService.h b/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheDirectoryService.h new file mode 100644 index 00000000..a2e688f5 --- /dev/null +++ b/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheDirectoryService.h @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::service::bcat { + /** + * @brief IDeliveryCacheDirectoryService is used to access BCAT directories + * @url https://switchbrew.org/wiki/BCAT_services#IDeliveryCacheDirectoryService + */ + class IDeliveryCacheDirectoryService : public BaseService { + public: + IDeliveryCacheDirectoryService(const DeviceState &state, ServiceManager &manager); + + /** + * @brief Given a DirectoryName, opens that directory + * @url https://switchbrew.org/wiki/BCAT_services#IDeliveryCacheDirectoryService + */ + Result Open (type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + /** + * @brief Returns the number (u32) of elements inside the directory (u64) + * @url https://switchbrew.org/wiki/BCAT_services#IDeliveryCacheDirectoryService + */ + Result GetCount (type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IDeliveryCacheDirectoryService, Open), + SFUNC(0x2, IDeliveryCacheDirectoryService, GetCount) + ) + }; +} diff --git a/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheFileService.cpp b/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheFileService.cpp new file mode 100644 index 00000000..1e911b66 --- /dev/null +++ b/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheFileService.cpp @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include "IDeliveryCacheFileService.h" + +namespace skyline::service::bcat { + IDeliveryCacheFileService::IDeliveryCacheFileService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {} + + Result IDeliveryCacheFileService::Open(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + const auto dir_name{request.PopString(0x20)}; + const auto file_name{request.PopString(0x20)}; + + Logger::Debug("Directory name = {}, File name = {}", dir_name, file_name); + return {}; + } + + Result IDeliveryCacheFileService::GetSize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + response.Push(static_cast(0)); + return {}; + } +} diff --git a/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheFileService.h b/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheFileService.h new file mode 100644 index 00000000..b72c285d --- /dev/null +++ b/app/src/main/cpp/skyline/services/bcat/IDeliveryCacheFileService.h @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2023 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include + +namespace skyline::service::bcat { + /** + * @brief IDeliveryCacheFileService is used to access BCAT files + * @url https://switchbrew.org/wiki/BCAT_services#IDeliveryCacheFileService + */ + class IDeliveryCacheFileService : public BaseService { + public: + IDeliveryCacheFileService(const DeviceState &state, ServiceManager &manager); + + /** + * @brief Given a DirectoryName and a FileName, opens the desired file + * @url https://switchbrew.org/wiki/BCAT_services#IDeliveryCacheFileService + */ + Result Open (type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + /** + * @brief Returns the size (u64) of the file + * @url https://switchbrew.org/wiki/BCAT_services#IDeliveryCacheFileService + */ + Result GetSize (type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response); + + SERVICE_DECL( + SFUNC(0x0, IDeliveryCacheFileService, Open), + SFUNC(0x2, IDeliveryCacheFileService, GetSize) + ) + }; +}