summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/fsmitm_romfsbuild.h
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-09-24 03:50:16 +0200
committerZach Hilman <zachhilman@gmail.com>2018-09-24 03:50:20 +0200
commitb3c2ec362bbbdd89da9c0aa84b425717f5e3d351 (patch)
treed3f4e621532f1f280f94bac4e6d071707aabbd35 /src/core/file_sys/fsmitm_romfsbuild.h
parentqt: Add UI elements for LayeredFS and related tools (diff)
downloadyuzu-b3c2ec362bbbdd89da9c0aa84b425717f5e3d351.tar
yuzu-b3c2ec362bbbdd89da9c0aa84b425717f5e3d351.tar.gz
yuzu-b3c2ec362bbbdd89da9c0aa84b425717f5e3d351.tar.bz2
yuzu-b3c2ec362bbbdd89da9c0aa84b425717f5e3d351.tar.lz
yuzu-b3c2ec362bbbdd89da9c0aa84b425717f5e3d351.tar.xz
yuzu-b3c2ec362bbbdd89da9c0aa84b425717f5e3d351.tar.zst
yuzu-b3c2ec362bbbdd89da9c0aa84b425717f5e3d351.zip
Diffstat (limited to 'src/core/file_sys/fsmitm_romfsbuild.h')
-rw-r--r--src/core/file_sys/fsmitm_romfsbuild.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/core/file_sys/fsmitm_romfsbuild.h b/src/core/file_sys/fsmitm_romfsbuild.h
new file mode 100644
index 000000000..b0c3c123b
--- /dev/null
+++ b/src/core/file_sys/fsmitm_romfsbuild.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2018 Atmosphère-NX
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Adapted by DarkLordZach for use/interaction with yuzu
+ *
+ * Modifications Copyright 2018 yuzu emulator team
+ * Licensed under GPLv2 or any later version
+ * Refer to the license.txt file included.
+ */
+
+#pragma once
+
+#include <map>
+#include <memory>
+#include <string>
+#include <boost/detail/container_fwd.hpp>
+#include "common/common_types.h"
+#include "core/file_sys/vfs.h"
+
+namespace FileSys {
+
+struct RomFSBuildDirectoryContext;
+struct RomFSBuildFileContext;
+struct RomFSDirectoryEntry;
+struct RomFSFileEntry;
+
+class RomFSBuildContext {
+public:
+ explicit RomFSBuildContext(VirtualDir base);
+ ~RomFSBuildContext();
+
+ // This finalizes the context.
+ std::map<u64, VirtualFile> Build();
+
+private:
+ VirtualDir base;
+ std::shared_ptr<RomFSBuildDirectoryContext> root;
+ std::map<std::string, std::shared_ptr<RomFSBuildDirectoryContext>, std::less<>> directories;
+ std::map<std::string, std::shared_ptr<RomFSBuildFileContext>, std::less<>> files;
+ u64 num_dirs = 0;
+ u64 num_files = 0;
+ u64 dir_table_size = 0;
+ u64 file_table_size = 0;
+ u64 dir_hash_table_size = 0;
+ u64 file_hash_table_size = 0;
+ u64 file_partition_size = 0;
+
+ void VisitDirectory(VirtualDir filesys, std::shared_ptr<RomFSBuildDirectoryContext> parent);
+
+ bool AddDirectory(std::shared_ptr<RomFSBuildDirectoryContext> parent_dir_ctx,
+ std::shared_ptr<RomFSBuildDirectoryContext> dir_ctx);
+ bool AddFile(std::shared_ptr<RomFSBuildDirectoryContext> parent_dir_ctx,
+ std::shared_ptr<RomFSBuildFileContext> file_ctx);
+};
+
+} // namespace FileSys