diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2024-02-08 23:58:44 +0100 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2024-02-10 07:23:22 +0100 |
commit | 7c2e9a6596c8b6c5d366c3eaaf926ad7db406486 (patch) | |
tree | 77657cc9413e380eb49e758647536a9dff4f7082 /src/core/hle/service/bcat/delivery_cache_storage_service.cpp | |
parent | Merge pull request #12951 from liamwhite/more-ipc (diff) | |
download | yuzu-7c2e9a6596c8b6c5d366c3eaaf926ad7db406486.tar yuzu-7c2e9a6596c8b6c5d366c3eaaf926ad7db406486.tar.gz yuzu-7c2e9a6596c8b6c5d366c3eaaf926ad7db406486.tar.bz2 yuzu-7c2e9a6596c8b6c5d366c3eaaf926ad7db406486.tar.lz yuzu-7c2e9a6596c8b6c5d366c3eaaf926ad7db406486.tar.xz yuzu-7c2e9a6596c8b6c5d366c3eaaf926ad7db406486.tar.zst yuzu-7c2e9a6596c8b6c5d366c3eaaf926ad7db406486.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/bcat/delivery_cache_storage_service.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/core/hle/service/bcat/delivery_cache_storage_service.cpp b/src/core/hle/service/bcat/delivery_cache_storage_service.cpp new file mode 100644 index 000000000..5d03df1e7 --- /dev/null +++ b/src/core/hle/service/bcat/delivery_cache_storage_service.cpp @@ -0,0 +1,57 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "core/hle/service/bcat/bcat_result.h" +#include "core/hle/service/bcat/delivery_cache_directory_service.h" +#include "core/hle/service/bcat/delivery_cache_file_service.h" +#include "core/hle/service/bcat/delivery_cache_storage_service.h" +#include "core/hle/service/cmif_serialization.h" + +namespace Service::BCAT { + +IDeliveryCacheStorageService::IDeliveryCacheStorageService(Core::System& system_, + FileSys::VirtualDir root_) + : ServiceFramework{system_, "IDeliveryCacheStorageService"}, root(std::move(root_)) { + // clang-format off + static const FunctionInfo functions[] = { + {0, C<&IDeliveryCacheStorageService::CreateFileService>, "CreateFileService"}, + {1, C<&IDeliveryCacheStorageService::CreateDirectoryService>, "CreateDirectoryService"}, + {2, C<&IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory>, "EnumerateDeliveryCacheDirectory"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +IDeliveryCacheStorageService::~IDeliveryCacheStorageService() = default; + +Result IDeliveryCacheStorageService::CreateFileService( + OutInterface<IDeliveryCacheFileService> out_interface) { + LOG_DEBUG(Service_BCAT, "called"); + + *out_interface = std::make_shared<IDeliveryCacheFileService>(system, root); + R_SUCCEED(); +} + +Result IDeliveryCacheStorageService::CreateDirectoryService( + OutInterface<IDeliveryCacheDirectoryService> out_interface) { + LOG_DEBUG(Service_BCAT, "called"); + + *out_interface = std::make_shared<IDeliveryCacheDirectoryService>(system, root); + R_SUCCEED(); +} + +Result IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory( + Out<u32> out_directories_size, + OutArray<DirectoryName, BufferAttr_HipcMapAlias> out_directories) { + LOG_DEBUG(Service_BCAT, "called, size={:016X}", out_directories.size()); + + *out_directories_size = + static_cast<u32>(std::min(out_directories.size(), entries.size() - next_read_index)); + memcpy(out_directories.data(), entries.data() + next_read_index, + *out_directories_size * sizeof(DirectoryName)); + next_read_index += *out_directories_size; + R_SUCCEED(); +} + +} // namespace Service::BCAT |