2021-11-27 00:53:57 +01:00
|
|
|
#pragma once
|
2018-10-24 23:31:26 +11:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2019-10-14 18:41:16 +11:00
|
|
|
#include <filesystem>
|
2018-10-24 23:31:26 +11:00
|
|
|
#include <stdint.h>
|
|
|
|
#include "bparse.h"
|
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
namespace xiv::dat
|
2018-10-24 23:31:26 +11:00
|
|
|
{
|
2020-02-10 14:05:04 +11:00
|
|
|
enum class FileType :
|
|
|
|
uint32_t
|
|
|
|
{
|
|
|
|
empty = 1,
|
|
|
|
standard = 2,
|
|
|
|
model = 3,
|
|
|
|
texture = 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
class Dat;
|
|
|
|
|
|
|
|
// Basic file from the dats
|
|
|
|
class File
|
|
|
|
{
|
|
|
|
friend class Dat;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
public:
|
|
|
|
File();
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2023-04-26 13:58:41 +02:00
|
|
|
~File() = default;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2023-04-26 13:58:41 +02:00
|
|
|
// Returns the file type of the File object
|
2020-02-10 14:05:04 +11:00
|
|
|
FileType get_type() const;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2023-04-26 13:58:41 +02:00
|
|
|
// Returns a const reference to the data sections in the File object
|
|
|
|
const std::vector< std::vector< char > >& get_data_sections() const;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2023-04-26 13:58:41 +02:00
|
|
|
// Returns a reference to the data sections in the File object
|
|
|
|
std::vector< std::vector< char > >& access_data_sections();
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2023-04-26 13:58:41 +02:00
|
|
|
// Exports the content of the File object to a file on disk at the given path
|
2020-02-10 14:05:04 +11:00
|
|
|
void exportToFile( const std::filesystem::path& i_path ) const;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
protected:
|
2023-04-26 13:58:41 +02:00
|
|
|
// Stores the file type of the File object
|
2020-02-10 14:05:04 +11:00
|
|
|
FileType _type;
|
2023-04-26 13:58:41 +02:00
|
|
|
|
|
|
|
// Stores the data sections of the File object as a vector of vectors of chars
|
|
|
|
std::vector< std::vector< char > > _data_sections;
|
2020-02-10 14:05:04 +11:00
|
|
|
};
|
2023-04-26 13:58:41 +02:00
|
|
|
}// namespace xiv::dat
|
2018-10-24 23:31:26 +11:00
|
|
|
|