pkgextract : added some enums with info

This commit is contained in:
georgemoralis 2023-02-13 20:28:02 +02:00
parent 4703224071
commit 4205d58747
2 changed files with 38 additions and 4 deletions

View file

@ -6,6 +6,13 @@
#include <stdio.h>
#include <inttypes.h>
enum PFSMode : U08 {
PFS_MODE_NONE = 0,
PFS_MODE_SIGNED = 0x1,
PFS_MODE_64BIT = 0x2,
PFS_MODE_ENCRYPTED = 0x4,
PFS_MODE_UNKNOWN = 0x8,
};
struct PFS_HDR {
U64 version;
U64 magic;
@ -44,7 +51,16 @@ public:
printf("- clean: 0x%X\n", psfOuterheader.clean);
printf("- ronly: 0x%X\n", psfOuterheader.ronly);
printf("- rsv: 0x%X\n", psfOuterheader.rsv);
printf("- mode: 0x%X\n", psfOuterheader.mode);
printf("- mode: 0x%X", psfOuterheader.mode);
if (psfOuterheader.mode & PFS_MODE_SIGNED)
printf(" signed");
if (psfOuterheader.mode & PFS_MODE_64BIT)
printf(" 64-bit");
if (psfOuterheader.mode & PFS_MODE_ENCRYPTED)
printf(" encrypted");
if (psfOuterheader.mode & PFS_MODE_UNKNOWN)
printf(" unknown");
printf("\n");
printf("- unk1: 0x%X\n", psfOuterheader.unk1);
printf("- blocksz: 0x%X\n", psfOuterheader.blocksz);
printf("- nbackup: 0x%X\n", psfOuterheader.nbackup);

View file

@ -6,9 +6,16 @@
#include <stdio.h>
#include <inttypes.h>
enum PKGFlags : U32 {
PKG_FLAGS_UNKNOWN = 0x01,
PKG_FLAGS_VER_1 = 0x01000000,
PKG_FLAGS_VER_2 = 0x02000000,
PKG_FLAGS_INTERNAL = 0x40000000,
PKG_FLAGS_FINALIZED = 0x80000000,
};
struct PKGHeader {
/*BE*/U32 magic;// Magic
/*BE*/U32 pkg_type;
/*BE*/U32 pkg_flags;
/*BE*/U32 pkg_0x8; //unknown field
/*BE*/U32 pkg_file_count;
/*BE*/U32 pkg_table_entry_count;
@ -70,7 +77,7 @@ struct PKGHeader {
inline void ReadBE(PKGHeader& s)
{
ReadBE(s.magic);
ReadBE(s.pkg_type);
ReadBE(s.pkg_flags);
ReadBE(s.pkg_0x8);
ReadBE(s.pkg_file_count);
ReadBE(s.pkg_table_entry_count);
@ -232,7 +239,18 @@ public:
{
printf("PS4 PKG header:\n");
printf("- PKG magic: 0x%X\n", pkgheader.magic);
printf("- PKG type: 0x%X\n", pkgheader.pkg_type);
printf("- PKG flags: 0x%X", pkgheader.pkg_flags);
if (pkgheader.pkg_flags & PKG_FLAGS_UNKNOWN)
printf(" unknown");
if (pkgheader.pkg_flags & PKG_FLAGS_VER_1)
printf(" ver_1");
if (pkgheader.pkg_flags & PKG_FLAGS_VER_2)
printf(" ver_2");
if (pkgheader.pkg_flags & PKG_FLAGS_INTERNAL)
printf(" internal");
if(pkgheader.pkg_flags & PKG_FLAGS_FINALIZED)
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);