pkg tool : file table info

This commit is contained in:
georgemoralis 2023-02-24 16:23:12 +02:00
parent 8ccfcfd553
commit 86ecf77a15
2 changed files with 20 additions and 6 deletions

View file

@ -71,6 +71,7 @@ bool PKG::extract(const std::string& filepath, const std::string& extractPath, s
ReadBE(entry);
//try to figure out the name
std::string name = getEntryNameByType(entry.id);
printPkgFileEntry(entry,name);
if (!name.empty())
{
std::size_t pos = name.find("/");//check if we have a directory (assuming we only have 1 level of subdirectories)
@ -107,10 +108,10 @@ bool PKG::extract(const std::string& filepath, const std::string& extractPath, s
pfs.pfsOuterReadHeader(pkg + pkgheader.pfs_image_offset);
pfs.printPsfOuterHeader();
//extract pfs_image.dat
/*FsFile out;
FsFile out;
out.Open(extractPath + "pfs_image.dat", fsWrite);
out.Write(pkg + pkgheader.pfs_image_offset, pkgheader.pfs_image_size);
out.Close();*/
out.Close();
munmap(pkg);
return true;
}

View file

@ -294,10 +294,10 @@ public:
printf(" finalized");
printf("\n");
printf("- PKG 0x8: 0x%X\n", pkgheader.pkg_0x8);
printf("- PKG file count: 0x%X\n", pkgheader.pkg_file_count);
printf("- PKG table entries: 0x%X\n", pkgheader.pkg_table_entry_count);
printf("- PKG system entries: 0x%X\n", pkgheader.pkg_sc_entry_count);
printf("- PKG table entries2: 0x%X\n", pkgheader.pkg_table_entry_count_2);
printf("- PKG file count: %u\n", pkgheader.pkg_file_count);
printf("- PKG table entries count: %u\n", pkgheader.pkg_table_entry_count);
printf("- PKG system entries count: %u\n", pkgheader.pkg_sc_entry_count);
printf("- PKG table entries2 count: %u\n", pkgheader.pkg_table_entry_count_2);
printf("- PKG table offset: 0x%X\n", pkgheader.pkg_table_entry_offset);
printf("- PKG table entry data size: 0x%X\n", pkgheader.pkg_sc_entry_data_size);
printf("- PKG body offset: 0x%" PRIx64 "\n", pkgheader.pkg_body_offset);
@ -395,5 +395,18 @@ public:
printf("\n");
printf("\n\n");
}
void printPkgFileEntry(PKGEntry entry, std::string name)
{
printf("-PS4 File Entry:\n");
printf("--found name: %s\n", name.c_str());
printf("--id: 0x%X\n", entry.id);
printf("--filename_offset: 0x%X\n", entry.filename_offset);
printf("--flags1: 0x%X\n", entry.flags1);
printf("--flags2: 0x%X\n", entry.flags2);
printf("--offset: 0x%X\n", entry.offset);
printf("--size: 0x%X\n", entry.size);
}
};