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/Changelog/2026-10-14-sk-engine-work-through-10-13.md b/Changelog/2026-10-14-sk-engine-work-through-10-13.md new file mode 100644 index 0000000..7305841 --- /dev/null +++ b/Changelog/2026-10-14-sk-engine-work-through-10-13.md @@ -0,0 +1,80 @@ +# SK engine and UI work through 2026-10-13, on 2026.10.13.3 + +Everything from SK's build since the 2026-10-11 batch that main doesn't have yet, merged onto +release 2026.10.13.3 with the conflicts resolved. Goes with RynthSuite's +`Changelog/2026-10-14-sk-rynthai-work-through-10-13.md`. + +Left out on purpose: SK's local installer scripts and release records, `.github` and +`.gitignore` edits for SK's fork, `BUILD.md` notes about SK's release script, and the +per-release changelogs (this file sums them up). + +## Merge notes for 2026.10.13.3 + +- **Plugin API v86.** 2026.10.13.3 took v84 for `GetObjectProperties`, so SK's additions follow it: + - v85: `ArmConfirmationFn`, `GetLastConfirmationFn` (craft-chance and other confirmation prompts); + - v86: `GetServerStateJsonFn` (the engine's server verdicts for plugins). +- `PluginContractVersion.Current` and `RynthCoreSdkApiVersion` are 86. In the SDK, + `HasConfirmationAnswers` needs v85+ and `HasGetServerStateJson` v86+. +- `tools/PluginManifestTests` checks the slot order (`GetObjectProperties` before `ArmConfirmation`). +- Plugins built against an older SK SDK must be rebuilt. + +## Confirmation answers (v85) + +- `Compatibility/ConfirmationResponder.cs` (new) binds `CM_Character::Event_ConfirmationResponse` + by byte pattern. `SmartBoxHooks` hands each ConfirmationRequest (game event 0x0274) to it. +- A plugin arms one answer (`ArmConfirmation`); the next matching prompt is answered and the result + is readable with `GetLastConfirmation`. Unarmed prompts go to the client as before. +- Char menu > Crafting opens RynthAi's Crafting tab. + +## One plugin per server, server verdicts (v86) + +- **Server plugins.** A plugin's manifest can name a server (id, hosts, world names). + `PluginManifestGate.SelectServerPlugins` loads only the matching server's plugin; with no match + every server plugin loads (fail-open). +- **Server verdicts.** The engine decides which servers are active (built-in ILT and Aelrynth, plus + every server a plugin declares) and exports them as JSON through `GetServerStateJson`. +- **Per-character override.** `ServerForce` / `ServerForceStore` save Auto, On or Off per + character; `/rc server auto|on|off` and a server picker in Options > Diagnostics set it. +- **Diagnostics server list.** `ServerMenus.Tick` runs every frame, bar or rail, so the list fills + in and each server plugin gets its "servermenu" verdict. Server plugins the gate skipped are + listed as "installed but not loaded"; forcing one On loads only that plugin on the pump thread + (`PluginManager.ServerPlugins.cs`, `UI/Sections/NotLoadedServers.cs`). +- **Launcher.** The Server Profile dialog has a known-server picker + (`src/RynthCore.App/KnownServerCatalog.cs`). +- `IltInfo.Refresh` logs its verdict at Info once per world (`RynthLog.Milestone`). + +## Mini Remote sections + +- `SectionRegistry`, `SectionCatalog` and the sections rail: each section draws the engine panels + that belong to it as tabs, then one collapsing group per active server. Plugins add sections + through `RynthPluginGetSectionsJson`. +- With the rail hidden, the plugin tabs come back in RynthAi's tab bar. +- "Char" is now "Session Stats" (the id stays `char`). Character and Charms moved to RynthOracle, + Banking to RynthInventory's Global Inventory. +- Char menu: Fellowship, and the quests open RynthOracle. The separate Hub launcher is removed + (the Mini Remote button, `/rc miniremote` and Char > Mini Remote open the same window). + +## Panels and settings + +- **Items panel:** weapons colored by damage type (UB-ILT palette, `DamageTypeColors`). +- **Progression:** one Attributes section; Infinite Leaftide's infinite attributes appear under the + retail XP costs when RynthILT reports them. +- **Settings and Damage panel:** environment-hit throttle for missile and magic (move closer, new + target or off) and per-monster attack power (High, Reckless, Variable, Reckless + Variable, with + `VariablePowerMin` / `VariablePowerMax`). +- **Session stats:** the luminance total behind luminance per hour is in the status JSON + (`luminanceSession`, additive). + +## Security review fixes + +- **A `%` in shown text could crash the client.** `ImGui/SafeImGui.cs` doubles every `%` before + ImGui formats it; 246 calls in 39 engine files use it. +- **Spoofed server replies.** The engine's own `/mastery-data` and `/mule-data` readers skip player + chat types (`Net/ChatOrigin.cs`), and the vault wire needs its marker at the start of the line. +- **StatusAgent 1.0.1:** hardening of the status server before it is opened to other PCs. + +## Tests + +- `tools/PluginManifestTests` (236 assertions), `tools/SectionsTests` (148 checks), + `tools/ObjectPropertyTests`, `EngineSettingsTests`, `LauncherSettingsTests`, `NetMessageTests`, + `StatusAgentTests`: all pass on this commit. diff --git a/docs/ACCLIENT_HOOK_INVENTORY.md b/docs/ACCLIENT_HOOK_INVENTORY.md new file mode 100644 index 0000000..0251747 --- /dev/null +++ b/docs/ACCLIENT_HOOK_INVENTORY.md @@ -0,0 +1,91 @@ +# ACClient Hook Inventory + +This file tracks RynthCore hook targets against the user's real AC client binary, with the AC client decompile used for semantics and the live binary used as the source of truth for hook placement. + +## Client Fingerprint + +- Path: `C:\Turbine\Asheron's Call\acclient.exe` +- File size: `4,841,472` bytes +- SHA256: `BCA95BBEBED4B9ED1FF09D0DA83144E2FC4208F63AD7ADA5CB47C3CA207CCBA9` +- PE machine: `0x014C` (`x86`) +- PE image size: `0x0056D000` + +## Rules For This Inventory + +- Use the decompile to understand semantics, call order, and callback behavior. +- Use the live `acclient.exe` to derive patterns, validate uniqueness, and choose the real hook address. +- Do not ship fixed RVAs from the decompile unless they have been validated against the live binary. +- Prefer hooking the AC client function that already implements the desired behavior over lower-level memory access. +- Every production hook should eventually have: + - a primary binary pattern + - at least one fallback pattern or alternate seam when practical + - runtime validation + - an explicit unsupported-state log/UI message + +## Priority Inventory + +### Lifecycle And UI + +| Surface | Decompiled seam | Actual-binary plan for this client | Status | Priority | +| --- | --- | --- | --- | --- | +| `OnLoginComplete` | `CPlayerSystem::SendLoginCompleteNotification` in `CPlayerSystem.cpp:4017-4031` | Pattern-scan the containing function using the unique `SetDisplayInventory(1)` plus `BroadcastGlobalMessage(..., 0xB, 0)` sequence, then hook the containing `thiscall` function. | Live in RynthCore | P0 | +| `OnUIInitialized` | `ClientUISystem::OnStartup` in `ClientUISystem.cpp:48` and `APIManager::SetUIReady(1)` in `APIManager.cpp:134` | Hook the tiny `OnStartup -> SetUIReady(1)` wrapper or the `SetUIReady(1)` transition path. Prefer the wrapper if the pattern is unique in the live binary. | Not implemented | P0 | +| `OnBusyCountIncremented` | `ClientUISystem::IncrementBusyCount` in `ClientUISystem.cpp:630` | Hook the wrapper that increments `m_cBusy` and updates cursor state when crossing `0 -> 1`. | Not implemented | P1 | +| `OnBusyCountDecremented` | `ClientUISystem::DecrementBusyCount` in `ClientUISystem.cpp:641` | Hook the wrapper that decrements `m_cBusy` and updates cursor state when crossing `1 -> 0`. | Not implemented | P1 | + +### Chat And Command + +| Surface | Decompiled seam | Actual-binary plan for this client | Status | Priority | +| --- | --- | --- | --- | --- | +| `OnChatWindowText` | `ClientSystem.cpp:108` | Hook the function that allocates a BSTR from `i_text`, calls `GetACPlugin()->OnChatWindowText`, then checks `bEat` before continuing UI output. | Ready for binary patterning | P0 | +| `OnChatBarEnter` | `ClientCommunicationSystem.cpp:14407` | Hook the function that allocates a BSTR from the entered line, calls `GetACPlugin()->OnChatBarEnter`, and returns early when the plugin consumes the line. | Ready for binary patterning | P0 | + +### World, Target, And Object Flow + +| Surface | Decompiled seam | Actual-binary plan for this client | Status | Priority | +| --- | --- | --- | --- | --- | +| `OnDeleteObject` | `ACCObjectMaint::DeleteObject` in `ACCObjectMaint.cpp:73-85` | Hook the clean wrapper that checks `APIIsReady`, calls `OnDeleteObject`, then calls `ACCWeenieObject::SetCorpseDeleted` and `CObjectMaint::DeleteObject`. | Ready for binary patterning | P0 | +| `OnSelectedTargetChange` | `ACCWeenieObject.cpp:710` and `ACCWeenieObject.cpp:1997` | Hook the selected-target setter path after `CM_UI::SendNotice_SelectionChanged` and before the direct plugin callback. | Ready for binary patterning | P0 | +| World/object dispatch | `ACSmartBox::DispatchSmartBoxEvent` in `ACSmartBox.cpp:37-171` | Hook the SmartBox dispatch seam as the high-value world/object/network filter layer. This is the likely replacement for many WorldFilter-style surfaces. | Ready for binary patterning | P0 | +| Object creation | `ACCObjectMaint::CreateObject` in `ACCObjectMaint.cpp:196` | Hook the object creation wrapper for higher-level object lifecycle callbacks when we need richer data than a raw SmartBox event. | Ready for binary patterning | P1 | +| Object inventory updates | `ACCObjectMaint::UpdateObjectInventory` in `ACCObjectMaint.cpp:377` | Hook the inventory update path for container/item-change compatibility events. | Ready for binary patterning | P1 | +| Update/create/delete server dispatch | `CM_Physics::DispatchSB_CreateObject`, `DispatchSB_UpdateObject`, `DispatchSB_DeleteObject` in `CM_Physics.cpp` | Use as fallback seams if the outer SmartBox dispatcher proves too broad or unstable. | Decompile-confirmed | P1 | + +### Combat And Trade + +| Surface | Decompiled seam | Actual-binary plan for this client | Status | Priority | +| --- | --- | --- | --- | --- | +| `OnCombatModeChange` | `ClientCombatSystem.cpp:1564` | Hook the branch that invokes the plugin callback after the combat mode change resolves and auto-targeting logic runs. | Ready for binary patterning | P1 | +| Trade window opened | `ClientTradeSystem.cpp:525` | Hook `Handle_Trade__Recv_RegisterTrade` after `CM_Trade::SendNotice_RegisterTrade` and before the internal attempt-to-trade follow-up. | Ready for binary patterning | P1 | +| Trade item added | `ClientTradeSystem::Handle_Trade__Recv_AddToTrade` in `ClientTradeSystem.cpp:560+` | Hook the direct wrapper that calls `CM_Trade::SendNotice_AddItemToTrade` and then `OnTradeWindowItemAdded`. | Ready for binary patterning | P1 | +| Trade completed | `ClientCommunicationSystem.cpp:3106` | Hook the message-switch case for `0x529` (`Trade Complete!`) that directly invokes `OnTradeCompleted`. | Ready for binary patterning | P1 | +| Trade accept/decline/close/clear | `ClientTradeSystem.cpp` | Hook the direct trade-system wrappers that invoke the corresponding plugin callback. | Decompiled seam confirmed, binary anchor still needed | P1 | + +## Host Call Surface To Expose Through RynthCore + +These are not plugin callback hooks, but they are part of the host API surface we should expose once the callback layer is in place. + +| API surface | Decompiled seam | Notes | Priority | +| --- | --- | --- | --- | +| `WriteToChat` | `APIManager__IAsheronsCallImpl.cpp` | Safe early host helper. | P0 | +| Selection get/set | `APIManager__IAsheronsCallImpl.cpp` | Pairs naturally with target-change callbacks. | P0 | +| `UseObject`, `UseObjectOn`, `UseEquippedItem` | `APIManager__IAsheronsCallImpl.cpp` | Good interaction helpers once lifecycle is stable. | P1 | +| `MoveItemExternal`, `MoveItemInternal` | `APIManager__IAsheronsCallImpl.cpp` | Useful once inventory callbacks exist. | P1 | +| `IsStandingStill`, `StopCompletely`, `TurnToHeading`, `SetAutoRun` | `APIManager__IAsheronsCallImpl.cpp` | Movement helper layer. Some of this already overlaps with existing RynthCore action hooks. | P0 | +| `GetCurCoords`, `GetPlayerID`, `GetGroundContainerID` | `APIManager__IAsheronsCallImpl.cpp` | Good basic state helpers. | P0 | +| `GetScreenDimensions`, `ItemIsKnown`, `GetItemName` | `APIManager__IAsheronsCallImpl.cpp` | Low-risk host helpers. | P1 | +| `IssueChatBarCommand` | `APIManager__IAsheronsCallImpl.cpp` | Treat as stub-like until runtime behavior is validated against the live client. | Hold | +| `GetCombatMode`, `GetBusyCount`, salvage panel APIs | `APIManager__IAsheronsCallImpl_vtbl.cpp` | Declared but not yet fully validated in the split. | Hold | + +## Implementation Waves + +1. Finish lifecycle/UI: `OnLoginComplete`, `OnUIInitialized`, busy count. +2. Add chat interception: `OnChatWindowText`, `OnChatBarEnter`. +3. Add world/object seams: SmartBox dispatch, delete/create/inventory, selected target. +4. Add combat/trade callbacks. +5. Expose the confirmed `IAsheronsCall` subset through RynthCore-native host APIs. + +## Notes + +- The split decompile is still very useful, but the login-complete work already showed that its function RVAs do not always line up with the user's live client binary. +- For this reason, future hook work should be tracked here first against the fingerprint above, then implemented in RynthCore with pattern scanning rather than fixed addresses. diff --git a/src/RynthCore.App.Avalonia/AccountProfileDialog.axaml b/src/RynthCore.App.Avalonia/AccountProfileDialog.axaml index f81b037..90798db 100644 --- a/src/RynthCore.App.Avalonia/AccountProfileDialog.axaml +++ b/src/RynthCore.App.Avalonia/AccountProfileDialog.axaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="RynthCore.App.Avalonia.AccountProfileDialog" Width="600" - Height="620" + Height="720" CanResize="False" WindowStartupLocation="CenterOwner" Title="Account Profile" @@ -24,6 +24,9 @@ + + + diff --git a/src/RynthCore.App.Avalonia/AccountProfileDialog.axaml.cs b/src/RynthCore.App.Avalonia/AccountProfileDialog.axaml.cs index 8ec66c6..3a99a11 100644 --- a/src/RynthCore.App.Avalonia/AccountProfileDialog.axaml.cs +++ b/src/RynthCore.App.Avalonia/AccountProfileDialog.axaml.cs @@ -12,11 +12,21 @@ internal partial class AccountProfileDialog : Window { private readonly LaunchAccountProfile _profile; private readonly List _servers; + private readonly Func> _knownCharactersFor; - public AccountProfileDialog(LaunchAccountProfile profile, List servers) + private List _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; + + /// (account name, server name) -> the characters known for it. + public AccountProfileDialog(LaunchAccountProfile profile, List servers, + Func> 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(); } + /// Lists the characters known for the account on the chosen server in "Log in as". + 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 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(); diff --git a/src/RynthCore.App.Avalonia/FirstLoginDialog.axaml b/src/RynthCore.App.Avalonia/FirstLoginDialog.axaml new file mode 100644 index 0000000..7ae22cf --- /dev/null +++ b/src/RynthCore.App.Avalonia/FirstLoginDialog.axaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +