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-15-dat-share-private-createfilew-slot-2026.10.5.64.md b/Changelog/2026-10-15-dat-share-private-createfilew-slot-2026.10.5.64.md new file mode 100644 index 0000000..0d89b2e --- /dev/null +++ b/Changelog/2026-10-15-dat-share-private-createfilew-slot-2026.10.5.64.md @@ -0,0 +1,65 @@ +# 2026.10.5.64 - engine: second client can open the DAT files again (2025 client) + +Previous release: 2026.10.5.62. + +## Problem + +With "Allow multiple clients" on, only the first client started. Every client launched after it +(Silentstorm, SK, ...) showed "Can't open the data files. Check that they exist and that you +have permission to write to them. The program will now exit." about half a second after the +engine loaded. + +The 2025 client (`C:\Turbine\Asheron's Call-ryn\ACClient.exe`, 0.0.11.6096) does not import +`kernel32!CreateFileW`. A Layer-for-Unicode style stub at `0x006B8D00` looks it up on first use +and stores it in a private slot at `0x00837374`, and AC opens every DAT file through that slot. + +- Up to 2026.10.5.60 the DAT share hook detoured the kernel32 export, so it caught those opens. + The log showed them as `Compat: DAT share - W [filtered]: client_portal.dat ... share=0x1->0x7`. +- 2026.10.5.61 moved the hook to the import tables of `acclient.exe` and `MSVCR70.dll`, to keep + Direct3D and drivers out of it. The private slot is in no import table, so from .61 on no DAT + open was rewritten. The `W [filtered]` lines stopped appearing. +- The first client then opened the DATs read/write and denied writes to everyone else + (`share=0x1`). A second client's own read/write open failed with a sharing violation. + +Confirmed on the running client: the three import slots pointed at the engine's detours, but the +private slot `0x00837374` still held `kernel32!CreateFileW`. + +## Change + +- The DAT share hook also finds acclient.exe's private CreateFileW/CreateFileA slots, then points + them at the same detours. Uninstall restores them like the import slots. +- The slots are found by the stub's full byte pattern, not a fixed address: + - push slot, push the function name, push "kernel32.dll", call the resolver, then + `jmp [slot]` through the same slot; + - the name must stand alone ("MyCreateFileW" does not count); + - the DLL operand must name kernel32.dll. +- If the slot hasn't been resolved yet (it still points at its stub), the detour calls + `kernel32!CreateFileW` directly, because calling the stub would overwrite the slot. +- Direct3D, drivers, the runtime and plugins still call CreateFile without the engine in the way. +- The startup log lists the slot, for example + `Compat: DAT share - hooked acclient.exe!CreateFileW private slot (stub 0x006B8D00) (slot 0x00837374, was 0x76ACEA10).` + With multi-client on, the `W [filtered]: client_portal.dat` lines come back. + +## Code + +- `src/RynthCore.Engine/Compatibility/LazyImportSlotScanner.cs` (new): reads the section table + of a mapped image and finds the stubs (`ReadSections`, `FindSlots`). +- `src/RynthCore.Engine/Compatibility/DatFileShareHooks.cs`: + - `HookLazySlots` hooks the private slots; + - `HookSlot` builds the A/W detour for import slots and private slots alike; + - the log line names the kind of slot. +- `tools/DatShareSlotTests` (new), 20 checks: + - synthetic stubs; + - near misses that must not match (another jmp slot, another DLL, a longer name, no call, a + slot outside the image, a lone push of the name); + - the real 2025 client: slot `0x00837374`, stub `0x006B8D00`, no CreateFileA slot. + +## Tests + +- `dotnet run -c Release --project tools\DatShareSlotTests`: 20 checks, 0 failed. +- `dotnet build src\RynthCore.Engine -c Release`: 0 errors, no new warnings. + +## Before updating + +Close the other clients first. A client already running on .61/.62 holds the DATs deny-write, +so a new client can't start alongside it until it is closed, even on .64. diff --git a/Changelog/2026-10-15-nav-settings-breadcrumbs-route-overlay-2026.10.5.62.md b/Changelog/2026-10-15-nav-settings-breadcrumbs-route-overlay-2026.10.5.62.md new file mode 100644 index 0000000..4464622 --- /dev/null +++ b/Changelog/2026-10-15-nav-settings-breadcrumbs-route-overlay-2026.10.5.62.md @@ -0,0 +1,45 @@ +# Breadcrumbs and Route overlay on Settings > Navigation (2026.10.5.62) + +Date: 2026-10-15 + +| Component | Version | Previous release | +|---|---|---| +| RynthCore.Engine | 2026.10.5.62 | 2026.10.5.61 | + +## What's new + +Settings > Navigation now has the Nav panel's two overlay switches, at the top of "Nav Marker +Display": + +- **Breadcrumbs**: record the trail you walk and draw it on the ground (`/ra navtrail on|off`). +- **Route Overlay**: draw the route in the world, meaning the waypoint rings and lines, the + waypoint labels and the guide line (`/ra navoverlay on|off`). + +They are the same switches as on the Nav panel, not copies. A change in either place shows in the +other: + +- The Nav panel's toggle also asks the Settings page to fetch again. It updates the Nav panel's + own settings copy too, so a nav point reach saved straight afterwards doesn't send the old value + back. +- A save from the Settings page also asks the Nav panel to fetch again. + +Both panels share the tooltips (`SettingsSchema.BreadcrumbsTip` and `RouteOverlayTip`). + +## Compatibility + +The new fields (`TrackBreadcrumbs` and `ShowRouteOverlay` in `RynthAiSettings`) are nullable. + +- **Older RynthAi:** it doesn't send them, so the two rows stay hidden, and a save sends null, + which RynthAi reads as unchanged. +- **RynthAi 0.5.70-legacy-ui or later:** sends and applies them. + +## Files + +- `src/RynthCore.Engine/UI/Data/SettingsData.cs`: the fields, the two rows, the shared tooltips, + and the Nav refresh after a save. +- `src/RynthCore.Engine/ImGui/Panels/NavFace.cs`: the shared tooltips and the local settings copy. +- `src/RynthCore.Engine/UI/Data/RynthAiData.cs`: a Settings refresh after each nav command. + +## Install + +The installer build (`installer\Build-Installer.ps1`) stamps the engine as 2026.10.5.62. diff --git a/installer/Publish-Update.ps1 b/installer/Publish-Update.ps1 index e124ea3..4c37329 100644 --- a/installer/Publish-Update.ps1 +++ b/installer/Publish-Update.ps1 @@ -43,7 +43,12 @@ param( # portals.tsv and locations.json from this folder. Only re-uploaded when the set changes # (its id is a hash of every file); otherwise the live feed's entry is carried over. [string]$NavDataDir = "C:\Games\RynthCore\NavData", - [switch]$SkipNavData # leave navdata out of this feed (launchers then keep what they have) + [switch]$SkipNavData, # leave navdata out of this feed (launchers then keep what they have) + # The World Map's optional sizes (RynthNav.Baker --map-world): worldmap-hd.rmap, worldmap-ultra.rmap and worldmap-p32.rmap from this + # folder are offered by the launcher as separate downloads ("mappacks" in the feed). Each is uploaded once under + # mappacks// and kept by later releases. Without this folder the live feed's packs are + # carried over unchanged, so a release that doesn't touch the maps never drops them. + [string]$MapPacksDir = "" ) $ErrorActionPreference = "Stop" @@ -144,6 +149,19 @@ foreach ($name in $suitePlugins) { Copy-Item "$rel\build\$name\RynthCore.Plugin.$name.dll" "$rel\plugins\" } +# Server plugins (Plugins\Shared\ServerPack; SilentKelpie's): one per game server, each loaded by the +# engine only for its own server. They go in the feed only, so the launcher offers each one under +# Available plugins for the player to install; not in RynthSuite-Plugins.zip or the installer. +$serverPlugins = "RynthAChard", "RynthAelrynth", "RynthColdeve", "RynthConquest", "RynthDerptide", "RynthDreamWeave", "RynthEversong", + "RynthFrostACE", "RynthFrostcull", "RynthLeafDawn", "RynthLeafdawning", "RynthPortalStorm", "RynthReefcull", "RynthSundering", "RynthThistlecrown" +foreach ($name in $serverPlugins) { + Step "Building $name (server plugin, feed only)" + $proj = Join-Path $RynthSuiteRoot "Plugins\RynthCore.Plugin.$name\RynthCore.Plugin.$name.csproj" + dotnet publish $proj -c Release "-p:Version=$Version" "-p:PublishDir=$rel\build\$name\" -v q -nologo + if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed for $name" } + Copy-Item "$rel\build\$name\RynthCore.Plugin.$name.dll" "$rel\plugins\" +} + Step "Packing RynthSuite-Plugins.zip" $zipRoot = "$rel\build\zip" foreach ($name in $suitePlugins) { @@ -202,12 +220,19 @@ Compress-Archive -Path "$zipRoot\*" -DestinationPath "$rel\RynthSuite-Plugins.zi $navData = $null $navZip = $null if (-not $SkipNavData) { - Step "RynthNav data (tiles, route graph, portals, Atlas, Town Network) from $NavDataDir" - $navFiles = @(Get-ChildItem $NavDataDir -File | Where-Object { $_.Name -match '^(nav_[0-9A-Fa-f]{4}\.tile|portals\.tsv|locations\.json|navgraph\.bin|townnet\.json)$' } | Sort-Object Name) + Step "RynthNav data (tiles, route graph, portals, Atlas, Town Network, World Map) from $NavDataDir" + $navFiles = @(Get-ChildItem $NavDataDir -File | Where-Object { $_.Name -match '^(nav_[0-9A-Fa-f]{4}\.tile|portals\.tsv|locations\.json|navgraph\.bin|townnet\.json|worldmap\.rmap|worldmap\.vec)$' } | Sort-Object Name) $tileCount = @($navFiles | Where-Object { $_.Extension -eq ".tile" }).Count if ($tileCount -eq 0) { throw "$NavDataDir has no tiles. Pass -NavDataDir, or -SkipNavData to publish without them." } # The long-range route graph (RynthNav.Baker --graph) must come from these very tiles: the # plugin ignores a graph whose tiles don't match (long gotos then walk the straight line). + # The World Map's picture (RynthNav.Baker --map --map-tiles from the dats; the terrain doesn't change between releases). + if (-not ($navFiles | Where-Object { $_.Name -eq "worldmap.rmap" })) { + Write-Warning "No worldmap.rmap in ${NavDataDir}: the World Map has no picture. Run: RynthNav.Baker --map --map-tiles --out and copy worldmap.rmap there." + } + if (-not ($navFiles | Where-Object { $_.Name -eq "worldmap.vec" })) { + Write-Warning "No worldmap.vec in ${NavDataDir}: the World Map has no buildings or roads. Run: RynthNav.Baker --map-vectors --out and copy worldmap.vec there." + } $graph = $navFiles | Where-Object { $_.Name -eq "navgraph.bin" } $newestTile = ($navFiles | Where-Object { $_.Extension -eq ".tile" } | Measure-Object LastWriteTimeUtc -Maximum).Maximum if (-not $graph) { Write-Warning "No navgraph.bin in ${NavDataDir}: long gotos will walk the straight line. Run: RynthNav.Baker --graph $NavDataDir" } @@ -255,6 +280,41 @@ if (-not $SkipNavData) { } } +# ── World map packs (optional sizes) ───────────────────────────────────────── +# key -> what the launcher shows; the file names are what RynthNav.Baker --map-world writes (extreme = --ppc 32, whose default name is worldmap-p32.rmap). +$mapPackDefs = [ordered]@{ + hd = @{ name = "HD"; file = "worldmap-hd.rmap"; description = "Sharper ground, roads, rooftops and trees." } + ultra = @{ name = "Ultra"; file = "worldmap-ultra.rmap"; description = "Very sharp: individual roofs and trees. Large download." } + extreme = @{ name = "Extreme"; file = "worldmap-p32.rmap"; description = "Every roof, road and tree in detail. Very large download (about 1 GB)." } + # (The 64 px "Maximum" map, worldmap-p64.rmap, is deliberately NOT here: it is for private use only and is never offered to players.) +} +$mapPacks = @() +$mapPackUploads = @() # files to put on the server: @{ Path; Remote; Sha } +if ($MapPacksDir) { + Step "World map packs from $MapPacksDir" + foreach ($key in $mapPackDefs.Keys) { + $def = $mapPackDefs[$key] + $f = Join-Path $MapPacksDir $def.file + if (-not (Test-Path $f)) { Write-Host " $($def.name): no $($def.file) here, not offered by this feed"; continue } + $sha = Sha256 $f + $id = $sha.Substring(0, 16) + $mapPacks += [ordered]@{ + key = $key; name = $def.name; file = $def.file + url = "$BaseUrl/mappacks/$id/$($def.file)" + size = [long](Get-Item $f).Length; sha256 = $sha; release = $release; description = $def.description + } + $mapPackUploads += @{ Path = $f; Remote = "mappacks/$id/$($def.file)"; Sha = $sha } + Write-Host (" {0}: {1:N1} MB, {2}" -f $def.name, ((Get-Item $f).Length / 1MB), $id) + } +} elseif ($liveManifest -and $liveManifest.mappacks) { + # Carried over from the live feed (ConvertFrom-Json): force the whole numbers back to integers. + $mapPacks = @($liveManifest.mappacks | ForEach-Object { + [ordered]@{ key = [string]$_.key; name = [string]$_.name; file = [string]$_.file; url = [string]$_.url; size = [long]$_.size + sha256 = [string]$_.sha256; release = [long]$_.release; description = [string]$_.description } + }) + Write-Host " map packs: $($mapPacks.Count) carried over from the live feed" +} + # ── 3. Manifest + signature ────────────────────────────────────────────────── Step "Writing and signing the manifest" $setup = Get-Item "$rel\RynthCore-Setup.exe" @@ -291,9 +351,11 @@ $plugins = foreach ($dll in Get-ChildItem "$rel\plugins\*.dll" | Sort-Object Nam size = $dll.Length sha256 = Sha256 $dll.FullName } - if ($pluginDescriptions[$pluginName]) { $entry.description = $pluginDescriptions[$pluginName] } - else { Write-Warning "No description for $pluginName - the launcher shows its own (or none). Add one to `$pluginDescriptions." } $pm = Get-RynthPluginManifest $dll.FullName + # The table first; a server plugin's own manifest description otherwise (its csproj's RynthPluginDescription). + if ($pluginDescriptions[$pluginName]) { $entry.description = $pluginDescriptions[$pluginName] } + elseif ($pm -and $pm.description) { $entry.description = [string]$pm.description } + else { Write-Warning "No description for $pluginName - the launcher shows its own (or none). Add one to `$pluginDescriptions." } if ($pm) { if ($pm.name -ne $pluginName) { throw "$($dll.Name): its manifest says '$($pm.name)', the feed would say '$pluginName'." } if ($pm.version -and $pm.version -ne $Version) { throw "$($dll.Name): its manifest is version $($pm.version), not $Version (stale build?)." } @@ -327,6 +389,7 @@ $manifest = [ordered]@{ plugins = @($plugins) } if ($navData) { $manifest.navdata = $navData } +if ($mapPacks.Count -gt 0) { $manifest.mappacks = @($mapPacks) } Set-Content "$rel\update.payload.json" ($manifest | ConvertTo-Json -Depth 5) -Encoding utf8NoBOM & (Join-Path $ScriptDir "Sign-Update.ps1") -PayloadPath "$rel\update.payload.json" -OutPath "$rel\update.json" -KeyDir $KeyDir if (-not (Test-Envelope "$rel\update.json" $trusted)) { throw "Signed feed does not verify against UpdateTrust.cs" } @@ -362,6 +425,23 @@ if ($navZip) { $navSum = " RynthNav-NavData.zip" } +# World map packs: content-addressed (the folder is the start of the file's SHA-256), so a pack already on the server +# is not sent again and an old release's URL keeps working. +foreach ($up in $mapPackUploads) { + $remoteFile = "$RemoteDir/$($up.Remote)" + ssh $SshHost "test -f '$remoteFile'" + if ($LASTEXITCODE -eq 0) { Write-Host " $($up.Remote): already on the server"; continue } + ssh $SshHost "mkdir -p '$(Split-Path $remoteFile -Parent | ForEach-Object { $_ -replace '\\','/' })'" + if ($LASTEXITCODE -ne 0) { throw "ssh mkdir for $($up.Remote) failed" } + scp -q $up.Path "${SshHost}:$remoteFile.part" + if ($LASTEXITCODE -ne 0) { throw "scp of $($up.Remote) failed" } + $got = (ssh $SshHost "sha256sum '$remoteFile.part'") -split '\s+' | Select-Object -First 1 + if ($got -ne $up.Sha) { ssh $SshHost "rm -f '$remoteFile.part'"; throw "Hash mismatch on the server for $($up.Remote) — feed NOT published" } + ssh $SshHost "mv -f '$remoteFile.part' '$remoteFile'" + if ($LASTEXITCODE -ne 0) { throw "Publishing $($up.Remote) failed" } + Write-Host " $($up.Remote): uploaded and hash-checked" +} + $remoteSums = ssh $SshHost "cd '$remoteRel' && sha256sum RynthCore-Setup.exe plugins/*.dll$navSum" $expect = @{ "RynthCore-Setup.exe" = $manifest.core.sha256 } if ($navZip) { $expect["RynthNav-NavData.zip"] = $navData.sha256 } 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +