void AvatarAssetDownloader::onRequestFinished(QNetworkReply *aReply) { if (aReply->error() != QNetworkReply::NoError) { qDebug() << "error: " << aReply->errorString(); return; } // verify that the file was downloaded DWORD fileSize = aReply->bytesAvailable(); // all assets have a Ytgr header that's 0x140 bytes if (fileSize < 0x140) { if (!v2Done) { v1Done = true; v2Done = true; v1TempPath = ""; manager->get(QNetworkRequest(QUrl("http://download.xboxlive.com/content/" + titleID + "/avataritems/v2/" + guid + ".bin"))); } else v2TempPath = ""; return; } // read the crap away, we don't need it BYTE temp[0x140]; aReply->read((char*)temp, 0x140); QString tempPath = QDir::tempPath() + "/" + QUuid::createUuid().toString().replace("{", "").replace("}", "").replace("-", ""); if (!v1Done) v1TempPath = tempPath; else v2TempPath = tempPath; // create a new temporary file QFile v1File(tempPath); v1File.open(QFile::Truncate | QFile::WriteOnly); // Write the STRB file to the local disk v1File.write(aReply->readAll()); // clean up v1File.flush(); v1File.close(); v1Done = true; // download the v2 file if (!v2Done) { v2Done = true; manager->get(QNetworkRequest(QUrl("http://download.xboxlive.com/content/" + titleID + "/avataritems/v2/" + guid + ".bin"))); } else emit FinishedDownloading(); }
void GPDDownloader::onDone(bool error) { emit FinishedDownloading(gameGPD, awardGPD, entry, error); }