Merge pull request #3171 from lioncash/internal-link

filesys/romfs: Make ProcessFile and ProcessDirectory internally linked
This commit is contained in:
bunnei 2019-11-28 01:18:10 -05:00 committed by GitHub
commit fe65045dcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -2,6 +2,8 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <memory>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/file_sys/fsmitm_romfsbuild.h" #include "core/file_sys/fsmitm_romfsbuild.h"
@ -12,7 +14,7 @@
#include "core/file_sys/vfs_vector.h" #include "core/file_sys/vfs_vector.h"
namespace FileSys { namespace FileSys {
namespace {
constexpr u32 ROMFS_ENTRY_EMPTY = 0xFFFFFFFF; constexpr u32 ROMFS_ENTRY_EMPTY = 0xFFFFFFFF;
struct TableLocation { struct TableLocation {
@ -51,7 +53,7 @@ struct FileEntry {
static_assert(sizeof(FileEntry) == 0x20, "FileEntry has incorrect size."); static_assert(sizeof(FileEntry) == 0x20, "FileEntry has incorrect size.");
template <typename Entry> template <typename Entry>
static std::pair<Entry, std::string> GetEntry(const VirtualFile& file, std::size_t offset) { std::pair<Entry, std::string> GetEntry(const VirtualFile& file, std::size_t offset) {
Entry entry{}; Entry entry{};
if (file->ReadObject(&entry, offset) != sizeof(Entry)) if (file->ReadObject(&entry, offset) != sizeof(Entry))
return {}; return {};
@ -99,6 +101,7 @@ void ProcessDirectory(VirtualFile file, std::size_t dir_offset, std::size_t file
this_dir_offset = entry.first.sibling; this_dir_offset = entry.first.sibling;
} }
} }
} // Anonymous namespace
VirtualDir ExtractRomFS(VirtualFile file, RomFSExtractionType type) { VirtualDir ExtractRomFS(VirtualFile file, RomFSExtractionType type) {
RomFSHeader header{}; RomFSHeader header{};

View file

@ -5,10 +5,6 @@
#pragma once #pragma once
#include <array> #include <array>
#include <map>
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/swap.h"
#include "core/file_sys/vfs.h" #include "core/file_sys/vfs.h"
namespace FileSys { namespace FileSys {