Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user-defined network settings via NetworkDefinitions.local.ini #661

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ClientCore/ClientConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class ClientConfiguration
private const string CLIENT_SETTINGS = "DTACnCNetClient.ini";
private const string GAME_OPTIONS = "GameOptions.ini";
private const string CLIENT_DEFS = "ClientDefinitions.ini";
private const string NETWORK_DEFS_LOCAL = "NetworkDefinitions.local.ini";
private const string NETWORK_DEFS = "NetworkDefinitions.ini";

private static ClientConfiguration _instance;
Expand Down Expand Up @@ -48,7 +49,17 @@ protected ClientConfiguration()

gameOptions_ini = new IniFile(SafePath.CombineFilePath(baseResourceDirectory.FullName, GAME_OPTIONS));

networkDefinitionsIni = new IniFile(SafePath.CombineFilePath(ProgramConstants.GetResourcePath(), NETWORK_DEFS));
string networkDefsPathLocal = SafePath.CombineFilePath(ProgramConstants.GetResourcePath(), NETWORK_DEFS_LOCAL);
if (File.Exists(networkDefsPathLocal))
{
networkDefinitionsIni = new IniFile(networkDefsPathLocal);
Logger.Log("Loaded network definitions from NetworkDefinitions.local.ini (user override)");
}
else
{
string networkDefsPath = SafePath.CombineFilePath(ProgramConstants.GetResourcePath(), NETWORK_DEFS);
networkDefinitionsIni = new IniFile(networkDefsPath);
}
}

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions DXMainClient/PreStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ public static void Initialize(StartupParams parameters)
if (!clientUserFilesDirectory.Exists)
clientUserFilesDirectory.Create();

MainClientConstants.Initialize();

Logger.Log("***Logfile for " + MainClientConstants.GAME_NAME_LONG + " client***");

string clientVersion = GitVersionInformation.AssemblySemVer;
Expand All @@ -103,6 +101,7 @@ public static void Initialize(StartupParams parameters)
#if DEVELOPMENT_BUILD
Logger.Log("This is a development build of the client. Stability and reliability may not be fully guaranteed.");
#endif
MainClientConstants.Initialize();

// Log information about given startup params
if (parameters.NoAudio)
Expand Down
Loading