2023-01-31 08:00:38 +00:00
|
|
|
#include <iostream>
|
2023-01-31 09:44:05 +00:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <direct.h>
|
|
|
|
#include "PKG.h"
|
2023-01-31 08:00:38 +00:00
|
|
|
int main()
|
|
|
|
{
|
2023-01-31 09:44:05 +00:00
|
|
|
PKG pkg;
|
|
|
|
if (!pkg.open("test.pkg"))
|
|
|
|
{
|
|
|
|
std::cout << "Error reading test.pkg\n";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
pkg.printPkgHeader();
|
|
|
|
std::string gamedir = "game/" + pkg.getTitleID();
|
|
|
|
struct stat sb;
|
|
|
|
if (stat(gamedir.c_str(), &sb) != 0)
|
|
|
|
{
|
|
|
|
_mkdir(gamedir.c_str());
|
|
|
|
}
|
|
|
|
std::string extractpath = "game/" + pkg.getTitleID() + "/";
|
|
|
|
std::string failreason;
|
|
|
|
if (!pkg.extract("test.pkg", extractpath, failreason))
|
|
|
|
{
|
|
|
|
std::cout << "Error extraction " << failreason;
|
|
|
|
}
|
2023-01-31 08:00:38 +00:00
|
|
|
}
|
|
|
|
|