diff options
author | Benjamin Dobell <benjamin.dobell@glassechidna.com.au> | 2011-07-20 18:43:49 +0200 |
---|---|---|
committer | Benjamin Dobell <benjamin.dobell@glassechidna.com.au> | 2011-07-20 18:43:49 +0200 |
commit | babef8e580c4b9d2daae1bd7b4092b59b5fa70be (patch) | |
tree | 87155afe8e797d1d0b6a24f12725c07c6d23995f /heimdall/source/main.cpp | |
parent | Documentation update. (diff) | |
download | Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar.gz Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar.bz2 Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar.lz Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar.xz Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.tar.zst Heimdall-babef8e580c4b9d2daae1bd7b4092b59b5fa70be.zip |
Diffstat (limited to '')
-rw-r--r-- | heimdall/source/main.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/heimdall/source/main.cpp b/heimdall/source/main.cpp index f5bf173..a3ae962 100644 --- a/heimdall/source/main.cpp +++ b/heimdall/source/main.cpp @@ -244,7 +244,7 @@ void closeFiles(map<string, FILE *> argumentfileMap) argumentfileMap.clear(); } -bool getDeviceInfo(BridgeManager *bridgeManager) +bool retrieveDeviceInfo(BridgeManager *bridgeManager) { // ---------- GET DEVICE INFORMATION ---------- @@ -271,6 +271,8 @@ bool getDeviceInfo(BridgeManager *bridgeManager) Interface::PrintError("Unexpected device info response!\nExpected: 180, 0 or 3\nReceived:%d\n", deviceInfoResult); return (false); } + + return (true); } int downloadPitFile(BridgeManager *bridgeManager, unsigned char **pitBuffer) @@ -643,10 +645,12 @@ int main(int argc, char **argv) Interface::PrintReleaseInfo(); Sleep(1000); - if (!bridgeManager->Initialise()) + int initialiseResult = bridgeManager->Initialise(); + + if (initialiseResult != 0) { delete bridgeManager; - return (0); + return ((initialiseResult == BridgeManager::kInitialiseDeviceNotDetected) ? 1 : 0); } bool success; @@ -666,7 +670,7 @@ int main(int argc, char **argv) return (0); } - if (!bridgeManager->BeginSession() || !getDeviceInfo(bridgeManager)) + if (!bridgeManager->BeginSession() || !retrieveDeviceInfo(bridgeManager)) { closeFiles(argumentFileMap); delete bridgeManager; @@ -686,7 +690,7 @@ int main(int argc, char **argv) case Interface::kActionClosePcScreen: { - if (!bridgeManager->BeginSession() || !getDeviceInfo(bridgeManager)) + if (!bridgeManager->BeginSession() || !retrieveDeviceInfo(bridgeManager)) { delete bridgeManager; return (-1); @@ -713,7 +717,7 @@ int main(int argc, char **argv) return (0); } - if (!bridgeManager->BeginSession() || !getDeviceInfo(bridgeManager)) + if (!bridgeManager->BeginSession() || !retrieveDeviceInfo(bridgeManager)) { delete bridgeManager; fclose(outputPitFile); @@ -764,7 +768,7 @@ int main(int argc, char **argv) int chipId = atoi(argumentMap.find(Interface::actions[Interface::kActionDump].valueArguments[Interface::kDumpValueArgChipId])->second.c_str()); - if (!bridgeManager->BeginSession() || !getDeviceInfo(bridgeManager)) + if (!bridgeManager->BeginSession() || !retrieveDeviceInfo(bridgeManager)) { fclose(dumpFile); @@ -783,7 +787,7 @@ int main(int argc, char **argv) case Interface::kActionPrintPit: { - if (!bridgeManager->BeginSession() || !getDeviceInfo(bridgeManager)) + if (!bridgeManager->BeginSession() || !retrieveDeviceInfo(bridgeManager)) { delete bridgeManager; return (-1); |