mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
5942182486
* Logger: Rename logger to Logger from dLogger * Logger: Add compile time filename Fix include issues Add writers Add macros Add macro to force compilation * Logger: Replace calls with macros Allows for filename and line number to be logged * Logger: Add comments and remove extra define Logger: Replace with unique_ptr also flush console at exit. regular file writer should be flushed on file close. Logger: Remove constexpr on variable * Logger: Simplify code * Update Logger.cpp
40 lines
780 B
C++
40 lines
780 B
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
#include <filesystem>
|
|
#include <fstream>
|
|
|
|
#pragma pack(push, 1)
|
|
struct PackRecord {
|
|
uint32_t m_Crc;
|
|
int32_t m_LowerCrc;
|
|
int32_t m_UpperCrc;
|
|
uint32_t m_UncompressedSize;
|
|
char m_UncompressedHash[32];
|
|
uint32_t m_Padding1;
|
|
uint32_t m_CompressedSize;
|
|
char m_CompressedHash[32];
|
|
uint32_t m_Padding2;
|
|
uint32_t m_FilePointer;
|
|
uint32_t m_IsCompressed; // u32 bool
|
|
};
|
|
#pragma pack(pop)
|
|
|
|
class Pack {
|
|
public:
|
|
Pack(const std::filesystem::path& filePath);
|
|
~Pack() = default;
|
|
|
|
bool HasFile(uint32_t crc);
|
|
bool ReadFileFromPack(uint32_t crc, char** data, uint32_t* len);
|
|
private:
|
|
std::ifstream m_FileStream;
|
|
std::filesystem::path m_FilePath;
|
|
|
|
char m_Version[7];
|
|
|
|
uint32_t m_RecordCount;
|
|
std::vector<PackRecord> m_Records;
|
|
};
|