diff --git a/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj b/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj
index b39cf67..a18f319 100644
--- a/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj
+++ b/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj
@@ -53,6 +53,7 @@
+
diff --git a/src/RynthCore.App/AcClientCommandLine.cs b/src/RynthCore.App/AcClientCommandLine.cs
new file mode 100644
index 0000000..36100ef
--- /dev/null
+++ b/src/RynthCore.App/AcClientCommandLine.cs
@@ -0,0 +1,75 @@
+using System.Collections.Generic;
+using System.Text;
+
+namespace RynthCore.App;
+
+///
+/// acclient.exe's own command-line rules, and how to write a value so the client reads it back.
+///
+/// The client splits its command line itself (ConvertCommandLineToArgList, 0x004098F0, called from
+/// WinMain; ArgumentParser::ParseCommandLine uses the same template), not with the C runtime's rules:
+/// * arguments are split on spaces (only ' ') outside quotes;
+/// * a " switches quoting on or off and is dropped; it is never part of an argument;
+/// * nothing is escaped: a backslash is an ordinary character;
+/// * a quote left open refuses the whole command line ("Unmatched quote"), so the client starts
+/// without the account, password or host.
+/// The launcher used to write the C runtime's form ("\"" around the value, \\ for \, \" for ") for a
+/// value with a space or a quote; the client kept the backslashes, so a password with a quote mark
+/// reached the server changed and the login failed (2026-10-21, a 30-character password with most
+/// special characters on Conquest; ThwargLauncher, which passes the password as it is, worked).
+///
+internal static class AcClientCommandLine
+{
+ ///
+ /// as one argument the client reads back as of it:
+ /// as it is when it has no space (what ThwargLauncher passes), else in quotes. Quote marks in it are
+ /// left out, as the client would drop them anyway; that also keeps the quotes balanced.
+ ///
+ public static string Token(string? value)
+ {
+ string v = ClientValue(value);
+ if (v.Length == 0)
+ return "\"\"";
+ return v.IndexOf(' ') >= 0 ? "\"" + v + "\"" : v;
+ }
+
+ /// What the client can receive of : everything but its quote marks.
+ public static string ClientValue(string? value) => (value ?? string.Empty).Replace("\"", string.Empty);
+
+ /// True when the client can't receive as it is (it has a quote mark).
+ public static bool LosesCharacters(string? value) => !string.IsNullOrEmpty(value) && value.IndexOf('"') >= 0;
+
+ ///
+ /// The arguments the client reads from , by its own rules; null when it
+ /// refuses the line (a quote left open). For tests, and for reading the client's -h the way it does.
+ ///
+ public static List? Split(string? commandLine)
+ {
+ var args = new List();
+ if (commandLine == null)
+ return null;
+ var cur = new StringBuilder();
+ bool inArg = false, quoted = false;
+ foreach (char c in commandLine)
+ {
+ if (c == ' ' && !quoted)
+ {
+ if (inArg) { args.Add(cur.ToString()); cur.Clear(); inArg = false; }
+ }
+ else if (c == '"')
+ {
+ quoted = !quoted;
+ }
+ else
+ {
+ inArg = true;
+ cur.Append(c);
+ }
+ }
+ if (quoted)
+ return null;
+ if (inArg)
+ args.Add(cur.ToString());
+ return args;
+ }
+}
diff --git a/src/RynthCore.App/AcLaunchArgumentBuilder.cs b/src/RynthCore.App/AcLaunchArgumentBuilder.cs
index b07968b..ed58c99 100644
--- a/src/RynthCore.App/AcLaunchArgumentBuilder.cs
+++ b/src/RynthCore.App/AcLaunchArgumentBuilder.cs
@@ -128,27 +128,6 @@ internal sealed class AcLaunchArgumentBuilder
return null;
}
- private static string Quote(string value)
- {
- value ??= string.Empty;
-
- if (value.Length == 0)
- return "\"\"";
-
- if (!NeedsQuoting(value))
- return value;
-
- return "\"" + value.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\"";
- }
-
- private static bool NeedsQuoting(string value)
- {
- foreach (char ch in value)
- {
- if (char.IsWhiteSpace(ch) || ch == '"')
- return true;
- }
-
- return false;
- }
+ /// One argument by acclient's own rules (AcClientCommandLine), not the C runtime's.
+ private static string Quote(string value) => AcClientCommandLine.Token(value);
}
diff --git a/src/RynthCore.Engine/Compatibility/AelrynthWire.cs b/src/RynthCore.Engine/Compatibility/AelrynthWire.cs
index 0f9b726..011662c 100644
--- a/src/RynthCore.Engine/Compatibility/AelrynthWire.cs
+++ b/src/RynthCore.Engine/Compatibility/AelrynthWire.cs
@@ -95,18 +95,21 @@ internal static class ServerDetect
return host.Length > 0;
}
- /// Windows command-line splitting, enough for the launchers' quoting (quotes group, \" is a quote).
+ ///
+ /// acclient's own splitting (ConvertCommandLineToArgList, 0x004098F0; the launcher's
+ /// AcClientCommandLine), so -h is the host the client itself reads: spaces split outside quotes,
+ /// a quote only toggles and is dropped, a backslash is ordinary. An open quote (the client refuses
+ /// the whole line) still yields what was read.
+ ///
private static List SplitArgs(string s)
{
var list = new List();
var cur = new System.Text.StringBuilder();
bool inQuotes = false, any = false;
- for (int i = 0; i < s.Length; i++)
+ foreach (char c in s)
{
- char c = s[i];
- if (c == '\\' && i + 1 < s.Length && s[i + 1] == '"') { cur.Append('"'); i++; any = true; continue; }
- if (c == '"') { inQuotes = !inQuotes; any = true; continue; }
- if (!inQuotes && char.IsWhiteSpace(c))
+ if (c == '"') { inQuotes = !inQuotes; continue; }
+ if (c == ' ' && !inQuotes)
{
if (any) { list.Add(cur.ToString()); cur.Clear(); any = false; }
continue;
diff --git a/src/RynthCore.Injector/LaunchCommand.cs b/src/RynthCore.Injector/LaunchCommand.cs
index 0a024c0..dd2f108 100644
--- a/src/RynthCore.Injector/LaunchCommand.cs
+++ b/src/RynthCore.Injector/LaunchCommand.cs
@@ -260,6 +260,8 @@ internal static class LaunchCommand
Log($"No password is saved for account '{acct}'. Launch it once from the launcher to enter it, or edit the account.");
return 2;
}
+ if (RynthCore.App.AcClientCommandLine.LosesCharacters(pwd))
+ Log("Note: the password has a quote mark (\"). The AC client can't receive one on its command line, so it logs in with the password less its quote marks.");
string arguments = server.Emulator == EmulatorKind.Gdle
? string.Join(" ",
@@ -384,16 +386,8 @@ internal static class LaunchCommand
// Mirrors AcLaunchArgumentBuilder.Quote — only quote when needed, escape
// backslashes + quotes inside.
- private static string Quote(string value)
- {
- value ??= string.Empty;
- if (value.Length == 0)
- return "\"\"";
- bool needs = value.Any(ch => char.IsWhiteSpace(ch) || ch == '"');
- if (!needs)
- return value;
- return "\"" + value.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\"";
- }
+ /// One argument by acclient's own rules (AcClientCommandLine), as the launcher writes it.
+ private static string Quote(string value) => RynthCore.App.AcClientCommandLine.Token(value);
private static string? GetOpt(string[] args, string name)
{
diff --git a/src/RynthCore.Injector/RynthCore.Injector.csproj b/src/RynthCore.Injector/RynthCore.Injector.csproj
index f245dd3..656f7ae 100644
--- a/src/RynthCore.Injector/RynthCore.Injector.csproj
+++ b/src/RynthCore.Injector/RynthCore.Injector.csproj
@@ -21,6 +21,7 @@
+
diff --git a/tools/LauncherSettingsTests/LauncherSettingsTests.csproj b/tools/LauncherSettingsTests/LauncherSettingsTests.csproj
index 41d9981..65ba8f6 100644
--- a/tools/LauncherSettingsTests/LauncherSettingsTests.csproj
+++ b/tools/LauncherSettingsTests/LauncherSettingsTests.csproj
@@ -31,6 +31,7 @@
+
diff --git a/tools/LauncherSettingsTests/Program.cs b/tools/LauncherSettingsTests/Program.cs
index 6f0ede3..3d930d9 100644
--- a/tools/LauncherSettingsTests/Program.cs
+++ b/tools/LauncherSettingsTests/Program.cs
@@ -174,8 +174,14 @@ internal static class Program
var builder = new AcLaunchArgumentBuilder();
LaunchServerProfile ace = Server(AcEmulatorKind.Ace), gdle = Server(AcEmulatorKind.Gdle);
- Check(builder.BuildArguments(ace, a).Contains("-v \"t3st pw \\\"quoted\\\" ü\""), "ACE args carry the password (-v)");
- Check(builder.BuildArguments(gdle, a).Contains("-a \"A:t3st pw \\\"quoted\\\" ü\""), "GDLE args carry account:password (-a)");
+ // Read back the way acclient reads its command line (AcClientCommandLine.Split): the password
+ // as typed, less its quote marks (the client can't receive one), and the host after it intact.
+ List? aceArgs = AcClientCommandLine.Split(builder.BuildArguments(ace, a));
+ Check(ArgAfter(aceArgs, "-v") == "t3st pw quoted ü" && ArgAfter(aceArgs, "-h") == "127.0.0.1:9000",
+ "ACE: the client reads the password (-v) and the host after it");
+ List? gdleArgs = AcClientCommandLine.Split(builder.BuildArguments(gdle, a));
+ Check(ArgAfter(gdleArgs, "-a") == "A:t3st pw quoted ü" && ArgAfter(gdleArgs, "-p") == "9000",
+ "GDLE: the client reads account:password (-a) and the port");
string preview = builder.BuildMaskedArguments(ace, a);
Check(!preview.Contains("t3st") && preview.Contains("-v " + AcLaunchArgumentBuilder.PasswordMask), "preview masked: " + preview);
LaunchAccountProfile noPw = loaded.AccountProfiles.First(x => x.Id == "b");
@@ -457,12 +463,92 @@ internal static class Program
try { Directory.Delete(root, recursive: true); } catch { }
}
+ ClientCommandLineChecks();
+
Console.WriteLine(_failed == 0
? $"PASS: {_checks} checks"
: $"FAIL: {_failed} of {_checks} checks failed");
return _failed == 0 ? 0 : 1;
}
+ // ── acclient's command line ──────────────────────────────────────────────
+ // Passwords with special characters failed to log in (2026-10-21, Conquest; ThwargLauncher, which
+ // passes the password as it is, worked): the launcher wrote the C runtime's escapes (\\ and \"),
+ // which acclient's own splitter keeps as typed. AcClientCommandLine.Split is that splitter
+ // (ConvertCommandLineToArgList, 0x004098F0); everything the launcher writes is read back with it.
+ private static void ClientCommandLineChecks()
+ {
+ Console.WriteLine("-- acclient's command line");
+
+ // The splitter itself, as decompiled: spaces split outside quotes, a quote toggles and is dropped,
+ // a backslash is ordinary, an open quote refuses the line.
+ Check(Same(AcClientCommandLine.Split("\"C:\\Turbine\\Asheron's Call\\acclient.exe\" -a x -v y"),
+ "C:\\Turbine\\Asheron's Call\\acclient.exe", "-a", "x", "-v", "y"), "the exe path in quotes, double spaces");
+ Check(Same(AcClientCommandLine.Split("a\"\"b c\\\"d e\""), "ab", "c\\d e"), "quotes dropped, a backslash kept as it is");
+ Check(AcClientCommandLine.Split("-v \"a b") == null, "an open quote refuses the line");
+ Check(Same(AcClientCommandLine.Split("-v a\tb"), "-v", "a\tb"), "only a space splits (a tab is part of the argument)");
+
+ // A long password with nearly every special character and no space (the report): written as it is,
+ // exactly as ThwargLauncher writes it.
+ string special = "Aa1!@#$%^&*()_+-=[]{}|\\:;'<>,.?/~`" + "Zz9\\\\end\\";
+ Check(AcClientCommandLine.Token(special) == special, "no space, no quote: the password as it is");
+ Check(ReadsBack(special, special), "and the client reads it back");
+
+ // Quote marks: the client drops them whatever the launcher does; with them left out the rest
+ // reaches the server as typed, and the line can't end on an open quote.
+ // Negative control: the old C-runtime form reads back wrong, so the checks here mean something.
+ static string OldQuote(string v) => "\"" + v.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\"";
+ Check(ArgAfter(AcClientCommandLine.Split("-v " + OldQuote("x\"y\"z\\") + " -h h"), "-v") is string old && old != "xyz\\",
+ "negative control: the old escapes reach the client changed");
+ Check(ReadsBack("p\"ss\\word", "pss\\word"), "one quote mark: left out, the backslash kept (was \\\\ before)");
+ Check(ReadsBack("x\"y\"z\\", "xyz\\"), "two quote marks");
+ Check(AcClientCommandLine.LosesCharacters("a\"b") && !AcClientCommandLine.LosesCharacters(special), "LosesCharacters: only a quote mark");
+ Check(ReadsBack("pa ss \\ word\\", "pa ss \\ word\\"), "spaces: in quotes, a trailing backslash kept");
+ Check(ReadsBack("ü€£§°´ ä", "ü€£§°´ ä"), "non-ASCII and a space");
+
+ // Every password ThwargLauncher can log in with (no space: it doesn't quote) reads back the same
+ // through ours; and ours reads back every password, quotes left out.
+ const string Alphabet = "ab\\\" !@#$%^&*()-_=+[]{};:',.<>/?|`~ü";
+ var rng = new Random(20261021);
+ int thwargSame = 0, ours = 0;
+ for (int n = 0; n < 4000; n++)
+ {
+ var sb = new System.Text.StringBuilder();
+ int len = 1 + rng.Next(40);
+ for (int i = 0; i < len; i++) sb.Append(Alphabet[rng.Next(Alphabet.Length)]);
+ string pw = sb.ToString();
+ string expected = AcClientCommandLine.ClientValue(pw);
+ if (expected.Length == 0) continue;
+ if (ReadsBack(pw, expected)) ours++;
+ else { Check(false, "reads back: " + pw); break; }
+ List? thwarg = AcClientCommandLine.Split("-a acct -v " + pw + " -h host:9000");
+ if (pw.IndexOf(' ') < 0 && thwarg != null && thwarg.Count == 6)
+ {
+ if (ArgAfter(thwarg, "-v") == expected) thwargSame++;
+ else { Check(false, "same as ThwargLauncher: " + pw); break; }
+ }
+ }
+ Check(ours > 3500 && thwargSame > 100, $"random passwords: {ours} read back, {thwargSame} the same as ThwargLauncher's");
+ }
+
+ /// The launcher's ACE line for , read back by acclient's rules.
+ private static bool ReadsBack(string password, string expected)
+ {
+ string line = "-a " + AcClientCommandLine.Token("acct") + " -v " + AcClientCommandLine.Token(password)
+ + " -h " + AcClientCommandLine.Token("host:9000") + " -rodat off";
+ List? args = AcClientCommandLine.Split(line);
+ return args != null && args.Count == 8 && ArgAfter(args, "-v") == expected && ArgAfter(args, "-h") == "host:9000";
+ }
+
+ private static string? ArgAfter(List? args, string name)
+ {
+ if (args == null) return null;
+ int i = args.IndexOf(name);
+ return i >= 0 && i + 1 < args.Count ? args[i + 1] : null;
+ }
+
+ private static bool Same(List? got, params string[] want) => got != null && got.SequenceEqual(want);
+
// ── helpers ──────────────────────────────────────────────────────────────
private static void Scenario(string name, string root, Action body)