jak-project/common/util/read_iso_file.h
Tyler Wilding 6446389263
extractor: cleanup, support unicode properly, and add multi-game support (#1609)
* extractor: refactor and cleanup for multi-game support

* deps: switch to `ghc::filesystem` as it is utf-8 everywhere by default

* extractor: finally working with unicode

* unicode: fix unicode cli args on windows in all `main` functions
2022-07-05 20:38:13 -04:00

43 lines
953 B
C++

#pragma once
#include <string>
#include <vector>
#include "common/util/FileUtil.h"
#include "third-party/xxhash.hpp"
struct IsoFile {
struct Entry {
bool is_dir = false;
std::string name;
// if file
size_t offset_in_file = 0;
size_t size = 0;
// if dir
std::vector<Entry> children;
void print(std::string* result, const std::string& prefix) const;
};
std::string print() const;
Entry root;
int files_extracted = 0;
bool shouldHash = false;
// There is no reason to map to the files, as we don't retain mappings of each file's expected
// hash
std::vector<xxh::hash64_t> hashes = {};
IsoFile();
};
IsoFile find_files_in_iso(FILE* fp);
void unpack_iso_files(FILE* fp, IsoFile& layout, const fs::path& dest);
IsoFile unpack_iso_files(FILE* fp,
const fs::path& dest,
bool print_progress,
const bool hashFiles = false);