Remove recursion from RomFS parse, clang-format

This commit is contained in:
offtkp 2023-07-29 17:01:44 +03:00
parent 2de35bd39d
commit fb6ec3aa5f
4 changed files with 202 additions and 194 deletions

View file

@ -1,22 +1,22 @@
#pragma once
#include <cstddef>
#include <cstring>
#include <vector>
#include "helpers.hpp"
namespace IVFC {
struct IVFCLevel {
u64 logicalOffset;
u64 size;
u64 blockSize;
};
struct IVFCLevel {
u64 logicalOffset;
u64 size;
u64 blockSize;
};
struct IVFC {
u64 masterHashSize;
std::vector<IVFCLevel> levels;
};
struct IVFC {
u64 masterHashSize;
std::vector<IVFCLevel> levels;
};
size_t parseIVFC(uintptr_t ivfcStart, IVFC& ivfc);
size_t parseIVFC(uintptr_t ivfcStart, IVFC& ivfc);
} // namespace IVFC
} // namespace IVFC

View file

@ -1,22 +1,23 @@
#pragma once
#include "helpers.hpp"
#include <memory>
#include <string>
#include <vector>
#include <memory>
#include "helpers.hpp"
namespace RomFS {
struct RomFSNode {
std::u16string name {};
// The file/directory offset relative to the start of the RomFS
u64 offset { 0 };
u64 size { 0 };
bool isDirectory { false };
struct RomFSNode {
std::u16string name;
// The file/directory offset relative to the start of the RomFS
u64 offset = 0;
u64 size = 0;
bool isDirectory = false;
std::vector<std::unique_ptr<RomFSNode>> directories {};
std::vector<std::unique_ptr<RomFSNode>> files {};
};
std::vector<std::unique_ptr<RomFSNode>> directories;
std::vector<std::unique_ptr<RomFSNode>> files;
};
std::unique_ptr<RomFSNode> parseRomFSTree(uintptr_t romFS, u64 romFSSize);
} // namespace RomFS
std::unique_ptr<RomFSNode> parseRomFSTree(uintptr_t romFS, u64 romFSSize);
} // namespace RomFS