From 65b6d97fa26c0a7b0158a90824f63099916cee0e Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Sun, 10 Jul 2016 09:41:11 -0400 Subject: [PATCH] If an included depot doesn't have the requested branch, fall back to "public". (Mirrors Steam behavior) --- DepotDownloader/ContentDownloader.cs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index b69bc926..2265a758 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -256,7 +256,6 @@ namespace DepotDownloader return BitConverter.ToUInt64(manifest_bytes, 0); } - Console.WriteLine("Invalid branch {0} for appId {1}", branch, appId); return INVALID_MANIFEST_ID; } @@ -425,22 +424,29 @@ namespace DepotDownloader return null; } - uint uVersion = GetSteam3AppBuildNumber(appId, branch); + if (steam3 != null) + steam3.RequestAppTicket((uint)depotId); - string installDir; - if (!CreateDirectories(depotId, uVersion, out installDir)) + ulong manifestID = GetSteam3DepotManifest(depotId, appId, branch); + if (manifestID == INVALID_MANIFEST_ID && branch != "public") + { + Console.WriteLine("Warning: Depot {0} does not have branch named \"{1}\". Trying public branch.", depotId, branch); + branch = "public"; + manifestID = GetSteam3DepotManifest(depotId, appId, branch); + } + + if (manifestID == INVALID_MANIFEST_ID) { - Console.WriteLine("Error: Unable to create install directories!"); + Console.WriteLine("Depot {0} ({1}) missing public subsection or manifest section.", depotId, contentName); return null; } - if(steam3 != null) - steam3.RequestAppTicket((uint)depotId); + uint uVersion = GetSteam3AppBuildNumber(appId, branch); - ulong manifestID = GetSteam3DepotManifest(depotId, appId, branch); - if (manifestID == INVALID_MANIFEST_ID) + string installDir; + if (!CreateDirectories(depotId, uVersion, out installDir)) { - Console.WriteLine("Depot {0} ({1}) missing public subsection or manifest section.", depotId, contentName); + Console.WriteLine("Error: Unable to create install directories!"); return null; }