mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-05 14:10:27 -04:00
45 lines
896 B
C++
45 lines
896 B
C++
#pragma once
|
|
|
|
#include "WString.h"
|
|
|
|
class IDDLFileEnumerator
|
|
{
|
|
public:
|
|
virtual bool File(WString name, int group, uint32_t offset)=0;
|
|
};
|
|
|
|
struct DDLData
|
|
{
|
|
void *data;
|
|
size_t sz;
|
|
|
|
DDLData():data(0),sz(0) {}
|
|
~DDLData() {free(data);}
|
|
DDLData(const DDLData &other):data(other.data),sz(other.sz)
|
|
{
|
|
DDLData &dother=const_cast<DDLData &>(other);
|
|
dother.data=0;dother.sz=0;
|
|
}
|
|
DDLData& operator =(const DDLData &other)
|
|
{
|
|
DDLData &dother=const_cast<DDLData &>(other);
|
|
data=other.data;sz=other.sz;
|
|
dother.data=0;dother.sz=0;
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
class DDLFile
|
|
{
|
|
HANDLE _hFile;
|
|
|
|
bool ReadFile(void *data, size_t sz);
|
|
public:
|
|
DDLFile(void);
|
|
~DDLFile(void);
|
|
|
|
bool OpenDDLFile(WString filename);
|
|
bool EnumFiles(IDDLFileEnumerator &enmClass);
|
|
DDLData ExtractFile(uint32_t offset);
|
|
uint32_t GetFileSize(uint32_t offset);
|
|
};
|