增加Lua导出和FileList
This commit is contained in:
+41
-15
@@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
namespace NPK
|
||||
{
|
||||
|
||||
@@ -8,6 +11,7 @@ namespace NPK
|
||||
//------------------------------------
|
||||
class INPKFile;
|
||||
class IFileStream;
|
||||
class IFileList;
|
||||
|
||||
//------------------------------------
|
||||
// NPK file error codes
|
||||
@@ -24,6 +28,7 @@ enum ErrorCode
|
||||
NPK_ERR_FILE_WRITE,
|
||||
NPK_ERR_PARAM,
|
||||
NPK_ERR_INVALID_STATE,
|
||||
NPK_ERR_NEW_FAILED,
|
||||
|
||||
//Other errors
|
||||
NPK_ERR_UNKNOWN
|
||||
@@ -39,6 +44,12 @@ INPKFile* createNPKFile();
|
||||
// destroy an NPK interface
|
||||
void closeNPKFile(INPKFile* npkFile);
|
||||
|
||||
// Create empty file list
|
||||
IFileList* createEmptyFileList();
|
||||
|
||||
// destroy a file list
|
||||
void destoryFileList(IFileList* fileList);
|
||||
|
||||
// Get the last error code
|
||||
ErrorCode getLastErrorCode();
|
||||
|
||||
@@ -48,27 +59,33 @@ const char* getLastErrorMessage();
|
||||
//------------------------------------
|
||||
// define the NPK file interface
|
||||
//------------------------------------
|
||||
struct FileItemBaseInfo
|
||||
{
|
||||
std::string keyName; // utf8 'common/etc/tribe.img'
|
||||
uint32_t fileOffset = 0;
|
||||
uint32_t fileSize = 0;
|
||||
};
|
||||
|
||||
struct FileItemFullInfo
|
||||
{
|
||||
std::string npkName; // utf8 'sprite_interface2_hud.npk'
|
||||
std::string npkBase; // utf8 'd:/dnf/ImagePacks2'
|
||||
std::string keyName; // 'common/etc/tribe.img'
|
||||
uint32_t fileOffset = 0;
|
||||
uint32_t fileSize = 0;
|
||||
uint32_t fileCRC = 0;
|
||||
};
|
||||
|
||||
class INPKFile
|
||||
{
|
||||
public:
|
||||
struct FileNode
|
||||
{
|
||||
std::string fileName;
|
||||
uint32_t fileOffset = 0;
|
||||
uint32_t fileSize = 0;
|
||||
};
|
||||
public:
|
||||
virtual bool openPakFile(const char* szPackFileName) = 0;
|
||||
|
||||
virtual bool openPakFile(const wchar_t* wszNpkPathName) = 0;
|
||||
virtual bool closePakFile(void) = 0;
|
||||
|
||||
virtual int32_t getFileCount(void) const = 0;
|
||||
|
||||
virtual bool getFileNode(int32_t index, FileNode& fileNode) const = 0;
|
||||
|
||||
virtual int32_t getFileCounts(void) const = 0;
|
||||
virtual bool getFileItemBaseInfo(int32_t index, FileItemBaseInfo* baseInfo) const = 0;
|
||||
virtual IFileStream* openFileStream(const char* szFileName) = 0;
|
||||
|
||||
virtual void closeFileStream(IFileStream* fileStream) = 0;
|
||||
virtual IFileList* generateFullInfoList(void) = 0;
|
||||
};
|
||||
|
||||
class IFileStream
|
||||
@@ -83,4 +100,13 @@ public:
|
||||
virtual bool isEOF(void) const = 0;
|
||||
};
|
||||
|
||||
class IFileList
|
||||
{
|
||||
public:
|
||||
virtual int32_t getFileCounts(void) const = 0;
|
||||
virtual bool getFileItem(int32_t index, FileItemFullInfo* fileItemFullInfo) const = 0;
|
||||
virtual void addFileNode(const FileItemFullInfo& fileItemFullInfo) = 0;
|
||||
virtual void mergeOtherListInto(const IFileList* sourceFileList) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user