mirror of
https://github.com/jakcron/nstool
synced 2024-11-15 02:06:40 +00:00
[nstool] Show pfs and romfs file offsets from the base offsets.
This commit is contained in:
parent
c1fc536c66
commit
1a5f045e0a
4 changed files with 10 additions and 3 deletions
|
@ -20,9 +20,9 @@ void PfsProcess::displayFs()
|
||||||
if (mCliOutputType >= OUTPUT_VERBOSE)
|
if (mCliOutputType >= OUTPUT_VERBOSE)
|
||||||
{
|
{
|
||||||
if (mPfs.getFsType() == mPfs.TYPE_PFS0)
|
if (mPfs.getFsType() == mPfs.TYPE_PFS0)
|
||||||
printf(" (offset=0x%" PRIx64 ", size=0x%" PRIx64 ")\n", mPfs.getFileList()[i].offset, mPfs.getFileList()[i].size);
|
printf(" (offset=0x%" PRIx64 ", size=0x%" PRIx64 ")\n", mBaseOffset + mPfs.getFileList()[i].offset, mPfs.getFileList()[i].size);
|
||||||
else
|
else
|
||||||
printf(" (offset=0x%" PRIx64 ", size=0x%" PRIx64 ", hash_protected_size=0x%" PRIx64 ")\n", mPfs.getFileList()[i].offset, mPfs.getFileList()[i].size, mPfs.getFileList()[i].hash_protected_size);
|
printf(" (offset=0x%" PRIx64 ", size=0x%" PRIx64 ", hash_protected_size=0x%" PRIx64 ")\n", mBaseOffset + mPfs.getFileList()[i].offset, mPfs.getFileList()[i].size, mPfs.getFileList()[i].hash_protected_size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -105,6 +105,7 @@ PfsProcess::PfsProcess() :
|
||||||
mReader(nullptr),
|
mReader(nullptr),
|
||||||
mCliOutputType(OUTPUT_NORMAL),
|
mCliOutputType(OUTPUT_NORMAL),
|
||||||
mVerify(false),
|
mVerify(false),
|
||||||
|
mBaseOffset(0),
|
||||||
mExtractPath(),
|
mExtractPath(),
|
||||||
mExtract(false),
|
mExtract(false),
|
||||||
mMountName(),
|
mMountName(),
|
||||||
|
@ -157,6 +158,7 @@ void PfsProcess::process()
|
||||||
void PfsProcess::setInputFile(fnd::IFile* file, size_t offset, size_t size)
|
void PfsProcess::setInputFile(fnd::IFile* file, size_t offset, size_t size)
|
||||||
{
|
{
|
||||||
mReader = new OffsetAdjustedIFile(file, offset, size);
|
mReader = new OffsetAdjustedIFile(file, offset, size);
|
||||||
|
mBaseOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PfsProcess::setCliOutputMode(CliOutputType type)
|
void PfsProcess::setCliOutputMode(CliOutputType type)
|
||||||
|
|
|
@ -34,6 +34,7 @@ private:
|
||||||
CliOutputType mCliOutputType;
|
CliOutputType mCliOutputType;
|
||||||
bool mVerify;
|
bool mVerify;
|
||||||
|
|
||||||
|
size_t mBaseOffset;
|
||||||
|
|
||||||
std::string mExtractPath;
|
std::string mExtractPath;
|
||||||
bool mExtract;
|
bool mExtract;
|
||||||
|
|
|
@ -18,7 +18,7 @@ void RomfsProcess::displayFile(const sFile& file, size_t tab) const
|
||||||
printf("%s", file.name.c_str());
|
printf("%s", file.name.c_str());
|
||||||
if (mCliOutputType >= OUTPUT_VERBOSE)
|
if (mCliOutputType >= OUTPUT_VERBOSE)
|
||||||
{
|
{
|
||||||
printf(" (offset=0x%" PRIx64 ", size=0x%" PRIx64 ")", file.offset, file.size);
|
printf(" (offset=0x%" PRIx64 ", size=0x%" PRIx64 ")", mBaseOffset + file.offset, file.size);
|
||||||
}
|
}
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
|
@ -226,6 +226,7 @@ RomfsProcess::RomfsProcess() :
|
||||||
mReader(nullptr),
|
mReader(nullptr),
|
||||||
mCliOutputType(OUTPUT_NORMAL),
|
mCliOutputType(OUTPUT_NORMAL),
|
||||||
mVerify(false),
|
mVerify(false),
|
||||||
|
mBaseOffset(0),
|
||||||
mExtractPath(),
|
mExtractPath(),
|
||||||
mExtract(false),
|
mExtract(false),
|
||||||
mMountName(),
|
mMountName(),
|
||||||
|
@ -266,6 +267,7 @@ void RomfsProcess::process()
|
||||||
void RomfsProcess::setInputFile(fnd::IFile* file, size_t offset, size_t size)
|
void RomfsProcess::setInputFile(fnd::IFile* file, size_t offset, size_t size)
|
||||||
{
|
{
|
||||||
mReader = new OffsetAdjustedIFile(file, offset, size);
|
mReader = new OffsetAdjustedIFile(file, offset, size);
|
||||||
|
mBaseOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RomfsProcess::setCliOutputMode(CliOutputType type)
|
void RomfsProcess::setCliOutputMode(CliOutputType type)
|
||||||
|
|
|
@ -112,6 +112,8 @@ private:
|
||||||
CliOutputType mCliOutputType;
|
CliOutputType mCliOutputType;
|
||||||
bool mVerify;
|
bool mVerify;
|
||||||
|
|
||||||
|
size_t mBaseOffset;
|
||||||
|
|
||||||
std::string mExtractPath;
|
std::string mExtractPath;
|
||||||
bool mExtract;
|
bool mExtract;
|
||||||
std::string mMountName;
|
std::string mMountName;
|
||||||
|
|
Loading…
Reference in a new issue