From 17fc2cf7760b30a9d4eec263dff7577ecd624e5b Mon Sep 17 00:00:00 2001 From: BlankenshipG Date: Wed, 14 Oct 2026 22:35:26 -0400 Subject: [PATCH] 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. --- ...-hook-scoped-to-ac-imports-2026.10.5.61.md | 61 ++++++++++++ ...-14-first-login-new-server-2026.10.5.58.md | 88 ++++++++++++++++++ ...10-14-gesture-safe-attacks-2026.10.5.57.md | 41 ++++++++ ...failed-prefs-swap-recovery-2026.10.5.60.md | 61 ++++++++++++ ...t-timer-optimized-defaults-2026.10.5.59.md | 40 ++++++++ .../RynthCore.App.Avalonia.csproj | 8 +- src/RynthCore.Engine/UI/Data/SettingsData.cs | 93 +++++++++++++++---- .../UI/Panels/SettingsPanel.cs | 13 ++- tools/LauncherSettingsTests/Program.cs | 44 +++++++++ 9 files changed, 428 insertions(+), 21 deletions(-) create mode 100644 Changelog/2026-10-14-dat-share-hook-scoped-to-ac-imports-2026.10.5.61.md create mode 100644 Changelog/2026-10-14-first-login-new-server-2026.10.5.58.md create mode 100644 Changelog/2026-10-14-gesture-safe-attacks-2026.10.5.57.md create mode 100644 Changelog/2026-10-14-launcher-failed-prefs-swap-recovery-2026.10.5.60.md create mode 100644 Changelog/2026-10-14-loot-timer-optimized-defaults-2026.10.5.59.md diff --git a/Changelog/2026-10-14-dat-share-hook-scoped-to-ac-imports-2026.10.5.61.md b/Changelog/2026-10-14-dat-share-hook-scoped-to-ac-imports-2026.10.5.61.md new file mode 100644 index 0000000..817f99e --- /dev/null +++ b/Changelog/2026-10-14-dat-share-hook-scoped-to-ac-imports-2026.10.5.61.md @@ -0,0 +1,61 @@ +# 2026.10.5.61 - engine: DAT share hook no longer intercepts Direct3D and driver file opens + +Previous release: 2026.10.5.60. + +## Problem + +On one PC every RynthCore launch ended with "Could not initialize Direct3D. Please ensure that +DirectX 9.0 or higher is installed." (twice), then "The game encountered a fatal DirectX issue +while attempting to start...", and AC exited with code 1 about 6 seconds in. The same client +started from another launcher (no engine) worked. 2026.10.5.60 (saved UserPreferences.ini +recovery) did not change it. + +In all three logs (builds 2026.10.14.2 and 2026.10.5.60) the error came 27-36 ms after the +engine started loading RynthChat, the plugin right after RynthAi. RynthAi took 378, 390 and +1175 ms to load, and the error moved with it, so AC's device creation was waiting on the engine +and failed as soon as it continued. + +The DAT share hook (on with "Allow multiple clients") detoured the kernel32 `CreateFileA` and +`CreateFileW` exports with MinHook. That caught every caller in the process, including +d3d9.dll and the GPU driver, which open files (shader caches) while AC creates its device. Each +of those opens ran through managed code, which can wait on the runtime while plugins load, and +the detour did not hand back the Win32 last error: callers read it even after a successful +CreateFile (ERROR_ALREADY_EXISTS with OPEN_ALWAYS), and on some drivers that fails device +creation. + +## Change + +- The hook patches only the import slots of the modules that open AC's data files: + `acclient.exe` (imports CreateFileA) and its CRT `MSVCR70.dll` (CreateFileA/W, used by + fopen/_wfopen; the "W" DAT lines in the log come from here). Direct3D, drivers, the runtime + and plugins call CreateFile without the engine in the way. +- The detour sets the Win32 last error back to the value CreateFile left before returning. +- The import slots are written back at engine shutdown (new step + `DatFileShareHooks.Uninstall`), because the detours belong to the engine generation that hot + reload unloads. +- A detour calls whatever its slot held before, so a Decal detour on the kernel32 export still + runs. +- The startup log now lists the hooked slots, for example + `Compat: DAT share - hooked MSVCR70.dll!CreateFileW import (...)`, and the DAT open lines + (`Compat: DAT share - W [filtered]: client_portal.dat ...`) still appear when multi-client is + on. + +## Code + +- `src/RynthCore.Engine/Compatibility/DatFileShareHooks.cs`: MinHook export hooks replaced by + IAT slot hooks (`HookModuleImports`, `InstallSlot`, `Uninstall`, `IatHook` record); detours + take the slot's original delegate and restore the last error (`SetWin32LastError`). +- `src/RynthCore.Engine/EngineLifecycle.cs`: `DatFileShareHooks.Uninstall` before + `MH_DisableHook(ALL)`. + +## Tests + +- `dotnet build src\RynthCore.Engine\RynthCore.Engine.csproj -c Release`: 0 errors, no new + warnings. No test project covers the hook; it needs a running client. +- Import tables checked on this PC: `acclient.exe` imports `KERNEL32!CreateFileA` (and + `CreateFileMappingA`); `MSVCR70.dll` imports `KERNEL32!CreateFileA` and `CreateFileW`. + +## For an affected PC before updating + +Set `"EnableDatShareHook": false` in `%APPDATA%\RynthCore\engine.json` (or turn off "Allow +multiple clients"), then launch. If the client starts, this hook was the cause. diff --git a/Changelog/2026-10-14-first-login-new-server-2026.10.5.58.md b/Changelog/2026-10-14-first-login-new-server-2026.10.5.58.md new file mode 100644 index 0000000..6f5149b --- /dev/null +++ b/Changelog/2026-10-14-first-login-new-server-2026.10.5.58.md @@ -0,0 +1,88 @@ +# 2026.10.5.58 - launcher: first login on a new server, every character on the account + +Previous release: 2026.10.5.57. Launcher project version 0.1.6 (was 0.1.5). + +## Problem + +An account set up for a new server never got in. The `SK` profile (Conquest, +`acconquest.ddns.net:9000`, and earlier Aelrynth) had no password saved, so +the launcher started the client with `-v ""`. The client refuses an empty +password before it connects: it shows "You can only run the game from the +launcher program" and exits about 4 seconds later. All six `SK` launches in the +logs (Aelrynth, 2026-10-13 08:31 to 23:47; Conquest, 23:48) ended this way, and +the launcher only recorded each one as a crash. + +An empty password would fail on the server too. ACE creates a new account on its +first login (`AllowAutoAccountCreation`), but only when a password is sent, and +it boots a login without one. + +Also: + +- A new account profile had no server picked unless you chose one, and the + launch list then put it on the first server profile. +- The launch list showed "(None - no auto-login) | offline" as if it were a + character name. + +## Change + +- **First Login dialog.** A manual launch of an account with no usable password + (none saved, or one that can't be decrypted on this Windows user) asks for it + first, instead of starting a client that can only fail. It has: + - An optional list of the account names used in your other profiles, to pick + an account you already have. + - The account name. On ACE, a new name creates the account on this first + login, if the server allows it. + - A password with confirmation, saved encrypted like the other accounts. If + another profile has the same account name with a saved password, a checkbox + reuses it (the encrypted copy is copied, never the plain text). + - "Log in as": stop at character select, or any character already known for + the account. + + Cancelling skips that account and logs why. Automatic launches don't show the + dialog. They skip the account, logging it at most once every 5 minutes. +- **Characters on the account.** With no character chosen, the client stops at + character select, where you can create characters. The engine already saves + the account's character list from character select, including newly created + characters. + - Stopping at character select before any character is known saves an empty + choice, not "(None)". Once the first character exists and is the only one, + the next launch logs it in. + - With several characters, the launch list's dropdown, and the new "Log in as" + in Edit Account, list them all. You pick which one logs in, or stop at + character select. +- **Account Profile dialog.** + - New "Log in as" list. + - A new account defaults to the server selected in the list. + - A server must be picked when there are server profiles. + - Account names over 50 characters (ACE's limit), or with ':' on GDLE (whose + login argument is `account:password`), are refused. +- **Launch list status.** "Needs password | launch to set up" for an account + without one, and "Character select" instead of the "(None)" text. +- **Never an empty password.** + - `AcLaunchArgumentBuilder.BuildArguments` refuses to build a command line with + an empty password, with the reason. + - The launch preview says the password is missing instead of showing `-v ""`. + - `RynthCore.Injector launch` refuses too. + +## Tests + +- tools/LauncherSettingsTests: 152 checks pass. + - The old checks that an account without a password "still launches as before + (empty)" now check that it's refused, with the reason, on ACE and GDLE. + - New: account-name checks, and a "first login on a new server" scenario: + - known account names + - reusing another profile's saved password (the copied encrypted password + still decrypts) + - the Log in as choices and what each saves + - the dialog's input checks +- tools/AelrynthTests: 89/89. +- The launcher and the injector build. The dialogs were not shown in a test run. + +## Files + +- `src/RynthCore.App/FirstLoginRules.cs` (new), `AcLaunchArgumentBuilder.cs`, `LaunchAccountProfile.cs` +- `src/RynthCore.App.Avalonia/FirstLoginDialog.axaml` and `.axaml.cs` (new) +- `src/RynthCore.App.Avalonia/AccountProfileDialog.axaml` and `.axaml.cs`, `MainWindow.axaml.cs`, + `RynthCore.App.Avalonia.csproj` +- `src/RynthCore.Injector/LaunchCommand.cs` +- `tools/LauncherSettingsTests/Program.cs`, `LauncherSettingsTests.csproj` diff --git a/Changelog/2026-10-14-gesture-safe-attacks-2026.10.5.57.md b/Changelog/2026-10-14-gesture-safe-attacks-2026.10.5.57.md new file mode 100644 index 0000000..5405bbf --- /dev/null +++ b/Changelog/2026-10-14-gesture-safe-attacks-2026.10.5.57.md @@ -0,0 +1,41 @@ +# 2026.10.5.57 - attacks and target selects no longer wait behind gestures + +Previous release: 2026.10.5.56. + +Goes with RynthAi 0.5.64-legacy-ui (fewer weapon swaps, faster point-blank +stall recovery: `RynthSuite/Changelog/2026-10-14-combat-speed-swaps-stalls-0.5.64.md`). + +## Problem + +While a gesture is in flight (the CMotionInterp pending-motion list is not +empty), `AcMainThreadQueue` defers the whole action ring for up to +`DrainDeferMaxMs` (2.5 s). With a crossbow or bow, a gesture is in flight +nearly all the time. In Silentkelpie's 2026-10-14 logs, target selects and +attacks ran 1.0-1.9 s late, and some attacks went past the 1.5 s stale limit +and were dropped. + +## Change + +- New `AcMainThreadQueue.RunsDuringGesture`. The retail client does these from + a key press at any moment, swing or not, so they now run during the defer: + - `SetSelectedObject` (the target select). + - `NativeAttack` (ClientCombatSystem StartAttackRequest / EndAttackRequest, + which the client itself holds until the motion allows it). + - `CancelAttack` (the 0x1B7 packet). +- These run from the head of the ring up to the first entry that doesn't + qualify, using `ActionRing.TryPeek` and `Pop`. FIFO order is kept: nothing + overtakes a held entry. +- Stance changes, movement, raw attack packets and item moves stay deferred as + before. When the gesture-safe entries empty the ring, the defer clock resets, + so the next held entry gets its full defer. + +## Tests + +- Engine builds. All RynthCore tool tests pass (EngineRobustnessTests 1159 + checks, among others). There is no unit harness for the drain (it needs AC's main + thread). The change is checked live through RynthAi's logs: attacks should no + longer be reported late or stale behind crossbow gestures. + +## Files + +- `src/RynthCore.Engine/Compatibility/AcMainThreadQueue.cs` diff --git a/Changelog/2026-10-14-launcher-failed-prefs-swap-recovery-2026.10.5.60.md b/Changelog/2026-10-14-launcher-failed-prefs-swap-recovery-2026.10.5.60.md new file mode 100644 index 0000000..d0d2394 --- /dev/null +++ b/Changelog/2026-10-14-launcher-failed-prefs-swap-recovery-2026.10.5.60.md @@ -0,0 +1,61 @@ +# 2026.10.5.60 - launcher: undo a saved UserPreferences.ini that stops the client starting + +Previous release: 2026.10.5.59. Launcher project version 0.1.7 (was 0.1.6). + +## Problem + +A client launched from RynthCore showed "Could not initialize Direct3D. Please ensure that +DirectX 9.0 or higher is installed." twice, then "The game encountered a fatal DirectX issue +while attempting to start. Try a different screen resolution or bit depth...", and exited +about 12 seconds after start. The same client started fine from another launcher. + +The engine was not involved: its D3D9 hooks only start at login, and the log had no D3D9 +lines. The difference was the launcher. Before every launch it copies the account's saved +game settings (`%APPDATA%\RynthCore\prefs\@.ini`, or the file set on the +profile) over the live `Documents\Asheron's Call\UserPreferences.ini`. The game reads its +resolution and full-screen mode from that file. A saved copy with a display mode the PC can't +use (another monitor, an old resolution) fails every launch, and the saved copy is only +refreshed after a normal session, so it was restored again on every launch. Another launcher +uses the live file, which is why it worked. + +## Change + +- When a client quits within 30 s (the existing "counted as crash" window) and its launch + swapped in a saved UserPreferences.ini that differs from the live file: + - The saved copy is renamed to `.ini.failed-yyyyMMdd-HHmmss` (kept, never swapped in + again). The account's old name-only copy (`.ini`) is set aside too when it holds + the same settings, because it re-seeds a missing per-server copy. + - The live UserPreferences.ini is put back to what it was before the swap, unless another + launch has swapped it since. + - The activity log says what happened. The next launch uses the live file, and the next + normal session saves a fresh copy. +- A file the user picked on the profile (UserPrefsPath) is never renamed; the live file is + still put back and the activity log points at the profile setting. +- Nothing changes when the saved copy matched the live file (the swap can't have caused the + exit), e.g. a missing password or a server that is down. + +## Code + +- `src/RynthCore.App/UserPrefsSwapRecovery.cs` (new): `UserPrefsSwap` record (stash path, + live path, stash bytes, live bytes before the swap), `SwapChangedPrefs`, `Recover` + (quarantine + restore), `QuarantinePath`. +- `src/RynthCore.App/AcClientLaunchSettingsService.cs`: `SwapUserPreferences` returns the + `UserPrefsSwap` (was `bool`) and reads the live file before overwriting it. +- `src/RynthCore.App.Avalonia/MainWindow.axaml.cs`: the three launch paths (RynthCore, Decal / + Decal + RynthCore, no injection) use `ApplyPrefsSwap` and record the swap per PID + (`TrackPrefsSwap`); `DetectQuickExits` calls `RecoverFailedPrefsSwap` for a quick exit. A swap + generation counter decides whether the live file can still be put back. + `ResolveLegacyUserPrefsPath` is shared with `ResolveUserPrefsPath`. +- `RynthCore.App.Avalonia.csproj`: links the new file; version 0.1.7. + +## Tests + +- `tools/LauncherSettingsTests`: 5 new scenarios (swap changed the live file or not; failed + stash set aside and live file restored; a different name-only stash kept; profile override + and later swap leave files alone; no live file before). `PASS: 163 checks`. +- `dotnet build src\RynthCore.App.Avalonia\RynthCore.App.Avalonia.csproj -c Release`: 0 errors. + +## For an affected PC now + +Rename or delete `%APPDATA%\RynthCore\prefs\@.ini` (and `.ini`) for +the failing account, or clear the UserPreferences file on its profile, then launch again. diff --git a/Changelog/2026-10-14-loot-timer-optimized-defaults-2026.10.5.59.md b/Changelog/2026-10-14-loot-timer-optimized-defaults-2026.10.5.59.md new file mode 100644 index 0000000..f03f8a5 --- /dev/null +++ b/Changelog/2026-10-14-loot-timer-optimized-defaults-2026.10.5.59.md @@ -0,0 +1,40 @@ +# 2026.10.5.59 - Loot Timers show their optimized defaults, with a button to use them + +Previous release: 2026.10.5.58 (installed engine 2026.10.5.57). + +Goes with RynthSuite's `Changelog/2026-10-14-loot-baseline-0.5.65.md` (RynthAi 0.5.65), which +measured the loot timer baseline and applied it to RynthAi's own Advanced Settings. The +engine's Settings panel (Looting tab) still showed the old list with no defaults. + +## Change + +- **Settings > Looting > Loot Timers (ms) - (optimized default).** Each timer's label ends + with its optimized default in brackets: + - Content Settle (100) + - Empty Corpse Wait (300) + - Assess Window (300) + - Loot Retry Timeout (1000) + - Corpse Open Retry (1500) + - Corpse Timeout (12000) +- **Use optimized defaults** button: sets all six timers to those values and saves them to + RynthAi like a typed value. It works in the in-game panel and in the launcher's panel. +- Each timer has a tooltip (what it waits for, and the measured appraisal times for Assess + Window). +- Inter-Item Delay and Closing Delay are no longer shown: RynthAi's corpse looting never reads + them (RynthAi hid them in 0.5.65). They are still carried so a save doesn't send them missing. +- The engine's own defaults for the timers (used until RynthAi sends its settings) now match + the optimized defaults: Assess Window 200 -> 300 ms, Loot Retry Timeout 500 -> 1000 ms. + +## Code + +- `UI/Data/SettingsData.cs`: new `LootTimerDefaults` (the six values, same as RynthSuite's + `LootBaseline.cs`; `Label`, `Apply`, `AllDefault`). `SettingRow` gains an optional + `Edit` action for buttons that change settings, built with `EditButton`. +- `ImGui/Panels/SettingsFace.cs` and `UI/Panels/SettingsPanel.cs`: a button row with `Edit` + applies it to the panel's copy and saves it (the launcher panel also rebuilds the tab so the + number boxes show the new values). + +## Tests + +- `dotnet build src\RynthCore.Engine\RynthCore.Engine.csproj -c Release`: 0 errors. No test + project compiles `SettingsData.cs`. diff --git a/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj b/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj index bdbee8b..f68feb2 100644 --- a/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj +++ b/src/RynthCore.App.Avalonia/RynthCore.App.Avalonia.csproj @@ -1,12 +1,12 @@ - - 0.1.6 - 0.1.6.0 - 0.1.6.0 + 0.1.7 + 0.1.7.0 + 0.1.7.0 WinExe net10.0-windows7.0 x86 diff --git a/src/RynthCore.Engine/UI/Data/SettingsData.cs b/src/RynthCore.Engine/UI/Data/SettingsData.cs index b785780..7b9cebc 100644 --- a/src/RynthCore.Engine/UI/Data/SettingsData.cs +++ b/src/RynthCore.Engine/UI/Data/SettingsData.cs @@ -238,14 +238,16 @@ internal sealed class RynthAiSettings // Salvage with the 0x027D request sent straight to the server, no salvage panel on screen // (default on; used when the engine has API v81; an older RynthAi doesn't send it). public bool SalvageWithoutPanel { get; set; } = true; + // Inter-Item Delay and Closing Delay: RynthAi's corpse looting never reads them (not shown in + // the panel since 2026.10.5.59), carried so a save doesn't send them missing. public int LootInterItemDelayMs { get; set; } = 50; - public int LootContentSettleMs { get; set; } = 100; - public int LootEmptyCorpseMs { get; set; } = 300; + public int LootContentSettleMs { get; set; } = LootTimerDefaults.ContentSettleMs; + public int LootEmptyCorpseMs { get; set; } = LootTimerDefaults.EmptyCorpseMs; public int LootClosingDelayMs { get; set; } = 200; - public int LootAssessWindowMs { get; set; } = 200; - public int LootRetryTimeoutMs { get; set; } = 500; - public int LootOpenRetryMs { get; set; } = 1500; - public int LootCorpseTimeoutMs { get; set; } = 12000; + public int LootAssessWindowMs { get; set; } = LootTimerDefaults.AssessWindowMs; + public int LootRetryTimeoutMs { get; set; } = LootTimerDefaults.RetryTimeoutMs; + public int LootOpenRetryMs { get; set; } = LootTimerDefaults.OpenRetryMs; + public int LootCorpseTimeoutMs { get; set; } = LootTimerDefaults.CorpseTimeoutMs; public int SalvageOpenDelayFirstMs { get; set; } = 400; public int SalvageOpenDelayFastMs { get; set; } = 50; public int SalvageAddDelayFirstMs { get; set; } = 600; @@ -331,6 +333,43 @@ internal static unsafe class SettingsCommands } } +/// +/// The optimized loot timer defaults, in ms: the same values as RynthSuite's LootBaseline.cs +/// (RynthAi 0.5.65), measured from live corpse looting on ACE (226 corpses, 39 pickups). Keep +/// the two in step. The Loot Timers rows show each one in brackets after the label. +/// +internal static class LootTimerDefaults +{ + public const int ContentSettleMs = 100; + public const int EmptyCorpseMs = 300; + /// Above the 256 ms 95th percentile of the measured appraisal replies. + public const int AssessWindowMs = 300; + /// No pickup needed a retry at 1000 ms (it counts from when the character is still). + public const int RetryTimeoutMs = 1000; + public const int OpenRetryMs = 1500; + public const int CorpseTimeoutMs = 12000; + + /// A row label with its optimized default: "Assess Window (300)". + public static string Label(string name, int defaultMs) => $"{name} ({defaultMs})"; + + /// Writes the six optimized defaults into . + public static void Apply(RynthAiSettings s) + { + s.LootContentSettleMs = ContentSettleMs; + s.LootEmptyCorpseMs = EmptyCorpseMs; + s.LootAssessWindowMs = AssessWindowMs; + s.LootRetryTimeoutMs = RetryTimeoutMs; + s.LootOpenRetryMs = OpenRetryMs; + s.LootCorpseTimeoutMs = CorpseTimeoutMs; + } + + /// True when all six timers are at the optimized defaults. + public static bool AllDefault(RynthAiSettings s) => + s.LootContentSettleMs == ContentSettleMs && s.LootEmptyCorpseMs == EmptyCorpseMs && + s.LootAssessWindowMs == AssessWindowMs && s.LootRetryTimeoutMs == RetryTimeoutMs && + s.LootOpenRetryMs == OpenRetryMs && s.LootCorpseTimeoutMs == CorpseTimeoutMs; +} + // ── Schema ───────────────────────────────────────────────────────────────── internal enum SettingKind { Bool, Int, Float, Double, Combo, Section, Spacer, Note, CraftingStatus, Button, TraceCategories, Text, Status, @@ -422,7 +461,10 @@ internal sealed record SettingRow( Func? GetText = null, Action? SetText = null, // Text rows: greyed hint shown while the box is empty. - string? Hint = null) + string? Hint = null, + // Button rows that change settings: applied to the panel's copy, which is then saved like + // any other edit (Click, when also set, runs after). + Action? Edit = null) { public bool IsVisible(RynthAiSettings s) => VisibleWhen == null || VisibleWhen(s); } @@ -537,6 +579,10 @@ internal static class SettingsSchema private static SettingRow Button(string label, string buttonText, Action click, string? tip = null) => new(SettingKind.Button, label, tip, ButtonText: buttonText, Click: click); + // A button that edits the settings (the panel saves the result like a typed value). + private static SettingRow EditButton(string label, string buttonText, Action edit, string? tip = null) => + new(SettingKind.Button, label, tip, ButtonText: buttonText, Edit: edit); + private static SettingRow Text(string label, Func get, Action set, string? tip = null, string? hint = null) => new(SettingKind.Text, label, tip, GetText: get, SetText: set, Hint: hint); @@ -1104,15 +1150,30 @@ internal static class SettingsSchema Bool("Salvage Without The Panel", s => s.SalvageWithoutPanel, (s, v) => s.SalvageWithoutPanel = v, "Salvage (and combine bags) by sending the salvage request to the server directly:\nAC's salvage panel never opens. When a request changes nothing, that batch is tried once\nthrough the panel. Needs an engine with plugin API v82; otherwise the panel is used."), Spacer(), - Section("Loot Timers (ms)"), - Int("Inter-Item Delay", s => s.LootInterItemDelayMs, (s, v) => s.LootInterItemDelayMs = v, 0, 5000, 25), - Int("Content Settle", s => s.LootContentSettleMs, (s, v) => s.LootContentSettleMs = v, 0, 5000, 25), - Int("Empty Corpse Wait", s => s.LootEmptyCorpseMs, (s, v) => s.LootEmptyCorpseMs = v, 0, 5000, 25), - Int("Closing Delay", s => s.LootClosingDelayMs, (s, v) => s.LootClosingDelayMs = v, 0, 5000, 25), - Int("Assess Window", s => s.LootAssessWindowMs, (s, v) => s.LootAssessWindowMs = v, 0, 5000, 25), - Int("Loot Retry Timeout", s => s.LootRetryTimeoutMs, (s, v) => s.LootRetryTimeoutMs = v, 0, 10000, 100), - Int("Corpse Open Retry", s => s.LootOpenRetryMs, (s, v) => s.LootOpenRetryMs = v, 0, 10000, 100), - Int("Corpse Timeout", s => s.LootCorpseTimeoutMs, (s, v) => s.LootCorpseTimeoutMs = v, 0, 60000, 500), + // The optimized default is in brackets after each label (LootTimerDefaults). Inter-Item + // Delay and Closing Delay are not shown: RynthAi's corpse looting never reads them. + Section("Loot Timers (ms) - (optimized default)"), + EditButton("Optimized defaults", "Use optimized defaults", LootTimerDefaults.Apply, + "Set all six loot timers to the optimized defaults, measured from live looting on ACE\n" + + "(226 corpses). RynthAi's log line [LootSettings] marks each timer baseline or custom."), + Int(LootTimerDefaults.Label("Content Settle", LootTimerDefaults.ContentSettleMs), + s => s.LootContentSettleMs, (s, v) => s.LootContentSettleMs = v, 0, 5000, 25, + "Wait after an open for the container's items. Only used when the items\naren't already known; on ACE they always were."), + Int(LootTimerDefaults.Label("Empty Corpse Wait", LootTimerDefaults.EmptyCorpseMs), + s => s.LootEmptyCorpseMs, (s, v) => s.LootEmptyCorpseMs = v, 0, 5000, 25, + "Wait for a corpse's contents before probing it or calling it empty."), + Int(LootTimerDefaults.Label("Assess Window", LootTimerDefaults.AssessWindowMs), + s => s.LootAssessWindowMs, (s, v) => s.LootAssessWindowMs = v, 0, 5000, 25, + "Hold items for their appraisal. Measured replies: 127 ms typical,\n256 ms at the 95th percentile, 350 ms at most."), + Int(LootTimerDefaults.Label("Loot Retry Timeout", LootTimerDefaults.RetryTimeoutMs), + s => s.LootRetryTimeoutMs, (s, v) => s.LootRetryTimeoutMs = v, 0, 10000, 100, + "Wait, once the character is still, before resending a pickup that hasn't\nlanded. Too short resends pickups the server is still doing."), + Int(LootTimerDefaults.Label("Corpse Open Retry", LootTimerDefaults.OpenRetryMs), + s => s.LootOpenRetryMs, (s, v) => s.LootOpenRetryMs = v, 0, 10000, 100, + "Wait before sending another open to a corpse that hasn't opened."), + Int(LootTimerDefaults.Label("Corpse Timeout", LootTimerDefaults.CorpseTimeoutMs), + s => s.LootCorpseTimeoutMs, (s, v) => s.LootCorpseTimeoutMs = v, 0, 60000, 500, + "Give up on a claimed corpse after this long. The clock stops during combat\nand buffing."), Spacer(), Section("Salvage Timers (ms) - First / Fast"), Int("Open (First)", s => s.SalvageOpenDelayFirstMs, (s, v) => s.SalvageOpenDelayFirstMs = v, 0, 5000, 50), diff --git a/src/RynthCore.Engine/UI/Panels/SettingsPanel.cs b/src/RynthCore.Engine/UI/Panels/SettingsPanel.cs index e5abf9d..a7cf1f6 100644 --- a/src/RynthCore.Engine/UI/Panels/SettingsPanel.cs +++ b/src/RynthCore.Engine/UI/Panels/SettingsPanel.cs @@ -334,7 +334,18 @@ internal static class SettingsPanel case SettingKind.Spacer: return Spacer(); case SettingKind.Button: - return ButtonRow(row.Label, row.ButtonText ?? row.Label, () => row.Click?.Invoke(), row.Tooltip); + return ButtonRow(row.Label, row.ButtonText ?? row.Label, () => + { + // A settings edit is pushed like a typed value; the tab is rebuilt so the + // number boxes show the new values. + if (row.Edit != null) + { + row.Edit(state.Data); + Push(state); + state.Rebuild?.Invoke(); + } + row.Click?.Invoke(); + }, row.Tooltip); case SettingKind.TraceCategories: return TraceCategoriesRow(state, row); case SettingKind.Text: diff --git a/tools/LauncherSettingsTests/Program.cs b/tools/LauncherSettingsTests/Program.cs index 104b00f..e116897 100644 --- a/tools/LauncherSettingsTests/Program.cs +++ b/tools/LauncherSettingsTests/Program.cs @@ -382,6 +382,50 @@ internal static class Program Check(!File.Exists(swap.LivePath), "live file removed so the game writes its defaults"); }); + // ── First Login dialog rules (a new server: no password, no characters yet) ── + Scenario("first login on a new server", root, () => + { + var withPw = new LaunchAccountProfile { Id = "ilt", AccountName = "silentkelpie" }; + withPw.SetPassword(Pw); + var noPwSame = new LaunchAccountProfile { Id = "other", AccountName = "SilentKelpie" }; + var conquest = new LaunchAccountProfile { Id = "new", AccountName = "SK", CharacterName = LaunchAccountProfile.NoneOption }; + var all = new List { withPw, noPwSame, conquest }; + + Check(FirstLoginRules.KnownAccountNames(all, "new").SequenceEqual(new[] { "silentkelpie" }), + "known names: the others, distinct ignoring case, not this profile's own"); + + Check(FirstLoginRules.SavedPasswordSource(all, "SILENTKELPIE", "new")?.Id == "ilt", + "the same name with a saved password can be reused (case ignored)"); + Check(FirstLoginRules.SavedPasswordSource(all, "SK", "new") == null, "a new name has none to reuse"); + Check(FirstLoginRules.SavedPasswordSource(all, "silentkelpie", "ilt") == null, "never the profile itself"); + + var copy = new LaunchAccountProfile { AccountName = "silentkelpie" }; + copy.CopyPasswordFrom(withPw); + Check(copy.PasswordProtected == withPw.PasswordProtected && copy.TryGetPasswordForLaunch(out string reused, out _) && reused == Pw, + "reuse copies the encrypted blob, and it decrypts"); + + var none = new List(); + List firstChoices = FirstLoginRules.LoginChoices(none, conquest.CharacterName); + Check(firstChoices.SequenceEqual(new[] { FirstLoginRules.StopAtCharacterSelect }), + "no characters yet: only stop at character select (the old (None) isn't listed)"); + Check(FirstLoginRules.CharacterNameFor(FirstLoginRules.StopAtCharacterSelect, none) == "", + "stop with none known saves \"\" so the first character created is picked next time"); + + var chars = new List { "Alpha", "Beta" }; + Check(FirstLoginRules.LoginChoices(chars, "Gamma").SequenceEqual(new[] { FirstLoginRules.StopAtCharacterSelect, "Gamma", "Alpha", "Beta" }), + "several characters: all listed, the saved one kept even if not seen yet"); + Check(FirstLoginRules.CharacterNameFor("Beta", chars) == "Beta", "picking a character saves it"); + Check(FirstLoginRules.CharacterNameFor(FirstLoginRules.StopAtCharacterSelect, chars) == LaunchAccountProfile.NoneOption, + "stop with characters known saves the explicit (None)"); + + Check(FirstLoginRules.Problem("SK", "", "", false, AcEmulatorKind.Ace)?.StartsWith("Enter the password") == true, "a password is required"); + Check(FirstLoginRules.Problem("SK", "a", "b", false, AcEmulatorKind.Ace)?.Contains("don't match") == true, "the confirmation must match"); + Check(FirstLoginRules.Problem("SK", "pw", "pw", false, AcEmulatorKind.Ace) == null, "name + matching password: ready"); + Check(FirstLoginRules.Problem("silentkelpie", "", "", true, AcEmulatorKind.Ace) == null, "reusing a saved password needs no typing"); + Check(FirstLoginRules.Problem("a:b", "pw", "pw", false, AcEmulatorKind.Gdle) != null, "GDLE name with a colon refused"); + Check(FirstLoginRules.Problem("", "pw", "pw", false, AcEmulatorKind.Ace) != null, "a name is required"); + }); + // A kill while createdump.exe / WerFault.exe writes a client's crash dump cuts the dump // short; the launcher's kills wait for the writer, then Grace more, at most MaxHold. Scenario("crash dump writers: which client a command line names", root, () =>