This is the first of many commits to improve code quality, and try to tame my bad looking code. Types such as Slot and Race are now living under types/ and have dedicated functions to go between ids and enumerations without a heavy std::map. A new repository API lives in a new SqPack header, which replaces the old crusty way of fetching repository information in GameData. Building equipment paths now live in libxiv (moved from novus) provided you have a model id. Standard methods to build index and dat filenames are provided in their functions now too.
58 lines
No EOL
1.6 KiB
C++
58 lines
No EOL
1.6 KiB
C++
#pragma once
|
|
|
|
#include <string_view>
|
|
#include <string>
|
|
#include <optional>
|
|
#include "exhparser.h"
|
|
#include "exlparser.h"
|
|
#include "indexparser.h"
|
|
#include "sqpack.h"
|
|
|
|
/*
|
|
* This handles reading/extracting the raw data from game data packs, such as dat0, index and index2 files.
|
|
* This is not local to "one" repository or sqpack, but oversees operation over all of them.
|
|
*
|
|
* This will "lazy-load" index and dat files as needed for now.
|
|
*
|
|
* This is definitely not the final name of this class :-p
|
|
*/
|
|
class GameData {
|
|
public:
|
|
/*
|
|
* Initializes the game data manager, this should pointing to the parent directory of the ex1/ex2/ffxiv directory.
|
|
*/
|
|
explicit GameData(std::string_view dataDirectory);
|
|
|
|
/*
|
|
* This extracts the raw file from dataFilePath to outPath;
|
|
*/
|
|
void extractFile(std::string_view dataFilePath, std::string_view outPath);
|
|
|
|
IndexFile<IndexHashTableEntry> getIndexListing(std::string_view folder);
|
|
|
|
void extractSkeleton();
|
|
|
|
std::optional<EXH> readExcelSheet(std::string_view name);
|
|
|
|
std::vector<std::string> getAllSheetNames();
|
|
|
|
/*
|
|
* Calculates a uint64 hash from a given game path.
|
|
*/
|
|
uint64_t calculateHash(std::string_view path);
|
|
|
|
private:
|
|
Repository& getBaseRepository();
|
|
|
|
/*
|
|
* Returns the repository, category for a given game path - respectively.
|
|
*/
|
|
std::tuple<Repository, std::string> calculateRepositoryCategory(std::string_view path);
|
|
|
|
std::string dataDirectory;
|
|
std::vector<Repository> repositories;
|
|
|
|
EXL rootEXL;
|
|
};
|
|
|
|
std::vector<std::uint8_t> read_data_block(FILE* file, size_t starting_position); |