Skip to content

Commit

Permalink
Use depotfromapp for getting manifest codes
Browse files Browse the repository at this point in the history
Partially reverts 3143362

Fixes #569
Fixes #570
  • Loading branch information
xPaw committed Nov 27, 2024
1 parent 682bfba commit 5fe8a82
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
25 changes: 21 additions & 4 deletions DepotDownloader/ContentDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,20 @@ static uint GetSteam3AppBuildNumber(uint appId, string branch)
return uint.Parse(buildid.Value);
}

static uint GetSteam3DepotProxyAppId(uint depotId, uint appId)
{
var depots = GetSteam3AppSection(appId, EAppInfoSection.Depots);
var depotChild = depots[depotId.ToString()];

if (depotChild == KeyValue.Invalid)
return INVALID_APP_ID;

if (depotChild["depotfromapp"] == KeyValue.Invalid)
return INVALID_APP_ID;

return depotChild["depotfromapp"].AsUnsignedInteger();
}

static async Task<ulong> GetSteam3DepotManifest(uint depotId, uint appId, string branch)
{
var depots = GetSteam3AppSection(appId, EAppInfoSection.Depots);
Expand Down Expand Up @@ -595,7 +609,12 @@ static async Task<DepotDownloadInfo> GetDepotInfo(uint depotId, uint appId, ulon
return null;
}

return new DepotDownloadInfo(depotId, appId, manifestId, branch, installDir, depotKey);
// For depots that are proxied through depotfromapp, we still need to resolve the proxy app id
var containingAppId = appId;
var proxyAppId = GetSteam3DepotProxyAppId(depotId, appId);
if (proxyAppId != INVALID_APP_ID) containingAppId = proxyAppId;

return new DepotDownloadInfo(depotId, containingAppId, manifestId, branch, installDir, depotKey);
}

private class ChunkMatch(DepotManifest.ChunkData oldChunk, DepotManifest.ChunkData newChunk)
Expand Down Expand Up @@ -727,7 +746,7 @@ private static async Task<DepotFilesData> ProcessDepotManifestAndFiles(Cancellat
}
else
{
Console.Write("Downloading depot manifest... ");
Console.WriteLine($"Downloading depot {depot.DepotId} manifest");

ulong manifestRequestCode = 0;
var manifestRequestCodeExpiration = DateTime.MinValue;
Expand Down Expand Up @@ -766,7 +785,6 @@ private static async Task<DepotFilesData> ProcessDepotManifestAndFiles(Cancellat
// If we could not get the manifest code, this is a fatal error
if (manifestRequestCode == 0)
{
Console.WriteLine("No manifest request code was returned for {0} {1}", depot.DepotId, depot.ManifestId);
cts.Cancel();
}
}
Expand Down Expand Up @@ -840,7 +858,6 @@ private static async Task<DepotFilesData> ProcessDepotManifestAndFiles(Cancellat
cts.Token.ThrowIfCancellationRequested();

Util.SaveManifestToFile(configDir, newManifest);
Console.WriteLine(" Done!");
}
}

Expand Down
11 changes: 8 additions & 3 deletions DepotDownloader/Steam3Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,14 @@ public async Task<ulong> GetDepotManifestRequestCodeAsync(uint depotId, uint app

var requestCode = await steamContent.GetManifestRequestCode(depotId, appId, manifestId, branch);

Console.WriteLine("Got manifest request code for {0} {1} result: {2}",
depotId, manifestId,
requestCode);
if (requestCode == 0)
{
Console.WriteLine($"No manifest request code was returned for depot {depotId} from app {appId}, manifest {manifestId}");
}
else
{
Console.WriteLine($"Got manifest request code for depot {depotId} from app {appId}, manifest {manifestId}, result: {requestCode}");
}

return requestCode;
}
Expand Down

0 comments on commit 5fe8a82

Please sign in to comment.