summaryrefslogtreecommitdiff
path: root/ZAPD/ZFile.cpp
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2021-06-11 12:50:29 -0400
committerGitHub <noreply@github.com>2021-06-11 12:50:29 -0400
commitc6b352aac040527d2962f3e764e460eb9e813fe5 (patch)
treebd47345f243f3a24f747d9ffc00cb550597964ab /ZAPD/ZFile.cpp
parentd9d3162abbe7bf1dfe8bdb0d6e3cad81f58db8a1 (diff)
strip extra padding at the end of each file (#150)
Diffstat (limited to 'ZAPD/ZFile.cpp')
-rw-r--r--ZAPD/ZFile.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/ZAPD/ZFile.cpp b/ZAPD/ZFile.cpp
index 9e5bb94..3e1559e 100644
--- a/ZAPD/ZFile.cpp
+++ b/ZAPD/ZFile.cpp
@@ -919,8 +919,14 @@ std::string ZFile::ProcessDeclarations()
std::string unaccountedPrefix = "unaccounted";
if (diff < 16 && !nonZeroUnaccounted)
+ {
unaccountedPrefix = "possiblePadding";
+ // Strip unnecessary padding at the end of the file.
+ if (unaccountedAddress + diff >= rawData.size())
+ break;
+ }
+
Declaration* decl = AddDeclarationArray(
unaccountedAddress, DeclarationAlignment::None, diff, "static u8",
StringHelper::Sprintf("%s_%06X", unaccountedPrefix.c_str(),