增加Lua导出和FileList

This commit is contained in:
2025-09-02 20:39:30 +08:00
parent 1fb319f0e8
commit 6788128cc3
18 changed files with 682 additions and 56 deletions
+10 -7
View File
@@ -21,19 +21,21 @@ bool extractNPKFiles(const char* szNPKFileName, const char* szOutputDir)
{
return false; // Failed to create NPK file interface
}
if (!npkFile->openPakFile(szNPKFileName))
std::wstring strFullName = convertAnsiStringToWide(szNPKFileName);
if (!(npkFile->openPakFile(strFullName.c_str())))
{
printf("Failed to open NPK file: '%s', Error=%s\n", szNPKFileName, NPK::getLastErrorMessage());
NPK::closeNPKFile(npkFile);
return false; // Failed to open NPK file
}
int32_t fileCount = npkFile->getFileCount();
int32_t fileCount = npkFile->getFileCounts();
for (int32_t i = 0; i < fileCount; ++i)
{
NPK::INPKFile::FileNode fileNode;
if (npkFile->getFileNode(i, fileNode))
NPK::FileItemBaseInfo baseInfo;
if (!npkFile->getFileItemBaseInfo(i, &baseInfo))
{
std::string outputPathName = std::string(szOutputDir) + "/" + fileNode.fileName;
std::string outputPathName = std::string(szOutputDir) + "/" + baseInfo.keyName;
char szOutputPath[MAX_PATH];
StringCbCopyA(szOutputPath, sizeof(szOutputPath), outputPathName.c_str());
@@ -46,10 +48,11 @@ bool extractNPKFiles(const char* szNPKFileName, const char* szOutputDir)
return false;
}
NPK::IFileStream* fileStream = npkFile->openFileStream(fileNode.fileName.c_str());
NPK::IFileStream* fileStream = npkFile->openFileStream(baseInfo.keyName.c_str());
if(fileStream == nullptr)
{
printf("Error: Failed to open file stream for '%s', Error=%s\n", fileNode.fileName.c_str(), NPK::getLastErrorMessage());
printf("Error: Failed to open file stream for '%s', Error=%s\n",
baseInfo.keyName.c_str(), NPK::getLastErrorMessage());
NPK::closeNPKFile(npkFile);
return false;
}