65 lines
1.4 KiB
C++
65 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "libNPK.h"
|
|
|
|
namespace NPK
|
|
{
|
|
|
|
class CNPKFile : public INPKFile
|
|
{
|
|
public:
|
|
//"NeoplePack_Bill\0"
|
|
static const char* kNPKFileHeaderMagic;
|
|
static const int32_t kNPKFileHeaderMagicSize = 16;
|
|
|
|
//"puchikon@neople dungeon and fighter DNFDNFDNFDNFDNFDNFDNFDNFDNFDNFDN..."
|
|
static const char* kNPKFileNameXorCode;
|
|
static const int32_t kNPKFileNameXorCodeSize = 256;
|
|
|
|
typedef struct {
|
|
char szFileHeadMagic[kNPKFileHeaderMagicSize];
|
|
int32_t nFileCounts;
|
|
} NPKFileHeader;
|
|
|
|
typedef struct {
|
|
uint32_t fileOffset;
|
|
uint32_t fileSize;
|
|
char szFileName[256];
|
|
} FileInfo;
|
|
|
|
public:
|
|
virtual bool openPakFile(const char* szPackFileName) override;
|
|
|
|
virtual bool closePakFile(void) override;
|
|
|
|
virtual int32_t getFileCount(void) const override {
|
|
return m_nFileCounts;
|
|
}
|
|
|
|
virtual bool getFileNode(int32_t index, FileNode& fileNode) const override;
|
|
|
|
virtual IFileStream* openFileStream(const char* szFileName) override;
|
|
|
|
virtual void closeFileStream(IFileStream* fileStream) override;
|
|
|
|
private:
|
|
bool checkPakFileHash(void);
|
|
void buildHashFileList(void);
|
|
|
|
private:
|
|
std::string m_strPackFileName;
|
|
HANDLE m_hPakFile = NULL;
|
|
int32_t m_nFileCounts = 0;
|
|
|
|
typedef std::vector<FileNode> FileList;
|
|
FileList m_fileList;
|
|
|
|
typedef std::unordered_map<std::string, int32_t> FileHashList;
|
|
FileHashList m_hashFileList;
|
|
|
|
public:
|
|
CNPKFile();
|
|
virtual ~CNPKFile();
|
|
};
|
|
|
|
} |