summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2023-08-21 16:29:04 +0200
committerGitHub <noreply@github.com>2023-08-21 16:29:04 +0200
commit861597eb2e32663dba37813273ff91434566523a (patch)
treea05b7c596209f754a822c03cca162c6f32b6a565 /src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h
parentMerge pull request #11320 from Kelebek1/mask_depthstencil_clear (diff)
parentfile_sys: tolerate empty NCA (diff)
downloadyuzu-861597eb2e32663dba37813273ff91434566523a.tar
yuzu-861597eb2e32663dba37813273ff91434566523a.tar.gz
yuzu-861597eb2e32663dba37813273ff91434566523a.tar.bz2
yuzu-861597eb2e32663dba37813273ff91434566523a.tar.lz
yuzu-861597eb2e32663dba37813273ff91434566523a.tar.xz
yuzu-861597eb2e32663dba37813273ff91434566523a.tar.zst
yuzu-861597eb2e32663dba37813273ff91434566523a.zip
Diffstat (limited to 'src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h')
-rw-r--r--src/core/file_sys/fssystem/fssystem_integrity_romfs_storage.h42
1 files changed, 42 insertions, 0 deletions
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..5f8512b2a
--- /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 {
+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();
+ }
+
+private:
+ HierarchicalIntegrityVerificationStorage m_integrity_storage;
+ Hash m_master_hash;
+ std::shared_ptr<ArrayVfsFile<sizeof(Hash)>> m_master_hash_storage;
+};
+
+} // namespace FileSys