aboutsummaryrefslogtreecommitdiffstats
path: root/libpit
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2013-01-22 23:53:30 +1100
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2013-01-22 23:53:30 +1100
commit31b1b0b2b0c9312e597ad35e26729474c21b20b9 (patch)
tree7cf1870cd39bc8510d7cd1db60c5bdb55bcbcdbb /libpit
parente0e84b2f7a28bd188f104f51a845dc4ed8a9b7ea (diff)
downloadexternal_heimdall-31b1b0b2b0c9312e597ad35e26729474c21b20b9.zip
external_heimdall-31b1b0b2b0c9312e597ad35e26729474c21b20b9.tar.gz
external_heimdall-31b1b0b2b0c9312e597ad35e26729474c21b20b9.tar.bz2
- Changed interpretation of packet size reponses of 0 from meaning "don't
care" to "unsupported". - Changed block size in libpit to mean either block size or block offset.
Diffstat (limited to 'libpit')
-rw-r--r--libpit/Source/libpit.cpp8
-rw-r--r--libpit/Source/libpit.h25
2 files changed, 15 insertions, 18 deletions
diff --git a/libpit/Source/libpit.cpp b/libpit/Source/libpit.cpp
index 56903f9..a1138b5 100644
--- a/libpit/Source/libpit.cpp
+++ b/libpit/Source/libpit.cpp
@@ -30,7 +30,7 @@ PitEntry::PitEntry()
identifier = 0;
attributes = 0;
updateAttributes = 0;
- blockSize = 0;
+ blockSizeOrOffset = 0;
blockCount = 0;
fileOffset = 0;
fileSize = 0;
@@ -47,7 +47,7 @@ PitEntry::~PitEntry()
bool PitEntry::Matches(const PitEntry *otherPitEntry) const
{
if (binaryType == otherPitEntry->binaryType && deviceType == otherPitEntry->deviceType && identifier == otherPitEntry->identifier
- && attributes == otherPitEntry->attributes && updateAttributes == otherPitEntry->updateAttributes && blockSize == otherPitEntry->blockSize
+ && attributes == otherPitEntry->attributes && updateAttributes == otherPitEntry->updateAttributes && blockSizeOrOffset == otherPitEntry->blockSizeOrOffset
&& blockCount == otherPitEntry->blockCount && fileOffset == otherPitEntry->fileOffset && fileSize == otherPitEntry->fileSize
&& strcmp(partitionName, otherPitEntry->partitionName) == 0 && strcmp(flashFilename, otherPitEntry->flashFilename) == 0
&& strcmp(fotaFilename, otherPitEntry->fotaFilename) == 0)
@@ -135,7 +135,7 @@ bool PitData::Unpack(const unsigned char *data)
entries[i]->SetUpdateAttributes(integerValue);
integerValue = PitData::UnpackInteger(data, entryOffset + 20);
- entries[i]->SetBlockSize(integerValue);
+ entries[i]->SetBlockSizeOrOffset(integerValue);
integerValue = PitData::UnpackInteger(data, entryOffset + 24);
entries[i]->SetBlockCount(integerValue);
@@ -186,7 +186,7 @@ void PitData::Pack(unsigned char *data) const
PitData::PackInteger(data, entryOffset + 16, entries[i]->GetUpdateAttributes());
- PitData::PackInteger(data, entryOffset + 20, entries[i]->GetBlockSize());
+ PitData::PackInteger(data, entryOffset + 20, entries[i]->GetBlockSizeOrOffset());
PitData::PackInteger(data, entryOffset + 24, entries[i]->GetBlockCount());
PitData::PackInteger(data, entryOffset + 28, entries[i]->GetFileOffset());
diff --git a/libpit/Source/libpit.h b/libpit/Source/libpit.h
index 40c7da5..7d6f346 100644
--- a/libpit/Source/libpit.h
+++ b/libpit/Source/libpit.h
@@ -25,12 +25,8 @@
#pragma warning(disable : 4996)
#endif
-#ifndef nullptr
-#define nullptr 0
-#endif
-
-// C Standard Library
-#include <string.h>
+// C/C++ Standard Library
+#include <string>
#include <vector>
namespace libpit
@@ -81,7 +77,7 @@ namespace libpit
unsigned int attributes;
unsigned int updateAttributes;
- unsigned int blockSize;
+ unsigned int blockSizeOrOffset;
unsigned int blockCount;
unsigned int fileOffset; // Obsolete
@@ -147,15 +143,16 @@ namespace libpit
{
this->updateAttributes = updateAttributes;
}
-
- unsigned int GetBlockSize(void) const
+
+ // Different versions of Loke (secondary bootloaders) on different devices intepret this differently.
+ unsigned int GetBlockSizeOrOffset(void) const
{
- return blockSize;
+ return blockSizeOrOffset;
}
- void SetBlockSize(unsigned int blockSize)
+ void SetBlockSizeOrOffset(unsigned int blockSizeOrOffset)
{
- this->blockSize = blockSize;
+ this->blockSizeOrOffset = blockSizeOrOffset;
}
unsigned int GetBlockCount(void) const
@@ -253,8 +250,8 @@ namespace libpit
unsigned int unknown1; // 0x08
unsigned int unknown2; // 0x0C
- unsigned short unknown3; // 0x10 (7508 = I9000, 7703 = I9100 & P1000)?
- unsigned short unknown4; // 0x12 (Always 65, probably attributes of some sort)
+ unsigned short unknown3; // 0x10
+ unsigned short unknown4; // 0x12
unsigned short unknown5; // 0x14
unsigned short unknown6; // 0x16