2018-07-27 22:14:03 +00:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
2018-09-20 02:04:51 +00:00
|
|
|
#include <map>
|
2018-07-27 22:14:03 +00:00
|
|
|
#include "common/common_funcs.h"
|
2018-09-04 01:58:19 +00:00
|
|
|
#include "common/common_types.h"
|
2018-07-27 22:14:03 +00:00
|
|
|
#include "common/swap.h"
|
|
|
|
#include "core/file_sys/vfs.h"
|
|
|
|
|
|
|
|
namespace FileSys {
|
|
|
|
|
2018-09-20 02:04:51 +00:00
|
|
|
struct RomFSHeader;
|
|
|
|
|
2018-07-27 22:14:03 +00:00
|
|
|
struct IVFCLevel {
|
|
|
|
u64_le offset;
|
|
|
|
u64_le size;
|
|
|
|
u32_le block_size;
|
|
|
|
u32_le reserved;
|
|
|
|
};
|
|
|
|
static_assert(sizeof(IVFCLevel) == 0x18, "IVFCLevel has incorrect size.");
|
|
|
|
|
|
|
|
struct IVFCHeader {
|
|
|
|
u32_le magic;
|
|
|
|
u32_le magic_number;
|
|
|
|
INSERT_PADDING_BYTES(8);
|
|
|
|
std::array<IVFCLevel, 6> levels;
|
|
|
|
INSERT_PADDING_BYTES(64);
|
|
|
|
};
|
|
|
|
static_assert(sizeof(IVFCHeader) == 0xE0, "IVFCHeader has incorrect size.");
|
|
|
|
|
2018-09-24 01:50:16 +00:00
|
|
|
enum class RomFSExtractionType {
|
|
|
|
Full, // Includes data directory
|
|
|
|
Truncated, // Traverses into data directory
|
|
|
|
};
|
|
|
|
|
2018-07-27 22:14:03 +00:00
|
|
|
// Converts a RomFS binary blob to VFS Filesystem
|
|
|
|
// Returns nullptr on failure
|
2018-09-24 01:50:16 +00:00
|
|
|
VirtualDir ExtractRomFS(VirtualFile file,
|
|
|
|
RomFSExtractionType type = RomFSExtractionType::Truncated);
|
2018-09-20 02:04:51 +00:00
|
|
|
|
|
|
|
// Converts a VFS filesystem into a RomFS binary
|
|
|
|
// Returns nullptr on failure
|
|
|
|
VirtualFile CreateRomFS(VirtualDir dir);
|
2018-07-27 22:14:03 +00:00
|
|
|
|
|
|
|
} // namespace FileSys
|