fs: add indirection to raw storage open, for hac2l

This commit is contained in:
Michael Scire
2022-03-13 20:58:02 -07:00
committed by SciresM
parent 9866285f0e
commit 32d443977e
6 changed files with 70 additions and 20 deletions

View File

@@ -90,6 +90,22 @@ namespace ams::fssrv::fscreator {
*out_splitter = std::move(splitter);
return ResultSuccess();
}
Result StorageOnNcaCreator::CreateByRawStorage(std::shared_ptr<fs::IStorage> *out, std::shared_ptr<fssystem::IAsynchronousAccessSplitter> *out_splitter, const fssystem::NcaFsHeaderReader *header_reader, std::shared_ptr<fs::IStorage> raw_storage, void *ctx, std::shared_ptr<fssystem::NcaReader> nca_reader) {
/* Create a fs driver. */
fssystem::NcaFileSystemDriver nca_fs_driver(nca_reader, m_allocator, m_buffer_manager, m_hash_generator_factory_selector);
/* Open the storage. */
auto *storage_ctx = static_cast<fssystem::NcaFileSystemDriver::StorageContext *>(ctx);
R_TRY(nca_fs_driver.CreateStorageByRawStorage(out, header_reader, std::move(raw_storage), storage_ctx));
/* Update the splitter. */
if (storage_ctx->compressed_storage != nullptr) {
*out_splitter = storage_ctx->compressed_storage;
}
R_SUCCEED();
}
#endif
}