29#ifndef HORIZON_LIBRARIES_GRF_GRF_HPP
30#define HORIZON_LIBRARIES_GRF_GRF_HPP
36#include <unordered_map>
37#include <boost/filesystem/path.hpp>
87 typedef std::unordered_map<std::string, std::shared_ptr<DataFile>>
FileMapType;
93 void extractFile(std::string file_name, std::string output_path, clock_t begin_time);
94 std::pair<grf_read_error_type, uint8_t *>
read(
const char *in_name,
int *size);
95 void decode(
unsigned char *buf,
size_t len,
char entry_type,
int entry_len);
96 void decodeFull(
unsigned char *buf,
size_t len,
int cycle);
grf_file_error_type
Definition: GRF.hpp:60
@ GRF_FILE_ERROR_NAME_TOO_LONG
Definition: GRF.hpp:62
@ GRF_FILE_ERROR_NONE
Definition: GRF.hpp:61
datafile_type
Definition: GRF.hpp:40
@ DATAFILE_TYPE_FILE
Definition: GRF.hpp:41
@ DATAFILE_TYPE_DES_MIXED
Definition: GRF.hpp:42
@ DATAFILE_TYPE_DES_HEADER
Definition: GRF.hpp:43
grf_read_error_type
Definition: GRF.hpp:66
@ GRE_READ_ERROR
Definition: GRF.hpp:69
@ GRE_NOT_FOUND
Definition: GRF.hpp:68
@ GRE_DECOMPRESS_SIZE_MISMATCH
Definition: GRF.hpp:70
@ GRE_OK
Definition: GRF.hpp:67
grf_load_result_type
Definition: GRF.hpp:47
@ GRF_LOAD_INCOMPLETE_HEADER
Definition: GRF.hpp:50
@ GRF_LOAD_ILLEGAL_DATA_FORMAT
Definition: GRF.hpp:55
@ GRF_LOAD_OK
Definition: GRF.hpp:48
@ GRF_LOAD_MAGIC_ERROR
Definition: GRF.hpp:51
@ GRF_LOAD_FORMAT_ERROR
Definition: GRF.hpp:52
@ GRF_LOAD_READ_ERROR
Definition: GRF.hpp:56
@ GRF_LOAD_PATH_ERROR
Definition: GRF.hpp:49
@ GRF_LOAD_INVALID_VERSION
Definition: GRF.hpp:53
@ GRF_LOAD_HEADER_READ_ERROR
Definition: GRF.hpp:54
FileMapType & getFileMap()
Definition: GRF.hpp:117
void decodeFull(unsigned char *buf, size_t len, int cycle)
Definition: GRF.cpp:120
const boost::filesystem::path & getGRFPath() const
Definition: GRF.hpp:105
FileErrorMapType & getFileErrorMap()
Definition: GRF.hpp:118
void setGRFSize(std::size_t const &size)
Definition: GRF.hpp:109
std::unordered_map< std::string, std::shared_ptr< DataFile > > FileMapType
Definition: GRF.hpp:87
void decodeShuffledBytes(BIT64 *src)
Substitutes some specific values for others, leaves rest intact.
Definition: GRF.cpp:89
boost::filesystem::path _path
Definition: GRF.hpp:122
int getTotalFiles() const
Definition: GRF.hpp:114
uint8_t get_id()
Definition: GRF.hpp:101
grf_load_result_type load()
Definition: GRF.cpp:188
void set_id(uint8_t id)
Definition: GRF.hpp:102
void setGRFPath(std::string const &path)
Definition: GRF.hpp:106
FileMapType _file_map
Definition: GRF.hpp:126
void setTotalFiles(int total)
Definition: GRF.hpp:115
std::size_t getGRFSize() const
Definition: GRF.hpp:108
GRF()
Definition: GRF.cpp:48
void decodeHeader(unsigned char *buf, size_t len)
Definition: GRF.cpp:105
FileErrorMapType _file_error_map
Definition: GRF.hpp:127
std::pair< grf_read_error_type, uint8_t * > read(const char *in_name, int *size)
Definition: GRF.cpp:345
int getGRFVersion() const
Definition: GRF.hpp:111
int _grf_version
Definition: GRF.hpp:124
void extractAllFiles()
Definition: GRF.cpp:274
int _total_files
Definition: GRF.hpp:125
void setGRFVersion(int version)
Definition: GRF.hpp:112
int _id
Definition: GRF.hpp:121
uint8_t substituteObfuscatedByte(uint8_t in)
Substitutes some specific values for others, leaves rest intact.
Definition: GRF.cpp:59
std::size_t _grf_size
Definition: GRF.hpp:123
void decode(unsigned char *buf, size_t len, char entry_type, int entry_len)
Decodes grf data.
Definition: GRF.cpp:162
void extractFile(std::string file_name, std::string output_path, clock_t begin_time)
Definition: GRF.cpp:286
std::unordered_map< std::string, grf_file_error_type > FileErrorMapType
Definition: GRF.hpp:88
One 64-bit block.
Definition: DES.hpp:42
int next_hash_collision
Definition: GRF.hpp:80
int original_size
Definition: GRF.hpp:77
char file_name[128 - 4 *5]
Definition: GRF.hpp:82
int compressed_size
Definition: GRF.hpp:75
int hash_table_position
Definition: GRF.hpp:79
char type
Definition: GRF.hpp:81
int entry_position
Definition: GRF.hpp:78
int compressed_aligned_size
Definition: GRF.hpp:76