extracting of pkg files (no pfs_image) is working okay . Some id->name conversions probably missing
This commit is contained in:
parent
5bbfa83b36
commit
af6071ae95
|
@ -1,5 +1,6 @@
|
|||
#include "PKG.h"
|
||||
#include "../../core/FsFile.h"
|
||||
#include <direct.h>
|
||||
|
||||
PKG::PKG()
|
||||
{
|
||||
|
@ -57,6 +58,20 @@ bool PKG::extract(const std::string& filepath, const std::string& extractPath, s
|
|||
std::string name = getEntryNameByType(entry.id);
|
||||
if (!name.empty())
|
||||
{
|
||||
std::size_t pos = name.find("/");//check if we have a directory (assuming we only have 1 level of subdirectories)
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
//directory found
|
||||
std::string dir = name.substr(0, pos+1);//include '/' as well
|
||||
std::string path = extractPath + dir;
|
||||
_mkdir(path.c_str());//make dir
|
||||
std::string file = name.substr(pos + 1);//read filename
|
||||
FsFile out;
|
||||
out.Open(path + file, fsWrite);
|
||||
out.Write(pkg + entry.offset, entry.size);
|
||||
out.Close();
|
||||
|
||||
}
|
||||
//found an name use it
|
||||
FsFile out;
|
||||
out.Open(extractPath + name, fsWrite);
|
||||
|
|
|
@ -174,7 +174,7 @@ public:
|
|||
{ 0x1280, "icon0.dds" },
|
||||
{ 0x12A0, "pic0.dds" },
|
||||
{ 0x12C0, "pic1.dds" },
|
||||
//{ 0x1400, "trophy/trophy00.trp" }
|
||||
{ 0x1400, "trophy/trophy00.trp" }
|
||||
};
|
||||
std::string entry_name="";
|
||||
|
||||
|
|
Loading…
Reference in New Issue