aboutsummaryrefslogtreecommitdiffstats
path: root/libpit/Source/libpit.h
diff options
context:
space:
mode:
Diffstat (limited to 'libpit/Source/libpit.h')
-rw-r--r--libpit/Source/libpit.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/libpit/Source/libpit.h b/libpit/Source/libpit.h
index 9e6c452..c7bfe8b 100644
--- a/libpit/Source/libpit.h
+++ b/libpit/Source/libpit.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2012 Benjamin Dobell, Glass Echidna
+/* Copyright (c) 2010-2013 Benjamin Dobell, Glass Echidna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -103,6 +103,11 @@ namespace libpit
bool Matches(const PitEntry *otherPitEntry) const;
+ bool IsFlashable(void) const
+ {
+ return strlen(partitionName) != 0;
+ }
+
unsigned int GetBinaryType(void) const
{
return binaryType;
@@ -250,7 +255,8 @@ namespace libpit
enum
{
kFileIdentifier = 0x12349876,
- kHeaderDataSize = 28
+ kHeaderDataSize = 28,
+ kPaddedSizeMultiplicand = 4096
};
private:
@@ -349,6 +355,22 @@ namespace libpit
return entryCount;
}
+ unsigned int GetDataSize(void) const
+ {
+ return PitData::kHeaderDataSize + entryCount * PitEntry::kDataSize;
+ }
+
+ unsigned int GetPaddedSize(void) const
+ {
+ unsigned int dataSize = GetDataSize();
+ unsigned int paddedSize = (dataSize / kPaddedSizeMultiplicand) * kPaddedSizeMultiplicand;
+
+ if (dataSize % kPaddedSizeMultiplicand != 0)
+ paddedSize += kPaddedSizeMultiplicand;
+
+ return paddedSize;
+ }
+
unsigned int GetUnknown1(void) const
{
return unknown1;