fix: SK engine and launcher fixes from 2026-10-14

- fix(engine): DAT share hook now patches only the CreateFile imports of
  acclient.exe and MSVCR70.dll instead of hooking kernel32 process-wide, so
  Direct3D and driver file opens are no longer routed through the detour
  ("Could not initialize Direct3D" on some machines). Uninstall restores the
  import slots on engine unload.
- fix(launcher): a saved UserPreferences.ini that makes the client exit
  within 30 s is quarantined and the previous live file is restored.
- fix(engine): target selects and attacks run during the gesture defer.
- feat(launcher): first login on a new server; pick any character on the
  account.
- feat(settings): loot timers show their optimized defaults, with a
  "Use optimized defaults" button.

Release notes are in Changelog/2026-10-14-*.md.
This commit is contained in:
BlankenshipG 2026-10-14 22:35:26 -04:00
commit 8919f7f169
25 changed files with 1373 additions and 163 deletions

View file

@ -12,11 +12,21 @@ internal partial class AccountProfileDialog : Window
{
private readonly LaunchAccountProfile _profile;
private readonly List<LaunchServerProfile> _servers;
private readonly Func<string, string, List<string>> _knownCharactersFor;
public AccountProfileDialog(LaunchAccountProfile profile, List<LaunchServerProfile> servers)
private List<string> _knownCharacters = [];
// Set once the player picks in "Log in as"; until then the saved choice is kept as it is
// (an empty one means "the only character, else character select").
private bool _loginAsChanged;
private bool _loadingLoginAs;
/// <param name="knownCharactersFor">(account name, server name) -> the characters known for it.</param>
public AccountProfileDialog(LaunchAccountProfile profile, List<LaunchServerProfile> servers,
Func<string, string, List<string>> knownCharactersFor)
{
_profile = profile;
_servers = servers;
_knownCharactersFor = knownCharactersFor;
InitializeComponent();
ServerComboBox.ItemsSource = _servers.Select(s => s.DisplayName).ToList();
@ -30,15 +40,52 @@ internal partial class AccountProfileDialog : Window
PasswordHintText.Text = profile.PasswordNeedsReentry
? "Password needs re-entering: the saved one can't be read on this Windows user (settings copied from another user or PC?). Type it again to launch this account."
: !profile.HasSavedPassword
? "No password is saved for this profile yet."
? "No password is saved for this profile yet. The game client won't start without one; you'll be asked for it on the first launch."
: "A password is saved for this profile, encrypted for this Windows user. It stays hidden unless you replace or clear it.";
ServerComboBox.SelectionChanged += (_, _) => RefreshLoginAs();
AccountBox.TextChanged += (_, _) => RefreshLoginAs();
LoginAsBox.SelectionChanged += (_, _) =>
{
if (!_loadingLoginAs)
_loginAsChanged = true;
};
RefreshLoginAs();
SaveButton.Click += (_, _) => SaveAndClose();
CancelButton.Click += (_, _) => Close(false);
BrowseUserPrefsButton.Click += async (_, _) => await BrowseUserPrefsAsync();
SnapshotUserPrefsButton.Click += (_, _) => SnapshotLiveUserPrefs();
}
/// <summary>Lists the characters known for the account on the chosen server in "Log in as".</summary>
private void RefreshLoginAs()
{
string accountName = AccountBox.Text?.Trim() ?? string.Empty;
string serverName = ServerComboBox.SelectedIndex >= 0 ? _servers[ServerComboBox.SelectedIndex].Name : string.Empty;
_knownCharacters = accountName.Length > 0 ? _knownCharactersFor(accountName, serverName) : [];
string? current = _loginAsChanged ? LoginAsBox.SelectedItem as string : null;
List<string> choices = FirstLoginRules.LoginChoices(_knownCharacters, _profile.CharacterName);
_loadingLoginAs = true;
try
{
LoginAsBox.ItemsSource = choices;
LoginAsBox.SelectedItem = current != null && choices.Contains(current) ? current
: choices.Contains(_profile.CharacterName) ? _profile.CharacterName
: FirstLoginRules.StopAtCharacterSelect;
}
finally
{
_loadingLoginAs = false;
}
LoginAsHintText.Text = _knownCharacters.Count == 0
? "No characters are known for this account on this server yet. Launch it: the client stops at character select, where you can create characters, and RynthCore picks them up there."
: $"{_knownCharacters.Count} character(s) on this account. Pick the one that logs in automatically, or stop at character select. The launch list's dropdown changes this too.";
}
private async System.Threading.Tasks.Task BrowseUserPrefsAsync()
{
var topLevel = GetTopLevel(this);
@ -112,10 +159,24 @@ internal partial class AccountProfileDialog : Window
return;
}
if (ServerComboBox.SelectedIndex >= 0)
_profile.ServerId = _servers[ServerComboBox.SelectedIndex].Id;
LaunchServerProfile? server = ServerComboBox.SelectedIndex >= 0 ? _servers[ServerComboBox.SelectedIndex] : null;
if (server == null && _servers.Count > 0)
{
ValidationText.Text = "Pick the server this account is for.";
return;
}
if (AcLaunchArgumentBuilder.AccountNameProblem(AccountBox.Text, server?.Emulator ?? AcEmulatorKind.Ace) is string nameProblem)
{
ValidationText.Text = nameProblem;
return;
}
if (server != null)
_profile.ServerId = server.Id;
_profile.AccountName = AccountBox.Text.Trim();
if (_loginAsChanged)
_profile.CharacterName = FirstLoginRules.CharacterNameFor(LoginAsBox.SelectedItem as string, _knownCharacters);
if (ClearPasswordCheckBox.IsChecked == true)
{
_profile.ClearPassword();