From 713af23d0a8a65926e03ad2e50406aae2463e6e1 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Thu, 29 Mar 2012 01:34:31 +1100 Subject: Replaced some extremely weird code that I came up with during the initial reverse engineering of the flashing protocol. Turns out all I needed to do was send the sequence size in bytes rather than performing weird calculations (which when packed) end up representing the same thing! --- heimdall/source/EndFileTransferPacket.h | 40 ++++++++------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) (limited to 'heimdall/source/EndFileTransferPacket.h') diff --git a/heimdall/source/EndFileTransferPacket.h b/heimdall/source/EndFileTransferPacket.h index 73353d5..32eee60 100644 --- a/heimdall/source/EndFileTransferPacket.h +++ b/heimdall/source/EndFileTransferPacket.h @@ -46,30 +46,17 @@ namespace Heimdall private: unsigned int destination; // Chip identifier perhaps - unsigned short partialPacketLength; // Length or (length - 65536) if lastFullPacket is odd. - unsigned int lastFullPacketIndex; - unsigned short unknown1; + unsigned int sequenceByteCount; + unsigned int unknown1; unsigned int partitionType; protected: - EndFileTransferPacket(unsigned int destination, unsigned int partialPacketLength, unsigned int lastFullPacketIndex, - unsigned short unknown1, unsigned int partitionType) + EndFileTransferPacket(unsigned int destination, unsigned int sequenceByteCount, unsigned int unknown1, unsigned int partitionType) : FileTransferPacket(FileTransferPacket::kRequestEnd) { this->destination = destination; - - if (partialPacketLength > 65535) - { - this->partialPacketLength = (partialPacketLength - 65536); - this->lastFullPacketIndex = lastFullPacketIndex + 1; - } - else - { - this->partialPacketLength = partialPacketLength; - this->lastFullPacketIndex = lastFullPacketIndex; - } - + this->sequenceByteCount = sequenceByteCount; this->unknown1 = unknown1; this->partitionType = partitionType; } @@ -81,20 +68,12 @@ namespace Heimdall return (destination); } - unsigned int GetPartialPacketLength(void) const - { - if (lastFullPacketIndex % 2 == 0) - return (partialPacketLength); - else - return (partialPacketLength + 65536); - } - - unsigned int GetLastFullPacketIndex(void) const + unsigned int GetSequenceByteCount(void) const { - return (lastFullPacketIndex - lastFullPacketIndex % 2); + return (sequenceByteCount); } - unsigned short GetUnknown1(void) const + unsigned int GetUnknown1(void) const { return (unknown1); } @@ -109,9 +88,8 @@ namespace Heimdall FileTransferPacket::Pack(); PackInteger(FileTransferPacket::kDataSize, destination); - PackShort(FileTransferPacket::kDataSize + 4, partialPacketLength); - PackInteger(FileTransferPacket::kDataSize + 6, lastFullPacketIndex); - PackShort(FileTransferPacket::kDataSize + 10, unknown1); + PackInteger(FileTransferPacket::kDataSize + 4, sequenceByteCount); + PackInteger(FileTransferPacket::kDataSize + 8, unknown1); PackInteger(FileTransferPacket::kDataSize + 12, partitionType); } }; -- cgit v1.2.3