Skip to content

Commit

Permalink
Adding ability to manually override the cellid used for logging into …
Browse files Browse the repository at this point in the history
…Steam
  • Loading branch information
tpill90 committed Oct 4, 2024
1 parent b29f378 commit 7310e3e
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 35 deletions.
15 changes: 13 additions & 2 deletions SteamPrefill/Handlers/Steam/Steam3Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@ public sealed class Steam3Session : IDisposable
/// </summary>
private uint CellId
{
get => File.Exists(AppConfig.CachedCellIdPath) ? uint.Parse(File.ReadAllText(AppConfig.CachedCellIdPath)) : 0;
get
{
if (AppConfig.CellIdOverride != null)
{
return AppConfig.CellIdOverride.Value;
}
if (File.Exists(AppConfig.CachedCellIdPath))
{
return uint.Parse(File.ReadAllText(AppConfig.CachedCellIdPath));
}
return 0;
}
set => File.WriteAllText(AppConfig.CachedCellIdPath, value.ToString());
}

Expand Down Expand Up @@ -178,7 +189,7 @@ private async Task ConfigureLoginDetailsAsync()
/// <exception cref="SteamConnectionException">Throws if unable to connect to Steam</exception>
private void ConnectToSteam()
{
_ansiConsole.LogMarkupVerbose($"Connecting with CellId: {LightYellow(CellId)}");
_ansiConsole.LogMarkupVerbose($"Connecting with CellId: {Magenta(CellId)}");
var timeoutAfter = DateTime.Now.AddSeconds(30);

// Busy waiting until the client has a successful connection established
Expand Down
13 changes: 12 additions & 1 deletion SteamPrefill/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static async Task<int> Main()
/// </summary>
private static List<string> ParseHiddenFlags()
{
// Have to skip the first argument, since its the path to the executable
// Have to skip the first argument, since it is the path to the executable
var args = Environment.GetCommandLineArgs().Skip(1).ToList();

// Enables SteamKit2 debugging as well as SteamPrefill verbose logs
Expand Down Expand Up @@ -90,6 +90,17 @@ private static List<string> ParseHiddenFlags()
args.Remove("--no-cache");
}

if (args.Any(e => e.Contains("--cellid")))
{
var flagIndex = args.IndexOf("--cellid");
var id = args[flagIndex + 1];
AppConfig.CellIdOverride = uint.Parse(id);

AnsiConsole.Console.LogMarkupLine($"Using {LightYellow("--cellid")} flag. Will force the usage of cell id {Magenta(id)}");
args.Remove("--cellid");
args.Remove(id);
}

// Adding some formatting to logging to make it more readable + clear that these flags are enabled
if (AppConfig.DebugLogs || AppConfig.SkipDownloads || AppConfig.NoLocalCache)
{
Expand Down
2 changes: 2 additions & 0 deletions SteamPrefill/Settings/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public static bool DebugLogs
}
}

public static uint? CellIdOverride { get; set; }

#endregion
}
}
67 changes: 35 additions & 32 deletions docs/mkdocs/steam-docs/CDN-Regions.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
# CDN Regions

Valve maintains CDNs in various regions for Steam, which are identified internally as a `CellId`. This is a list of the currently known CDN regions for Steam, pulled directly from the **Content Server Directory Service**.

The **Download Region** setting in Steam will display a large number of regions, however the majority of them do not exist. The only ones that exist are the ones included in this page. In addition, setting an override region will have no effect on which download region your client will use. Steam will always determine which download region to serve you from, based on some unknown geo-location criteria.

![docker no command](images/download-region-settings.png){: style="height:430px"}

Please note that this list is non-exhaustive, and likely inaccurate, as Valve may potentially change them in the future.

| Cell Id | Short | City |
|---------|-------|-------------------|
| 0 | | **Use Geolocation** |
| 1 | ord | Chicago |
| 4 | lhr | London |
| 5 | fra | Frankfurt |
| 14 | par | Paris |
| 15 | ams | Amsterdam |
| 25 | gru | Sao Paulo |
| 31 | sea | Seattle |
| 32 | tyo | Japan |
| 33 | hkg | Hong Kong |
| 35 | sgp | Singapore |
| 38 | waw | Poland |
| 40 | mad | Madrid |
| 50 | atl | Atlanta |
| 52 | syd | Sydney |
| 63 | iad | Washington, DC |
| 64 | lax | Los Angeles |
| 65 | dfw | Dallas Fort-Worth |
| 66 | sto | Stockholm |
| 92 | vie | Vienna |
# CDN Regions

!!! Note
As of 2024-10-04 it appears that it is no longer possible to choose a CDN region in Steam. It is however still possible to choose a region for logging into Steam.

Valve maintains CDNs in various regions for Steam, which are identified internally as a `CellId`. This is a list of the currently known CDN regions for Steam, pulled directly from the **Content Server Directory Service**.

The **Download Region** setting in Steam will display a large number of regions, however the majority of them do not exist. The only ones that exist are the ones included in this page. In addition, setting an override region will have no effect on which download region your client will use. Steam will always determine which download region to serve you from, based on some unknown geo-location criteria.

![download region](images/download-region-settings.png){: style="height:430px"}

Please note that this list is non-exhaustive, and likely inaccurate, as Valve may potentially change them in the future.

| Cell Id | Short | City |
|---------|-------|-------------------|
| 0 | | **Use Geolocation** |
| 1 | ord | Chicago |
| 4 | lhr | London |
| 5 | fra | Frankfurt |
| 14 | par | Paris |
| 15 | ams | Amsterdam |
| 25 | gru | Sao Paulo |
| 31 | sea | Seattle |
| 32 | tyo | Japan |
| 33 | hkg | Hong Kong |
| 35 | sgp | Singapore |
| 38 | waw | Poland |
| 40 | mad | Madrid |
| 50 | atl | Atlanta |
| 52 | syd | Sydney |
| 63 | iad | Washington, DC |
| 64 | lax | Los Angeles |
| 65 | dfw | Dallas Fort-Worth |
| 66 | sto | Stockholm |
| 92 | vie | Vienna |

0 comments on commit 7310e3e

Please sign in to comment.