diff options
author | Benjamin Dobell <benjamin.dobell+github@glassechidna.com.au> | 2012-03-29 15:50:27 +0200 |
---|---|---|
committer | Benjamin Dobell <benjamin.dobell+github@glassechidna.com.au> | 2012-03-29 15:50:27 +0200 |
commit | 907c942fd12ff204a387f5cc0a7f3de079186100 (patch) | |
tree | 5dfad7a827b3ceff16f775a5d10f72207d0b8007 | |
parent | Replaced some extremely weird code that I came up with during the initial (diff) | |
download | Heimdall-907c942fd12ff204a387f5cc0a7f3de079186100.tar Heimdall-907c942fd12ff204a387f5cc0a7f3de079186100.tar.gz Heimdall-907c942fd12ff204a387f5cc0a7f3de079186100.tar.bz2 Heimdall-907c942fd12ff204a387f5cc0a7f3de079186100.tar.lz Heimdall-907c942fd12ff204a387f5cc0a7f3de079186100.tar.xz Heimdall-907c942fd12ff204a387f5cc0a7f3de079186100.tar.zst Heimdall-907c942fd12ff204a387f5cc0a7f3de079186100.zip |
Diffstat (limited to '')
-rw-r--r-- | heimdall/source/BridgeManager.cpp | 6 | ||||
-rw-r--r-- | heimdall/source/BridgeManager.h | 2 | ||||
-rw-r--r-- | heimdall/source/EndFileTransferPacket.h | 14 | ||||
-rw-r--r-- | heimdall/source/EndModemFileTransferPacket.h | 4 | ||||
-rw-r--r-- | heimdall/source/EndPhoneFileTransferPacket.h | 4 | ||||
-rw-r--r-- | heimdall/source/Interface.cpp | 9 | ||||
-rw-r--r-- | heimdall/source/main.cpp | 22 | ||||
-rw-r--r-- | libpit/Source/libpit.cpp | 8 | ||||
-rw-r--r-- | libpit/Source/libpit.h | 17 |
9 files changed, 37 insertions, 49 deletions
diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp index b58ffe9..439e41a 100644 --- a/heimdall/source/BridgeManager.cpp +++ b/heimdall/source/BridgeManager.cpp @@ -921,7 +921,7 @@ int BridgeManager::ReceivePitFile(unsigned char **pitBuffer) const return (fileSize); } -bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int partitionType, unsigned int fileIdentifier) const +bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int chipIdentifier, unsigned int fileIdentifier) const { if (destination != EndFileTransferPacket::kDestinationModem && destination != EndFileTransferPacket::kDestinationPhone) { @@ -1123,7 +1123,7 @@ bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int if (destination == EndFileTransferPacket::kDestinationPhone) { - EndPhoneFileTransferPacket *endPhoneFileTransferPacket = new EndPhoneFileTransferPacket(sequenceByteCount, 0, partitionType, + EndPhoneFileTransferPacket *endPhoneFileTransferPacket = new EndPhoneFileTransferPacket(sequenceByteCount, 0, chipIdentifier, fileIdentifier, isLastSequence); success = SendPacket(endPhoneFileTransferPacket, 3000); @@ -1138,7 +1138,7 @@ bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int } else // destination == EndFileTransferPacket::kDestinationModem { - EndModemFileTransferPacket *endModemFileTransferPacket = new EndModemFileTransferPacket(sequenceByteCount, 0, partitionType, isLastSequence); + EndModemFileTransferPacket *endModemFileTransferPacket = new EndModemFileTransferPacket(sequenceByteCount, 0, chipIdentifier, isLastSequence); success = SendPacket(endModemFileTransferPacket, 3000); delete endModemFileTransferPacket; diff --git a/heimdall/source/BridgeManager.h b/heimdall/source/BridgeManager.h index a1586c8..5dc7496 100644 --- a/heimdall/source/BridgeManager.h +++ b/heimdall/source/BridgeManager.h @@ -121,7 +121,7 @@ namespace Heimdall bool SendPitFile(FILE *file) const;
int ReceivePitFile(unsigned char **pitBuffer) const;
- bool SendFile(FILE *file, unsigned int destination, unsigned int partitionType, unsigned int fileIdentifier = 0xFFFFFFFF) const;
+ bool SendFile(FILE *file, unsigned int destination, unsigned int chipIdentifier, unsigned int fileIdentifier = 0xFFFFFFFF) const;
bool ReceiveDump(unsigned int chipType, unsigned int chipId, FILE *file) const;
bool IsVerbose(void) const
diff --git a/heimdall/source/EndFileTransferPacket.h b/heimdall/source/EndFileTransferPacket.h index 32eee60..23c2591 100644 --- a/heimdall/source/EndFileTransferPacket.h +++ b/heimdall/source/EndFileTransferPacket.h @@ -45,20 +45,20 @@ namespace Heimdall private:
- unsigned int destination; // Chip identifier perhaps
+ unsigned int destination; // PDA / Modem
unsigned int sequenceByteCount;
unsigned int unknown1;
- unsigned int partitionType;
+ unsigned int chipIdentifier;
protected:
- EndFileTransferPacket(unsigned int destination, unsigned int sequenceByteCount, unsigned int unknown1, unsigned int partitionType)
+ EndFileTransferPacket(unsigned int destination, unsigned int sequenceByteCount, unsigned int unknown1, unsigned int chipIdentifier)
: FileTransferPacket(FileTransferPacket::kRequestEnd)
{
this->destination = destination;
this->sequenceByteCount = sequenceByteCount;
this->unknown1 = unknown1;
- this->partitionType = partitionType;
+ this->chipIdentifier = chipIdentifier;
}
public:
@@ -78,9 +78,9 @@ namespace Heimdall return (unknown1);
}
- unsigned int GetPartitionType(void) const
+ unsigned int GetChipIdentifier(void) const
{
- return (partitionType);
+ return (chipIdentifier);
}
virtual void Pack(void)
@@ -90,7 +90,7 @@ namespace Heimdall PackInteger(FileTransferPacket::kDataSize, destination);
PackInteger(FileTransferPacket::kDataSize + 4, sequenceByteCount);
PackInteger(FileTransferPacket::kDataSize + 8, unknown1);
- PackInteger(FileTransferPacket::kDataSize + 12, partitionType);
+ PackInteger(FileTransferPacket::kDataSize + 12, chipIdentifier);
}
};
}
diff --git a/heimdall/source/EndModemFileTransferPacket.h b/heimdall/source/EndModemFileTransferPacket.h index e21ad20..39a2c25 100644 --- a/heimdall/source/EndModemFileTransferPacket.h +++ b/heimdall/source/EndModemFileTransferPacket.h @@ -34,8 +34,8 @@ namespace Heimdall public:
- EndModemFileTransferPacket(unsigned int sequenceByteCount, unsigned int unknown1, unsigned int partitionType, bool endOfFile)
- : EndFileTransferPacket(EndFileTransferPacket::kDestinationModem, sequenceByteCount, unknown1, partitionType)
+ EndModemFileTransferPacket(unsigned int sequenceByteCount, unsigned int unknown1, unsigned int chipIdentifier, bool endOfFile)
+ : EndFileTransferPacket(EndFileTransferPacket::kDestinationModem, sequenceByteCount, unknown1, chipIdentifier)
{
this->endOfFile = (endOfFile) ? 1 : 0;
}
diff --git a/heimdall/source/EndPhoneFileTransferPacket.h b/heimdall/source/EndPhoneFileTransferPacket.h index 606bcd0..711892d 100644 --- a/heimdall/source/EndPhoneFileTransferPacket.h +++ b/heimdall/source/EndPhoneFileTransferPacket.h @@ -57,9 +57,9 @@ namespace Heimdall public:
- EndPhoneFileTransferPacket(unsigned int sequenceByteCount, unsigned int unknown1, unsigned int partitionType,
+ EndPhoneFileTransferPacket(unsigned int sequenceByteCount, unsigned int unknown1, unsigned int chipIdentifier,
unsigned int fileIdentifier, bool endOfFile)
- : EndFileTransferPacket(EndFileTransferPacket::kDestinationPhone, sequenceByteCount, unknown1, partitionType)
+ : EndFileTransferPacket(EndFileTransferPacket::kDestinationPhone, sequenceByteCount, unknown1, chipIdentifier)
{
this->fileIdentifier = fileIdentifier;
this->endOfFile = (endOfFile) ? 1 : 0;
diff --git a/heimdall/source/Interface.cpp b/heimdall/source/Interface.cpp index 55aa392..28db003 100644 --- a/heimdall/source/Interface.cpp +++ b/heimdall/source/Interface.cpp @@ -444,14 +444,9 @@ void Interface::PrintPit(const PitData *pitData) Interface::Print("\n\n--- Entry #%d ---\n", i); Interface::Print("Unused: %s\n", (entry->GetUnused()) ? "Yes" : "No"); - const char *partitionTypeText = "Unknown"; + const char *chipIdentifierText = "Unknown"; - if (entry->GetPartitionType() == PitEntry::kPartitionTypeRfs) - partitionTypeText = "RFS"; - else if (entry->GetPartitionType() == PitEntry::kPartitionTypeExt4) - partitionTypeText = "EXT4"; - - Interface::Print("Partition Type: %d (%s)\n", entry->GetPartitionType(), partitionTypeText); + Interface::Print("Chip Identifier: %d (%s)\n", entry->GetChipIdentifier()); Interface::Print("Partition Identifier: %d\n", entry->GetPartitionIdentifier()); diff --git a/heimdall/source/main.cpp b/heimdall/source/main.cpp index bd4403b..b698e77 100644 --- a/heimdall/source/main.cpp +++ b/heimdall/source/main.cpp @@ -71,13 +71,13 @@ vector<const char *> knownPartitionNames[kKnownPartitionCount]; struct PartitionInfo { - unsigned int partitionType; + unsigned int chipIdentifier; string partitionName; FILE *file; - PartitionInfo(unsigned int partitionType, const char *partitionName, FILE *file) + PartitionInfo(unsigned int chipIdentifier, const char *partitionName, FILE *file) { - this->partitionType = partitionType; + this->chipIdentifier = chipIdentifier; this->partitionName = partitionName; this->file = file; } @@ -218,7 +218,7 @@ bool mapFilesToPartitions(const map<string, FILE *>& argumentFileMap, const PitD if (!pitEntry && knownPartition == kKnownPartitionPit) { - // NOTE: We're assuming a PIT file always has partitionType zero. + // NOTE: We're assuming a PIT file always has chipIdentifier zero. PartitionInfo partitionInfo(0, knownPartitionNames[kKnownPartitionPit][0], it->second); partitionInfoMap.insert(pair<unsigned int, PartitionInfo>(0xFFFFFFFF, partitionInfo)); @@ -232,7 +232,7 @@ bool mapFilesToPartitions(const map<string, FILE *>& argumentFileMap, const PitD return (false); } - PartitionInfo partitionInfo(pitEntry->GetPartitionType(), pitEntry->GetPartitionName(), it->second); + PartitionInfo partitionInfo(pitEntry->GetChipIdentifier(), pitEntry->GetPartitionName(), it->second); partitionInfoMap.insert(pair<unsigned int, PartitionInfo>(pitEntry->GetPartitionIdentifier(), partitionInfo)); } @@ -264,7 +264,7 @@ int downloadPitFile(BridgeManager *bridgeManager, unsigned char **pitBuffer) return (devicePitFileSize); } -bool flashFile(BridgeManager *bridgeManager, unsigned int partitionType, unsigned int partitionIndex, const char *partitionName, FILE *file) +bool flashFile(BridgeManager *bridgeManager, unsigned int chipIdentifier, unsigned int partitionIndex, const char *partitionName, FILE *file) { // PIT files need to be handled differently, try determine if the partition we're flashing to is a PIT partition. bool isPit = false; @@ -313,7 +313,7 @@ bool flashFile(BridgeManager *bridgeManager, unsigned int partitionType, unsigne //if (bridgeManager->SendFile(file, EndPhoneFileTransferPacket::kDestinationPhone, // <-- Kies method. WARNING: Doesn't work on Galaxy Tab! // EndPhoneFileTransferPacket::kFileModem)) - if (bridgeManager->SendFile(file, EndModemFileTransferPacket::kDestinationModem, partitionType)) // <-- Odin method + if (bridgeManager->SendFile(file, EndModemFileTransferPacket::kDestinationModem, chipIdentifier)) // <-- Odin method { Interface::Print("%s upload successful\n", partitionName); return (true); @@ -329,7 +329,7 @@ bool flashFile(BridgeManager *bridgeManager, unsigned int partitionType, unsigne // We're uploading to a phone partition Interface::Print("Uploading %s\n", partitionName); - if (bridgeManager->SendFile(file, EndPhoneFileTransferPacket::kDestinationPhone, partitionType, partitionIndex)) + if (bridgeManager->SendFile(file, EndPhoneFileTransferPacket::kDestinationPhone, chipIdentifier, partitionIndex)) { Interface::Print("%s upload successful\n", partitionName); return (true); @@ -474,7 +474,7 @@ bool attemptFlash(BridgeManager *bridgeManager, map<string, FILE *> argumentFile { PartitionInfo *partitionInfo = &(it->second); - if (!flashFile(bridgeManager, partitionInfo->partitionType, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file)) + if (!flashFile(bridgeManager, partitionInfo->chipIdentifier, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file)) return (false); break; @@ -489,7 +489,7 @@ bool attemptFlash(BridgeManager *bridgeManager, map<string, FILE *> argumentFile { PartitionInfo *partitionInfo = &(it->second); - if (!flashFile(bridgeManager, partitionInfo->partitionType, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file)) + if (!flashFile(bridgeManager, partitionInfo->chipIdentifier, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file)) return (false); } } @@ -501,7 +501,7 @@ bool attemptFlash(BridgeManager *bridgeManager, map<string, FILE *> argumentFile { PartitionInfo *partitionInfo = &(it->second); - if (!flashFile(bridgeManager, partitionInfo->partitionType, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file)) + if (!flashFile(bridgeManager, partitionInfo->chipIdentifier, it->first, partitionInfo->partitionName.c_str(), partitionInfo->file)) return (false); } } diff --git a/libpit/Source/libpit.cpp b/libpit/Source/libpit.cpp index 205ba38..3104f24 100644 --- a/libpit/Source/libpit.cpp +++ b/libpit/Source/libpit.cpp @@ -26,7 +26,7 @@ using namespace libpit; PitEntry::PitEntry() { unused = false; - partitionType = 0; + chipIdentifier = 0; partitionIdentifier = 0; partitionFlags = 0; unknown1 = 0; @@ -45,7 +45,7 @@ PitEntry::~PitEntry() bool PitEntry::Matches(const PitEntry *otherPitEntry) const { - if (unused == otherPitEntry->unused && partitionType == otherPitEntry->partitionType && partitionIdentifier == otherPitEntry->partitionIdentifier + if (unused == otherPitEntry->unused && chipIdentifier == otherPitEntry->chipIdentifier && partitionIdentifier == otherPitEntry->partitionIdentifier && partitionFlags == otherPitEntry->partitionFlags && unknown1 == otherPitEntry->unknown1 && partitionBlockSize == otherPitEntry->partitionBlockSize && partitionBlockCount == otherPitEntry->partitionBlockCount && unknown2 == otherPitEntry->unknown2 && unknown3 == otherPitEntry->unknown3 && strcmp(partitionName, otherPitEntry->partitionName) == 0 && strcmp(filename, otherPitEntry->filename) == 0) @@ -121,7 +121,7 @@ bool PitData::Unpack(const unsigned char *data) entries[i]->SetUnused((integerValue != 0) ? true : false); integerValue = PitData::UnpackInteger(data, entryOffset + 4); - entries[i]->SetPartitionType(integerValue); + entries[i]->SetChipIdentifier(integerValue); integerValue = PitData::UnpackInteger(data, entryOffset + 8); entries[i]->SetPartitionIdentifier(integerValue); @@ -177,7 +177,7 @@ void PitData::Pack(unsigned char *data) const PitData::PackInteger(data, entryOffset, (entries[i]->GetUnused()) ? 1 : 0); - PitData::PackInteger(data, entryOffset + 4, entries[i]->GetPartitionType()); + PitData::PackInteger(data, entryOffset + 4, entries[i]->GetChipIdentifier()); PitData::PackInteger(data, entryOffset + 8, entries[i]->GetPartitionIdentifier()); PitData::PackInteger(data, entryOffset + 12, entries[i]->GetPartitionFlags()); diff --git a/libpit/Source/libpit.h b/libpit/Source/libpit.h index 1231cf0..a7bf5c9 100644 --- a/libpit/Source/libpit.h +++ b/libpit/Source/libpit.h @@ -48,13 +48,6 @@ namespace libpit enum { - kPartitionTypeRfs = 0, - kPartitionTypeBlank = 1, // ? - kPartitionTypeExt4 = 2 - }; - - enum - { kPartitionFlagWrite = 1 << 1 }; @@ -62,7 +55,7 @@ namespace libpit bool unused; - unsigned int partitionType; + unsigned int chipIdentifier; unsigned int partitionIdentifier; unsigned int partitionFlags; @@ -94,14 +87,14 @@ namespace libpit this->unused = unused; } - unsigned int GetPartitionType(void) const + unsigned int GetChipIdentifier(void) const { - return partitionType; + return chipIdentifier; } - void SetPartitionType(unsigned int partitionType) + void SetChipIdentifier(unsigned int chipIdentifier) { - this->partitionType = partitionType; + this->chipIdentifier = chipIdentifier; } unsigned int GetPartitionIdentifier(void) const |