Galaxy: Fix downloading DLC files

Add product id from depot JSON to galaxyDepotItem struct

Previously downloader failed to download DLC files because DLCs have different product id than base game
Fix downloading DLC files by setting product id for each depot item
This commit is contained in:
Sude 2017-03-06 06:58:11 +02:00
parent f5af312fd4
commit 8cbc62b8cd
2 changed files with 13 additions and 3 deletions

View File

@ -26,7 +26,6 @@ struct galaxyDepotItemChunk
uintmax_t size_uncompressed;
uintmax_t offset_compressed;
uintmax_t offset_uncompressed;
};
struct galaxyDepotItem
@ -36,6 +35,7 @@ struct galaxyDepotItem
uintmax_t totalSizeCompressed;
uintmax_t totalSizeUncompressed;
std::string md5;
std::string product_id;
};
class galaxyAPI

View File

@ -3556,11 +3556,21 @@ void Downloader::galaxyInstallGame(const std::string& product_id, int build_inde
continue;
std::string depotHash = json["depots"][i]["manifest"].asString();
std::string depot_product_id = json["depots"][i]["productId"].asString();
if (depot_product_id.empty())
depot_product_id = product_id;
std::vector<galaxyDepotItem> vec = gogGalaxy->getDepotItemsVector(depotHash);
// Set product id for items
for (auto it = vec.begin(); it != vec.end(); ++it)
it->product_id = depot_product_id;
items.insert(std::end(items), std::begin(vec), std::end(vec));
}
off_t totalSize = 0;
uintmax_t totalSize = 0;
for (unsigned int i = 0; i < items.size(); ++i)
{
if (Globals::globalConfig.bVerbose)
@ -3716,7 +3726,7 @@ void Downloader::galaxyInstallGame(const std::string& product_id, int build_inde
chunk.memory = (char *) malloc(1);
chunk.size = 0;
json = gogGalaxy->getSecureLink(product_id, gogGalaxy->hashToGalaxyPath(items[i].chunks[j].md5_compressed));
json = gogGalaxy->getSecureLink(items[i].product_id, gogGalaxy->hashToGalaxyPath(items[i].chunks[j].md5_compressed));
// Prefer edgecast urls
bool bPreferEdgecast = true;