diff --git a/DepotDownloader/DepotDownloader.csproj b/DepotDownloader/DepotDownloader.csproj index 4a7508b3..896a0dbf 100644 --- a/DepotDownloader/DepotDownloader.csproj +++ b/DepotDownloader/DepotDownloader.csproj @@ -4,10 +4,10 @@ net9.0 true LatestMajor - 2.7.3 + 3.0.0 Steam Downloading Utility SteamRE Team - Copyright © SteamRE Team 2024 + Copyright © SteamRE Team 2025 ..\Icon\DepotDownloader.ico true true @@ -27,6 +27,6 @@ - + diff --git a/DepotDownloader/Program.cs b/DepotDownloader/Program.cs index 42b18ab4..35b9c825 100644 --- a/DepotDownloader/Program.cs +++ b/DepotDownloader/Program.cs @@ -11,6 +11,7 @@ using System.Runtime.InteropServices; using System.Text.RegularExpressions; using System.Threading.Tasks; using SteamKit2; +using SteamKit2.CDN; namespace DepotDownloader { @@ -64,6 +65,21 @@ namespace DepotDownloader ContentDownloader.Config.RememberPassword = HasParameter(args, "-remember-password"); ContentDownloader.Config.UseQrCode = HasParameter(args, "-qr"); + if (username == null) + { + if (ContentDownloader.Config.RememberPassword) + { + Console.WriteLine("Error: -remember-password can not be used without -username."); + return 1; + } + + if (ContentDownloader.Config.UseQrCode) + { + Console.WriteLine("Error: -qr can not be used without -username."); + return 1; + } + } + ContentDownloader.Config.DownloadManifestOnly = HasParameter(args, "-manifest-only"); var cellId = GetParameter(args, "-cellid", -1); @@ -118,6 +134,23 @@ namespace DepotDownloader ContentDownloader.Config.VerifyAll = HasParameter(args, "-verify-all") || HasParameter(args, "-verify_all") || HasParameter(args, "-validate"); ContentDownloader.Config.MaxServers = GetParameter(args, "-max-servers", 20); + + if (HasParameter(args, "-use-lancache")) + { + await Client.DetectLancacheServerAsync(); + if (Client.UseLancacheServer) + { + Console.WriteLine("Detected Lancache server! Downloads will be directed through the Lancache."); + + // Increasing the number of concurrent downloads when the cache is detected since the downloads will likely + // be served much faster than over the internet. Steam internally has this behavior as well. + if (!HasParameter(args, "-max-downloads")) + { + ContentDownloader.Config.MaxDownloads = 25; + } + } + } + ContentDownloader.Config.MaxDownloads = GetParameter(args, "-max-downloads", 8); ContentDownloader.Config.MaxServers = Math.Max(ContentDownloader.Config.MaxServers, ContentDownloader.Config.MaxDownloads); ContentDownloader.Config.LoginID = HasParameter(args, "-loginid") ? GetParameter(args, "-loginid") : null; @@ -228,7 +261,7 @@ namespace DepotDownloader #region App downloading var branch = GetParameter(args, "-branch") ?? GetParameter(args, "-beta") ?? ContentDownloader.DEFAULT_BRANCH; - ContentDownloader.Config.BetaPassword = GetParameter(args, "-betapassword"); + ContentDownloader.Config.BetaPassword = GetParameter(args, "-branchpassword") ?? GetParameter(args, "-betapassword"); ContentDownloader.Config.DownloadAllPlatforms = HasParameter(args, "-all-platforms"); @@ -494,8 +527,8 @@ namespace DepotDownloader Console.WriteLine(" -app <# or \"# # ...\"> - the AppID(s) to download. Provide multiple IDs separated by spaces."); Console.WriteLine(" -depot <# or \"# # ...\"> - the DepotID(s) to download. Must correspond to the provided AppIDs."); Console.WriteLine(" -manifest <# or \"# # ...\"> - manifest ID(s) of content to download (requires -depot). Must correspond to the provided DepotIDs."); - Console.WriteLine($" -beta - download from specified branch if available (default: {ContentDownloader.DEFAULT_BRANCH})."); - Console.WriteLine(" -betapassword - branch password if applicable."); + Console.WriteLine($" -branch - download from specified branch if available (default: {ContentDownloader.DEFAULT_BRANCH})."); + Console.WriteLine(" -branchpassword - branch password if applicable."); Console.WriteLine(" -all-platforms - downloads all platform-specific depots when -app is used."); Console.WriteLine(" -all-archs - download all architecture-specific depots when -app is used."); Console.WriteLine(" -os - the operating system for which to download the game (windows, macos, or linux)."); @@ -519,13 +552,13 @@ namespace DepotDownloader Console.WriteLine(" Prefix file path with `regex:` if you want to match with regex."); Console.WriteLine(" Each file path should be on its own line."); Console.WriteLine(); - Console.WriteLine(" -validate - include checksum verification of files already downloaded."); - Console.WriteLine(" -manifest-only - downloads a human-readable manifest for any depots that would be downloaded."); - Console.WriteLine(" -cellid <#> - the overridden CellID of the content server to download from."); - Console.WriteLine(" -max-servers <#> - maximum number of content servers to use (default: 20)."); - Console.WriteLine(" -max-downloads <#> - maximum number of chunks to download concurrently (default: 8)."); - Console.WriteLine(" -loginid <#> - a unique 32-bit integer Steam LogonID in decimal, required if running"); - Console.WriteLine(" multiple instances of DepotDownloader concurrently."); + Console.WriteLine(" -validate - include checksum verification of files already downloaded"); + Console.WriteLine(" -manifest-only - downloads a human readable manifest for any depots that would be downloaded."); + Console.WriteLine(" -cellid <#> - the overridden CellID of the content server to download from."); + Console.WriteLine(" -max-servers <#> - maximum number of content servers to use. (default: 20)."); + Console.WriteLine(" -max-downloads <#> - maximum number of chunks to download concurrently. (default: 8)."); + Console.WriteLine(" -loginid <#> - a unique 32-bit integer Steam LogonID in decimal, required if running multiple instances of DepotDownloader concurrently."); + Console.WriteLine(" -use-lancache - forces downloads over the local network via a Lancache instance."); } static void PrintVersion(bool printExtra = false) diff --git a/README.md b/README.md index 12f45512..2856e2ca 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,8 @@ Parameter | Description `-depot <#>` | the DepotID to download. `-manifest ` | manifest id of content to download (requires `-depot`, default: current for branch). `-ugc <#>` | the UGC ID to download. -`-beta ` | download from specified branch if available (default: Public). -`-betapassword ` | branch password if applicable. +`-branch ` | download from specified branch if available (default: Public). +`-branchpassword ` | branch password if applicable. `-all-platforms` | downloads all platform-specific depots when `-app` is used. `-os ` | the operating system for which to download the game (windows, macos or linux, default: OS the program is currently running on) `-osarch ` | the architecture for which to download the game (32 or 64, default: the host's architecture) @@ -88,6 +88,7 @@ Parameter | Description `-max-servers <#>` | maximum number of content servers to use. (default: 20). `-max-downloads <#>` | maximum number of chunks to download concurrently. (default: 8). `-loginid <#>` | a unique 32-bit integer Steam LogonID in decimal, required if running multiple instances of DepotDownloader concurrently. +`-use-lancache` | forces downloads over the local network via a Lancache instance `-V` or `--version` | print version and runtime ## Frequently Asked Questions @@ -100,3 +101,8 @@ Any connection to Steam will be closed if they share a LoginID. You can specify ### Why doesn't my password containing special characters work? Do I have to specify the password on the command line? If you pass the `-password` parameter with a password that contains special characters, you will need to escape the command appropriately for the shell you are using. You do not have to include the `-password` parameter on the command line as long as you include a `-username`. You will be prompted to enter your password interactively. + +### I am getting error 401 or no manifest code returned for old manifest ids +Try logging in with a Steam account, this may happen when using anonymous account. + +Steam allows developers to block downloading old manifests, in which case no manifest code is returned even when parameters appear correct.