pkgextract print outer pfs header
This commit is contained in:
parent
1323147b5b
commit
4703224071
|
@ -0,0 +1,18 @@
|
||||||
|
#include "PFS.h"
|
||||||
|
|
||||||
|
PFS::PFS()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PFS::~PFS()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PFS::pfsOuterReadHeader(U08* psfOuterStart)
|
||||||
|
{
|
||||||
|
psfOuterheader = (PFS_HDR&)psfOuterStart[0];
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
#pragma once
|
||||||
|
#include <string>
|
||||||
|
#include "Types.h"
|
||||||
|
#include <io.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
struct PFS_HDR {
|
||||||
|
U64 version;
|
||||||
|
U64 magic;
|
||||||
|
U64 id;
|
||||||
|
U08 fmode;
|
||||||
|
U08 clean;
|
||||||
|
U08 ronly;
|
||||||
|
U08 rsv;
|
||||||
|
U16 mode;
|
||||||
|
U16 unk1;
|
||||||
|
U32 blocksz;
|
||||||
|
U32 nbackup;
|
||||||
|
U64 nblock;
|
||||||
|
U64 ndinode;
|
||||||
|
U64 ndblock;
|
||||||
|
U64 ndinodeblock;
|
||||||
|
U64 superroot_ino;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PFS
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
PFS_HDR psfOuterheader;
|
||||||
|
public:
|
||||||
|
PFS();
|
||||||
|
~PFS();
|
||||||
|
bool pfsOuterReadHeader(U08* psfOuterStart);
|
||||||
|
|
||||||
|
void printPsfOuterHeader()
|
||||||
|
{
|
||||||
|
printf("PS4 PSF Outer Header:\n");
|
||||||
|
printf("- version: 0x%" PRIx64 "\n", psfOuterheader.version);
|
||||||
|
printf("- magic: 0x%" PRIx64 "\n", psfOuterheader.magic);
|
||||||
|
printf("- id: 0x%" PRIx64 "\n", psfOuterheader.id);
|
||||||
|
printf("- fmode: 0x%X\n", psfOuterheader.fmode);
|
||||||
|
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("- unk1: 0x%X\n", psfOuterheader.unk1);
|
||||||
|
printf("- blocksz: 0x%X\n", psfOuterheader.blocksz);
|
||||||
|
printf("- nbackup: 0x%X\n", psfOuterheader.nbackup);
|
||||||
|
printf("- nblock: 0x%" PRIx64 "\n", psfOuterheader.nblock);
|
||||||
|
printf("- ndinode: 0x%" PRIx64 "\n", psfOuterheader.ndinode);
|
||||||
|
printf("- ndblock: 0x%" PRIx64 "\n", psfOuterheader.ndblock);
|
||||||
|
printf("- ndinodeblock: 0x%" PRIx64 "\n", psfOuterheader.ndinodeblock);
|
||||||
|
printf("- superroot_ino: 0x%" PRIx64 "\n", psfOuterheader.superroot_ino);
|
||||||
|
|
||||||
|
printf("\n\n");
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,5 +1,6 @@
|
||||||
#include "PKG.h"
|
#include "PKG.h"
|
||||||
#include "FsFile.h"
|
#include "FsFile.h"
|
||||||
|
#include "PFS.h"
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
|
||||||
PKG::PKG()
|
PKG::PKG()
|
||||||
|
@ -101,11 +102,15 @@ bool PKG::extract(const std::string& filepath, const std::string& extractPath, s
|
||||||
out.Close();
|
out.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//PFS read
|
||||||
|
PFS pfs;
|
||||||
|
pfs.pfsOuterReadHeader(pkg + pkgheader.pfs_image_offset);
|
||||||
|
pfs.printPsfOuterHeader();
|
||||||
//extract pfs_image.dat
|
//extract pfs_image.dat
|
||||||
FsFile out;
|
/*FsFile out;
|
||||||
out.Open(extractPath + "pfs_image.dat", fsWrite);
|
out.Open(extractPath + "pfs_image.dat", fsWrite);
|
||||||
out.Write(pkg + pkgheader.pfs_image_offset, pkgheader.pfs_image_size);
|
out.Write(pkg + pkgheader.pfs_image_offset, pkgheader.pfs_image_size);
|
||||||
out.Close();
|
out.Close();*/
|
||||||
munmap(pkg);
|
munmap(pkg);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -243,7 +243,7 @@ public:
|
||||||
printf("- PKG body offset: 0x%" PRIx64 "\n", pkgheader.pkg_body_offset);
|
printf("- PKG body offset: 0x%" PRIx64 "\n", pkgheader.pkg_body_offset);
|
||||||
printf("- PKG body size: 0x%" PRIx64 "\n", pkgheader.pkg_body_size);
|
printf("- PKG body size: 0x%" PRIx64 "\n", pkgheader.pkg_body_size);
|
||||||
printf("- PKG content offset: 0x%" PRIx64 "\n", pkgheader.pkg_content_offset);
|
printf("- PKG content offset: 0x%" PRIx64 "\n", pkgheader.pkg_content_offset);
|
||||||
printf("- PKG conteít size: 0x%" PRIx64 "\n", pkgheader.pkg_content_offset);
|
printf("- PKG content size: 0x%" PRIx64 "\n", pkgheader.pkg_content_offset);
|
||||||
printf("- PKG pkg_content_id: %s\n", pkgheader.pkg_content_id);
|
printf("- PKG pkg_content_id: %s\n", pkgheader.pkg_content_id);
|
||||||
|
|
||||||
printf("- PKG drm type: 0x%X\n", pkgheader.pkg_drm_type);
|
printf("- PKG drm type: 0x%X\n", pkgheader.pkg_drm_type);
|
||||||
|
|
|
@ -128,11 +128,13 @@
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="FsFile.cpp" />
|
<ClCompile Include="FsFile.cpp" />
|
||||||
|
<ClCompile Include="PFS.cpp" />
|
||||||
<ClCompile Include="PKG.cpp" />
|
<ClCompile Include="PKG.cpp" />
|
||||||
<ClCompile Include="pkgextract.cpp" />
|
<ClCompile Include="pkgextract.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="FsFile.h" />
|
<ClInclude Include="FsFile.h" />
|
||||||
|
<ClInclude Include="PFS.h" />
|
||||||
<ClInclude Include="PKG.h" />
|
<ClInclude Include="PKG.h" />
|
||||||
<ClInclude Include="Types.h" />
|
<ClInclude Include="Types.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
<ClCompile Include="FsFile.cpp">
|
<ClCompile Include="FsFile.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="PFS.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="PKG.h">
|
<ClInclude Include="PKG.h">
|
||||||
|
@ -35,5 +38,8 @@
|
||||||
<ClInclude Include="Types.h">
|
<ClInclude Include="Types.h">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="PFS.h">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue