From 86f6b6b7b2d930e8203114332b04a5c49a780b06 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 10 Aug 2023 21:34:43 -0400 Subject: vfs: expand support for NCA reading --- .../fssystem/fssystem_integrity_romfs_storage.h | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h (limited to 'src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h') diff --git a/src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h b/src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h new file mode 100644 index 000000000..b80e9a302 --- /dev/null +++ b/src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h @@ -0,0 +1,42 @@ +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/file_sys/fssystem/fssystem_hierarchical_integrity_verification_storage.h" +#include "core/file_sys/fssystem/fssystem_nca_header.h" +#include "core/file_sys/vfs_vector.h" + +namespace FileSys { + +constexpr inline size_t IntegrityLayerCountRomFs = 7; +constexpr inline size_t IntegrityHashLayerBlockSize = 16_KiB; + +class IntegrityRomFsStorage : public IReadOnlyStorage { +private: + HierarchicalIntegrityVerificationStorage m_integrity_storage; + Hash m_master_hash; + std::shared_ptr> m_master_hash_storage; + +public: + IntegrityRomFsStorage() {} + virtual ~IntegrityRomFsStorage() override { + this->Finalize(); + } + + Result Initialize( + HierarchicalIntegrityVerificationInformation level_hash_info, Hash master_hash, + HierarchicalIntegrityVerificationStorage::HierarchicalStorageInformation storage_info, + int max_data_cache_entries, int max_hash_cache_entries, s8 buffer_level); + void Finalize(); + + virtual size_t Read(u8* buffer, size_t size, size_t offset) const override { + return m_integrity_storage.Read(buffer, size, offset); + } + + virtual size_t GetSize() const override { + return m_integrity_storage.GetSize(); + } +}; + +} // namespace FileSys -- cgit v1.2.3 From 50eee9b2185c59c32fb82cf464230a058edd10ea Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 12 Aug 2023 15:18:55 -0400 Subject: fssystem: rework for yuzu style --- src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h') diff --git a/src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h b/src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h index b80e9a302..5f8512b2a 100644 --- a/src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h +++ b/src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h @@ -13,11 +13,6 @@ constexpr inline size_t IntegrityLayerCountRomFs = 7; constexpr inline size_t IntegrityHashLayerBlockSize = 16_KiB; class IntegrityRomFsStorage : public IReadOnlyStorage { -private: - HierarchicalIntegrityVerificationStorage m_integrity_storage; - Hash m_master_hash; - std::shared_ptr> m_master_hash_storage; - public: IntegrityRomFsStorage() {} virtual ~IntegrityRomFsStorage() override { @@ -37,6 +32,11 @@ public: virtual size_t GetSize() const override { return m_integrity_storage.GetSize(); } + +private: + HierarchicalIntegrityVerificationStorage m_integrity_storage; + Hash m_master_hash; + std::shared_ptr> m_master_hash_storage; }; } // namespace FileSys -- cgit v1.2.3