From 7c024c290b7d9b7fc7a3d42a605c517e6273823a Mon Sep 17 00:00:00 2001 From: jakcron Date: Tue, 22 May 2018 19:36:39 +0800 Subject: [PATCH] [nstool] Removed relative offsets in Pfs/Romfs Process because it isn't guarenteed to be reliable. --- programs/nstool/source/PfsProcess.cpp | 6 ++---- programs/nstool/source/PfsProcess.h | 2 -- programs/nstool/source/RomfsProcess.cpp | 4 +--- programs/nstool/source/RomfsProcess.h | 2 -- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/programs/nstool/source/PfsProcess.cpp b/programs/nstool/source/PfsProcess.cpp index ae2d3e4..b108c2c 100644 --- a/programs/nstool/source/PfsProcess.cpp +++ b/programs/nstool/source/PfsProcess.cpp @@ -20,9 +20,9 @@ void PfsProcess::displayFs() if (mCliOutputType >= OUTPUT_VERBOSE) { if (mPfs.getFsType() == mPfs.TYPE_PFS0) - printf(" (offset=0x%" PRIx64 ", size=0x%" PRIx64 ")\n", mBaseOffset + mPfs.getFileList()[i].offset, mPfs.getFileList()[i].size); + printf(" (offset=0x%" PRIx64 ", size=0x%" PRIx64 ")\n", mPfs.getFileList()[i].offset, mPfs.getFileList()[i].size); else - 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); + 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); } else { @@ -105,7 +105,6 @@ PfsProcess::PfsProcess() : mReader(nullptr), mCliOutputType(OUTPUT_NORMAL), mVerify(false), - mBaseOffset(0), mExtractPath(), mExtract(false), mMountName(), @@ -158,7 +157,6 @@ void PfsProcess::process() void PfsProcess::setInputFile(fnd::IFile* file, size_t offset, size_t size) { mReader = new OffsetAdjustedIFile(file, offset, size); - mBaseOffset = offset; } void PfsProcess::setCliOutputMode(CliOutputType type) diff --git a/programs/nstool/source/PfsProcess.h b/programs/nstool/source/PfsProcess.h index 9439eae..18ad507 100644 --- a/programs/nstool/source/PfsProcess.h +++ b/programs/nstool/source/PfsProcess.h @@ -34,8 +34,6 @@ private: CliOutputType mCliOutputType; bool mVerify; - size_t mBaseOffset; - std::string mExtractPath; bool mExtract; std::string mMountName; diff --git a/programs/nstool/source/RomfsProcess.cpp b/programs/nstool/source/RomfsProcess.cpp index c11e46c..1a0f8a3 100644 --- a/programs/nstool/source/RomfsProcess.cpp +++ b/programs/nstool/source/RomfsProcess.cpp @@ -18,7 +18,7 @@ void RomfsProcess::displayFile(const sFile& file, size_t tab) const printf("%s", file.name.c_str()); if (mCliOutputType >= OUTPUT_VERBOSE) { - printf(" (offset=0x%" PRIx64 ", size=0x%" PRIx64 ")", mBaseOffset + file.offset, file.size); + printf(" (offset=0x%" PRIx64 ", size=0x%" PRIx64 ")", file.offset, file.size); } putchar('\n'); } @@ -226,7 +226,6 @@ RomfsProcess::RomfsProcess() : mReader(nullptr), mCliOutputType(OUTPUT_NORMAL), mVerify(false), - mBaseOffset(0), mExtractPath(), mExtract(false), mMountName(), @@ -267,7 +266,6 @@ void RomfsProcess::process() void RomfsProcess::setInputFile(fnd::IFile* file, size_t offset, size_t size) { mReader = new OffsetAdjustedIFile(file, offset, size); - mBaseOffset = offset; } void RomfsProcess::setCliOutputMode(CliOutputType type) diff --git a/programs/nstool/source/RomfsProcess.h b/programs/nstool/source/RomfsProcess.h index 2719308..5c2a2e0 100644 --- a/programs/nstool/source/RomfsProcess.h +++ b/programs/nstool/source/RomfsProcess.h @@ -112,8 +112,6 @@ private: CliOutputType mCliOutputType; bool mVerify; - size_t mBaseOffset; - std::string mExtractPath; bool mExtract; std::string mMountName;