Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6e8bb8dbf | ||
| 3fafd29133 | |||
| 8713c804ce | |||
| c7ef40224a | |||
| 8b09539bb6 | |||
| 7caafc72af | |||
| 7f1e7d5039 | |||
| 55e15c0ac4 | |||
| 7cb161cf44 | |||
| c68204f160 | |||
| 418d80bafb | |||
| abe0cee4de | |||
| 5ad460080c | |||
| 00ee01167e | |||
| b1c182b05d | |||
| 057bb66426 | |||
| 2546497f37 | |||
| 8cb74c7685 | |||
| 0bfe184288 | |||
| f9ae10d692 | |||
| 8728446a27 | |||
| f4246dbbd0 | |||
| 539a7a3e64 | |||
| 2be3668232 | |||
| c4efe5821d | |||
| b059db4ca2 | |||
| 5defb009a6 | |||
| 286abd1445 | |||
| 7439236e1d | |||
| 44074df011 | |||
| 605ec6f0e6 |
609 changed files with 80901 additions and 4662 deletions
2
BUILD.md
2
BUILD.md
|
|
@ -32,6 +32,8 @@ C:\Games\RynthSuite\<Plugin>\ ← each plugin as a managed assembly + its depend
|
|||
| Loader/Shim change, clients running | `scripts\Publish-EngineCoreClr.ps1` — the in-use copies are renamed aside; new launches get the new ones |
|
||||
| Installer | `installer\Build-Installer.ps1` (release plugins stay NativeAOT: the new engine loads them) |
|
||||
| Hot-reload test on a local server | `scripts\Test-ClrWorld.ps1 -Reloads 3` (see its header) |
|
||||
| Every offline test (RynthCore, RynthSuite, RynthServers) | `scripts\Run-AllTests.ps1` (`-Only <folder>` for one); `installer\Publish-Update.ps1` runs it and won't publish if one fails |
|
||||
| RynthAi in game (buffing, a kill, looting, missile crafting) | `scripts\Run-GameTest.ps1` (logs a test character in, runs RynthSuite's `GameTests\RynthSelfTest.af`, prints PASS / FAIL / SKIP; see its header) |
|
||||
| Why didn't a generation unload? | `tools\AlcRoots <pid>` (build it: `dotnet build tools\AlcRoots -c Release`) |
|
||||
|
||||
`-NativeAot` on `Deploy-RynthCore.ps1` and `Build-Installer.ps1` builds the old NativeAOT engine,
|
||||
|
|
|
|||
24
CONTRIBUTING.md
Normal file
24
CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Contributing to RynthCore
|
||||
|
||||
RynthCore is the hook layer: it injects into the client, reads the game, runs plugins and hosts their windows. Features belong to plugins (RynthSuite), and features for one game server belong to that server's plugin.
|
||||
|
||||
## What goes here
|
||||
|
||||
- Hooks into the client and readers of game state (objects, inventory, vitals, positions, chat, spells).
|
||||
- The plugin API (`src/RynthCore.PluginSdk`) and its versions: a new capability is a generic function every plugin can use.
|
||||
- The window host: the ImGui shell, panels and pop-outs, themes, fonts, the sections rail.
|
||||
- Services every plugin can use: settings files, status export, logging, hotkeys, the launcher and updater.
|
||||
|
||||
## What doesn't
|
||||
|
||||
- A feature of one plugin, including its screens: plugins draw their own windows with the engine's ImGui.
|
||||
- Anything for one game server: that server's plugin in RynthSuite.
|
||||
|
||||
When a plugin needs something the engine can't do yet, add the generic hook here and build the feature in the plugin.
|
||||
|
||||
## Pull requests
|
||||
|
||||
- One purpose per pull request; a change that spans RynthCore and RynthSuite comes as a pull request to each, the hook first.
|
||||
- Plugin API numbers and versions are assigned when a change is merged.
|
||||
- Add or update the offline checks under `tools/` where they exist.
|
||||
- Say in the description what you tested in game and on which server.
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# 2026.10.5.71 - SK port: Display chrome + Vaulted Dungeons Options gate
|
||||
|
||||
Previous release: 2026.10.5.70.
|
||||
|
||||
## Summary
|
||||
|
||||
Standing `sk` branch now carries tonight's local engine work for upstream release prep:
|
||||
|
||||
- **Settings > Display**: Borderless Windowed, Remember Open Windows and Positions, Save Layout Now (`AcWindowChrome`, EngineSettings, PanelStateStore).
|
||||
- **Settings > Navigation > Vaulted Dungeons**: Options checkbox (default off) that gates the Mini Remote ILT "Vaulted Dungeons" tab (paired with RynthSuite `sk` Ai/ILT).
|
||||
- Chat type **0x1C** recognized for ILT channel lines (ChatData).
|
||||
- Loot picker filter and related FaceKit / Mini Remote face polish from 2026.10.5.65–.70.
|
||||
|
||||
## Deploy note
|
||||
|
||||
Live clients load CoreCLR from `C:\Games\RynthCore\Runtime\`. Publish with
|
||||
`scripts\Publish-EngineCoreClr.ps1 -MsBuildArgs @('-p:Version=2026.10.5.71')`.
|
||||
60
Changelog/2026-10-18-bar-declutter.md
Normal file
60
Changelog/2026-10-18-bar-declutter.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# Bar declutter: Item Count and Skills off the bar, Inventory buttons, Skills under Oracle
|
||||
|
||||
Branch `feature/bar-declutter`, from `status-export`. Not deployed, not released. The idea and the first
|
||||
version are Silentkelpie's (rynth PR 6, "inventory bar declutter ... Skills under Oracle"); this takes the
|
||||
parts the owner approved and changes what the owner decided differently.
|
||||
|
||||
## Bar
|
||||
|
||||
- Item Count no longer has a bar icon. It opens from Inventory's Count button, `/rc itemcount`, and the
|
||||
Character menu.
|
||||
- Mini Remote keeps its bar icon (Silentkelpie removed it; it stays). Inventory gets a Remote button too, as
|
||||
an addition.
|
||||
- Skills leaves the bar only while RynthOracle provides the Skills / Attributes / Progress tabs. The icon
|
||||
shows whenever it does not: no Oracle window registered, or an Oracle that has never sent
|
||||
`/rc oracle-skills` (an older Oracle). Nobody loses the way in.
|
||||
|
||||
## Skills under Oracle
|
||||
|
||||
- `/rc oracle-skills <skills|attrs|progress|off>`: Oracle says which Skills body to embed in its window
|
||||
(`OracleSkillsEmbed`; the contract is unchanged from the PR). Any valid form also tells the engine that
|
||||
Oracle has the tabs. An Oracle that wants the Skills icon hidden before the player first opens the tab can
|
||||
send `/rc oracle-skills off` once at startup.
|
||||
- `/rc skills`, `/rc progression` and the Character menu's Skills line go to Oracle (`/ro skills`,
|
||||
`/ro progress`, `/ro attrs`) when its tabs are there, else open the standalone Skills panel as before.
|
||||
`/rc skills hide` closes Oracle only while it shows a Skills tab; `/rc skills toggle` closes it when it
|
||||
already shows Skills.
|
||||
- Fixed from the PR: the embed re-ran `SkillsFace.OnShown()` every two seconds and nothing ever called
|
||||
`OnHidden`, so the Progression subscription stayed on after Oracle left the tab. Now the face is shown
|
||||
once when the embed first draws and hidden once when it stops (`ShownLatch`): `/rc oracle-skills off`,
|
||||
Oracle's window closed or removed, the Oracle plugin unloaded, engine reload / shutdown, or no draw for
|
||||
a second (idle sweep). `OnShown` / `OnHidden` themselves are idempotent, so subscribing twice never
|
||||
registers twice.
|
||||
|
||||
## Inventory
|
||||
|
||||
- Modern header and Classic title bar get Mini Remote, RynthSort (`/rsort`), Item Count and Global Inventory
|
||||
(`/ginv`) buttons. The Character menu gets a Global Inventory line.
|
||||
- The PR's four text buttons were about 190 px wide: at the retail width (300, scale 1) they pushed the
|
||||
title to nothing and put Vault (Aelrynth) at about x=-44, off the panel. `UI/InventoryTitleLayout.cs`
|
||||
now lays the bar out: the size / tools / Modern toggles stay at the right, Vault next to them is always
|
||||
there, and the four buttons take the richest style that leaves the title 56 units: text (480 wide and
|
||||
up), icons (360, or retail without Vault), or one "..." menu (retail with Vault). The title is cut with
|
||||
an ellipsis to the room it has. The Modern header does the same with icons / menu / nothing and drops the
|
||||
item count text last.
|
||||
- Settings > Inventory Management > Floating HUDs tooltip says the floating pack count HUD is not the Item
|
||||
Count panel.
|
||||
|
||||
## Not taken from the PR
|
||||
|
||||
The in-world hot-reload hold, the chat combat filters (already merged), the Enlightenment calculator UI, his
|
||||
changelog files and version bumps.
|
||||
|
||||
## Files
|
||||
|
||||
- ImGui/Panels/ShownLatch.cs, OracleSkillsEmbed.cs, SkillsRouting.cs (new), SkillsFace.cs,
|
||||
ScriptWindowFace.cs, InventoryFace.cs, InventoryFace.Classic.cs, RynthAiFace.cs
|
||||
- ImGui/ImGuiBar.cs, ImGui/ImGuiPanelHost.cs (one idle-sweep line)
|
||||
- UI/InventoryTitleLayout.cs (new), UI/ScriptWindows/ScriptWindowRegistry.cs, UI/Data/SettingsData.cs
|
||||
- Compatibility/RynthCoreChatCommands.cs
|
||||
- Tests: `tools/BarDeclutterTests` (lifecycle balance, TabsAvailable rule, title layout grid)
|
||||
36
Changelog/2026-10-18-chat-link-probe-2026.10.18.25.md
Normal file
36
Changelog/2026-10-18-chat-link-probe-2026.10.18.25.md
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# 2026.10.18.25: /rc chatlinkprobe (toward coordinate links in AC's own chat) (2026-10-18)
|
||||
|
||||
**Kind:** Diagnostic (Engine). Previous: 2026.10.18.24 (test installer), 2026.10.18.15 (last engine hot build).
|
||||
|
||||
## Why
|
||||
|
||||
Coordinates are links in RynthChat (2026.10.17.2), but not in AC's own chat window. ub-IT and VirindiTank
|
||||
do it through Decal, which wraps coordinates in AC's clickable-name markup and catches the click with its
|
||||
`ChatNameClicked` hook. RynthCore must do this without Decal, and no public source names the acclient
|
||||
function that handles a click on a chat link. This probe finds that function by watching the client.
|
||||
|
||||
## What
|
||||
|
||||
`/rc chatlinkprobe [seconds|off]` (default 60 s, at most 600). While it runs:
|
||||
|
||||
- **Coordinates in AC's chat window become AC links.** Each pair is printed as
|
||||
`<Tell:IIDString:110011:42.1N, 33.6E>42.1N, 33.6E<\Tell>`, using the same link id as GoArrow and
|
||||
UtilityBelt. The rewrite happens only in what AC prints, through the engine's own chat hook (held
|
||||
lines, and lines printed at once on AC's main thread). Plugins and RynthChat still get each line as
|
||||
the server sent it. AC's own markup (players' names) is never rewritten.
|
||||
- **Every message to `gmMainChatUI::ListenToElementMessage` is logged** (up to 400 per run): its
|
||||
first 12 dwords, and any text they point at.
|
||||
|
||||
Nothing changes while the probe is off.
|
||||
|
||||
## How to use it
|
||||
|
||||
1. `/rc chatlinkprobe 120`
|
||||
2. Have coordinates appear in AC's chat, for example `/tell <yourself> 42.1N 33.6E`.
|
||||
3. Click the coordinates in AC's chat window, then click a player's name.
|
||||
4. Send the RynthCore log. The click's message tells the next build which call to hook so a click goes
|
||||
to RynthNav (arrow, or with Ctrl held a walk), with no Decal.
|
||||
|
||||
## Checks
|
||||
|
||||
Engine builds; ChatHoldTests, ChatCoordTests 49/49, ChatTellTests and ChatFilterTests pass.
|
||||
43
Changelog/2026-10-18-display-chrome.md
Normal file
43
Changelog/2026-10-18-display-chrome.md
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Settings > Display: Borderless Windowed, remembered windows, Save Layout Now
|
||||
|
||||
Branch `feature/display-chrome`, from `status-export`. Not deployed. From SilentKelpie's
|
||||
RynthCore PR 6 (the Display chrome piece only), with the changes below.
|
||||
|
||||
## What changed
|
||||
|
||||
- `UI/AcWindowChrome.cs` (Win32) and `UI/AcWindowChromePolicy.cs` (the decisions, pure and tested).
|
||||
- Settings > Display:
|
||||
- **Borderless Windowed** (`BorderlessWindowed`, default off): hides the Asheron's Call title bar and
|
||||
borders while staying windowed.
|
||||
- **Remember Open Windows and Positions** (`RememberWindowLayout`, default on, as panels have always
|
||||
been): off stops `panel_state.txt` being overwritten and stops panels reopening from the last session.
|
||||
- **Remember Game Window Position** (`RememberAcWindowPosition`, default off, new): saves the game
|
||||
window's position and size and puts it back after login.
|
||||
- **Save Layout Now**: writes open panels, the window position (if remembered), the Vision HUD and
|
||||
`imgui.ini` now.
|
||||
|
||||
## How it differs from the PR
|
||||
|
||||
- Chrome is only given back to a window this setting stripped. That is recorded on the window itself
|
||||
(an HWND property holding the style from before), so it survives an engine hot reload and ends with
|
||||
the process. With the setting off and no marker nothing is touched: exclusive fullscreen and external
|
||||
borderless tools are left alone.
|
||||
- The window rect is kept per client (`ac_window.<server-character>.txt`), written only when it
|
||||
changed (checked every 10 s, written by the background writer). Until a character is known nothing is
|
||||
restored or saved; after 90 s without one the shared `ac_window.txt` is used.
|
||||
- Nothing changes the window inside the render callback. EndScene only reads; style changes and the
|
||||
move/resize are posted to the game window's own WndProc (`Win32Backend.PostToGameThread`, as pop-out
|
||||
windows are created). Settings toggles go the same way. Without the ImGui backend (no WndProc
|
||||
subclass) the feature stays inactive.
|
||||
- An off-screen saved rect, a rect under 160x120 or a minimised/maximised/fullscreen-looking window is
|
||||
ignored. `PanelStateStore.Flush` no longer claims to be a no-op when remembering is off (it is an
|
||||
explicit save).
|
||||
- Not taken: Vaulted gate, chat 0x1C, hot-reload hold, bar declutter.
|
||||
|
||||
## Tests
|
||||
|
||||
`tools/EngineSettingsTests`: defaults and engine.json round trip for the three settings, the
|
||||
borderless decisions (setting off with no marker changes nothing; our marker restores; on strips once),
|
||||
off-screen / size limits, per-client file names, the rect file.
|
||||
|
||||
Not yet tested in game (windowed vs fullscreen, hot reload).
|
||||
53
Changelog/2026-10-18-engine-review-fixes.md
Normal file
53
Changelog/2026-10-18-engine-review-fixes.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# Engine review fixes (crash log size, dump safety, transition gate valve, AutoId)
|
||||
|
||||
RynthCore.SehTrampoline.dll native version 8 (previous: 7). Branch `fix/engine-review`, from
|
||||
`integration/pr-fixes-2026-10-18`. Not deployed.
|
||||
|
||||
## native-crash.log no longer grows without bound
|
||||
|
||||
- Decal's handled null-ref AV (about once a minute, one address) was written on every hit: the 30 s
|
||||
"relog" applied to noise too. About 1,440 entries a day, 5-6 KB each. Now a noise address repeats only
|
||||
at powers of two (about 11 entries a day for that address). The 30 s relog and the always-write for
|
||||
a non-AV code stay for genuine (AC-class) addresses, capped at `CLF_MAX_RELOGS` (16) per address.
|
||||
What a cap skips is still in the flush ring, so a fatal hit is recovered at exit.
|
||||
- A total byte budget per process (`CLF_MAX_LOG_BYTES`, 3 MB, counted from the file's size at install):
|
||||
past it ordinary entries stop after one marker line. Fatal entries (last chance, crash-exit flush)
|
||||
get 256 KB more.
|
||||
- `native-crash.log` is one file for every client, so `LogPaths.RotateAtStartup` (per-PID) never
|
||||
covered it. `LogPaths.RotateNativeCrashLogAtStartup` moves one over 1 MB to `native-crash.log.old`
|
||||
on the first engine generation, before the native side opens it.
|
||||
- Tests: `native/SehTrampoline/tests/Run-CrashLogFilterTests.ps1`.
|
||||
|
||||
## Full-memory OUT OF MEMORY dump: disk check and a cap across clients
|
||||
|
||||
`DumpBudget` (pure, tested): the volume must keep 2 GB free after the dump, and the full dumps already
|
||||
in the folder (any client) are capped at 4 files / 14 GB. The check and an empty placeholder file are
|
||||
made under one machine-wide mutex, so clients that hit the box together cannot all pass first. A refusal
|
||||
prunes older dumps once and asks again, else writes the small dump. The small dump (also the hang dump)
|
||||
needs 200 MB free.
|
||||
|
||||
## Crash dump on TerminateProcess / NtTerminateProcess is back (bounded)
|
||||
|
||||
7cbf69e removed the managed dump on a crash exit and relied on CoreCLR's `createdump`. Checked offline
|
||||
with a small CoreCLR host: `createdump` does run for a native AV that unwinds through a managed frame
|
||||
and for one that reaches the CLR's unhandled-exception filter. It does not run when AC's own handler
|
||||
catches a native AV and answers with TerminateProcess (no CLR frame, no CLR filter), and nothing else
|
||||
wrote a dump there. `ProcessExitHooks.DumpCrashOnce` writes one small dump on that path: after the
|
||||
native log flush, on its own thread with a 20 s wait, once per process, not when `clr_<pid>_*.dmp`
|
||||
exists, newest 5 kept.
|
||||
|
||||
## World-transition gate: safety valve and a setting
|
||||
|
||||
A gate held continuously for 120 s (`WorldTransitionState.MaxHoldMs`) opens by itself: logged once
|
||||
(`[Lifecycle] world-transition gate OPENED by its safety valve`), counted in the heartbeat as
|
||||
`gateov=N`, closed again when the raw transition ends. engine.json `TransitionGate` (default true;
|
||||
only a hand-set false is written) turns the gate off; it is read at client start.
|
||||
|
||||
## AutoId
|
||||
|
||||
- `AutoIdDrain`: when the 512-per-tick evaluation budget runs out with items left, the evaluated ones
|
||||
move to the back, so the next tick starts where this one stopped.
|
||||
- Identify data kept since a client release is dropped on re-create when the release was
|
||||
`ReleasedObjectRetention.StaleAfterMs` (2 min) or more ago (the client sends no updates for a released
|
||||
object). A short absence still keeps its data. The no-re-appraisal window after a release is
|
||||
therefore effectively 2 min rather than 10 for data freshness; tune the constant if that is too eager.
|
||||
65
Changelog/2026-10-18-enl-calculator.md
Normal file
65
Changelog/2026-10-18-enl-calculator.md
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
# Skills > Progression: Enlightenment calculator
|
||||
|
||||
Branch `feature/enl-calculator`, from `integration/pr-fixes-2026-10-18`. Not deployed, not released.
|
||||
The idea and the first version are Silentkelpie's (rynth PR 6, "Skills Progression: Enl calculator UI");
|
||||
this takes only the calculator UI and its data, checked against the producer, with its failure modes
|
||||
tightened.
|
||||
|
||||
## What it shows
|
||||
|
||||
On the Enlightenment section of the Progression tab, under the plan totals, an **Enl calculator**
|
||||
collapsible (open by default), drawn from what RynthILT's `AppendEnlCalculatorJson` sends:
|
||||
|
||||
- **Per-level table**: Enl, Item, Qty, Lum for each step of the plan. Green while the simulated stock still
|
||||
covers that step, amber after. The first 12 steps show; "Show all N steps" lists up to 100 in a table
|
||||
that scrolls on its own, so a long plan never stretches the panel.
|
||||
- **Still need / have**: luminance and each material.
|
||||
- **Sigil craft chain (301-325)**: the eight chain rows (craft rows tagged), with RynthILT's note.
|
||||
- Two lines under "Coins per token": the e-coins needed, and the luminance to buy them.
|
||||
|
||||
## Not changed
|
||||
|
||||
- Which luminance figure the Augmentation rows and the planners use. RynthILT's calculator simulates with
|
||||
its **banked** luminance (`Bank.Luminance`), not the character's; the footnote says "banked luminance"
|
||||
because that is what the numbers are (the PR's own text said "character", which the producer does not do).
|
||||
- Nothing else of the PR's commit: hot reload hold, bar declutter, Oracle embed, chat filters and the
|
||||
changelog / version files are handled elsewhere. The "Plan to level" label and the "Totals to plan:"
|
||||
heading from the PR are left as they were.
|
||||
|
||||
## Absence and bad data
|
||||
|
||||
- An older RynthILT / RynthAi, or a server without ILT, sends none of the fields: the arrays are empty, the
|
||||
strings empty, and the section and the two e-coin lines are not drawn.
|
||||
- The row arrays are read by tolerant converters (`UI/Data/EnlRowConverters.cs`). `null`, a non-array, a row
|
||||
that is not an object, a missing or mistyped field, unknown extra fields: that row (or just that field)
|
||||
falls back to its default and the rest of the snapshot parses. Before, any such `JsonException` would have
|
||||
turned the whole Progression snapshot into "unavailable" and hidden the Augmentation planner too. Rows
|
||||
are capped at 200 per array on parse; the table draws at most 100 level rows and 16 material / chain rows.
|
||||
- `ProgressionSource.ParseJson` is the one parse (the poll uses it).
|
||||
|
||||
## Width
|
||||
|
||||
The tables are 16 less than the panel, with the label column stretching and the number columns fixed
|
||||
(scaled down below the retail width of 300). Cell text wraps inside the cell instead of running off the
|
||||
panel; the notes wrap at the panel's own wrap position, like the rest of the section.
|
||||
|
||||
## Lifecycle
|
||||
|
||||
No new subscription: the calculator draws the Progression snapshot the Skills face already subscribes to in
|
||||
`ProgressionShown` / `ProgressionHidden`, so the `ShownLatch` show / hide balance of the embedded Skills face
|
||||
is unchanged. Row text (level, count, chain numbers, the "(craft)" label) is formatted once per snapshot,
|
||||
and the Show all button label only when its mode changes; nothing grows per frame.
|
||||
|
||||
## Files
|
||||
|
||||
- `UI/Data/ProgressionData.cs` (Enl calculator fields on `EnlPlanner`, `EnlLevelRow`, `EnlMaterialRow`,
|
||||
`EnlChainRow`, `EnlCalculatorView` limits, `ProgressionSource.ParseJson`)
|
||||
- `UI/Data/EnlRowConverters.cs` (new)
|
||||
- `ImGui/Panels/SkillsFace.Progression.cs`
|
||||
- Tests: `tools/EnlCalculatorTests` (new; the sample JSON follows `AppendEnlCalculatorJson`'s shape)
|
||||
|
||||
## Not verified
|
||||
|
||||
No live client and no live RynthILT data: how the tables render (column widths, wrapping at 300, the
|
||||
scrolling table) and the real numbers were not seen in game. The parse is tested against a sample built from
|
||||
the producer's code, not captured output.
|
||||
54
Changelog/2026-10-18-reload-hold-optin.md
Normal file
54
Changelog/2026-10-18-reload-hold-optin.md
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# Opt-in: hold engine reloads while in the world
|
||||
|
||||
Branch `feature/reload-hold-optin`, from `status-export`. Not deployed, not released. No native
|
||||
(`Loader.c`) change, so no loader version bump.
|
||||
|
||||
SilentKelpie's PR 6 (his 2026.10.16.3 / .5 "hold hot reloads while in-world") as a setting that is
|
||||
**off by default**, so a reload behaves exactly as before unless the player turns it on.
|
||||
|
||||
## Why
|
||||
|
||||
On his machine, stacked automatic hot reloads (the loader's file watcher, engine deploys) while logged
|
||||
in were crashing clients: the loader shut the engine down, then the CoreCLR re-init failed mid-flight.
|
||||
His fix held every reload, forever, until logout, and even a reload asked for by hand waited. That is
|
||||
too blunt as a default, so it is opt-in, bounded, and leaves hand reloads alone.
|
||||
|
||||
## What
|
||||
|
||||
- `engine.json` `HoldReloadInWorld` (default `false`; only a `true` is written; missing, or anything
|
||||
that is not a boolean, reads as `false`). Settings > Misc: "Hold reloads while in the world", with a
|
||||
tooltip, directly under "Background Identify".
|
||||
- On: an automatic engine reload waits, with the game still running on the old engine, until the player
|
||||
logs out or reaches character select (`ReloadInWorldGate`, polled every 2 s, "still in the world"
|
||||
logged every 30 s, one chat line). It runs in `RynthCoreShutdown` before the plugin (combat) deferral,
|
||||
so old and new loaders behave the same.
|
||||
- **Never forever.** `engine.json` `HoldReloadInWorldMaxMinutes` (default 10, valid 1-240; out of range
|
||||
is clamped, a non-number reads as 10; only a non-default value is written; Settings > Misc "Give up
|
||||
holding after (min)", shown while the hold is on). At the bound the hold logs once
|
||||
(`held N min, reloading anyway`) and the reload goes ahead.
|
||||
- **Hand reloads are never held.** ERl, the bar RL button, `/rc rl` and the hotkey set the existing
|
||||
hand-reload mark; the gate now honours it (`ShouldHold(byHand, ...)`; his version ignored `byHand`).
|
||||
A hand reload that arrives while an automatic one is being held ends the hold at the next poll and also
|
||||
skips the plugin deferral, like any hand reload. Switching the setting off mid-wait also releases it.
|
||||
- Fails open: a throwing query, setting read or gate counts as "do not hold".
|
||||
- Off: none of this runs; no wait and no new log line.
|
||||
|
||||
## Left out of the PR
|
||||
|
||||
- `Loader.c` ReloadWatcher poll and `RynthCoreMayHotReload` export (loader 2.2): the wait is done in the
|
||||
managed `Shutdown`, which the loader already calls on its reload thread (the same place the plugin
|
||||
deferral waits), so the native poll is redundant. It would also have needed its own bound in C, which
|
||||
could not be built or tested here.
|
||||
- `RequestManualReload` and the reroute of ERl / bar RL / `/rc rl` / hotkey: hand reloads are not held now.
|
||||
- The rest of that commit (inventory bar declutter, Oracle Skills embed, ...).
|
||||
|
||||
## Files
|
||||
|
||||
- `src/RynthCore.Engine/ReloadInWorldGate.cs` (new), `EntryPoint.cs`
|
||||
- `Plugins/EngineSettings.cs` (keys, owned-keys list), `UI/Data/SettingsData.cs` (Settings > Misc rows)
|
||||
- `tools/ReloadInWorldGateTests` (new, 44 checks), `tools/EngineSettingsTests` (round trip, clamp, defaults)
|
||||
|
||||
## Not verified
|
||||
|
||||
No live client: the actual deferral in a running world, the chat line, and the Settings rows were not
|
||||
exercised in game.
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
# sk: port of the SK test branch (RynthCore 2026.10.18.24) (2026-10-18)
|
||||
|
||||
Previous `sk` push: 2026-10-16 (2026.10.15.8 hot push and the Display chrome port).
|
||||
|
||||
One squashed commit puts everything on SK's test branch (`test/hotbuild-2026-10-16`, as merged onto
|
||||
aelrynth `main` 2026.10.17.1) onto the standing `sk` branch, so it reaches rynth in PR #6 like the
|
||||
rest of SK's work. It matches the 2026.10.18.24 test installer.
|
||||
|
||||
## How it was merged
|
||||
|
||||
- `sk` was first synced onto aelrynth `main` (2026.10.17.1; nothing dropped).
|
||||
- The test branch was squash-merged on top. Where both changed the same lines, the test branch won
|
||||
(its code is what testers ran). Changes only `sk` had were kept.
|
||||
- The places where both sides had added the same feature in different spots were cut down to the
|
||||
test branch's single copy:
|
||||
- Settings > Display's Borderless Windowed and Remember Window Layout settings;
|
||||
- the inventory title bar buttons, which are now the Vault button with a "more" menu;
|
||||
- the first-login launcher test.
|
||||
- The engine and every tool test build.
|
||||
|
||||
## What it brings (details in each Changelog file)
|
||||
|
||||
- **Inventory:** the Aelrynth Vault in the Classic and Modern looks (2026.10.18.14, .15).
|
||||
- **Loot:** the "Add to loot profile" attribute checklist for all gear, pet essences and cantrip
|
||||
tiers (2026.10.18.10).
|
||||
- **Graphics:** low-memory safeguard (2026.10.18.11), the graphics settings panel and per-account
|
||||
graphics (2026.10.18.1, .3).
|
||||
- **Window placement:** borderless, multi-client and placement fixes (2026.10.17.x).
|
||||
- **Chat:** coordinate links and the arrow; retail chat filters.
|
||||
- **Launcher:** DXVK toggle, server list scrolling, prefs swap, updater when ahead of the feed.
|
||||
- **Installer:** experimental plugins without their own `<Version>` get the release calver (no
|
||||
more 1.0.0), plus the test installers' release notes.
|
||||
- **Earlier fork work** the test branch carried since the 2026-10-04 SK merge, as listed under
|
||||
`Changelog/`.
|
||||
38
Changelog/2026-10-18-vaulted-dungeons-setting.md
Normal file
38
Changelog/2026-10-18-vaulted-dungeons-setting.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Settings > Navigation: Vaulted Dungeons master switch
|
||||
|
||||
Branch `feature/vaulted-setting`, from `integration/pr-fixes-2026-10-18`. Not deployed, not released.
|
||||
Pairs with RynthSuite `feature/vaulted-dungeons` (the keeper itself).
|
||||
|
||||
From SilentKelpie's RynthCore PR 6 (commit 3), the Vaulted Dungeons row only. The Display chrome and
|
||||
the chat 0x1C part of that commit are already merged.
|
||||
|
||||
## What
|
||||
|
||||
- Settings > Navigation, section "Infinite Leaftide": **Vaulted Dungeons**, off by default. It is the
|
||||
master switch of RynthILT's Vaulted Dungeons keeper (Infinite Leaftide / ACECustom only): off, the
|
||||
keeper does nothing (no recalls, no `/rc quit`, no Mini Remote tab, a saved On or Auto Start ignored);
|
||||
turning it off while it runs stops it at once.
|
||||
- The setting is **RynthAi's** (`EnableVaultedDungeons` in the RynthAi profile, per character). The
|
||||
engine keeps no copy: `RynthAiSettings.EnableVaultedDungeons` in `UI/Data/SettingsData.cs` is only
|
||||
the mirror of RynthAi's settings payload, like every other row. RynthILT reads the switch from RynthAi
|
||||
(`RynthAi.Hub` `VaultedDungeonsEnabled`), so there is exactly one source of truth.
|
||||
- The mirror is nullable, as the Nav panel's switches are: a RynthAi that predates the setting omits it,
|
||||
the row stays hidden, and a save sends `null`, which RynthAi leaves alone (his version used a plain
|
||||
`bool`, which would have written `false` over the switch).
|
||||
|
||||
## Left out of the PR
|
||||
|
||||
- The rest of that commit (already merged, or separate decisions): Variable Power and Hitting the
|
||||
Environment rows, the changelog notes, the installer version files.
|
||||
|
||||
## Files
|
||||
|
||||
- `src/RynthCore.Engine/UI/Data/SettingsData.cs`
|
||||
- `tools/VaultedSettingTests` (new, 22 checks): the mirror's JSON (absent, false, true, case), the
|
||||
Navigation row (one, a checkbox, hidden until RynthAi sends the value, reads Off by default, edits
|
||||
only that property, tooltip). It loads the built engine assembly and reaches the internal types by
|
||||
reflection (`SettingsData.cs` has no standalone compile seam).
|
||||
|
||||
## Not verified
|
||||
|
||||
No live client: the row in the Settings window, and the keeper's reaction to the switch (RynthSuite side).
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
# Engine 2026.10.18.30: automated system text shows in the System tab only (2026-10-19)
|
||||
|
||||
Previous release: 2026.10.18.29 (incoming chat queue for 25,000-line quest replies). Goes with
|
||||
RynthChat 0.3.4.
|
||||
|
||||
## Why
|
||||
|
||||
RynthChat's All tab filled up with system text nobody typed or asked for: the server's login
|
||||
messages, the `/myquests` and `/qb list` replies the plugins request on their own (thousands of
|
||||
lines on an Infinite Leaftide character), and the login probes' replies. RynthChat records every
|
||||
line, including the ones a plugin hides from the retail chat, so those showed under All too.
|
||||
|
||||
## Changed
|
||||
|
||||
- **Automated system text shows in System only.** A line RynthChat marks automated (`"auto"`)
|
||||
and that no rule or standard filter placed is routed to the System tab and left out of All and
|
||||
its own channel tab. RynthChat marks:
|
||||
- `/myquests` and `/qb list` lines, whoever sent the command;
|
||||
- the login burst: system text from entering the world until 30 s after login completes
|
||||
(welcome, MOTD, house and allegiance notices, the plugins' login probes); admin tells
|
||||
never count;
|
||||
- any line a plugin ate.
|
||||
- **The engine reports eaten lines to RynthChat.** After every plugin has seen a line, the chat
|
||||
dispatch calls RynthChat's new `RynthChatNoteEaten` when a plugin ate it (one lookup per batch).
|
||||
With an older RynthChat, the export is missing and nothing happens.
|
||||
- **Setting:** Chat filters > Standard filters > "Automated system text shows in System only".
|
||||
It is on by default, saved as `automatedToSystem` in `rynthchat_settings.json`; files without
|
||||
it load as on. Changing it re-routes the kept lines.
|
||||
- The rule editor's test box names the step "Automated" when it applies.
|
||||
|
||||
## Tests
|
||||
|
||||
- `tools/ChatHistoryBench` (22/22): 8 new checks.
|
||||
- An automated line shows in System only, from any channel.
|
||||
- An unmarked line still shows under All.
|
||||
- With the setting off, automated lines show under All.
|
||||
- A rule that moves the line still decides first.
|
||||
- RynthChat's classifier and buffer: login-burst, admin-tell and eaten-line handling.
|
||||
- The bench also gets the standard-filter stub it lacked, so it builds again.
|
||||
- The checks caught a crash before release. The new RynthChat regex read a timeout field that is
|
||||
declared further down the file, so it was still zero at startup and RynthChat failed to start.
|
||||
It is fixed in RynthChat 0.3.4.
|
||||
- ChatFilterTests 1329/1329, ChatHoldTests 46/46, ChatTellTests 59/59; ChatDiscordTests and
|
||||
ChatCoordTests pass.
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Engine 2026.10.18.29: incoming chat queue sized for 25,000-line quest replies (2026-10-19)
|
||||
|
||||
Previous release: 2026.10.18.25 (chat link probe).
|
||||
|
||||
## Why
|
||||
|
||||
On ACECustom, `/myquests` and `/qb list` print one chat line per quest flag. Infinite Leaftide
|
||||
characters hold more than 15,000 flags, and the lists should cope with at least 25,000. The
|
||||
plugins' incoming-chat queue (`PluginManager.MaxPendingIncomingChats`) held 4,096 lines and
|
||||
dropped the oldest past that. A slow plugin pump during a 25,000-line burst would have lost the
|
||||
head of the reply.
|
||||
|
||||
## Changed
|
||||
|
||||
- `MaxPendingIncomingChats` is 65,536. A queued line is a short string, so a full queue costs a
|
||||
few MB. Drops are still counted and logged at most every 10 s ("incoming chat line(s) dropped
|
||||
before plugins heard them").
|
||||
|
||||
Goes with RynthILT 0.2.22, RynthOracle 0.6.1 and RynthAi 0.5.91 (RynthSuite changelog
|
||||
`2026-10-19-quest-lists-25000-flags-...`).
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# Engine 2026.10.19.3: Items panel Prismatic damage type (2026-10-19)
|
||||
|
||||
Previous release: 2026.10.19.2 (the merged test branch over rynth's 2026.10.19.1). Goes with
|
||||
RynthAi 0.5.93, which treats Prismatic as universal damage.
|
||||
|
||||
## Changed
|
||||
|
||||
- **Prismatic damage type.** Missile weapons and ammo on the Items panel can be set to
|
||||
"Prismatic", universal damage. RynthAi resolves it per target to the weakest element, or the
|
||||
Monsters rule's damage type. Other kinds keep the eight elements.
|
||||
- It works in both the ImGui and Avalonia faces.
|
||||
- The list is `ItemsCommands.MissileElements`, chosen by `ItemsCommands.ElementsFor(kind)`.
|
||||
- **Its colour** is a light rose (`DamageTypeColors.Prismatic`).
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
# Merge rynth main (2026.10.18.1 and 2026.10.19.1 snapshots) into the test branch (2026-10-19)
|
||||
|
||||
Brings rynth's two newest release snapshots (aelrynth main `605ec6f` and `44074df`) into
|
||||
`test/hotbuild-2026-10-16`, by way of `test/hotbuild-2026-10-16-on-aelrynth`. The owner asked for a
|
||||
careful merge, keeping both sides' changes. The plain merge had 38 conflicting files (139 sections).
|
||||
|
||||
## How it was merged
|
||||
|
||||
- **Files rynth built on our published `sk` code (85% or more of it adopted).** These were merged
|
||||
against `upstream/sk` as the base, so his edits land on top of ours. Eight files.
|
||||
- **Every other file.** Resolved section by section against the true merge base.
|
||||
|
||||
## Taken from rynth
|
||||
|
||||
- **Plugin contract v87/v88.** `GetWieldedItems` (EquipmentTracker); managed plugins find their
|
||||
shared dependencies in `Runtime\PluginShared`.
|
||||
- **Settings and Skills.**
|
||||
- `SkillsRouting`: the Skills bar icon shows only while Oracle can't host the Skills tabs.
|
||||
- The Oracle Skills embed lifecycle (`OracleSkillsEmbed.Bind`, `NoteDrawn` and `Sweep`).
|
||||
- The hardened Enl calculator data (lenient row converters, preformatted row text) and its
|
||||
drawing ("Show all", narrow-panel scaling).
|
||||
- **Chat.** `ChatRetailVerdict`, `SharedFileWatch` for the settings file, and his coordinate-link
|
||||
helpers in `ChatCoords`. The standard filters "Damage you deal / take" keep their original meaning.
|
||||
- **Inventory.** Rynth's header layout for the related-panel buttons: icons, or a "more" menu when
|
||||
short. The Vault is never dropped. This applies to both looks.
|
||||
- **Reload hold.** `HoldReloadInWorld` (opt-in, default off) and `HoldReloadInWorldMaxMinutes`,
|
||||
his reworked `ReloadInWorldGate`, and its tests.
|
||||
- **Display.** `RememberAcWindowPosition`: game-window placement split from panel layout, opt-in.
|
||||
It is shown in Settings > Display as "Remember Game Window Position".
|
||||
- **Release pipeline.** `Publish-Update.ps1` builds the plugins managed by default (collectible, so
|
||||
a reload frees them), collects `PluginShared`, and passes `-PluginSharedDir` and `-RynthAiDll`
|
||||
to the installer.
|
||||
|
||||
## Kept from the test branch
|
||||
|
||||
- **`AcWindowChrome`.**
|
||||
- Ours is kept: Fills Monitor, Reset Window Borders, Save Window Position, a separate borderless
|
||||
rect, and the Graphics profiles.
|
||||
- Its placement save and restore now follow `RememberAcWindowPosition`.
|
||||
- Rynth's threading rework (window changes posted to the game WndProc, `AcWindowChromePolicy`)
|
||||
is not ported yet. Follow-up.
|
||||
- **`BorderlessFillMonitor`.** Added back to rynth's `EngineSettings`.
|
||||
- **The loader gate.** `RynthCoreMayHotReload` and `RequestManualReload` are kept, now under
|
||||
`HoldReloadInWorld` in place of the removed `AllowInWorldAutoHotReload`. With the hold on, the
|
||||
loader waits in the world for every reload, a hand reload too (a mid-session CoreCLR re-init can
|
||||
still crash). With it off (the default), reloads go ahead mid-session, as upstream does.
|
||||
- **ImGui bar.** Sense stays under RynthNav and Item Count / Mini Remote under Inventory. Skills
|
||||
uses rynth's conditional icon. The ILT bar section stays removed.
|
||||
- **Installer.** Our full-installer `Build-Installer.ps1`, with rynth's managed-RynthAi and
|
||||
`PluginShared` staging ported into it. Our optional Decal bridge, versioned installer copy, the
|
||||
`RynthLevistras` server plugin, and server plugins in the zip.
|
||||
- **Automated chat to System.** `AutomatedToSystem`; the Enl calculator's "How to get" column and
|
||||
vendor-rate editors; the Augmentations STILL NEEDED row.
|
||||
- **Items.** Weapon damage-type tints are combined with rynth's move up / down buttons.
|
||||
|
||||
## Tests
|
||||
|
||||
- **All 59 `tools/*Tests` and benches pass.**
|
||||
- **`PluginManifestTests`.** Our "v86 slot last" opening was dropped; rynth's slot counts include
|
||||
his v87 slot.
|
||||
- **`EngineSettingsTests`.** No longer prints the removed `AllowInWorldAutoHotReload`.
|
||||
56
Changelog/2026-10-19-rynthai-classic-look.md
Normal file
56
Changelog/2026-10-19-rynthai-classic-look.md
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# RynthAi dashboard: the Classic (retail) look
|
||||
|
||||
Branch `feature/rynthai-classic`, from `status-export`. Pairs with RynthSuite
|
||||
`feature/rynthai-classic-settings` (four VTank options on the settings bridge).
|
||||
|
||||
Tom 2026-10-19: players asked for a VTank-style panel next to the dashboard; implement the
|
||||
AC-style design as an option. Design: the RynthAi Classic canvas (claude.ai artifact
|
||||
2VCb8Lk7vGjBfoX73PJKVL, "Classic" page). Our own layout and wording; the retail pictures are
|
||||
the player's own `client_portal.dat`, read at runtime (RetailSprites), so nothing ships.
|
||||
|
||||
## What
|
||||
|
||||
- **A second look for the dashboard.** `RynthAiDashboardState.Classic` (line 14 of
|
||||
rynthai_avalonia.cache, "classic|modern"; line 15 the open tab). Switched by the new Scroll
|
||||
chip on the Modern title row, the Modern button on the Classic title bar, Settings > Display
|
||||
> RynthAi Dashboard Look, and `/rc dashboard classic|modern|tab <name>`. Modern stays the
|
||||
default. The dashboard's size is kept and put back when switching back.
|
||||
- **One retail window, eight tabs** (`ImGui/Panels/Classic/`):
|
||||
- **Main**: every setting of VTank's options page (ranges, autostack/autocram, peace
|
||||
mode and rebuff when idle, navigation/looting first, rare corpses only, fellowship,
|
||||
dispel items/self, M. charges when off, pets), Stop/Start, Rebuff all/Cancel, the
|
||||
settings profile, the five systems with a live line, and the recharge meters (retail
|
||||
vitals bars) with the heal / restam / get-mana trigger to drag and the top-off mark.
|
||||
- **Monsters**: the monster rules (Damage panel's source), weapon/damage/priority,
|
||||
debuffs and spell shapes as gems, Add target, Remove.
|
||||
- **Gear**: the Items lists (weapons with element, consumables with kind), add the
|
||||
selected item, clean missing, shield and mana tapping.
|
||||
- **Buffs**: buff profile, buffing on/off, every spell on you with its icon and time left.
|
||||
- **Route**: route file, route type, the points with your distance to each, add/remove,
|
||||
the overlay switches.
|
||||
- **Loot**: looting on/off, the profile in use, the edited profile's rules (on/off,
|
||||
move, copy, delete, add, save, reload).
|
||||
- **Meta**: meta on/off, file, state, the rules grouped by state.
|
||||
- **Tuning**: every Settings row, a tab at a time or searched; toggles, numbers, choices
|
||||
and headers drawn retail, the special rows with the Settings panel's drawing.
|
||||
Deep editing (loot conditions, meta rules, Damage-panel extras) opens the existing panel.
|
||||
- **Settings**: four VTank options on the bridge (`UseDispelItems`, `AutoFellowMgmt`,
|
||||
`MChargesWhenOff`, `CustomPetRange`), nullable like EnableVaultedDungeons: hidden (dimmed
|
||||
on the Main tab) until a RynthAi that sends them.
|
||||
- Minimized (the dashboard's shared flag) shows the title bar over the systems, Stop/Start
|
||||
and the three vitals meters.
|
||||
|
||||
## Tested
|
||||
|
||||
Local ACE test client (Buffi, +Buffi @ ACEmulator) on a test runtime: every tab drawn with
|
||||
the retail art, the window kept on the screen when a tab is taller, settings both ways
|
||||
(RynthAi `/mt opt set usedispelitems true` showed on the Main tab; the profile on disk
|
||||
followed).
|
||||
|
||||
## Files
|
||||
|
||||
- `src/RynthCore.Engine/ImGui/Panels/Classic/*` (new)
|
||||
- `src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs` (switch, Scroll chip)
|
||||
- `src/RynthCore.Engine/UI/RynthAiDashboardState.cs` (Classic, ClassicTab)
|
||||
- `src/RynthCore.Engine/UI/Data/SettingsData.cs` (Dashboard Look row, the four options)
|
||||
- `src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs` (`/rc dashboard`)
|
||||
56
Changelog/2026-10-19-sk-chat-settings.md
Normal file
56
Changelog/2026-10-19-sk-chat-settings.md
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# Silentkelpie PR 6, commit 7: engine settings, chat, Modern vault, launcher picker
|
||||
|
||||
Branch `feature/sk2-chat`, from `integration/pr-fixes-2026-10-18`. Not deployed, not released.
|
||||
|
||||
From SilentKelpie's RynthCore PR 6 (commit 7, "port SK test branch (2026.10.18.24) onto sk"). That commit
|
||||
is a squash against his base, so it was taken piece by piece and adapted; none of its hunks that roll back
|
||||
our newer code were taken (plugin API comments, display chrome, DatFileShareHooks, InventoryTitleLayout,
|
||||
bar restructure, Skills embed, updater floor, installer / launcher DXVK).
|
||||
|
||||
## What
|
||||
|
||||
- **engine.json saves only the keys this client changed.** Every client kept the whole settings in memory
|
||||
and wrote them all back, so a client that never touched a setting put its stale value over another
|
||||
client's change (a Display option set in one client came back in all of them). `Save(key)` records the
|
||||
key and `EngineSettingsFile.Merge` takes only those from the engine; every other key keeps what the file
|
||||
holds. A changed key back at its default is still left out (removed); a missing file still gets the whole
|
||||
settings. Redone against our key set (TransitionGate, HoldReloadInWorld(+MaxMinutes),
|
||||
RememberAcWindowPosition, AutoIdMode, ...); his BorderlessFillMonitor key is not here.
|
||||
- **Map coordinates in chat are underlined links** (hover: hand and tooltip). Click points RynthNav's arrow
|
||||
there, Ctrl+click walks there; a drag still selects and copies, right-click keeps the line menu.
|
||||
- **Lines a chat filter hides stay out of AC's own chat window too.** The engine runs RynthChat's Hide rules
|
||||
and ticked standard filters on a held line before its verdict (`ChatModel.ShouldHideInRetail`,
|
||||
`ChatRetailVerdict`); a moved or copied line still prints in AC. Option under Standard filters, on by
|
||||
default (`hideInRetail`). The plugin pump's incoming chat queue holds 4096 lines (was 256) and logs drops.
|
||||
- **RynthChat re-reads `rynthchat_settings.json` when another client saved it** (`SharedFileWatch`, every
|
||||
2 s): rules, standard filters, tabs and display options follow, this client's own saves are skipped, its
|
||||
selected tab is kept.
|
||||
- **Modern Inventory has the Aelrynth Vault**: a chest button beside the Classic button, the vault in place
|
||||
of the grid, caption, Refresh, right-click Withdraw. The header positions are now `InventoryHeaderLayout`;
|
||||
the Vault takes its room first and is never dropped.
|
||||
- **Launcher**: a Known server picker in the Server Profile dialog (17 servers) and the Launcher tab scroll
|
||||
fix (the profile cards no longer push Updates and Launch Targets out of reach).
|
||||
|
||||
## Left out
|
||||
|
||||
- The low-memory safeguard (turn Adaptive degrade on after an early address-space shortage): it is a part
|
||||
of his graphics profile code (AcGraphics, AcGraphicsPrefs, graphics.json, the launcher writing the
|
||||
profile into UserPreferences.ini), which is not taken.
|
||||
- In his chat/PluginManager hunks: the EngineStatusMetrics call, the MemoryUse.Mark removal, "v85" ->
|
||||
"v81" comment edits and the ServerPlugins wording (rollbacks).
|
||||
- His Classic title-bar "more" menu, and the DXVK toggle in the launcher.
|
||||
|
||||
## Files
|
||||
|
||||
- `src/RynthCore.Engine/Plugins/EngineSettings.cs`, `EngineSettingsFile.cs`
|
||||
- `src/RynthCore.Engine/ImGui/Panels/ChatFace.cs`, `ChatFiltersFace.cs`, `InventoryFace.cs`, `InventoryFace.Classic.cs`
|
||||
- `src/RynthCore.Engine/UI/Data/ChatCoords.cs`, `ChatData.cs`, `ChatSettingsDto.cs`, `ChatRetailVerdict.cs` (new), `SharedFileWatch.cs` (new)
|
||||
- `src/RynthCore.Engine/UI/InventoryTitleLayout.cs`, `Plugins/PluginManager.cs`
|
||||
- `src/RynthCore.App/KnownServerCatalog.cs` (new), `src/RynthCore.App.Avalonia/` (ServerProfileDialog, MainWindow, csproj)
|
||||
- Tests: `tools/EngineSettingsTests`, `ChatCoordTests`, `ChatFilterTests`, `BarDeclutterTests`, `LauncherSettingsTests`
|
||||
|
||||
## Not verified
|
||||
|
||||
No live client: the underlined links and clicks, the retail-chat hide and the 4096 queue under a real burst,
|
||||
the settings re-read between two running clients, the Modern vault button and grid (needs an Aelrynth
|
||||
character), the launcher dialog and scroll.
|
||||
53
Changelog/2026-10-19-sk-loot-combat.md
Normal file
53
Changelog/2026-10-19-sk-loot-combat.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# Add-to-loot attribute checklist, Variable Power, Hitting the Environment and Kite rows
|
||||
|
||||
Branch `feature/sk2-loot-combat`, from `integration/pr-fixes-2026-10-18`. Not deployed, not released.
|
||||
Pairs with RynthSuite `feature/sk2-loot-combat` (RynthAi's side of all of it).
|
||||
|
||||
From SilentKelpie's RynthCore PR 6 (commit 7, and the Settings rows of commit 6), adapted.
|
||||
|
||||
## What
|
||||
|
||||
- **Add to loot profile, attribute checklist** (`ImGui/Panels/LootAddDialog.cs`, `UI/Data/LootEditData.cs`).
|
||||
The popup lists every attribute the item has, grouped (Item, Weapon / Armor, Ratings, Spells, Pet
|
||||
essence, T11, Requirements). Tick a row to require it, pick `>=`, `=`, `<=` (spells: or better /
|
||||
exact / any tier) and type a value. The popup is wider with the list. "Items like this" pre-ticks what
|
||||
it always required.
|
||||
- Wire: the ask carries `Choices` (one per row the player changed, null until then) and the draft
|
||||
carries `AttributesSupported` and `Attributes`. These are the DTO mirrors of RynthSuite's
|
||||
`LootEditWire`.
|
||||
- **Fallback:** a RynthAi without the checklist never sets `AttributesSupported`, so the popup keeps
|
||||
its single "Include T11 attributes" box and nothing else changes. An older engine against the new
|
||||
RynthAi never sends `Choices`, and RynthAi then builds exactly what it built before.
|
||||
- **Settings > Melee Combat:** "Variable Power (monster rules)" (Variable Min % / Max %), "Hitting the
|
||||
Environment" (Missile Response, Hits to trip, Window, Move closer by, Closest, Skip target) and
|
||||
"Pull Away (Kite)" (Pull Distance, Tag Before Fleeing). **Settings > Spell Combat:** "Hitting the
|
||||
Environment" (Magic Response).
|
||||
- **Damage panel, a monster's detail:** a "Power" combo (Default, High, Reckless, Variable,
|
||||
Reckless + Variable) and a "Kite" combo (Default, Off, PullAway). A new rule copied from the DEFAULT line
|
||||
follows it; one copied from a name rule keeps that rule's choices.
|
||||
|
||||
## Defaults
|
||||
|
||||
Nothing changes until a player turns it on: every response is Off, every rule's Power and Kite are
|
||||
Default (Default Power is the global Power settings, Default Kite on the DEFAULT line is Off).
|
||||
|
||||
## Compatibility
|
||||
|
||||
- The new RynthAi settings are **nullable mirrors** in `RynthAiSettings`, like the Vaulted Dungeons
|
||||
switch: a RynthAi that predates them omits them, the rows (and their section headers) stay hidden,
|
||||
and a save sends `null`, which RynthAi leaves alone. His version used plain ints and a bool, which
|
||||
would have written the engine's defaults over a RynthAi that did not have them.
|
||||
- `Combo` rows gained an optional `when:` like the other kinds (needed to hide Missile / Magic Response).
|
||||
- An older RynthAi ignores the Rule's new `AttackPower` and `Kite` fields.
|
||||
|
||||
## Not taken
|
||||
|
||||
The rest of that commit: the ring run-away and its engine side are decided separately; the chat, display
|
||||
and EngineSettings pieces are on other branches.
|
||||
|
||||
## Tests
|
||||
|
||||
- `tools/CombatSettingsTests` (new): the mirrors, the rows' visibility and ranges, the schema defaults,
|
||||
the Power / Kite spellings and the rule's change detection.
|
||||
- `tools/LootAddWireTests` (new): the popup's DTOs against what RynthAi's `LootEditWire` writes and
|
||||
reads, and the older-RynthAi fallback.
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Engine 2026.10.18.31: Skills panel shows luminance still needed and how to get chain items (2026-10-19)
|
||||
|
||||
Previous release: 2026.10.18.30 (automated system text in the System tab). Goes with RynthILT 0.2.23.
|
||||
|
||||
## Changed (Skills panel, Progression tab)
|
||||
|
||||
- **Augmentations:**
|
||||
- A STILL NEEDED row under TOTALS: the luminance still needed after banked and character
|
||||
luminance, and the e-coins short. It is green when nothing is left.
|
||||
- The line under the table that shows the subtraction.
|
||||
- **Enlightenment, "Still need / have" and "Sigil craft chain":**
|
||||
- A "How to get" column (dim, wrapped) with RynthILT's recipe or vendor trade for each row.
|
||||
- With an older RynthILT, the chain keeps its "craft" marker and the materials table keeps three columns.
|
||||
- **Vendor rates** under the chain: Extracts per Ascension Coin, and the Trophy trade (extracts
|
||||
and Trophies). They are sent as `prog extractsperasc` / `trophyextracts` / `trophycount` and
|
||||
shown only when RynthILT reports them.
|
||||
- `ProgressionData`:
|
||||
- `AugPlanner`: `stillLum`, `stillCoins`, `stillLine`.
|
||||
- `EnlPlanner`: `extractsPerAsc`, `trophyExtracts`, `trophyCount` (-1 when absent).
|
||||
- `EnlMaterialRow` and `EnlChainRow`: `how`.
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
# Engine 2026.10.20.11: chat filter rules no longer switch off for good on long sessions
|
||||
|
||||
## Fixed
|
||||
|
||||
- Silentkelpie, about 48 hours into one session: the chat filter had "stopped working". Its rules
|
||||
were being switched off one by one: "ChatModel: rule "^\[RynthNet] Silentstorm connected\.$" is
|
||||
too slow (a match took over 15 ms) and is skipped until edited." That pattern takes
|
||||
microseconds. The 15 ms regex timeout is wall-clock time, so a pause of the whole thread during
|
||||
an easy match (a garbage collection, other processes scheduled in on a machine running several
|
||||
clients) threw it, and the rule stayed off until someone edited it. Over days, rule after rule
|
||||
went off. (The skip was never saved, so a restart brought them back, which is why it only
|
||||
showed on long sessions.)
|
||||
|
||||
## Changed
|
||||
|
||||
- A rule match (and the "colour the match" scan) that times out is run once more before the rule
|
||||
is judged slow: a pause doesn't repeat, a slow pattern does.
|
||||
- A rule judged slow is skipped for 10 minutes and then tried again on its own; each further
|
||||
strike doubles the wait (20, 40 minutes ...), at most 4 hours. Editing the pattern still clears
|
||||
it at once. The log says when it is skipped (and for how long) and when it is tried again.
|
||||
- The filter editor's status and test box say so ("skipped for a while ... tried again on its own").
|
||||
- Unchanged: the per-pass budget for genuinely slow rules (100 ms per 500 kept lines), which
|
||||
already caps one reading at 30 ms so a single pause can't condemn a rule there.
|
||||
|
||||
## Tests
|
||||
|
||||
- tools/ChatFilterTests: "slow rules: a second chance, and tried again later" (the strike waits;
|
||||
an easy rule matches; a pattern that always times out fails twice; the router skips a slow rule
|
||||
and tries it again after its wait, then waits 20 minutes after a second strike; an edit clears
|
||||
it; an easy rule hides its line again once tried again). 1484/1484 checks passed.
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
# Engine 2026.10.20.14: a command's reply shows in the RynthChat tab you typed it in
|
||||
|
||||
Previous release: 2026.10.20.13.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Silentkelpie: `/fship` and other server commands typed in RynthChat's box "don't show up"
|
||||
in RynthChat. AC's own chat showed them. Nothing was lost or filtered:
|
||||
- The server's reply to a command is system text (ACE's `ChatMessageType.Broadcast`, type 0),
|
||||
so RynthChat files it under System, which shows only in the All and System tabs. The
|
||||
seven `[FSHIP]: use /fship ...` lines were in All the whole time.
|
||||
- The window was on another tab.
|
||||
|
||||
How this was checked, so the same report can be ruled out quickly next time:
|
||||
- This PC's rules and standard filters run through the engine's real router leave the
|
||||
`[FSHIP]` lines in All and System.
|
||||
- RynthChat's chat log showed all seven lines arriving at 09:42:53.
|
||||
- No plugin eats them.
|
||||
|
||||
## Changed
|
||||
|
||||
- **A command's reply follows you** (`UI/Data/ChatReplyTab.cs`). When you send a slash or
|
||||
`@` command from RynthChat's box, the tab you're on is marked for 5 s. The System lines (the
|
||||
server's replies) and Rynth lines (plugin replies) that arrive in that time also show in
|
||||
that tab, as well as in All and System. The mark is kept on the line itself
|
||||
(`ChatLine.ReplyTab`, checked in `ChatModel.LineInTab`), so a re-route pass after a rule edit
|
||||
keeps it. A rule that hides the line still hides it everywhere.
|
||||
- Not for chat: `/say`, `/tell`, `/reply`, `/retell`, `/f`, `/a`, emotes and the channel
|
||||
commands already land in Chat or a channel tab. Not for commands typed in All, which shows
|
||||
everything. Not for automated lines (a plugin's own polls, the login burst). Not for other
|
||||
channels, so combat in those seconds stays where it was.
|
||||
|
||||
## Tests
|
||||
|
||||
- `tools/ChatFilterTests`: "command replies: shown in the tab the command was typed in" covers:
|
||||
- which commands count (`/fship`, `/bank d p 10k`, `@help` do; `/tell`, `/f`, `/a`, plain
|
||||
text and a lone `/` don't);
|
||||
- System and Rynth replies follow to the tab, and combat lines don't;
|
||||
- automated lines aren't copied, and the 5 s window ends;
|
||||
- typing in All or System marks nothing extra;
|
||||
- a `/tell` marks nothing.
|
||||
1665/1665 checks passed.
|
||||
- The engine and `tools/ChatHistoryBench` build with no new warnings.
|
||||
|
||||
## Install
|
||||
|
||||
Not hot deployed. Every engine hot reload since at least 2026-10-21 closes the running clients
|
||||
(see the 2026.10.20.13 notes), so this needs the clients closed first, then
|
||||
`scripts\Publish-EngineCoreClr.ps1 -EngineOnly -MsBuildArgs '-p:Version=2026.10.20.14' -AllowBehind`.
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# RynthChat: /myquests replies no longer wipe the chat history (2026.10.20.18)
|
||||
|
||||
## Symptom
|
||||
Every so often the chat looked reset: older lines under All vanished at once
|
||||
(noticed around banking, but unrelated to it).
|
||||
|
||||
## Cause
|
||||
RynthAi's Meta Manager polls `/myquests` about every ten minutes. On a
|
||||
well-played character the reply is about 2,200 lines (Silentkelpie's flight
|
||||
dump of 21:51:29 shows bursts at 21:40:41 and 21:50:49). Those lines are
|
||||
marked automated and shown only in the System tab, but they counted against
|
||||
the same 2,000-line "Chat history" as everything else, so each reply pushed
|
||||
every line under All out of the history.
|
||||
|
||||
## Fix
|
||||
- `ChatHistory.Keep` / `Merge(..., extra)`: automated lines (ChatLine.Automated:
|
||||
/myquests and /qb replies, the login burst, lines a plugin ate) are kept on
|
||||
their own budget of the same length; ordinary lines keep the full setting.
|
||||
Order is kept. Worst case memory is twice the setting (about 3.6 MB at 2,000).
|
||||
- `ChatSource`: the merge and the trim use it.
|
||||
- `ChatFace.DropGone`: removes any shown line the source no longer keeps (from
|
||||
the middle as well as the top), keeping the view in place while scrolled up.
|
||||
|
||||
RynthChat's own ring (the plugin) still holds the newest lines of both kinds;
|
||||
the engine reads it ten times a second, so it only matters on a bind or reload.
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# RynthChat: following the newest line and keeping your place when scrolled up
|
||||
|
||||
Reported: the chat "auto-scrolled to the top" instead of following the bottom, and a manual
|
||||
scroll didn't keep its place: it skipped back to the top or the bottom.
|
||||
|
||||
Seen live (2026-10-24): following stopped by itself as soon as the mouse rested over the chat,
|
||||
without any wheel or click, and from then on the view crept up as a full buffer dropped its
|
||||
oldest lines, until it sat at the top showing ten-minute-old lines.
|
||||
|
||||
## Cause
|
||||
|
||||
`ChatFace.DrawLines` decided "the player scrolled" from any change of the list's scroll between
|
||||
frames, and also only moved the view itself when lines dropped off the top. Any scroll change
|
||||
the player didn't make (a hover or focus change, a re-measure, ImGui clamping the scroll to new
|
||||
content) therefore turned following off, or moved the view the player was reading.
|
||||
|
||||
## Fix
|
||||
|
||||
- Only the player moves the list: the wheel over it, a press on its scrollbar (held until the
|
||||
button comes up), or a drag-select past its edges. Only those turn following off (wheel up, or
|
||||
leaving the bottom) or back on (back at the bottom).
|
||||
- Following: the view is put at the bottom every frame unless the player is scrolling.
|
||||
- Not following: the view is put back where the player left it every frame, moved only by how
|
||||
much the lines above it changed (dropped from a full buffer, re-measured after a resize or a
|
||||
rule change), so nothing else can move it.
|
||||
- Kept: the place is kept across a route rebuild (another client's settings, a rule edit) by
|
||||
the line at the top of the view.
|
||||
|
||||
## Files
|
||||
|
||||
- `src/RynthCore.Engine/ImGui/Panels/ChatFace.cs`
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
# Engine 2026.10.20.13: chat filters stop getting lost; each character keeps its own window layout
|
||||
|
||||
Previous release: 2026.10.20.12, this change's first hot deploy, which was missing a log line.
|
||||
Before that: 2026.10.20.11.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Silentkelpie, running five clients: RynthChat "keeps losing" its filters, they "stop working",
|
||||
and the chat window resets. The RynthChat plugin wasn't the cause. Every client on the machine
|
||||
shares two files, and each wrote its whole state over the other clients':
|
||||
- **Chat rules and standard filters** (`%AppData%\RynthCore\rynthchat_settings.json`). A client
|
||||
re-read the file only while its chat window was open. A client with chat closed kept old rules
|
||||
in memory and wrote them back at its next save, even from a tab click. Every other client then
|
||||
reloaded that old copy, and each standard filter the file didn't list went off. On 2026-10-24
|
||||
between 08:43 and 08:46 one client saved 15 times and the four others reloaded every one.
|
||||
- **Window positions** (`%LocalAppData%\RynthCore\panel_state.txt`, one `panel.Chat` row for
|
||||
every client). A client read it at start and on an engine reload, then rewrote all of it on any
|
||||
window move, open or close. So a client's chat window came back wherever the client that saved
|
||||
last had its own, or closed. The file was also rewritten in place, so a client dying mid-write
|
||||
could leave it cut off.
|
||||
|
||||
## Changed
|
||||
|
||||
- **Chat settings are checked all the time.** The engine's UI step (`UiDataHub`) now checks the
|
||||
shared file every step, throttled to a timestamp check every 2 s, whether or not the chat window
|
||||
is open. Before, only the chat window's data source did, while it was subscribed.
|
||||
- **A save merges instead of overwriting** (`UI/Data/ChatSettingsMerge.cs`). When another client
|
||||
changed the file since this client's base (what its settings in memory came from), each
|
||||
top-level setting is decided on its own:
|
||||
- a setting this client changed is saved from this client;
|
||||
- a setting this client left alone keeps the file's value;
|
||||
- a setting only the other client wrote is kept.
|
||||
The client then picks up the merged result itself. A file that can't be read, or a merge that
|
||||
doesn't load back, leaves the save as it was. The rule list and the standard filters are each
|
||||
one setting, so if two clients edit rules at the same moment, the later save's list still wins.
|
||||
The base is taken when the save is asked for, not when it is written, so a reload in between
|
||||
can't make older settings look current. A merged result is applied only if no newer save has
|
||||
been asked for since.
|
||||
- **A tab click no longer saves.** The selected tab is this client's own; it is written with the
|
||||
client's next real change and ignored by the others, as before.
|
||||
- **Window layout is per character** (`UI/PanelStatePath.cs`, `UI/PanelStateStore.cs`).
|
||||
`panel_state.<server>.<character>.txt` comes from this process's launch context
|
||||
(`ServerName`, `TargetCharacter`). A character's first run starts from the shared
|
||||
`panel_state.txt`, and its saves then go to its own file. A client started outside the launcher
|
||||
still uses the shared file. Saves are written to a temp file and swapped in.
|
||||
- **The log says which layout file is in use**, at the first save. In 2026.10.20.12 this line was
|
||||
written at load, which runs during engine start before the log is up, so it never appeared;
|
||||
2026.10.20.13 moves it to the first save.
|
||||
|
||||
## Tests
|
||||
|
||||
- `tools/ChatFilterTests`: "settings merge: a save never undoes another client's rules" covers:
|
||||
- a stale client changing only its font and tab keeps the other client's new rule and preset change;
|
||||
- a client editing rules keeps its edit, and the other client's font stays;
|
||||
- a setting only the other client wrote is kept, and one this client removed stays removed;
|
||||
- no base, no file, a broken file, or nobody else saving all leave this client's text as is.
|
||||
1648/1648 checks passed.
|
||||
- `tools/PanelStateTests` (new): file names from the server and character, with unsafe and
|
||||
non-ASCII characters as `_`, long names cut, and case not making a second file. The shared name
|
||||
is used when the character is unknown. The launch context is read, including broken, missing
|
||||
and non-string values. 16/16 checks passed.
|
||||
- The engine builds (`-c Release -p:EngineHost=coreclr`) with no new warnings.
|
||||
|
||||
## Install
|
||||
|
||||
Hot deployed with `scripts\Publish-EngineCoreClr.ps1 -EngineOnly -MsBuildArgs
|
||||
'-p:Version=2026.10.20.13' -AllowBehind`. `-AllowBehind` is needed because this checkout has no
|
||||
`status-export` branch for the script's safety check; it holds everything the live
|
||||
2026.10.20.11 engine was built from.
|
||||
|
||||
**Hot reload closed every running client, both times.** On each deploy, each client loaded the
|
||||
new engine generation, logged `[loader] Hooks: 2 patch(es) applied in one freeze`, and its
|
||||
process ended within a second:
|
||||
- the .12 deploy: the five clients that were running (Silentkelpie's at 09:07:51, after waiting
|
||||
for its fight to end);
|
||||
- the .13 deploy: the five clients relaunched at 09:07.
|
||||
|
||||
This is not from this change. Every hot reload in the logs since at least 2026-10-21 ends the
|
||||
same way, including the 2026.10.20.11 deploy at 13:59 on 2026-10-23. The five clients started
|
||||
fresh at 09:12 run 2026.10.20.13. Until the hot reload is fixed, deploy the engine with the
|
||||
clients closed.
|
||||
|
||||
After the 2026.10.20.12 deploy, four characters made their own layout files within two minutes,
|
||||
each started from the shared layout:
|
||||
`panel_state.aelrynth.sk.txt`, `panel_state.infiniteleaftide.silentstorm.txt`,
|
||||
`panel_state.infiniteleaftide.silent_pack.txt` and
|
||||
`panel_state.infiniteleaftide.slient_hoooooooe.txt`. Silentkelpie makes its own at its first
|
||||
window save. The shared `panel_state.txt` is no longer written by launcher-started clients.
|
||||
48
Changelog/2026-10-24-inventory-filter-like-this.md
Normal file
48
Changelog/2026-10-24-inventory-filter-like-this.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# Inventory: filter like this, and find like this in Global Inventory
|
||||
|
||||
Two new lines in the Inventory panel's right-click menu, under "Add to loot profile...":
|
||||
|
||||
- **Filter inventory like this...** opens the Add to loot profile popup in a filter mode: the
|
||||
same Match choice (default "Items like this") and the same attribute checklist, but no
|
||||
profile, action or name. **Filter** asks RynthAi to judge every item you carry and wear with
|
||||
that rule (its looter's own evaluator), and the list shows only the matches.
|
||||
- A bar under the tools row names the filter (hover: its conditions), offers
|
||||
**Identify N** when some items can't be judged until identified, and clears it (X).
|
||||
- The panel asks RynthAi again every 2 s while it shows (find_refresh), so new loot and
|
||||
finished identifies show up; RynthAi only answers when the result changed.
|
||||
- Clearing filters, closing the Classic tools row or hiding the panel clears it. In Classic
|
||||
the bar is in the tools row, which opens when the filter is applied.
|
||||
- **Find like this in Global Inventory...** (enabled when RynthInventory is loaded) uses the
|
||||
same popup; **Search** sends the rule to RynthInventory as `/ginv like <spec>`, which opens
|
||||
Global Inventory filtered to every character's matching items.
|
||||
|
||||
Needs the matching RynthSuite (RynthAi item_find / find_refresh / find_close, RynthInventory
|
||||
0.1.5). An older RynthAi gets a "too old" note in the popup.
|
||||
|
||||
## Files
|
||||
|
||||
- `ImGui/Panels/LootAddDialog.cs`: `LootAddMode` (AddRule, FilterInventory, FilterGlobal),
|
||||
FilterBody, item_find and its answer (TakeFind), `NextSeq`.
|
||||
- `ImGui/Panels/InventoryFace.LikeFilter.cs` (new): the filter state, refreshes and the bar.
|
||||
- `ImGui/Panels/InventoryFace.cs`, `InventoryFace.Classic.cs`: menu lines, the list filter, the bar.
|
||||
- `UI/Data/LootEditData.cs`: request Find / Scope / Candidates, draft Find, `LootEditItemFindDto`,
|
||||
state ItemFind (mirrors LootSdk LootEditWire).
|
||||
|
||||
## Follow-up: checklist filters and spell lists
|
||||
|
||||
- **The Inventory panel's filter button** (the list-check icon in the tools row) now opens the
|
||||
same checklist popup with no item: every attribute a loot rule can test, unticked, with a
|
||||
value to fill in (named values such as material, skill, slayer, class pick from a list).
|
||||
Filter judges your items the same way as "Filter inventory like this". The old rule list
|
||||
editor no longer hides items (its saved rules are left in the settings file).
|
||||
- **Global Inventory** gets the same checklist ("Attribute filter +" next to the search box):
|
||||
one group open at a time, a ticked row shows its comparison and value; the search filters
|
||||
every character's saved items as you tick.
|
||||
- **Spell lists** in every checklist (Add to loot profile, both filters, Global Inventory):
|
||||
- Add spell: Creature, Life or Item, a family from the spell table (buffs only: no debuffs,
|
||||
war or void), a level I to VIII; "or better" by default (exact / any tier in its row).
|
||||
Levels VII and VIII have their own names ("Might of the Lugians", "Incantation of Strength
|
||||
Self"), so the rule lists the family's spells by name; Self and Other both count.
|
||||
- Add cantrip: Minor, Major, Epic, Legendary or Paragon and a cantrip name.
|
||||
- Cantrip "or better" and the tier counts now include Paragon ("Paragon" or "Paragon's").
|
||||
- Named values on an item's rows (material, wield skill...) can be changed from a list.
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Inventory right-click: Add to Damage panel weapons (2026.10.20.19)
|
||||
|
||||
Right-click a weapon, wand or shield in the Inventory panel and choose
|
||||
**Add to Damage panel weapons**. It joins RynthAi's weapons list (Items), which is
|
||||
what the Damage panel offers per monster and what combat may use. A shield goes in
|
||||
as an off-hand item. RynthAi says in chat whether it was added or is already
|
||||
listed (and refuses anything that is not a weapon, wand or shield).
|
||||
|
||||
- RynthAi: `RynthPluginAddWeaponById(uint id)`; `LegacyWeaponsUi.AddWeapon(id)` is
|
||||
the old Add Selected logic without needing the item selected first (Add Selected
|
||||
now calls it). Saves the settings.
|
||||
- Engine: `ItemsCommands.AddWeapon(id)` (refreshes the Items and Damage views);
|
||||
the menu entry shows for items whose type is melee, missile or caster, or that
|
||||
go in the shield slot. With a RynthAi that lacks the export, the click is logged.
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# Plugin windows keep their spot per character (plugin API v91)
|
||||
|
||||
Floating windows that plugins draw themselves (the Item HUD, the Mini Remote, the
|
||||
Nav HUD, RynthAi's legacy settings windows, ub-Rythai's windows, RynthILT's pages,
|
||||
the server packs' server window) kept their spot and size only in imgui.ini. Every
|
||||
running client shares that one file and rewrites all of it, so a window moved or
|
||||
resized in one client came back where another client's next save had it.
|
||||
|
||||
The engine now keeps those spots per character, the way its own panels already
|
||||
were: `%LocalAppData%\RynthCore\window_state.<server>.<character>.txt`, one line
|
||||
per window (`<key>=x,y,width,height`). A window is saved when the player lets go
|
||||
of the mouse after moving or resizing it; moves the code makes are not saved.
|
||||
|
||||
- Engine: `UI/WindowPlacementStore.cs`; API v91 `GetWindowPlacement` /
|
||||
`SetWindowPlacement` (`Plugins/WindowPlacementApi.cs`). SDK:
|
||||
`RynthCoreHost.HasWindowPlacements`, `TryGetWindowPlacement`, `SetWindowPlacement`.
|
||||
- Plugins: one shared control, `RynthSuite/Plugins/Shared/SavedWindow.cs` (linked
|
||||
source). The plugin sets `SavedWindow.Host` at start; each window calls `Apply()`
|
||||
right before `ImGui.Begin` and `Track()` inside it.
|
||||
- RynthAi: the Item HUD and Mini Remote placement fields added to huds.json on
|
||||
2026-10-26 are gone (the shared control replaces them); place those two windows
|
||||
once more after updating.
|
||||
- On an engine older than v91 the windows behave as before (imgui.ini).
|
||||
46
Changelog/2026-11-07-bar-menu.md
Normal file
46
Changelog/2026-11-07-bar-menu.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# Bar icon dropdown: plugin API v95
|
||||
|
||||
Branch `pr/bar-menu`, from `pr/web-panel` (web panel, v94). Not deployed. The API number 95 is provisional, as
|
||||
94 is (unmerged upstream branches also use these numbers; whichever merges second renumbers). The manifest is parsed here; the bar draws it (below).
|
||||
|
||||
## What changed
|
||||
|
||||
- A plugin window in the sections manifest (`windows`, with `"bar": true`) may declare `"barMenu"`: up to 6 items of
|
||||
`{ "id", "tooltip", "icon", "command" }`. `SectionManifest.cs` parses it into `SectionWindowDecl.BarMenu`
|
||||
(`SectionBarMenuItem` records; `Menu` is the never-null view).
|
||||
- Validation, with the window always kept: the id is a short lower-case word and unique in the menu, the tooltip is
|
||||
non-empty and capped at 48 characters, the command is a single `/...` chat command (the same rule as a contribution's),
|
||||
the icon is one Phosphor glyph or empty (an icon that is not a glyph is kept as an empty icon, and the bar draws the tooltip's first letter). An item with a bad id, tooltip or command is dropped; items past
|
||||
`MaxBarMenuItems` (6) are ignored; a `barMenu` that is not an array is ignored.
|
||||
- `PluginContractVersion.Current` and the SDK's `RynthCoreSdkApiVersion` (`RynthCore.PluginSdk.targets`) go to 95.
|
||||
No function table change. Engines before v95 ignore the key, so a plugin can declare it unconditionally.
|
||||
|
||||
## Tests
|
||||
|
||||
`tools/SectionsTests`:
|
||||
|
||||
- `ManifestBarMenu`: valid items in order with exact fields, rejected commands (no slash, a line break, over-long),
|
||||
empty id, duplicate id, empty tooltip, empty icon kept, 20 items capped to 6, a non-array `barMenu`, no key, and the
|
||||
48-character tooltip cap.
|
||||
- `BarMenuHoverTiming`: the 0.15 s open delay, a quick sweep never opening, the 0.30 s close delay covering the gap
|
||||
from icon to dropdown, switching to another icon at once, no reopen while still hovering after a click, and a
|
||||
clock jump or a gap over 0.5 s resetting.
|
||||
- `BarMenuReload`: a change to only `barMenu` leaves the panel signature alone (no re-registration) and changes the
|
||||
menu signature (so the bar rebuilds).
|
||||
|
||||
`tools/PluginManifestTests` pins the SDK and engine numbers together, and that `PluginContractVersion.BarMenu` is at or
|
||||
below `Current`.
|
||||
|
||||
Not yet tested in game.
|
||||
|
||||
## The dropdown
|
||||
|
||||
- Hovering a plugin window's bar icon for 0.15 s drops a column of icon buttons flush below it (flush above when it would
|
||||
cross the bottom of the screen; clamped sideways). It stays while the mouse is over the icon or the column, and for
|
||||
0.30 s after it leaves both. Another icon's dropdown replaces it at once. Clicking an item runs its command as a player
|
||||
chat command (the hotkey path) and closes the dropdown. The icon's own click still toggles the window.
|
||||
- A plugin reload that changes only `barMenu` reaches the bar: `PluginWindows.Sync` refreshes the hosted declaration
|
||||
(`WindowPlan.MenuSignature`) without re-registering the panel, and bumps the version so the bar rebuilds its buttons.
|
||||
- The dropdown is brought to the display front every frame (cimgui `igBringWindowToDisplayFront`, no focus change), so a
|
||||
panel focused since does not cover it; without those exports it keeps its normal order and logs once.
|
||||
- Timing is `ImGui/BarMenuHover.cs` (pure; `SectionsTests` `BarMenuHoverTiming`). Drawing is in-game only.
|
||||
44
Changelog/2026-11-07-web-panel.md
Normal file
44
Changelog/2026-11-07-web-panel.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# In-game web panel: plugin API v94
|
||||
|
||||
Branch `pr/web-panel`, from upstream `main` c68204f (release 2026.11.8.1). Not deployed. The API number 94
|
||||
follows upstream's v93 (GetMonsterHealth) and is provisional (unmerged upstream branches also use 94; whichever
|
||||
merges second renumbers). CoreCLR engine only.
|
||||
|
||||
## What changed
|
||||
|
||||
- Four new function slots at the end of the plugin API table (`WebPanelOpenFn`, `WebPanelNavigateFn`,
|
||||
`WebPanelCloseFn`, `WebPanelGetStateFn`), and SDK wrappers on `RynthCoreHost`: `HasWebPanel`,
|
||||
`OpenWebPanel(WebPanelOptions)`, `NavigateWebPanel`, `CloseWebPanel`, `GetWebPanelState`. Types are in
|
||||
`RynthCore.PluginSdk/WebPanelTypes.cs`. No call blocks its caller.
|
||||
- `WebPanel/WebPanelHost.cs` (engine): one WebView2 panel over the game window, on its own STA thread, with an
|
||||
unowned popup window, a caption bar with a close box, a remembered size and place, and Escape / Alt+F4 / `X` to close.
|
||||
- Navigation allowlist (`WebPanelUrlPolicy`): https only, default port, no user info, exact host or `*.suffix`
|
||||
(`*.x.com` does not match `x.com`: list both). Off-list navigations, pop-ups and custom-scheme launches never
|
||||
load in the panel; an absolute http(s) URL goes to the system browser, anything else is dropped.
|
||||
- Per-world, per-key WebView2 profile (`WebPanelProfile`): the plugin's key is lower-cased and hashed, and the world is added.
|
||||
- `/rc webpanel [status|close]`: a redacted one-line report, and a close.
|
||||
- `engine.json` `"WebPanel": false`: kill switch. `OpenWebPanel` then answers `Unavailable`.
|
||||
- `RynthCore.PluginSdk.targets` already raised a shared-SDK release build's `RynthPluginMinEngineApi` below 88 to the
|
||||
SDK's API; that is now 94 for every such plugin. Plugins that must run on older cores declare 88 or higher.
|
||||
- `tools\WebPanelHarness`: an offline 32-bit harness for the host (see the doc).
|
||||
- Docs: `docs/WEB_PANEL.md` is the plugin contract.
|
||||
|
||||
## How it behaves
|
||||
|
||||
- The panel is designed never to take focus from another program; confirm in game. It takes the foreground (and
|
||||
page focus) only if the foreground window already belongs to the game, and it hides while another program is in front.
|
||||
- Logs and chat never carry a URL's query, fragment or user info (the launch code rides in the query).
|
||||
- Failures: the panel fails only when the WebView2 browser process or the main renderer exits, or the renderer is
|
||||
reported unresponsive 3 times in 30 s. Other process failures are logged. `RuntimeMissing` / `CreateFailed` fall back to
|
||||
the system browser when the plugin asked for it (the default). Page permission `ClipboardRead` is allowed only
|
||||
for allowlisted origins; the rest are denied.
|
||||
- The NativeAOT engine flavour has no web panel: the slots stay zero and `HasWebPanel` is false.
|
||||
|
||||
## Tests
|
||||
|
||||
`tools/WebPanelTests`: URL allowlist and redaction, window visibility and layout, profile folder, the ABI glue.
|
||||
`tools/WebPanelHarness`: the host in a collectible load context against real WebView2 (needs a desktop, the
|
||||
WebView2 runtime and the x86 .NET 10 runtime; not part of `Run-AllTests.ps1`). Checks that need another program in
|
||||
the foreground report UNVERIFIED and are owner in-game checks.
|
||||
|
||||
Not yet tested in game.
|
||||
7
Changelog/2026-11-11-dungeon-map-visited-per-floor.md
Normal file
7
Changelog/2026-11-11-dungeon-map-visited-per-floor.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# 2026-11-11 — Dungeon Map: each shown floor draws its own walked cells
|
||||
|
||||
The Dungeon Map drew the walked (visited) cells for the player's floor only, and RynthAi's snapshot
|
||||
painted them by x/y, so the cells walked on other floors showed up too. RynthAi now paints the floor you
|
||||
stand on, separately for each floor (RynthSuite 2026-11-11-dungeon-trail-stays-on-its-floor). The map draws
|
||||
each shown floor's own walked cells: the player's floor in full, the other shown floors dimmed as their walls
|
||||
are. Floors that aren't shown draw none.
|
||||
58
Changelog/2026-11-11-settings-regroup.md
Normal file
58
Changelog/2026-11-11-settings-regroup.md
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# Settings panel regrouped: 14 tabs in three groups, 10 settings get rows
|
||||
|
||||
Branch `feature/settings-regroup`, from `rc/2026.11.next` f219759. Not deployed. RynthSuite's chat text and tooltips that
|
||||
name a tab are on `feature/settings-regroup-text` (from `rc/2026.11.next` a91104fe). The phone app's own copy of the
|
||||
groups is on RynthRemote's `feature/settings-regroup`. No plugin API change; any RynthAi works with it.
|
||||
|
||||
## What changed
|
||||
|
||||
- The tabs, in three sidebar groups:
|
||||
- **RynthCore · this PC:** Interface (Display + UI), Game Client (new), Hotkeys.
|
||||
- **RynthAi · saved in the profile:** General (was Misc), Recharge, Combat (was Melee Combat), Spell Combat, Ranges,
|
||||
Navigation, Buffing, Looting, Inventory (new), Vendoring.
|
||||
- **Support:** Diagnostics.
|
||||
- What moved where:
|
||||
- **Interface:** the theme and the dashboard look (Look), text size, the RynthCore toolbar, the four "Hide retail"
|
||||
switches, your vitals plate and Show Target Stamina / Mana, the RynthDefective windows in the retail toolbar's
|
||||
place, and window layout.
|
||||
- **Game Client:** Borderless Windowed and Remember Game Window Position (Game Window); the FPS limit, the video
|
||||
patch and Background Identify (Performance); Close Client on Server Disconnect and the reload hold (Disconnects
|
||||
And Updates); the server picker (Server, from Diagnostics).
|
||||
- **Hotkeys:** Insert Key Releases the UI (from Display).
|
||||
- **General:** login and VTank switches (Starting Up), Peace Mode When Idle and Weapons Back After Heals (Between
|
||||
Fights), Escape Acid and Lava and the macro stops (Safety Stops, from Misc and Recharge), Recall On Death (from
|
||||
Recharge), fellowship management (from Spell Combat), Vaulted Dungeons (Server Features, from Navigation).
|
||||
- **Combat:** targeting (from Ranges) and the blacklist (from Misc) under Targeting; line of sight and the missile
|
||||
arcs (from Misc); both environment responses together (Magic Response from Spell Combat); missile ammo crafting
|
||||
(the old Crafting tab).
|
||||
- **Buffing:** Buff Spell Interval (from Spell Combat), Use Buff Items (from Recharge).
|
||||
- **Inventory:** packs (Autostack, Autocram, Tidy, Floating HUDs), aetheria, salvage and its timers (from Looting),
|
||||
Give Interval (from Misc), Item Info (from Display).
|
||||
- Follow-up (`feature/settings-hunt-df-rows`, on `rc/2026.11.next` 1d6345a): **Hunt On Login** under General > Starting
|
||||
Up (one or the other with Patrol On Login: ticking one clears the other, as RynthAi keeps them), and the **Dirty
|
||||
Fighting rotation** under Combat > Attack Power & Height with its **Effect order** and **Then attack** (RynthAi's
|
||||
DfHeightRotation, DfHeightOrder, DfDefaultHeight; also its own Dirty Fighting window). Hidden until RynthAi sends them.
|
||||
- Taken out: Misc's duplicate Auto Cram (Inventory > Packs > Enable Autocram is the same switch) and Recharge's three
|
||||
"Helper Settings — NOT WIRED YET" sliders (they do nothing; their values stay in the payload).
|
||||
- New rows for settings RynthAi already had and sends (each hidden until RynthAi sends the value, so an older RynthAi
|
||||
shows nothing and a save leaves them alone):
|
||||
- Combat > Targeting: **Cast Settle (ms)**.
|
||||
- Combat > Weapon Swaps: **Weakness Swap Min Gain %**, **No Swap Under Target Health %**, **Wait After Target
|
||||
Switch (ms)**, **Prefer Dual Wield**, **Off-hand Default** (Auto, Shield, Weapon, None).
|
||||
- Buffing: **Idle Margin (minutes)** (with Rebuff When Idle on), **Skip buffs this character can't use**.
|
||||
- Looting: **Loot Mode** (RynthAi's loot messages already pointed here), **Chest relock wait (s)** (also on the
|
||||
Item Tool), and the **Loot By Name** section (Names, Radius; 399b519 rebuilt, never shipped before).
|
||||
- Pins: My settings drawer pins are "Tab/Section/Label" keys. A pin saved under the old layout is found again by its
|
||||
label on the tabs its old tab's rows went to, and the file is rewritten with the new keys when it loads
|
||||
(`QuickSettings.MigrateKey`). Misc's Auto Cram pin goes to Enable Autocram. An engine older than this one won't
|
||||
draw the rewritten pins (they stay in the file).
|
||||
- `/rc settings <tab>` and a plugin's link accept the old names too (`SettingsSchema.FindTab`: Display and UI open
|
||||
Interface, Misc opens General, Melee Combat and Crafting open Combat). `/rc diagnostics` and `/rc serverpick`
|
||||
open Game Client, where the server picker is now.
|
||||
- Text that names a tab follows: chat replies, tooltips, the video patch banner and the comments.
|
||||
|
||||
## Tests
|
||||
|
||||
- `tools/SettingsLayoutTests` (new): the tab order and groups; every one of the 301 pin keys of the old layout
|
||||
(`OldPinKeys.txt`, dumped from f219759) leads to its row; the old tab names; where the moved rows are.
|
||||
- `tools/CombatSettingsTests` and `tools/VaultedSettingTests` follow the rows to Combat and General.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# 2026-11-12 — Progress tab: the ILT sections only on Infinite Leaftide
|
||||
|
||||
The Skills panel's Progress body (Oracle's Progress tab) still shows on every server. Off Infinite Leaftide
|
||||
it shows only the retail attribute XP planner, without the infinite-attributes raiser, the augmentation and
|
||||
enlightenment planners, or the "need RynthILT's ILT features" note. On Leaftide (IltInfo.IsIlt, or RynthILT's
|
||||
progression snapshot) nothing changes.
|
||||
14
Changelog/2026-11-15-item-tool-give-amount-and-every.md
Normal file
14
Changelog/2026-11-15-item-tool-give-amount-and-every.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# 2026-11-15 — Item Tool: Quick give's Amount and Every fields
|
||||
|
||||
Silentkelpie: "on item tool add in a option to give x number of a item and a timer of how often every x
|
||||
seconds."
|
||||
|
||||
- Item Tool > Quick give has two fields, side by side under the item and target picks:
|
||||
- **Amount (0 = all)**: how many a round gives.
|
||||
- **Every (s, 0 = once)**: the seconds between rounds; the give goes on until Stop.
|
||||
- A value goes to RynthAi on Enter or a +/- click ("giveamount N", "giveevery N"). The field keeps the
|
||||
sent value until RynthAi's data shows it back.
|
||||
- With a RynthAi older than this, the fields are hidden and the description is the old one.
|
||||
- ItemToolData reads RynthAi's new keys: amount, everySec, amountMax, everyMax, rounds, units, nextInSec.
|
||||
|
||||
The giving itself is RynthAi's: RynthSuite/Changelog/2026-11-15-quick-give-amount-and-every.md.
|
||||
5
Changelog/2026-11-22-inventory-add-to-trade-shop.md
Normal file
5
Changelog/2026-11-22-inventory-add-to-trade-shop.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Inventory — Add to Trade Shop (multi-select)
|
||||
|
||||
Right-click a picked item (or a Ctrl/Shift multi-selection) → **Add to Trade Shop** / **Add N to Trade Shop**.
|
||||
|
||||
Runs `/ra tradeshop addids …` and opens the Trade Shop window so prices can be edited.
|
||||
8
Changelog/2026-11-22-inventory-trade-shop-storefront.md
Normal file
8
Changelog/2026-11-22-inventory-trade-shop-storefront.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Inventory — Trade Shop Storefront button
|
||||
|
||||
## What changed
|
||||
|
||||
- Modern Inventory header always reserves a Storefront icon (left of Classic / Vault) that runs `/ra tradeshop ui`.
|
||||
- Classic title bar places the same Storefront control next to Vault when there is room.
|
||||
- Header declutter math reserves Trade Shop like Vault so related-panel icons / the “more” menu share what is left.
|
||||
- BarDeclutterTests cover Shop geometry on Modern and Classic layouts.
|
||||
12
Changelog/2026-11-22-settings-game-client-vtank-import.md
Normal file
12
Changelog/2026-11-22-settings-game-client-vtank-import.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# Settings > Game Client: VirindiTank import (2026.11.22.42)
|
||||
|
||||
Previous engine tip: 2026.11.22.40.
|
||||
|
||||
## Change
|
||||
|
||||
Game Client gains a **VirindiTank** section with **Import…**. It runs `/ra vtimport` through
|
||||
RynthAi (confirm first). Available on every server — the import UI is no longer only on the ILT
|
||||
Hub / Mini Remote Gear tab.
|
||||
|
||||
RynthAi copies VirindiTank loot, nav maps and metas into LootProfiles / NavProfiles / MetaFiles and
|
||||
merges MyMonsters from text `.usd` (see RynthSuite changelog for 0.5.100).
|
||||
16
Changelog/2026-11-22-sk-backlog-test-merge.md
Normal file
16
Changelog/2026-11-22-sk-backlog-test-merge.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# SK backlog → aelrynth main (2026.11.22.48)
|
||||
|
||||
Squash of `test/main-merge-2026-10-25` through stamp **2026.11.22.48** onto rynth main 2026.11.19.1.
|
||||
|
||||
## Included (high level)
|
||||
|
||||
- Trade Shop Storefront + inventory multi-add
|
||||
- Loot Editor checklist / named pickers / Raw editor
|
||||
- Inventory filter/checklist, imbue/slayer tooltips, Item Tool Amount/Every
|
||||
- Chat command-reply routing, filter persistence, `/command` → `@command`
|
||||
- Per-character window placements (plugin/pop-out)
|
||||
- `/rc switchchar` and related window/radar command fixes
|
||||
- Dungeon Map floor walked cells; ILT-gated Progress; RynthNav custom portals
|
||||
- Tests and release stamps through 2026.11.22.48
|
||||
|
||||
Standing PR only — rynth cherry-picks / snapshots; not a merge of `sk` into main.
|
||||
|
|
@ -81,6 +81,7 @@ For full deploy details, the Inno Setup installer, and gotchas, see [`BUILD.md`]
|
|||
- `docs/ACCLIENT_HOOK_INVENTORY.md` — hook target inventory against the user's live `acclient.exe`
|
||||
- `docs/PLUGIN_HOOK_MATRIX.md` — clean-room hook surface matrix
|
||||
- `docs/LEGAL_COMPATIBILITY.md` — project policy on Decal/VTank compatibility
|
||||
- `installer/HEADLESS-README.md` — players' guide to the experimental Headless mode (installed as `Headless\README.md`)
|
||||
- `docs/archive/` — archived plans and one-off utilities
|
||||
|
||||
## Repository notes
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RynthCore.HookResolver.UI",
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RynthCore.DecalBridge", "src\RynthCore.DecalBridge\RynthCore.DecalBridge.csproj", "{44C8CF3A-3011-4C80-BDEE-1414B3D6CFAE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RynthCore.Headless", "src\RynthCore.Headless\RynthCore.Headless.csproj", "{88A03697-4463-4F1B-90DC-8FFAAD37912D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RynthCore.Headless.Cli", "src\RynthCore.Headless.Cli\RynthCore.Headless.Cli.csproj", "{2E2B5C60-7B36-4974-B379-B4FD982F59A3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RynthCore.Geometry", "src\RynthCore.Geometry\RynthCore.Geometry.csproj", "{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
|
|
@ -185,18 +191,57 @@ Global
|
|||
{44C8CF3A-3011-4C80-BDEE-1414B3D6CFAE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{44C8CF3A-3011-4C80-BDEE-1414B3D6CFAE}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{44C8CF3A-3011-4C80-BDEE-1414B3D6CFAE}.Release|x64.Build.0 = Release|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Release|x86.Build.0 = Release|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D}.Release|x64.Build.0 = Release|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Release|x86.Build.0 = Release|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3}.Release|x64.Build.0 = Release|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Release|x86.Build.0 = Release|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{D1E2F3A4-5678-4ABC-8DEF-1234567890AB} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{2B283E05-12BB-45F9-B8E5-8F53C1FAB737} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{BB0C5CB5-6C75-4C17-9348-5CA0C481B65C} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{A72E31D3-5D91-4C39-A30C-A96A492BBE82} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{D1E2F3A4-5678-4ABC-8DEF-1234567890AB} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{C1A2B3D4-0007-0007-0007-000000000007} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{C1A2B3D4-0008-0008-0008-000000000008} = {52D7C9F1-3A4E-4B11-9C2D-7E1A8C3F4D89}
|
||||
{C1A2B3D4-0009-0009-0009-000000000009} = {52D7C9F1-3A4E-4B11-9C2D-7E1A8C3F4D89}
|
||||
{44C8CF3A-3011-4C80-BDEE-1414B3D6CFAE} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{88A03697-4463-4F1B-90DC-8FFAAD37912D} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{2E2B5C60-7B36-4974-B379-B4FD982F59A3} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
{982C1BFD-DF0B-4E5F-868D-361DFA0B21CC} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
|
|
@ -33,6 +33,19 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||
SOFTWARE.
|
||||
```
|
||||
|
||||
## Barlow Semi Condensed
|
||||
|
||||
- What: the Barlow Semi Condensed font, SemiBold and Bold (`BarlowSemiCondensed-SemiBold.ttf`, `BarlowSemiCondensed-Bold.ttf`), the narrow label face of the instrument dashboard (plugin windows get it through GetUiFont, Narrow*).
|
||||
- Where: `src/RynthCore.Engine/Assets/Fonts/`, embedded in `RynthCore.Engine.dll` as resources.
|
||||
- Source: https://github.com/google/fonts/tree/main/ofl/barlowsemicondensed (The Barlow Project Authors, https://github.com/jpt/barlow)
|
||||
- Licence: SIL Open Font License 1.1, in full in `src/RynthCore.Engine/Assets/Fonts/Barlow.LICENSE`. The fonts are bundled unmodified; the licence allows bundling them with software, not selling them alone.
|
||||
|
||||
```
|
||||
Copyright 2017 The Barlow Project Authors (https://github.com/jpt/barlow)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
```
|
||||
|
||||
## Chorizite DatReaderWriter (format reference for the dat readers)
|
||||
|
||||
- What: the layout of Asheron's Call .dat files (header, block chains, the directory B-tree) and of the Texture and Palette files, used as the reference when RynthCore's own dat reader and icon decoder were written (2026-10-05). The code is RynthCore's own (MIT); this notice is kept because the library was the format reference.
|
||||
|
|
@ -63,3 +76,40 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
||||
|
||||
## Microsoft WebView2 SDK (the in-game web panel)
|
||||
|
||||
- What: `Microsoft.Web.WebView2.Core.dll` (the managed WebView2 Core wrapper) and the x86 `WebView2Loader.dll`, which the engine uses to host the in-game web panel on the CoreCLR build. They find and drive the Evergreen WebView2 Runtime already installed on the machine; the runtime itself is not shipped.
|
||||
- Where: shipped in `Runtime\` of every CoreCLR install, referenced from `src/RynthCore.Engine/RynthCore.Engine.csproj` (NuGet `Microsoft.Web.WebView2` 1.0.2903.40). The package's WinForms and WPF assemblies are not used or shipped.
|
||||
- Source: https://www.nuget.org/packages/Microsoft.Web.WebView2
|
||||
- Licence: Microsoft's BSD-style licence, reproduced below from the package's own LICENSE.txt.
|
||||
|
||||
```
|
||||
Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* The name of Microsoft Corporation, or the names of its contributors
|
||||
may not be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
```
|
||||
|
|
|
|||
|
|
@ -7,9 +7,11 @@ into the PC.
|
|||
|
||||
It is built in two deliberately separated halves:
|
||||
|
||||
1. **Engine status export** — opt-in, **default OFF**. When enabled, the engine
|
||||
writes a small **local** JSON file per client. It never opens a network
|
||||
connection.
|
||||
1. **Status export** — opt-in, **default OFF**. The private **RynthRemote**
|
||||
plugin (loaded only by you) writes a small **local** JSON file per client;
|
||||
the engine itself writes none. A headless character (`rynth-headless`, see
|
||||
[HEADLESS.md](HEADLESS.md)) writes the same files from its own process.
|
||||
Neither opens a network connection for this.
|
||||
2. **`RynthCore.StatusAgent.exe`** — a separate, optional program that runs **on
|
||||
your own PC**, reads those local files, and forwards a rolled-up payload to
|
||||
**an endpoint you configure**. It is not injected into the game, not in the
|
||||
|
|
@ -23,11 +25,12 @@ This feature is designed so that distributing RynthCore to other people changes
|
|||
nothing for them unless they explicitly turn it on, and even then nothing leaves
|
||||
their machine:
|
||||
|
||||
- **Default off.** With `EnableStatusExport` absent or `false`, the engine writes
|
||||
no status file and behaves exactly as before.
|
||||
- **No telemetry from the game.** `acclient.exe` / the engine never opens a
|
||||
socket for this feature. The most it ever does is write a local file under
|
||||
`C:\Games\RynthCore\Logs\status\`, right next to the logs it already writes.
|
||||
- **Default off.** Without the RynthRemote plugin loaded, no game client writes a
|
||||
status file and everything behaves exactly as before. (Headless characters
|
||||
write theirs by default, see below.)
|
||||
- **No telemetry from the game.** `acclient.exe` / the engine / the plugin never
|
||||
open a socket for this feature. The most they do is write a local file under
|
||||
`C:\Games\RynthCore\Logs\status\`, right next to the logs already written.
|
||||
- **The network half runs on the operator's PC, by the operator.** Only
|
||||
`RynthCore.StatusAgent.exe` makes outbound requests, only to the URL **you**
|
||||
put in **your** config, and only while you choose to run it. With no URL set it
|
||||
|
|
@ -41,25 +44,33 @@ agent — there is no path by which your build reaches into their PC.
|
|||
|
||||
## Turning it on (operator setup)
|
||||
|
||||
### 1. Enable the engine status export
|
||||
### 1. Load the RynthRemote plugin
|
||||
|
||||
Add to **your** `%APPDATA%\RynthCore\engine.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"EnableStatusExport": true
|
||||
}
|
||||
```
|
||||
|
||||
(Or set the env var `RYNTHCORE_STATUS_EXPORT=1` before launching AC for a
|
||||
one-session test without editing the file.) Picked up on next client launch.
|
||||
|
||||
The engine then writes, once per second, per running client:
|
||||
(The engine's own `EnableStatusExport` switch is gone; the files come from the
|
||||
plugin now.) Add the RynthRemote plugin to the launcher's plugin list. It then
|
||||
writes, once per second, per running client (plus `.inventory`, `.settings` and
|
||||
`.character` files next to it), and drains the phone's commands from
|
||||
`Logs\status\commands\RynthCore.<pid>.*.cmd.json`:
|
||||
|
||||
```
|
||||
C:\Games\RynthCore\Logs\status\RynthCore.<pid>.status.json
|
||||
```
|
||||
|
||||
**Headless characters.** `rynth-headless` writes the same four files and drains
|
||||
the same command files for each character it hosts. One process hosts several
|
||||
characters, so `<pid>` is a per-character **client id** (odd, above a billion,
|
||||
never a real process id), and the status carries `"headless": true`,
|
||||
`"hostPid"` and `"hostProcess": "rynth-headless"`. The agent checks that the
|
||||
host process is up and named rynth-headless, where for a retail client it checks
|
||||
that `<pid>` is an `acclient`. Its status folder is the run config's
|
||||
`statusDir` (the launcher's `HeadlessStatusDir`); by default it is
|
||||
`C:\Games\RynthCore\Logs\status\`, the agent's default `StatusDirectory`, so
|
||||
both kinds show together. `"statusDir": ""` turns its status files off. Unlike a
|
||||
game client, a headless character writes them without RynthRemote; they stay
|
||||
local files like the others. A headless character has no window, so screen streaming, clicks,
|
||||
`closeClient`, travel and raise are not available for it. Movement, assess and
|
||||
every RynthAi command work as they do on a retail client.
|
||||
|
||||
### 2. Build and run the agent
|
||||
|
||||
```powershell
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ param(
|
|||
# Explicit path to the RynthSuite repo root. When omitted, defaults to the
|
||||
# sibling directory of RynthCore (i.e. ..\RynthSuite relative to this repo).
|
||||
[string]$RynthSuiteRoot = "",
|
||||
# Explicit path to the RynthServers repo root (rynth's server plugins: RynthILT and one per
|
||||
# server). When omitted, defaults to the sibling directory ..\RynthServers.
|
||||
[string]$RynthServersRoot = "",
|
||||
# Version string injected into the installer (yyyy.m.d.n). When omitted,
|
||||
# the version defined in RynthCore.iss is used as-is.
|
||||
[string]$Version = "",
|
||||
|
|
@ -102,7 +105,13 @@ param(
|
|||
# Makes the bridge mandatory: no Decal means a failed build rather than a skipped bridge.
|
||||
[switch]$IncludeDecalBridge,
|
||||
# Decal's install folder, when not the default C:\Program Files (x86)\Decal 3.0.
|
||||
[string]$DecalDir = ""
|
||||
[string]$DecalDir = "",
|
||||
# Managed (collectible) plugins, built by Publish-Update.ps1 (engine API 88): the folder of the
|
||||
# plugins' common dependencies, staged into Runtime\PluginShared, and the managed RynthAi DLL,
|
||||
# used instead of the NativeAOT RynthAi build. NativeAOT plugins can never be unloaded, so each
|
||||
# reload kept a copy of every one (220-450 MB of address space per reload, 2026-10-19).
|
||||
[string]$PluginSharedDir = "",
|
||||
[string]$RynthAiDll = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
|
@ -189,6 +198,10 @@ $ProjectsRoot = Split-Path $RepoRoot -Parent # e.g. C:\Projects
|
|||
if (-not $RynthSuiteRoot) {
|
||||
$RynthSuiteRoot = "$ProjectsRoot\RynthSuite"
|
||||
}
|
||||
# RynthServers root (server plugins since 2026-10-21): explicit param, else the sibling convention.
|
||||
if (-not $RynthServersRoot) {
|
||||
$RynthServersRoot = "$ProjectsRoot\RynthServers"
|
||||
}
|
||||
|
||||
# ── Source state (release builds) ───────────────────────────────────────────
|
||||
# A deployment package must map to exact commits. Tracked changes outside
|
||||
|
|
@ -240,6 +253,8 @@ $ExperimentalPlugins = @('RynthChat', 'RynthJuice', 'RynthNav', 'RynthTracker',
|
|||
$ExperimentalProjectDirs = @{ 'UbRythai' = "$RynthSuiteRoot\Plugins\ub-Rythai\RynthCore.Plugin.UbRythai" }
|
||||
function Get-ExperimentalDir([string]$Name) {
|
||||
if ($ExperimentalProjectDirs.ContainsKey($Name)) { return $ExperimentalProjectDirs[$Name] }
|
||||
# RynthILT and the per-server plugins live in RynthServers (rynth, 2026-10-21).
|
||||
if ($Name -eq 'RynthILT' -or $ServerPlugins -contains $Name) { return "$RynthServersRoot\Plugins\RynthCore.Plugin.$Name" }
|
||||
return "$RynthSuiteRoot\Plugins\RynthCore.Plugin.$Name"
|
||||
}
|
||||
function Get-ExperimentalProject([string]$Name) { "$(Get-ExperimentalDir $Name)\RynthCore.Plugin.$Name.csproj" }
|
||||
|
|
@ -251,7 +266,11 @@ function Get-ExperimentalPublish([string]$Name) { "$(Get-ExperimentalDir $Name)\
|
|||
# RynthSuite companion plugins (installer components, on in a Full install). Same layout as the
|
||||
# experimental ones: <RynthSuite>\<Name>\RynthCore.Plugin.<Name>.dll, from Plugins\RynthCore.Plugin.<Name>\.
|
||||
# They carry no <Version> of their own, so they get the release calver (-p:Version) like the engine.
|
||||
$SuitePlugins = @('RynthOracle', 'RynthILT', 'RynthInventory', 'RynthSort')
|
||||
# Server plugins (RynthServers): installed with the suite and registered with the launcher; RynthCore
|
||||
# loads only the one for the server you connect to (PluginManifestGate), so each one's features show
|
||||
# only on its own server. RynthILT is the Infinite Leaftide one.
|
||||
$ServerPlugins = @('RynthAChard', 'RynthAelrynth', 'RynthColdeve', 'RynthConquest', 'RynthDerptide', 'RynthDreamWeave', 'RynthEversong', 'RynthFrostACE', 'RynthFrostcull', 'RynthLeafDawn', 'RynthLeafdawning', 'RynthLevistras', 'RynthPortalStorm', 'RynthReefcull', 'RynthSundering', 'RynthThistlecrown', 'RynthThreads')
|
||||
$SuitePlugins = @('RynthOracle', 'RynthILT', 'RynthInventory', 'RynthSort') + $ServerPlugins
|
||||
# RynthNav's starter portal list (shipped into <RynthCore>\NavData, never overwritten).
|
||||
$NavPortalsTsv = "$RynthSuiteRoot\Tools\RynthNav.PortalGraph\Data\portals.tsv"
|
||||
|
||||
|
|
@ -295,13 +314,15 @@ if (-not $SkipBuild) {
|
|||
}
|
||||
# (Default: the CoreCLR engine and native loader are built straight into staging below.)
|
||||
|
||||
# ── 4. RynthAi plugin (NativeAOT; keeps its own version) ─────────────────
|
||||
Write-Host ""
|
||||
Write-Host "[4/7] Publishing RynthAi plugin (NativeAOT)..." -ForegroundColor Cyan
|
||||
# Its plugin version is RynthAiVersionCommand.HandWrittenVersion; the DLL's ProductVersion
|
||||
# takes the release calver so an installed file never reads 1.0.0.
|
||||
dotnet publish $PluginProject -c $Configuration @VersionArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "Plugin publish failed (exit $LASTEXITCODE)" }
|
||||
# ── 4. RynthAi plugin (NativeAOT; keeps its own version; a managed RynthAi from Publish-Update replaces it) ──
|
||||
if (-not $RynthAiDll) {
|
||||
Write-Host ""
|
||||
Write-Host "[4/7] Publishing RynthAi plugin (NativeAOT)..." -ForegroundColor Cyan
|
||||
# Its plugin version is RynthAiVersionCommand.HandWrittenVersion; the DLL's ProductVersion
|
||||
# takes the release calver so an installed file never reads 1.0.0.
|
||||
dotnet publish $PluginProject -c $Configuration @VersionArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "Plugin publish failed (exit $LASTEXITCODE)" }
|
||||
}
|
||||
|
||||
# ── 5. Loot Editor (self-contained Avalonia tool) ─────────────────────────
|
||||
Write-Host ""
|
||||
|
|
@ -471,10 +492,18 @@ Copy-PublishTree $LootEditorPublish "$CoreStaging\Tools\LootEditor"
|
|||
|
||||
# RynthAi plugin DLL → <RynthSuite>\RynthAi (next to its data dirs; the installer hands the
|
||||
# path to the launcher via HKA\Software\Rynth\PendingPluginRegistration).
|
||||
$pluginDll = "$PluginPublish\RynthCore.Plugin.RynthAi.dll"
|
||||
$pluginDll = if ($RynthAiDll) { $RynthAiDll } else { "$PluginPublish\RynthCore.Plugin.RynthAi.dll" }
|
||||
if (-not (Test-Path $pluginDll)) { throw "Plugin DLL not found at: $pluginDll" }
|
||||
Copy-Item $pluginDll "$SuiteStaging\RynthAi\" -Force
|
||||
|
||||
# The managed plugins' common dependencies (engine API 88: ManagedPlugins looks in Runtime\PluginShared).
|
||||
if ($PluginSharedDir) {
|
||||
if (-not (Test-Path $PluginSharedDir)) { throw "PluginShared folder not found at: $PluginSharedDir" }
|
||||
New-Item -ItemType Directory -Path "$CoreStaging\Runtime\PluginShared" -Force | Out-Null
|
||||
Copy-Item "$PluginSharedDir\*" "$CoreStaging\Runtime\PluginShared\" -Force
|
||||
Write-Host " Runtime\PluginShared: $((Get-ChildItem "$CoreStaging\Runtime\PluginShared" -File).Count) file(s)"
|
||||
}
|
||||
|
||||
# Monster Editor → <RynthSuite>\RynthAi\MonsterEditor (RynthAi's dashboard launches it from there)
|
||||
Copy-PublishTree $MonsterEditorPublish "$SuiteStaging\RynthAi\MonsterEditor"
|
||||
|
||||
|
|
@ -533,6 +562,17 @@ if ($SkipDecalBridge) {
|
|||
# release.txt — which core release this install is ($release, from -Version at the top).
|
||||
Set-Content -Path "$CoreStaging\release.txt" -Value @($release, $Version) -Encoding ASCII
|
||||
|
||||
# The PE machine field of a DLL (e_lfanew at 0x3C, then the COFF Machine at PE offset + 4). The game is
|
||||
# 32-bit, so the web panel's native loader must be the x86 one (0x14C): the NuGet package also carries
|
||||
# win-x64 and win-arm64 copies that would load nowhere.
|
||||
function Assert-PeMachine([string]$Path, [int]$Expected) {
|
||||
$bytes = [System.IO.File]::ReadAllBytes($Path)
|
||||
if ($bytes.Length -lt 0x40) { throw "$Path is not a PE file (too short)" }
|
||||
$pe = [System.BitConverter]::ToInt32($bytes, 0x3C)
|
||||
if ($pe -lt 0 -or $pe + 6 -gt $bytes.Length) { throw "$Path is not a PE file (bad e_lfanew)" }
|
||||
$machine = [System.BitConverter]::ToUInt16($bytes, $pe + 4)
|
||||
if ($machine -ne $Expected) { throw ("{0}: PE machine 0x{1:X}, expected 0x{2:X}" -f $Path, $machine, $Expected) }
|
||||
}
|
||||
# Everything a working install needs. The 2026-09-25 public installer went out
|
||||
# without the Loader and the SEH trampoline because nothing checked.
|
||||
$required = @(
|
||||
|
|
@ -555,7 +595,9 @@ if (-not $NativeAot) {
|
|||
$required += @(
|
||||
"$CoreStaging\Runtime\RynthCore.Shim.dll",
|
||||
"$CoreStaging\Runtime\dotnet\coreclr.dll",
|
||||
"$CoreStaging\Runtime\dotnet\System.Private.CoreLib.dll"
|
||||
"$CoreStaging\Runtime\dotnet\System.Private.CoreLib.dll",
|
||||
"$CoreStaging\Runtime\Microsoft.Web.WebView2.Core.dll",
|
||||
"$CoreStaging\Runtime\WebView2Loader.dll"
|
||||
)
|
||||
}
|
||||
if ($buildDecalBridge) {
|
||||
|
|
@ -563,6 +605,9 @@ if ($buildDecalBridge) {
|
|||
}
|
||||
$missing = @($required | Where-Object { -not (Test-Path $_) })
|
||||
if ($missing.Count -gt 0) { throw "Staging is missing required files:`n $($missing -join "`n ")" }
|
||||
if (-not $NativeAot) {
|
||||
Assert-PeMachine "$CoreStaging\Runtime\WebView2Loader.dll" 0x14C
|
||||
}
|
||||
|
||||
# Every assembly the launcher's deps.json lists must be staged next to it — a launcher DLL whose
|
||||
# deps.json doesn't match is exactly the "Could not load RynthCore.DesktopLog" failure of 2026-10-04.
|
||||
|
|
|
|||
75
installer/HEADLESS-README.md
Normal file
75
installer/HEADLESS-README.md
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# Headless mode (experimental)
|
||||
|
||||
Headless runs an account with **no game window**. Instead of starting the Asheron's Call
|
||||
client, the launcher starts `rynth-headless.exe`, RynthCore's own client. It logs the
|
||||
character in and runs RynthAi, the way RynthAi runs inside the game, but nothing is drawn
|
||||
on screen. Use it for a bot character you don't need to watch.
|
||||
|
||||
It is experimental: it may stop, get stuck or do something the game client wouldn't. Try it
|
||||
on a character you can afford to lose time with, and check on it.
|
||||
|
||||
## What it can and can't do
|
||||
|
||||
- **ACE servers only.** The launcher refuses to start a Headless account on a GDLE server.
|
||||
- **No game window and no in-game screens.** There is no RynthCore bar, no RynthAi window
|
||||
and no chat window. You give RynthAi its orders with commands (see below).
|
||||
- **Which plugins run:** only 64-bit plugins. By default that is the RynthAi that comes with
|
||||
RynthCore (in `Headless\plugins\RynthAi` in the RynthCore folder). The plugins in the
|
||||
launcher's Plugins tab, Decal and Decal plugins (VTank, UtilityBelt and the rest) do not
|
||||
run in a headless client.
|
||||
- **It walks on the game's own maps** (it reads your AC client's files), but it can't jump
|
||||
or swim.
|
||||
- **One character per account.** As in the game, an account can have only one character in
|
||||
the world. Don't start the same account in a game client as well: the server drops one.
|
||||
- **64-bit Windows only.**
|
||||
|
||||
## Setting it up
|
||||
|
||||
1. Install or update RynthCore as usual. The headless client comes with it.
|
||||
2. In the launcher, set the account's injection method to **Headless (experimental)**.
|
||||
3. Pick the character the same way as for any account. With none set, the first character
|
||||
on the account logs in.
|
||||
4. Click the account's **OnLogin** button and add the commands RynthAi should get once the
|
||||
character is in the world, for example `/ra start` to start the macro. RynthAi uses the
|
||||
profiles, metas and loot profiles in its headless folder (below), not the ones your game
|
||||
clients use, so copy the ones you want there first.
|
||||
5. Launch the account as usual.
|
||||
|
||||
## Where its files are
|
||||
|
||||
- **RynthAi's files for headless characters:** `%LOCALAPPDATA%\RynthCore\headless\RynthAi\`
|
||||
(settings and loot profiles, metas, navs). Copy profiles from `C:\Games\RynthSuite\RynthAi\`
|
||||
into the same subfolders to use them headless.
|
||||
- **Log:** `%LOCALAPPDATA%\RynthCore\headless\headless-<account>.log`, one per account (what
|
||||
the character and its plugins did, and what the server refused). RynthAi's own logs are
|
||||
in `RynthAi\Logs` there.
|
||||
- **Status files** (for status tools that read them): `C:\Games\RynthCore\Logs\status\`.
|
||||
|
||||
## Seeing it and stopping it
|
||||
|
||||
- The account shows in the launcher like any running client.
|
||||
- **The Headless window** (the **Headless clients** button under Live Sessions, or **Runtime >
|
||||
Headless client > Show headless clients**) shows what each headless character is doing:
|
||||
- a list with a coloured dot for each character: green botting, blue idle, red dead, grey not
|
||||
in the world, amber not answering (no news for 10 seconds; it leaves the list after 30);
|
||||
- for the one you pick: health, stamina and mana, what RynthAi is doing and its target, where
|
||||
the character is (map coordinates outdoors), XP per hour and this session, kills, deaths,
|
||||
vitae, burden and how long it has run;
|
||||
- its last 30 chat lines (combat damage lines left out) and the last 50 lines of its log,
|
||||
updated every second;
|
||||
- a command box for `/ra`, `/rnav`, `/mt` and `/rn` commands (for example `/ra pause`): it
|
||||
says when the character took the command and shows the chat line it answered with;
|
||||
- **Start macro / Stop macro**, **Log out** (that character's headless client logs out and
|
||||
closes) and **Open log folder**.
|
||||
- To stop a headless client, use **Runtime > Headless client > Log out headless clients**. It
|
||||
asks every headless client to log its character out and close (it is closed after 20 seconds
|
||||
if it doesn't). With AutoLaunch on, uncheck the account first, or the launcher starts it again.
|
||||
|
||||
## Settings (Runtime tab, Headless client)
|
||||
|
||||
- **rynth-headless.exe:** leave it empty to use the one that comes with RynthCore.
|
||||
- **Headless plugins:** leave it empty to use the RynthAi that comes with RynthCore. To list
|
||||
your own, give one 64-bit plugin DLL per line; never the ones from the Plugins tab, which
|
||||
are 32-bit and can't load in it.
|
||||
|
||||
To go back, set the account's injection method to **RynthCore** again.
|
||||
|
|
@ -6,8 +6,12 @@
|
|||
.DESCRIPTION
|
||||
One command per release:
|
||||
1. Refuses if the signing key isn't set up or isn't trusted by the launcher being shipped,
|
||||
if either repo has uncommitted changes, or if -Version isn't newer than the live feed.
|
||||
2. Builds the installer (Build-Installer.ps1 -Version; it includes the Decal bridge, so the
|
||||
if either repo has uncommitted changes, or if -Version isn't newer than the live feed;
|
||||
with -SkipNavData, also if the last published RynthNav map can't be found or isn't on
|
||||
the server as signed (a feed without it gives new RynthNav players no map).
|
||||
2. Runs every offline test program in RynthCore, RynthSuite and RynthServers
|
||||
(scripts\Run-AllTests.ps1) and stops if any fails: nothing is built or uploaded.
|
||||
Then builds the installer (Build-Installer.ps1 -Version; it includes the Decal bridge, so the
|
||||
build machine needs Decal installed) and the RynthSuite plugins into
|
||||
installer\Releases\<release>\ — never into the live C:\Games folders.
|
||||
3. Writes the manifest (sizes + SHA-256 of every file), signs it with the DPAPI key
|
||||
|
|
@ -33,17 +37,29 @@ param(
|
|||
[string]$Notes = "",
|
||||
[switch]$DryRun, # build + sign + verify, upload nothing
|
||||
[switch]$AllowDirty, # publish with uncommitted changes (don't)
|
||||
# Publish without running the test programs first (step 2). For an emergency hotfix only; the
|
||||
# release log says the tests were skipped.
|
||||
[switch]$SkipTests,
|
||||
[string]$SshHost = "aelrynth-vps",
|
||||
[string]$RemoteDir = "/var/www/site/downloads/rynth",
|
||||
[string]$BaseUrl = "https://aelrynth.com/downloads/rynth",
|
||||
[string]$KeyDir = (Join-Path $env:USERPROFILE ".rynthcore-update-signing"),
|
||||
[string]$RynthSuiteRoot = "",
|
||||
# The server plugins' repository (2026-10-21), beside RynthSuite (it compiles RynthSuite's shared
|
||||
# contracts and the same RynthCore SDK, so their shared DLLs match). Defaults to ..\RynthServers.
|
||||
[string]$RynthServersRoot = "",
|
||||
[string]$TrustFile = "", # defaults to the launcher's UpdateTrust.cs; override for tests
|
||||
# RynthNav's data shipped to launchers as the signed "navdata" archive: tiles (nav_XXXX.tile),
|
||||
# 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)
|
||||
# Build and upload no new RynthNav archive: the feed carries the last published navdata entry
|
||||
# instead (see "RynthNav's map with -SkipNavData" below). It never ships a feed without the map.
|
||||
[switch]$SkipNavData,
|
||||
# With -SkipNavData: an earlier update.json (signed) or update.payload.json whose navdata entry to
|
||||
# carry, for when neither the live feed nor any kept release manifest has one.
|
||||
[string]$NavDataFrom = "",
|
||||
[switch]$NativeAotPlugins, # the old NativeAOT plugin builds (each reload keeps a copy of every one)
|
||||
# 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/<first 16 hex of its SHA-256>/ and kept by later releases. Without this folder the live feed's packs are
|
||||
|
|
@ -55,6 +71,11 @@ $ErrorActionPreference = "Stop"
|
|||
$ScriptDir = $PSScriptRoot
|
||||
$RepoRoot = Split-Path $ScriptDir -Parent
|
||||
if (-not $RynthSuiteRoot) { $RynthSuiteRoot = Join-Path (Split-Path $RepoRoot -Parent) "RynthSuite" }
|
||||
if (-not $RynthServersRoot) { $RynthServersRoot = Join-Path (Split-Path $RynthSuiteRoot -Parent) "RynthServers" }
|
||||
if (-not (Test-Path (Join-Path $RynthServersRoot "Plugins"))) { throw "No RynthServers checkout at $RynthServersRoot (pass -RynthServersRoot)." }
|
||||
if ((Resolve-Path (Split-Path $RynthServersRoot -Parent)).Path -ne (Resolve-Path (Split-Path $RynthSuiteRoot -Parent)).Path) {
|
||||
throw "RynthServers ($RynthServersRoot) must sit beside RynthSuite ($RynthSuiteRoot): it builds against that RynthSuite and RynthCore."
|
||||
}
|
||||
if (-not $TrustFile) { $TrustFile = Join-Path $RepoRoot "src\RynthCore.App.Avalonia\UpdateTrust.cs" }
|
||||
|
||||
function Step($m) { Write-Host ""; Write-Host "== $m" -ForegroundColor Cyan }
|
||||
|
|
@ -104,11 +125,28 @@ try {
|
|||
Write-Host " signing key is trusted by the launcher ($($trusted.Count) keys)"
|
||||
|
||||
if (-not $AllowDirty) {
|
||||
foreach ($repo in $RepoRoot, $RynthSuiteRoot) {
|
||||
foreach ($repo in $RepoRoot, $RynthSuiteRoot, $RynthServersRoot) {
|
||||
$dirty = git -C $repo status --porcelain --untracked-files=no
|
||||
if ($dirty) { throw "$repo has uncommitted changes — release from committed code (or pass -AllowDirty):`n$dirty" }
|
||||
}
|
||||
Write-Host " RynthCore $(git -C $RepoRoot rev-parse --short HEAD), RynthSuite $(git -C $RynthSuiteRoot rev-parse --short HEAD)"
|
||||
Write-Host " RynthCore $(git -C $RepoRoot rev-parse --short HEAD), RynthSuite $(git -C $RynthSuiteRoot rev-parse --short HEAD), RynthServers $(git -C $RynthServersRoot rev-parse --short HEAD)"
|
||||
}
|
||||
|
||||
# The plugins build against the RynthCore beside RynthSuite (its SDK and build targets), not
|
||||
# necessarily this checkout. Those targets must derive minEngineApi for release builds
|
||||
# (RynthPluginSharedSdk, see the plugin build below): with older ones every managed plugin's
|
||||
# manifest would keep its csproj's stale minimum (66), and launchers would offer it to cores that
|
||||
# can't even load managed plugins.
|
||||
$managedPluginApi = 0
|
||||
if (-not $NativeAotPlugins) {
|
||||
$sdkTargets = Join-Path (Split-Path $RynthSuiteRoot -Parent) "RynthCore\src\RynthCore.PluginSdk\build\RynthCore.PluginSdk.targets"
|
||||
$targetsText = if (Test-Path $sdkTargets) { Get-Content $sdkTargets -Raw } else { "" }
|
||||
$floor = [regex]::Match($targetsText, '<RynthCoreManagedPluginApi>(\d+)</RynthCoreManagedPluginApi>')
|
||||
if (-not $floor.Success -or $targetsText -notmatch "'\`$\(RynthPluginSharedSdk\)' == 'true'") {
|
||||
throw "The plugins' SDK build targets ($sdkTargets) don't derive minEngineApi for release builds (RynthPluginSharedSdk). Update the RynthCore checkout beside RynthSuite to one with this script's SDK."
|
||||
}
|
||||
$managedPluginApi = [int]$floor.Groups[1].Value
|
||||
Write-Host " plugin SDK targets: minEngineApi derived per plugin (managed plugins need API $managedPluginApi+)"
|
||||
}
|
||||
|
||||
$liveManifest = $null
|
||||
|
|
@ -122,13 +160,207 @@ try {
|
|||
Write-Host " no live feed yet — this is the first release"
|
||||
}
|
||||
|
||||
# ── RynthNav's map with -SkipNavData ─────────────────────────────────────────
|
||||
# -SkipNavData means "build and upload no new archive", never "ship without the map": the feed
|
||||
# carries the last published "navdata" entry, the way map packs are carried. It used to drop the
|
||||
# entry, so every feed from 2026.10.18.1 on had none and a player who added RynthNav got no tiles,
|
||||
# route graph or World Map (structural audit 2026-10-21, #6). The entry comes from, in order:
|
||||
# -NavDataFrom, the live feed, then each earlier release's own signed manifest
|
||||
# (releases/<n>/update.json, kept from 2026.10.19.1 on; releases.json names them, newest first).
|
||||
# The first one found is used once its archive is checked on the server (size and SHA-256, the
|
||||
# same ssh + sha256sum check as the uploads); a missing or changed archive, or no entry anywhere,
|
||||
# stops the release here, before anything is built.
|
||||
|
||||
# A manifest's navdata object as the feed writes it (ConvertFrom-Json: whole numbers forced back to
|
||||
# integers, see the [long] note at the navdata step), or $null when it isn't a usable entry. The
|
||||
# URL must be inside the feed folder, as the launcher requires (RynthUpdater.CheckUrl).
|
||||
function ConvertTo-NavDataEntry($nd) {
|
||||
if (-not $nd) { return $null }
|
||||
try {
|
||||
$e = [ordered]@{
|
||||
id = ([string]$nd.id).ToLowerInvariant()
|
||||
release = [long]$nd.release
|
||||
url = [string]$nd.url
|
||||
size = [long]$nd.size
|
||||
sha256 = ([string]$nd.sha256).ToLowerInvariant()
|
||||
files = [long]$nd.files
|
||||
bytes = [long]$nd.bytes
|
||||
}
|
||||
} catch { return $null }
|
||||
if ($e.id -notmatch '^[0-9a-f]{16,64}$' -or $e.sha256 -notmatch '^[0-9a-f]{64}$' -or $e.size -le 0 -or $e.files -le 0 -or
|
||||
-not $e.url.StartsWith("$BaseUrl/", [StringComparison]::Ordinal) -or $e.url.Contains("..")) { return $null }
|
||||
return $e
|
||||
}
|
||||
|
||||
# The manifest in a signed update.json (only when a key the launcher trusts signed it) or in a plain
|
||||
# update.payload.json (a local release folder's); $null when it can't be read.
|
||||
function Read-ManifestFile([string]$path) {
|
||||
try {
|
||||
$doc = Get-Content $path -Raw | ConvertFrom-Json
|
||||
if ($doc.payload -and $doc.signatures) {
|
||||
if (-not (Test-Envelope $path $trusted)) { Write-Warning "$path is not signed by a key the launcher trusts - ignored."; return $null }
|
||||
return [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($doc.payload)) | ConvertFrom-Json
|
||||
}
|
||||
return $doc
|
||||
} catch { Write-Warning "Can't read ${path}: $($_.Exception.Message)"; return $null }
|
||||
}
|
||||
|
||||
# @{ Entry; From } for the last published navdata entry (see above), or $null.
|
||||
function Find-PublishedNavData {
|
||||
if ($NavDataFrom) {
|
||||
if (-not (Test-Path $NavDataFrom)) { throw "-NavDataFrom: no file at $NavDataFrom" }
|
||||
$m = Read-ManifestFile $NavDataFrom
|
||||
$e = if ($m) { ConvertTo-NavDataEntry $m.navdata } else { $null }
|
||||
if ($null -eq $e) { throw "-NavDataFrom: $NavDataFrom has no usable navdata entry (or isn't signed by a trusted key)." }
|
||||
return @{ Entry = $e; From = $NavDataFrom }
|
||||
}
|
||||
if ($liveManifest) {
|
||||
$e = ConvertTo-NavDataEntry $liveManifest.navdata
|
||||
if ($null -ne $e) { return @{ Entry = $e; From = "the live feed (release $($liveManifest.release))" } }
|
||||
}
|
||||
$history = @()
|
||||
try { $history = @((Invoke-RestMethod "$BaseUrl/releases.json" -TimeoutSec 20).releases) }
|
||||
catch { Write-Warning "releases.json: $($_.Exception.Message)" }
|
||||
$looked = 0
|
||||
foreach ($h in $history) {
|
||||
$v = ([string]$h.version).Split('.')
|
||||
if ($v.Count -ne 4 -or ($v | Where-Object { $_ -notmatch '^\d+$' })) { continue }
|
||||
$n = [int]$v[0] * 1000000 + [int]$v[1] * 10000 + [int]$v[2] * 100 + [int]$v[3]
|
||||
if ($n -ge $release -or $n -lt 2026101901) { continue } # 2026101901: the first release whose manifest is kept
|
||||
if (++$looked -gt 20) { break }
|
||||
$tmp = New-TemporaryFile
|
||||
try {
|
||||
try { Invoke-WebRequest "$BaseUrl/releases/$n/update.json" -OutFile $tmp -UseBasicParsing -TimeoutSec 20 | Out-Null }
|
||||
catch { continue }
|
||||
$m = Read-ManifestFile $tmp
|
||||
if ($m -and [long]$m.release -eq $n) {
|
||||
$e = ConvertTo-NavDataEntry $m.navdata
|
||||
if ($null -ne $e) { return @{ Entry = $e; From = "release $n's signed manifest" } }
|
||||
}
|
||||
} finally { Remove-Item $tmp -ErrorAction SilentlyContinue }
|
||||
}
|
||||
return $null
|
||||
}
|
||||
|
||||
# The archive an entry names must be on the server exactly as signed: the launcher refuses a download
|
||||
# whose size or SHA-256 differs, so a feed pointing at a gone or changed file gives players no map.
|
||||
function Assert-RemoteNavData($e, [string]$from) {
|
||||
$relPath = $e.url.Substring($BaseUrl.Length + 1)
|
||||
if ($relPath -notmatch '^[A-Za-z0-9._/-]+$') { throw "RynthNav's map entry from $from has an unexpected URL: $($e.url)" }
|
||||
$remoteFile = "$RemoteDir/$relPath"
|
||||
$out = @(ssh $SshHost "stat -c %s '$remoteFile' && sha256sum '$remoteFile'")
|
||||
if ($LASTEXITCODE -ne 0 -or $out.Count -lt 2) {
|
||||
throw "RynthNav's map from $from ($remoteFile) is not on the server (or ssh failed) - not publishing a feed without the map. " +
|
||||
"Leave out -SkipNavData and pass -NavDataDir a complete, finished NavData folder to publish a new archive."
|
||||
}
|
||||
$size = [long]("$($out[0])".Trim())
|
||||
$sum = ("$($out[1])".Trim() -split '\s+')[0].ToLowerInvariant()
|
||||
if ($size -ne $e.size -or $sum -ne $e.sha256) {
|
||||
throw "RynthNav's map on the server ($remoteFile) is not the one $from signed (size $size vs $($e.size), sha256 $sum vs $($e.sha256)) - not publishing."
|
||||
}
|
||||
Write-Host (" RynthNav map: release {0}'s archive ({1:N0} MB, id {2}) is on the server as signed; from {3}" -f $e.release, ($e.size / 1MB), $e.id, $from)
|
||||
}
|
||||
|
||||
if ($NavDataFrom -and -not $SkipNavData) { throw "-NavDataFrom goes with -SkipNavData (without it the archive is built from -NavDataDir)." }
|
||||
$carriedNavData = $null
|
||||
if ($SkipNavData) {
|
||||
$found = Find-PublishedNavData
|
||||
if (-not $found) {
|
||||
throw "-SkipNavData, but neither the live feed nor any kept release manifest has RynthNav's map (navdata), and a feed without it " +
|
||||
"gives players who add RynthNav no tiles, route graph or World Map - not publishing. Either leave out -SkipNavData and pass " +
|
||||
"-NavDataDir a complete, finished NavData folder (not one being re-baked) to publish a new archive, or pass -NavDataFrom an " +
|
||||
"earlier update.json / update.payload.json that has the entry."
|
||||
}
|
||||
Assert-RemoteNavData $found.Entry $found.From
|
||||
$carriedNavData = $found.Entry
|
||||
}
|
||||
|
||||
# ── 2. Build ─────────────────────────────────────────────────────────────────
|
||||
$rel = Join-Path $ScriptDir "Releases\$release"
|
||||
if (Test-Path $rel) { Remove-Item $rel -Recurse -Force }
|
||||
New-Item -ItemType Directory -Force "$rel\plugins", "$rel\build" | Out-Null
|
||||
|
||||
# Every offline test program in the three repos, before anything is built (2026-10-22: tests only ran
|
||||
# when someone remembered to). One failure stops the release; the logs stay in Releases\<release>\tests.
|
||||
if ($SkipTests) {
|
||||
Step "Tests SKIPPED (-SkipTests)"
|
||||
Write-Warning "Publishing $Version without running the tests."
|
||||
} else {
|
||||
Step "Running the tests (scripts\Run-AllTests.ps1)"
|
||||
& (Join-Path $RepoRoot "scripts\Run-AllTests.ps1") -RynthCoreRoot $RepoRoot -RynthSuiteRoot $RynthSuiteRoot `
|
||||
-RynthServersRoot $RynthServersRoot -LogDir "$rel\tests"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Tests failed (summary above, logs in $rel\tests) - not publishing. Fix them, or pass -SkipTests for an emergency hotfix."
|
||||
}
|
||||
}
|
||||
|
||||
# Plugins: built MANAGED by default (collectible: a reload frees them; NativeAOT plugins can never be
|
||||
# unloaded, so every reload kept a copy of each one - 220-450 MB of address space per reload,
|
||||
# 2026-10-19). Each managed plugin still ships as one DLL in the feed: their common dependencies
|
||||
# (RynthCore.PluginSdk, PluginCore, ImGui.NET, MoonSharp, ...) go into the installer's
|
||||
# Runtime\PluginShared, where the engine (API 88) finds them. -NativeAotPlugins: the old builds.
|
||||
# minEngineApi: -p:RynthPluginSharedSdk=true tells the SDK's build targets that these plugins bind
|
||||
# the PluginShared SDK, which reaches players only with this release's core. Each plugin's manifest
|
||||
# then says its own declared minimum when that is 88 or more (a checked claim), else this SDK's API
|
||||
# (_RynthPluginEffectiveMinEngineApi in RynthCore.PluginSdk.targets explains why). The feed copies
|
||||
# each plugin's minEngineApi from the manifest embedded in its DLL (below), which is also what the
|
||||
# engine checks at load and what the launcher's EngineBlocker holds updates by. This used to force
|
||||
# -p:RynthPluginMinEngineApi=88 on every plugin, a constant that offered plugins calling v89 SDK
|
||||
# members to API-88 cores (structural audit 2026-10-21, F5 / #7).
|
||||
$suitePlugins = "RynthChat", "RynthTracker", "RynthNav", "RynthVision", "RynthLua", "RynthOracle", "RynthInventory", "RynthSort", "RynthNet", "RynthDefective"
|
||||
# Server plugins (the RynthServers repository since 2026-10-21; ServerPack is 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 on its Server plugins tab for the player to install; not in
|
||||
# RynthSuite-Plugins.zip or the installer. RynthILT and RynthThreads were in the zip until 2026-10-21.
|
||||
$serverPlugins = "RynthAChard", "RynthAelrynth", "RynthColdeve", "RynthConquest", "RynthDerptide", "RynthDreamWeave", "RynthEversong",
|
||||
"RynthFrostACE", "RynthFrostcull", "RynthILT", "RynthLeafDawn", "RynthLeafdawning", "RynthLevistras", "RynthPortalStorm",
|
||||
"RynthReefcull", "RynthSundering", "RynthThistlecrown", "RynthThreads"
|
||||
$managedArgs = if ($NativeAotPlugins) { @() } else {
|
||||
@("-p:PublishAot=false", "-p:NativeLib=", "-p:SelfContained=false", "-p:RuntimeIdentifier=win-x86",
|
||||
"-p:GenerateRuntimeConfigurationFiles=false", "-p:RynthPluginSharedSdk=true")
|
||||
}
|
||||
function Build-Plugin([string]$name, [string]$label, [string]$root = $RynthSuiteRoot, [string[]]$extra = @()) {
|
||||
Step "Building $name$label"
|
||||
$proj = Join-Path $root "Plugins\RynthCore.Plugin.$name\RynthCore.Plugin.$name.csproj"
|
||||
if (-not (Test-Path $proj)) { throw "No project for $name at $proj" }
|
||||
# PublishDir overrides the projects' own (RynthNav/RynthVision publish into the live C:\Games folders).
|
||||
dotnet publish $proj -c Release "-p:Version=$Version" "-p:PublishDir=$rel\build\$name\" @managedArgs @extra -v q -nologo
|
||||
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed for $name" }
|
||||
}
|
||||
foreach ($name in @("RynthAi") + $suitePlugins) { Build-Plugin $name "" }
|
||||
# Against this release's RynthSuite, whatever RynthServers' own Directory.Build.props would pick.
|
||||
$suiteRootArg = "-p:RynthSuiteRoot=$((Resolve-Path $RynthSuiteRoot).Path.TrimEnd('\'))\"
|
||||
foreach ($name in $serverPlugins) { Build-Plugin $name " (server plugin, feed only)" $RynthServersRoot @($suiteRootArg) }
|
||||
|
||||
$sharedDir = ""
|
||||
if (-not $NativeAotPlugins) {
|
||||
# Every plugin's dependencies, once each; the same name must be the same file in every plugin
|
||||
# (they all build from this commit), else the release stops.
|
||||
$sharedDir = "$rel\build\PluginShared"
|
||||
New-Item -ItemType Directory -Force $sharedDir | Out-Null
|
||||
$seen = @{}
|
||||
foreach ($name in @("RynthAi") + $suitePlugins + $serverPlugins) {
|
||||
foreach ($f in Get-ChildItem "$rel\build\$name\*.dll") {
|
||||
if ($f.Name -like "RynthCore.Plugin.*.dll") { continue }
|
||||
$hash = (Get-FileHash $f.FullName -Algorithm SHA256).Hash
|
||||
if ($seen.ContainsKey($f.Name)) {
|
||||
if ($seen[$f.Name] -ne $hash) { throw "PluginShared: $($f.Name) differs between plugins ($name) - not publishing." }
|
||||
continue
|
||||
}
|
||||
$seen[$f.Name] = $hash
|
||||
Copy-Item $f.FullName "$sharedDir\"
|
||||
}
|
||||
}
|
||||
Write-Host " PluginShared: $($seen.Count) file(s): $(($seen.Keys | Sort-Object) -join ', ')"
|
||||
}
|
||||
|
||||
Step "Building the installer ($Version)"
|
||||
& (Join-Path $ScriptDir "Build-Installer.ps1") -Version $Version -RynthSuiteRoot $RynthSuiteRoot
|
||||
$installerArgs = @{ Version = $Version; RynthSuiteRoot = $RynthSuiteRoot }
|
||||
if (-not $NativeAotPlugins) {
|
||||
$installerArgs.PluginSharedDir = $sharedDir
|
||||
$installerArgs.RynthAiDll = "$rel\build\RynthAi\RynthCore.Plugin.RynthAi.dll"
|
||||
}
|
||||
& (Join-Path $ScriptDir "Build-Installer.ps1") @installerArgs
|
||||
if (-not $?) { throw "Build-Installer.ps1 failed" }
|
||||
# The Decal bridge (experimental, opt-in per account) is only in installers built where Decal is
|
||||
# installed; a launcher updating through this feed without it can't run "Decal + RynthCore" accounts.
|
||||
|
|
@ -140,37 +372,17 @@ if (Test-Path $bridgeStaged) {
|
|||
}
|
||||
# The versioned installer is the primary artifact (the RynthCore-Setup.exe copy is best effort).
|
||||
Copy-Item (Join-Path $ScriptDir "Output\RynthCore-Setup-$Version.exe") "$rel\RynthCore-Setup.exe"
|
||||
# Build-Installer.ps1 stages RynthSuite files under staging\suite\ (RynthAi -> staging\suite\RynthAi\).
|
||||
Copy-Item (Join-Path $ScriptDir "staging\suite\RynthAi\RynthCore.Plugin.RynthAi.dll") "$rel\plugins\"
|
||||
|
||||
$suitePlugins = "RynthChat", "RynthTracker", "RynthNav", "RynthVision", "RynthLua", "RynthOracle", "RynthInventory", "RynthSort", "RynthILT", "RynthThreads", "RynthNet"
|
||||
# One plugin per server (Plugins\Shared\ServerPack). RynthCore loads only the one whose manifest
|
||||
# hosts claim the client's connect host, so installing all of them costs disk, not memory.
|
||||
$serverPlugins = "RynthAChard", "RynthAelrynth", "RynthColdeve", "RynthConquest", "RynthDerptide", "RynthDreamWeave",
|
||||
"RynthEversong", "RynthFrostACE", "RynthFrostcull", "RynthLeafDawn", "RynthLeafdawning", "RynthLevistras",
|
||||
"RynthPortalStorm", "RynthReefcull", "RynthSundering", "RynthThistlecrown"
|
||||
# RynthAi: the managed build when plugins are managed, else the NativeAOT one Build-Installer.ps1
|
||||
# staged under staging\suite\RynthAi\.
|
||||
$rynthAiFeed = if ($NativeAotPlugins) { Join-Path $ScriptDir "staging\suite\RynthAi\RynthCore.Plugin.RynthAi.dll" }
|
||||
else { "$rel\build\RynthAi\RynthCore.Plugin.RynthAi.dll" }
|
||||
Copy-Item $rynthAiFeed "$rel\plugins\"
|
||||
foreach ($name in $suitePlugins + $serverPlugins) {
|
||||
Copy-Item "$rel\build\$name\RynthCore.Plugin.$name.dll" "$rel\plugins\"
|
||||
}
|
||||
# Server plugins also go in RynthSuite-Plugins.zip: RynthCore loads only the one whose manifest hosts
|
||||
# claim the client's connect host, so installing all of them costs disk, not memory.
|
||||
$suitePlugins += $serverPlugins
|
||||
foreach ($name in $suitePlugins) {
|
||||
Step "Building $name"
|
||||
$proj = Join-Path $RynthSuiteRoot "Plugins\RynthCore.Plugin.$name\RynthCore.Plugin.$name.csproj"
|
||||
# PublishDir overrides the projects' own (RynthNav/RynthVision publish into the live C:\Games folders).
|
||||
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\"
|
||||
}
|
||||
|
||||
# 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"
|
||||
|
|
@ -209,14 +421,14 @@ Extract this zip into C:\Games - it creates:
|
|||
C:\Games\RynthSuite\RynthOracle\ RynthOracle plugin (quests, character, titles; based on Oracle of Dereth by Advis Eveldan)
|
||||
C:\Games\RynthSuite\RynthInventory\ RynthInventory plugin (search every character's items)
|
||||
C:\Games\RynthSuite\RynthSort\ RynthSort plugin (keeps your packs sorted; replaces the RynthSort Lua script)
|
||||
C:\Games\RynthSuite\RynthILT\ RynthILT plugin (Infinite Leaftide only: the ILT Hub, Guardian, bounties, progression, ILT settings, /fship fellowship commands)
|
||||
C:\Games\RynthSuite\RynthThreads\ RynthThreads plugin (DreamWeave only: Fragment Press results, what each component brings)
|
||||
C:\Games\RynthSuite\RynthNet\ RynthNet plugin (links your clients on this PC: /ub bc, shared vitals, the Characters panel)
|
||||
C:\Games\RynthSuite\Rynth<Server>\ One server plugin per server (RynthColdeve, RynthAelrynth,
|
||||
RynthPortalStorm, ...): the server's facts, rules and commands.
|
||||
RynthCore loads only the one for the server you connect to.
|
||||
C:\Games\RynthSuite\RynthDefective\ RynthDefective plugin (a shortcut bar, AC's panel buttons and the Selection, in place of the retail toolbar)
|
||||
C:\Games\RynthCore\NavData\ RynthNav's portals and Atlas
|
||||
|
||||
Plugins for one game server (RynthILT for Infinite Leaftide, RynthThreads for
|
||||
DreamWeave, and one per server) are not in this zip: install yours from the
|
||||
launcher's Server plugins tab.
|
||||
|
||||
Then, in the RynthCore launcher's Plugins tab, add the full path of each
|
||||
plugin DLL you want. Install RynthCore first (RynthCore-Setup.exe), which
|
||||
also installs RynthAi and the Loot Editor. After that the launcher keeps
|
||||
|
|
@ -230,13 +442,14 @@ Compress-Archive -Path "$zipRoot\*" -DestinationPath "$rel\RynthSuite-Plugins.zi
|
|||
# RynthNav's data for the launchers (RynthUpdater.NavData.cs): one archive, flat, only the file
|
||||
# names RynthNav reads. Its id is a hash over every file's name and SHA-256, so an unchanged
|
||||
# set reuses the live entry (and the archive already on the server) instead of re-uploading.
|
||||
$navData = $null
|
||||
# -SkipNavData: the entry found and checked in step 1 (never none).
|
||||
$navData = $carriedNavData
|
||||
$navZip = $null
|
||||
if (-not $SkipNavData) {
|
||||
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." }
|
||||
if ($tileCount -eq 0) { throw "$NavDataDir has no tiles. Pass -NavDataDir, or -SkipNavData to carry the last published map." }
|
||||
# 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).
|
||||
|
|
@ -268,6 +481,7 @@ if (-not $SkipNavData) {
|
|||
bytes = [long]$navData.bytes
|
||||
}
|
||||
Write-Host " unchanged ($($navFiles.Count) files, id $navId): the live archive from release $($navData.release) stays"
|
||||
Assert-RemoteNavData $navData "the live feed"
|
||||
} else {
|
||||
$navZip = "$rel\RynthNav-NavData.zip"
|
||||
Add-Type -AssemblyName System.IO.Compression, System.IO.Compression.FileSystem
|
||||
|
|
@ -339,14 +553,15 @@ $pluginDescriptions = @{
|
|||
RynthChat = "A chat window that sorts messages into tabs."
|
||||
RynthTracker = "Kills, experience and luminance per hour for each session."
|
||||
RynthNav = "Walks you to coordinates and towns, with route planning and the Atlas. Downloads its map (about 540 MB)."
|
||||
RynthVision = "Shows unclimbable slopes, impassable water and your radar range in the world."
|
||||
RynthVision = "Shows unclimbable slopes, impassable water and your radar range in the world, and lights dark dungeons."
|
||||
RynthLua = "Lua scripting for metas and your own scripts."
|
||||
RynthOracle = "Quests, character, titles and leaderboards."
|
||||
RynthOracle = "Quests, character and titles."
|
||||
RynthInventory = "Search every character's items."
|
||||
RynthSort = "Keeps your packs sorted: new loot goes to the pack its rule names."
|
||||
RynthILT = "Infinite Leaftide only: the ILT Hub (the Mini Remote's banking, gear, charms and games tabs), the Guardian, bounty tracking, progression planning, ILT settings and the /fship fellowship commands."
|
||||
RynthThreads = "DreamWeave only: records Fragment Press results and works out what each component brings."
|
||||
RynthNet = "Links your characters on this PC: broadcast commands (/ub bc), shared vitals and the Characters panel."
|
||||
RynthDefective = "A shortcut bar with AC's own keys, buttons for AC's panels and the Selection, in place of the retail toolbar."
|
||||
# Server plugins: only the one for the server you connect to loads.
|
||||
RynthAChard = "AChard's server plugin: server facts, PvP rules and commands. Loads only on AChard."
|
||||
RynthAelrynth = "Aelrynth's server plugin: server facts, mods and commands. Loads only on Aelrynth."
|
||||
|
|
@ -389,8 +604,12 @@ $plugins = foreach ($dll in Get-ChildItem "$rel\plugins\*.dll" | Sort-Object Nam
|
|||
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?)." }
|
||||
# The plugin's own minimum, as its build wrote it into the DLL (see the plugin build above).
|
||||
$min = [int]$pm.minEngineApi
|
||||
if ($min -gt $engineApi) { throw "$($dll.Name) needs engine API $min but this release's engine is $engineApi - it would never load." }
|
||||
if ($managedPluginApi -gt 0 -and $min -lt $managedPluginApi) {
|
||||
throw "$($dll.Name): its manifest says engine API $min, but a managed plugin needs $managedPluginApi just to load - launchers would offer it to cores that can't run it (stale SDK targets beside RynthSuite?)."
|
||||
}
|
||||
if ($min -gt 0) { $entry.minEngineApi = $min }
|
||||
Write-Host " $pluginName $($pm.version): engine API $min+"
|
||||
} else {
|
||||
|
|
@ -418,7 +637,9 @@ $manifest = [ordered]@{
|
|||
}
|
||||
plugins = @($plugins)
|
||||
}
|
||||
if ($navData) { $manifest.navdata = $navData }
|
||||
# Every feed carries RynthNav's map (built above, unchanged from the live feed, or carried by -SkipNavData).
|
||||
if (-not $navData) { throw "No RynthNav map (navdata) for this feed - not publishing a feed without it." }
|
||||
$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
|
||||
|
|
@ -448,6 +669,10 @@ scp -q "$rel\RynthCore-Setup.exe" "${SshHost}:$remoteRel/RynthCore-Setup.exe"
|
|||
if ($LASTEXITCODE -ne 0) { throw "scp of the installer failed" }
|
||||
scp -q (Get-ChildItem "$rel\plugins\*.dll").FullName "${SshHost}:$remoteRel/plugins/"
|
||||
if ($LASTEXITCODE -ne 0) { throw "scp of the plugins failed" }
|
||||
# The release's own signed manifest stays beside its files: the launcher's Roll back
|
||||
# (RynthUpdater.Rollback.cs) verifies it to go back to this release later.
|
||||
scp -q "$rel\update.json" "${SshHost}:$remoteRel/update.json"
|
||||
if ($LASTEXITCODE -ne 0) { throw "scp of the release's update.json failed" }
|
||||
$navSum = ""
|
||||
if ($navZip) {
|
||||
scp -q $navZip "${SshHost}:$remoteRel/RynthNav-NavData.zip"
|
||||
|
|
@ -472,8 +697,9 @@ foreach ($up in $mapPackUploads) {
|
|||
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 }
|
||||
$remoteSums = ssh $SshHost "cd '$remoteRel' && sha256sum RynthCore-Setup.exe update.json plugins/*.dll$navSum"
|
||||
$expect = @{ "RynthCore-Setup.exe" = $manifest.core.sha256
|
||||
"update.json" = (Get-FileHash "$rel\update.json" -Algorithm SHA256).Hash.ToLowerInvariant() }
|
||||
if ($navZip) { $expect["RynthNav-NavData.zip"] = $navData.sha256 }
|
||||
foreach ($pl in $plugins) { $expect["plugins/$($pl.file)"] = $pl.sha256 }
|
||||
foreach ($line in $remoteSums) {
|
||||
|
|
@ -481,6 +707,9 @@ foreach ($line in $remoteSums) {
|
|||
if ($expect[$name.TrimStart('*')] -ne $sum) { throw "Hash mismatch on the server for $name — feed NOT published" }
|
||||
}
|
||||
Write-Host " $($expect.Count) files uploaded and hash-checked"
|
||||
# A carried RynthNav archive (not uploaded by this release) is checked once more just before the
|
||||
# feed that points at it goes live.
|
||||
if (-not $navZip) { Assert-RemoteNavData $navData "this feed" }
|
||||
|
||||
Step "Replacing the website downloads"
|
||||
scp -q "$rel\RynthCore-Setup.exe" "${SshHost}:$RemoteDir/.RynthCore-Setup.exe.new"
|
||||
|
|
|
|||
|
|
@ -68,6 +68,24 @@ Name: "suite\rynthoracle"; Description: "RynthOracle - quests, quest timers,
|
|||
Name: "suite\rynthilt"; Description: "RynthILT - Infinite Leaftide features (hub, progression, banking, bounties)"; Types: full
|
||||
Name: "suite\rynthinventory"; Description: "RynthInventory - inventory, item counts and global manage"; Types: full
|
||||
Name: "suite\rynthsort"; Description: "RynthSort - inventory sorting"; Types: full
|
||||
; Server plugins (RynthServers): RynthCore loads only the one for the server you connect to.
|
||||
Name: "suite\rynthachard"; Description: "RynthAChard - server plugin for AChard (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthaelrynth"; Description: "RynthAelrynth - server plugin for Aelrynth (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthcoldeve"; Description: "RynthColdeve - server plugin for Coldeve (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthconquest"; Description: "RynthConquest - server plugin for Conquest (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthderptide"; Description: "RynthDerptide - server plugin for Derptide (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthdreamweave"; Description: "RynthDreamWeave - server plugin for DreamWeave (loads only on that server)"; Types: full
|
||||
Name: "suite\ryntheversong"; Description: "RynthEversong - server plugin for Eversong (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthfrostace"; Description: "RynthFrostACE - server plugin for FrostACE (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthfrostcull"; Description: "RynthFrostcull - server plugin for Frostcull (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthleafdawn"; Description: "RynthLeafDawn - server plugin for LeafDawn (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthleafdawning"; Description: "RynthLeafdawning - server plugin for Leafdawning (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthlevistras"; Description: "RynthLevistras - server plugin for Levistras (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthportalstorm"; Description: "RynthPortalStorm - server plugin for PortalStorm (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthreefcull"; Description: "RynthReefcull - server plugin for Reefcull (loads only on that server)"; Types: full
|
||||
Name: "suite\rynthsundering"; Description: "RynthSundering - server plugin for Sundering (loads only on that server)"; Types: full
|
||||
Name: "suite\rynththistlecrown"; Description: "RynthThistlecrown - server plugin for Thistlecrown (loads only on that server)"; Types: full
|
||||
Name: "suite\rynththreads"; Description: "RynthThreads - server plugin for DreamWeave's Threads (loads only on that server)"; Types: full
|
||||
; Experimental plugins: unchecked by default in every install type (ticking one switches to Custom).
|
||||
Name: "experimental"; Description: "RynthSuite: Experimental plugins (work in progress)"
|
||||
Name: "experimental\rynthchat"; Description: "RynthChat - replacement chat window (classifies and owns game chat)"
|
||||
|
|
@ -120,6 +138,23 @@ Source: "staging\suite\RynthOracle\RynthCore.Plugin.RynthOracle.dll"; Dest
|
|||
Source: "staging\suite\RynthILT\RynthCore.Plugin.RynthILT.dll"; DestDir: "{code:GetSuiteDir}\RynthILT"; Components: suite\rynthilt; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthInventory\RynthCore.Plugin.RynthInventory.dll"; DestDir: "{code:GetSuiteDir}\RynthInventory"; Components: suite\rynthinventory; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthSort\RynthCore.Plugin.RynthSort.dll"; DestDir: "{code:GetSuiteDir}\RynthSort"; Components: suite\rynthsort; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthAChard\RynthCore.Plugin.RynthAChard.dll"; DestDir: "{code:GetSuiteDir}\RynthAChard"; Components: suite\rynthachard; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthAelrynth\RynthCore.Plugin.RynthAelrynth.dll"; DestDir: "{code:GetSuiteDir}\RynthAelrynth"; Components: suite\rynthaelrynth; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthColdeve\RynthCore.Plugin.RynthColdeve.dll"; DestDir: "{code:GetSuiteDir}\RynthColdeve"; Components: suite\rynthcoldeve; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthConquest\RynthCore.Plugin.RynthConquest.dll"; DestDir: "{code:GetSuiteDir}\RynthConquest"; Components: suite\rynthconquest; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthDerptide\RynthCore.Plugin.RynthDerptide.dll"; DestDir: "{code:GetSuiteDir}\RynthDerptide"; Components: suite\rynthderptide; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthDreamWeave\RynthCore.Plugin.RynthDreamWeave.dll"; DestDir: "{code:GetSuiteDir}\RynthDreamWeave"; Components: suite\rynthdreamweave; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthEversong\RynthCore.Plugin.RynthEversong.dll"; DestDir: "{code:GetSuiteDir}\RynthEversong"; Components: suite\ryntheversong; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthFrostACE\RynthCore.Plugin.RynthFrostACE.dll"; DestDir: "{code:GetSuiteDir}\RynthFrostACE"; Components: suite\rynthfrostace; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthFrostcull\RynthCore.Plugin.RynthFrostcull.dll"; DestDir: "{code:GetSuiteDir}\RynthFrostcull"; Components: suite\rynthfrostcull; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthLeafDawn\RynthCore.Plugin.RynthLeafDawn.dll"; DestDir: "{code:GetSuiteDir}\RynthLeafDawn"; Components: suite\rynthleafdawn; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthLeafdawning\RynthCore.Plugin.RynthLeafdawning.dll"; DestDir: "{code:GetSuiteDir}\RynthLeafdawning"; Components: suite\rynthleafdawning; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthLevistras\RynthCore.Plugin.RynthLevistras.dll"; DestDir: "{code:GetSuiteDir}\RynthLevistras"; Components: suite\rynthlevistras; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthPortalStorm\RynthCore.Plugin.RynthPortalStorm.dll"; DestDir: "{code:GetSuiteDir}\RynthPortalStorm"; Components: suite\rynthportalstorm; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthReefcull\RynthCore.Plugin.RynthReefcull.dll"; DestDir: "{code:GetSuiteDir}\RynthReefcull"; Components: suite\rynthreefcull; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthSundering\RynthCore.Plugin.RynthSundering.dll"; DestDir: "{code:GetSuiteDir}\RynthSundering"; Components: suite\rynthsundering; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthThistlecrown\RynthCore.Plugin.RynthThistlecrown.dll"; DestDir: "{code:GetSuiteDir}\RynthThistlecrown"; Components: suite\rynththistlecrown; Flags: ignoreversion overwritereadonly
|
||||
Source: "staging\suite\RynthThreads\RynthCore.Plugin.RynthThreads.dll"; DestDir: "{code:GetSuiteDir}\RynthThreads"; Components: suite\rynththreads; Flags: ignoreversion overwritereadonly
|
||||
|
||||
; Experimental plugins: each in its own <RynthSuite>\<Name>\ folder (the layout the launcher already uses).
|
||||
Source: "staging\suite\RynthChat\RynthCore.Plugin.RynthChat.dll"; DestDir: "{code:GetSuiteDir}\RynthChat"; Components: experimental\rynthchat; Flags: ignoreversion overwritereadonly
|
||||
|
|
@ -307,7 +342,7 @@ end;
|
|||
|
||||
// Number of entries in SuitePluginName; keep in sync with the [Components]/[Files] suite rows.
|
||||
const
|
||||
SuitePluginCount = 4;
|
||||
SuitePluginCount = 21;
|
||||
|
||||
// Companion plugin names; component "suite\<lowercase name>" installs <Suite>\<Name>\RynthCore.Plugin.<Name>.dll.
|
||||
function SuitePluginName(Index: Integer): string;
|
||||
|
|
@ -317,6 +352,23 @@ begin
|
|||
1: Result := 'RynthILT';
|
||||
2: Result := 'RynthInventory';
|
||||
3: Result := 'RynthSort';
|
||||
4: Result := 'RynthAChard';
|
||||
5: Result := 'RynthAelrynth';
|
||||
6: Result := 'RynthColdeve';
|
||||
7: Result := 'RynthConquest';
|
||||
8: Result := 'RynthDerptide';
|
||||
9: Result := 'RynthDreamWeave';
|
||||
10: Result := 'RynthEversong';
|
||||
11: Result := 'RynthFrostACE';
|
||||
12: Result := 'RynthFrostcull';
|
||||
13: Result := 'RynthLeafDawn';
|
||||
14: Result := 'RynthLeafdawning';
|
||||
15: Result := 'RynthLevistras';
|
||||
16: Result := 'RynthPortalStorm';
|
||||
17: Result := 'RynthReefcull';
|
||||
18: Result := 'RynthSundering';
|
||||
19: Result := 'RynthThistlecrown';
|
||||
20: Result := 'RynthThreads';
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
2026.10.18.24
|
||||
2026.11.22.48
|
||||
|
|
@ -1 +1 @@
|
|||
2026.10.18.15
|
||||
2026.11.22.47
|
||||
1
last-built-version.txt
Normal file
1
last-built-version.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
2026.10.20.14
|
||||
|
|
@ -29,6 +29,9 @@
|
|||
// init export returns (HooksFlush; on a first launch AC's main thread is still suspended
|
||||
// then), on every reload, and ~20 ms after the last change otherwise (a background
|
||||
// flusher). A hook's slot is set at once; its patch follows within that window.
|
||||
// Each freeze runs with the process in HIGH priority class (BoostForFreeze): on a busy
|
||||
// machine the freeze otherwise waited seconds on low-priority threads, with AC's main
|
||||
// thread suspended all that time (2026-11-01).
|
||||
// ============================================================================
|
||||
|
||||
#include "Loader.h"
|
||||
|
|
@ -84,6 +87,8 @@ static HANDLE g_dirtyEvent;
|
|||
static volatile DWORD g_lastChange;
|
||||
|
||||
static void FlushLocked(const char* why);
|
||||
static DWORD BoostForFreeze(void);
|
||||
static void RestoreAfterFreeze(DWORD cls);
|
||||
|
||||
static DWORD WINAPI Flusher(LPVOID unused)
|
||||
{
|
||||
|
|
@ -143,7 +148,9 @@ static void SetPatched(int i, int patched)
|
|||
{
|
||||
HookEntry* e = &g_hooks[i];
|
||||
if (e->patched == patched) return;
|
||||
DWORD cls = BoostForFreeze(); // each call is a freeze of its own
|
||||
int st = patched ? p_enable(e->target) : p_disable(e->target);
|
||||
RestoreAfterFreeze(cls);
|
||||
if (st == MH_OK) e->patched = patched;
|
||||
else LoaderLog("ERR", "Hooks: MinHook %s %p failed: %d", patched ? "enable" : "disable", e->target, st);
|
||||
}
|
||||
|
|
@ -162,6 +169,30 @@ static void Want(int i, int patched)
|
|||
SetEvent(g_dirtyEvent);
|
||||
}
|
||||
|
||||
// Raises the process to HIGH_PRIORITY_CLASS for one MinHook freeze; returns the class to put
|
||||
// back (0 = left as it was). MinHook's freeze suspends the process's threads one by one and reads
|
||||
// each one's context (GetThreadContext), and that read waits until the suspended thread itself
|
||||
// gets a CPU to run the kernel's get-context APC. A LOWEST or BELOW_NORMAL thread (AC's d3d9
|
||||
// workers, the engine's heartbeat) on a machine saturated by normal-priority work (every client
|
||||
// hot reloading at once) waits seconds for that, while the threads already suspended, AC's main
|
||||
// thread first among them, stay frozen: the 4-7 s "applied in one freeze" lines and main-thread
|
||||
// hangs of the 2026-10-31/11-01 reloads. In HIGH class a LOWEST thread is at 11, above every
|
||||
// normal process, so the reads come back at once (tools\LoaderFreezeBench measures both). Every
|
||||
// other thread is suspended for most of the window, so the boost doesn't let this process take
|
||||
// CPU from the other clients beyond the freeze itself.
|
||||
static DWORD BoostForFreeze(void)
|
||||
{
|
||||
HANDLE self = GetCurrentProcess();
|
||||
DWORD cls = GetPriorityClass(self);
|
||||
if (cls == 0 || cls == HIGH_PRIORITY_CLASS || cls == REALTIME_PRIORITY_CLASS) return 0;
|
||||
return SetPriorityClass(self, HIGH_PRIORITY_CLASS) ? cls : 0;
|
||||
}
|
||||
|
||||
static void RestoreAfterFreeze(DWORD cls)
|
||||
{
|
||||
if (cls != 0) SetPriorityClass(GetCurrentProcess(), cls);
|
||||
}
|
||||
|
||||
// Applies every pending patch/unpatch in one MinHook freeze. (Caller holds g_lock.)
|
||||
static void FlushLocked(const char* why)
|
||||
{
|
||||
|
|
@ -176,7 +207,9 @@ static void FlushLocked(const char* why)
|
|||
}
|
||||
if (n == 0) return;
|
||||
DWORD t0 = GetTickCount();
|
||||
DWORD cls = BoostForFreeze();
|
||||
int st = p_applyQueued();
|
||||
RestoreAfterFreeze(cls);
|
||||
if (st == MH_OK) {
|
||||
for (int k = 0; k < n; k++) g_hooks[queued[k]].patched = g_hooks[queued[k]].want;
|
||||
LoaderLog("INF", "Hooks: %d patch(es) applied in one freeze (%lu ms, %s).", n, GetTickCount() - t0, why);
|
||||
|
|
|
|||
|
|
@ -17,10 +17,20 @@
|
|||
* heap corruption.
|
||||
* - Each faulting address has a slot with its hit count and the time it was last
|
||||
* written. The first sighting is written. A repeat is written again (with its count)
|
||||
* when the count is a power of two, when 30 s have passed since that address was
|
||||
* last written, or when the code is not an AV. So a contained AV that later recurs
|
||||
* as the fatal one is not swallowed as "seen before": a fatal fault is usually a
|
||||
* terminate from some handler, and then no last-chance filter ever runs.
|
||||
* when the count is a power of two (any class), or, for an AC-class address only,
|
||||
* when 30 s have passed since it was last written, or when the code is not an AV.
|
||||
* So a contained AV that later recurs as the fatal one is not swallowed as "seen
|
||||
* before": a fatal fault is usually a terminate from some handler, and then no
|
||||
* last-chance filter ever runs.
|
||||
* Review fix (2026-10-18): the 30 s relog used to apply to noise too, so Decal's
|
||||
* handled null-ref AV (about once a minute, one address) was written on EVERY hit:
|
||||
* ~1,440 entries (~5-6 KB each with the stack sweep) per day per client. Noise now
|
||||
* repeats only at powers of two (about 11 entries a day for that address), and the
|
||||
* 30 s / non-AV relogs are capped per address (CLF_MAX_RELOGS); what a cap or the
|
||||
* dedupe skips is still in the flush ring, so a fatal hit is recovered at exit.
|
||||
* - A total byte budget (CLF_MAX_LOG_BYTES, counted from the file's size at install plus
|
||||
* what this process writes): past it ordinary entries are dropped after ONE marker
|
||||
* line; fatal entries (last-chance, crash-exit flush) get CLF_LOG_RESERVE_BYTES more.
|
||||
* - Noise is classified, written once per address like the rest, and never charged to
|
||||
* the AC limit:
|
||||
* .NET Framework (Decal plugins): faulting module clr.dll, mscorwks.dll, mscorlib;
|
||||
|
|
@ -50,6 +60,9 @@
|
|||
#define CLF_MAX_LAST_CHANCE 8
|
||||
#define CLF_ADDR_SLOTS 128
|
||||
#define CLF_RELOG_MS 30000u
|
||||
#define CLF_MAX_RELOGS 16 /* non-power-of-two rewrites per address */
|
||||
#define CLF_MAX_LOG_BYTES (3u * 1024u * 1024u) /* ordinary entries stop here */
|
||||
#define CLF_LOG_RESERVE_BYTES (256u * 1024u) /* extra room for fatal entries */
|
||||
|
||||
#define CLF_CODE_ACCESS_VIOLATION 0xC0000005u
|
||||
#define CLF_CODE_FAIL_FAST 0xC0000602u
|
||||
|
|
@ -80,6 +93,7 @@ typedef struct {
|
|||
unsigned int lastWriteMs;
|
||||
unsigned char cls; /* clf_class */
|
||||
unsigned char used;
|
||||
unsigned char relogs; /* writes that were not first / power-of-two (time, non-AV) */
|
||||
} clf_slot;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -90,6 +104,10 @@ typedef struct {
|
|||
unsigned int otherRepeats; /* other repeats not written */
|
||||
unsigned int overCap; /* not written: limit reached */
|
||||
unsigned int untracked; /* AC addresses written but not tracked (table full of AC) */
|
||||
unsigned int relogCapped; /* relogs skipped: the address used its CLF_MAX_RELOGS */
|
||||
unsigned int logBytes; /* bytes in the log file: size at install + written since */
|
||||
unsigned int byteDenied; /* entries dropped by the byte budget */
|
||||
unsigned char capMarked; /* the budget marker line has been written */
|
||||
} clf_state;
|
||||
|
||||
static int clf_is_logged_code(unsigned int code)
|
||||
|
|
@ -152,10 +170,22 @@ static clf_decision clf_repeat(clf_state* s, clf_slot* slot, unsigned int code,
|
|||
{
|
||||
slot->hits++;
|
||||
if (hits) *hits = slot->hits;
|
||||
if (clf_is_pow2(slot->hits) || nowMs - slot->lastWriteMs >= CLF_RELOG_MS || code != CLF_CODE_ACCESS_VIOLATION) {
|
||||
if (clf_is_pow2(slot->hits)) {
|
||||
slot->lastWriteMs = nowMs;
|
||||
return CLF_LOG_REPEAT;
|
||||
}
|
||||
/* The 30 s relog is for genuine (AC-class) faults only: noise at one address (Decal's
|
||||
* handled null-ref, about once a minute) would otherwise be written on every hit. A
|
||||
* non-AV code is always written, within the per-address cap. */
|
||||
if ((slot->cls == CLF_CLASS_AC && nowMs - slot->lastWriteMs >= CLF_RELOG_MS)
|
||||
|| code != CLF_CODE_ACCESS_VIOLATION) {
|
||||
if (slot->relogs < CLF_MAX_RELOGS) {
|
||||
slot->relogs++;
|
||||
slot->lastWriteMs = nowMs;
|
||||
return CLF_LOG_REPEAT;
|
||||
}
|
||||
s->relogCapped++;
|
||||
}
|
||||
if (slot->cls != CLF_CLASS_AC) s->noiseRepeats++; else s->otherRepeats++;
|
||||
return CLF_SKIP_REPEAT;
|
||||
}
|
||||
|
|
@ -189,6 +219,7 @@ static clf_decision clf_new(clf_state* s, unsigned int code, unsigned int addr,
|
|||
slot->hits = 1;
|
||||
slot->lastWriteMs = nowMs;
|
||||
slot->cls = (unsigned char)cls;
|
||||
slot->relogs = 0;
|
||||
slot->used = 1;
|
||||
} else {
|
||||
s->untracked++;
|
||||
|
|
@ -266,6 +297,26 @@ static int clf_ring_take(clf_ring* g, clf_rec* out, unsigned int* older)
|
|||
return n;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
CLF_BYTES_OK = 0, /* write the entry */
|
||||
CLF_BYTES_MARK, /* over the budget: write the one marker line, then no entry */
|
||||
CLF_BYTES_DENY, /* over the budget: write nothing */
|
||||
} clf_bytes;
|
||||
|
||||
/*
|
||||
* The byte budget, asked before each entry. fatal: a last-chance / crash-exit entry,
|
||||
* which may use CLF_LOG_RESERVE_BYTES beyond CLF_MAX_LOG_BYTES. The caller adds what it
|
||||
* writes to s->logBytes (the marker included).
|
||||
*/
|
||||
static clf_bytes clf_bytes_gate(clf_state* s, int fatal)
|
||||
{
|
||||
unsigned int limit = CLF_MAX_LOG_BYTES + (fatal ? CLF_LOG_RESERVE_BYTES : 0u);
|
||||
if (s->logBytes < limit) return CLF_BYTES_OK;
|
||||
s->byteDenied++;
|
||||
if (!fatal && !s->capMarked) { s->capMarked = 1; return CLF_BYTES_MARK; }
|
||||
return CLF_BYTES_DENY;
|
||||
}
|
||||
|
||||
/* The last-chance (unhandled) filter. Any code: whatever reaches it is fatal. */
|
||||
static clf_decision clf_last_chance(clf_state* s)
|
||||
{
|
||||
|
|
|
|||
35
native/SehTrampoline/DumpArgs.h
Normal file
35
native/SehTrampoline/DumpArgs.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* DumpArgs.h - the command line of RC_DumpProcess (SehTrampoline.c): "<pid> <dump path>", the
|
||||
* path being the rest of the line (spaces kept, trailing spaces and a closing quote dropped).
|
||||
* The engine writes it (src\RynthCore.Engine\HangDumpCommand.cs). Pure: tests\DumpArgsTests.c.
|
||||
*/
|
||||
#pragma once
|
||||
#include <wchar.h>
|
||||
|
||||
/* 1 when `cmd` holds a pid above 0 and a non-empty path that fits `cap` characters (with its 0). */
|
||||
static int ParseDumpArgs(const wchar_t* cmd, unsigned long* pid, wchar_t* path, int cap)
|
||||
{
|
||||
unsigned long p = 0;
|
||||
int n = 0;
|
||||
if (!cmd || !pid || !path || cap < 2) return 0;
|
||||
path[0] = 0;
|
||||
while (*cmd == L' ' || *cmd == L'\t') cmd++;
|
||||
if (*cmd < L'0' || *cmd > L'9') return 0;
|
||||
while (*cmd >= L'0' && *cmd <= L'9') {
|
||||
unsigned long d = (unsigned long)(*cmd - L'0');
|
||||
if (p > (4294967295UL - d) / 10) return 0; /* would overflow */
|
||||
p = p * 10 + d;
|
||||
cmd++;
|
||||
}
|
||||
if (*cmd != L' ' && *cmd != L'\t') return 0;
|
||||
while (*cmd == L' ' || *cmd == L'\t') cmd++;
|
||||
if (*cmd == L'"') cmd++;
|
||||
while (*cmd && *cmd != L'"') {
|
||||
if (n >= cap - 1) return 0; /* too long: refuse rather than cut the name */
|
||||
path[n++] = *cmd++;
|
||||
}
|
||||
while (n > 0 && (path[n - 1] == L' ' || path[n - 1] == L'\t')) n--;
|
||||
path[n] = 0;
|
||||
*pid = p;
|
||||
return p != 0 && n > 0;
|
||||
}
|
||||
|
|
@ -27,7 +27,11 @@
|
|||
#include <windows.h>
|
||||
|
||||
/* File version of this native module (bump with every behavioural change). */
|
||||
#define RC_SEH_TRAMPOLINE_VERSION 7 /* v7: stack sweeps bounded by this thread's stack (TEB), never
|
||||
#define RC_SEH_TRAMPOLINE_VERSION 9 /* v9: RC_DumpProcess, the hang dump written from rundll32 (out of
|
||||
the client's process);
|
||||
v8: noise repeats only at powers of two, capped relogs per address,
|
||||
a total byte budget for native-crash.log (CrashLogFilter.h);
|
||||
v7: stack sweeps bounded by this thread's stack (TEB), never
|
||||
reading at or past StackBase;
|
||||
v6: AwfulWaffle's crash logger (per-address dedupe, pid/date,
|
||||
flush ring, RC_FlushCrashLog, module cache) merged with v3-v5;
|
||||
|
|
@ -546,7 +550,21 @@ static clf_class cl_first_frame_class(unsigned int esp)
|
|||
static void cl_write(const char* p, DWORD n)
|
||||
{
|
||||
DWORD wr;
|
||||
if (g_logHandle != INVALID_HANDLE_VALUE) WriteFile(g_logHandle, p, n, &wr, NULL);
|
||||
if (g_logHandle != INVALID_HANDLE_VALUE && WriteFile(g_logHandle, p, n, &wr, NULL))
|
||||
g_filter.logBytes += wr; /* under g_logOwner, like every writer */
|
||||
}
|
||||
|
||||
/* The byte budget (CrashLogFilter.h). Under the lock, before an entry. Returns 1 when the
|
||||
* entry may be written. The first refusal of an ordinary entry writes one marker line. */
|
||||
static int cl_budget(int fatal)
|
||||
{
|
||||
clf_bytes b = clf_bytes_gate(&g_filter, fatal);
|
||||
if (b == CLF_BYTES_MARK) {
|
||||
const char* m = "\r\n==== NATIVE CRASH LOGGER: log size budget reached, further ordinary entries are dropped "
|
||||
"(fatal entries still get a reserve; restart the client or trim the file to resume) ====\r\n";
|
||||
cl_write(m, (DWORD)lstrlenA(m));
|
||||
}
|
||||
return b == CLF_BYTES_OK;
|
||||
}
|
||||
|
||||
/* Append " pid=N tid=N date=YYYY-MM-DD time=HH:MM:SS" (local time). */
|
||||
|
|
@ -569,7 +587,7 @@ static char* cl_stamp(char* p)
|
|||
return p;
|
||||
}
|
||||
|
||||
static void cl_write_entry(PEXCEPTION_POINTERS ep, const char* kind, unsigned int hits)
|
||||
static void cl_write_entry(PEXCEPTION_POINTERS ep, const char* kind, unsigned int hits, int fatal)
|
||||
{
|
||||
char* p = g_buf;
|
||||
CONTEXT* c = ep->ContextRecord;
|
||||
|
|
@ -577,6 +595,7 @@ static void cl_write_entry(PEXCEPTION_POINTERS ep, const char* kind, unsigned in
|
|||
unsigned int exAddr = (unsigned int)(UINT_PTR)ep->ExceptionRecord->ExceptionAddress;
|
||||
unsigned int words;
|
||||
if (g_logHandle == INVALID_HANDLE_VALUE) return;
|
||||
if (!cl_budget(fatal)) return;
|
||||
|
||||
p = cl_str(p, "\r\n==== NATIVE CRASH LOGGER (");
|
||||
p = cl_str(p, kind);
|
||||
|
|
@ -604,6 +623,10 @@ static void cl_write_entry(PEXCEPTION_POINTERS ep, const char* kind, unsigned in
|
|||
p = cl_u(p, g_filter.otherRepeats);
|
||||
p = cl_str(p, " overCap=");
|
||||
p = cl_u(p, g_filter.overCap);
|
||||
p = cl_str(p, " relogCapped=");
|
||||
p = cl_u(p, g_filter.relogCapped);
|
||||
p = cl_str(p, " logBytes=");
|
||||
p = cl_u(p, g_filter.logBytes);
|
||||
p = cl_str(p, "\r\n eip="); p = cl_sym(p, c->Eip, 1);
|
||||
p = cl_str(p, " esp="); p = cl_hex(p, c->Esp);
|
||||
p = cl_str(p, " ebp="); p = cl_hex(p, c->Ebp);
|
||||
|
|
@ -670,6 +693,7 @@ static void cl_flush_locked(const char* reason, unsigned int code, unsigned int
|
|||
n = k;
|
||||
}
|
||||
if (n == 0 || g_logHandle == INVALID_HANDLE_VALUE) return;
|
||||
if (!cl_budget(maxAgeMs == 0)) return; /* last chance / crash exit are fatal: they get the reserve */
|
||||
p = g_buf;
|
||||
p = cl_str(p, "\r\n==== NATIVE CRASH LOGGER (flush: ");
|
||||
p = cl_str(p, reason);
|
||||
|
|
@ -731,7 +755,7 @@ static LONG CALLBACK CrashVeh(PEXCEPTION_POINTERS ep)
|
|||
if (slot) {
|
||||
/* A repeat: decided without touching any module. */
|
||||
if (clf_repeat(&g_filter, slot, code, now, &hits) == CLF_LOG_REPEAT) {
|
||||
cl_write_entry(ep, slot->cls != CLF_CLASS_AC ? "first-chance, repeat, noise" : "first-chance, repeat", hits);
|
||||
cl_write_entry(ep, slot->cls != CLF_CLASS_AC ? "first-chance, repeat, noise" : "first-chance, repeat", hits, 0);
|
||||
written = 1;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -742,11 +766,11 @@ static LONG CALLBACK CrashVeh(PEXCEPTION_POINTERS ep)
|
|||
leaf == NULL && code == CLF_CODE_ACCESS_VIOLATION ? cl_first_frame_class(ep->ContextRecord->Esp) : CLF_CLASS_AC);
|
||||
clf_decision d = clf_new(&g_filter, code, exAddr, cls, now);
|
||||
if (d == CLF_LOG_COUNTED)
|
||||
cl_write_entry(ep, "first-chance", 1);
|
||||
cl_write_entry(ep, "first-chance", 1, 0);
|
||||
else if (d == CLF_LOG_NOISE)
|
||||
cl_write_entry(ep, cls == CLF_CLASS_NETFX
|
||||
? "first-chance, .NET Framework noise, not counted"
|
||||
: "first-chance, managed (CoreCLR) noise, not counted", 1);
|
||||
: "first-chance, managed (CoreCLR) noise, not counted", 1, 0);
|
||||
written = d == CLF_LOG_COUNTED || d == CLF_LOG_NOISE;
|
||||
}
|
||||
/* Kept for a flush (memory only): the fatal hit is often one not written here. */
|
||||
|
|
@ -766,7 +790,7 @@ static LONG WINAPI CrashLastChance(PEXCEPTION_POINTERS ep)
|
|||
if (cl_lock()) {
|
||||
cl_flush_locked("last chance", ep->ExceptionRecord->ExceptionCode, 0);
|
||||
if (clf_last_chance(&g_filter) == CLF_LOG_LAST_CHANCE)
|
||||
cl_write_entry(ep, "LAST-CHANCE, unhandled", 1);
|
||||
cl_write_entry(ep, "LAST-CHANCE, unhandled", 1, 1);
|
||||
cl_unlock();
|
||||
}
|
||||
if (g_prevFilter && g_prevFilter != CrashLastChance) {
|
||||
|
|
@ -830,6 +854,9 @@ RC_InstallCrashLogger(const wchar_t* logPath)
|
|||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (h != INVALID_HANDLE_VALUE) {
|
||||
HANDLE old = g_logHandle;
|
||||
DWORD size = GetFileSize(h, NULL); /* the budget counts what is already there */
|
||||
g_filter.logBytes = size == INVALID_FILE_SIZE ? 0u : (unsigned int)size;
|
||||
g_filter.capMarked = 0;
|
||||
g_logHandle = h;
|
||||
if (old != INVALID_HANDLE_VALUE) { CloseHandle(old); }
|
||||
}
|
||||
|
|
@ -949,7 +976,7 @@ static int gt_filter(PEXCEPTION_POINTERS ep, GT_FAULT* f)
|
|||
f->module[k] = 0;
|
||||
}
|
||||
if (InterlockedIncrement(&g_gameTickRecords) <= CL_MAX_GAMETICK) {
|
||||
cl_write_entry(ep, "AV CAUGHT IN GAME TICK (Client::UseTime guard; tick dropped, client kept running)", 1);
|
||||
cl_write_entry(ep, "AV CAUGHT IN GAME TICK (Client::UseTime guard; tick dropped, client kept running)", 1, 0);
|
||||
}
|
||||
cl_unlock();
|
||||
if (leaf && f->module && f->module[0]) {
|
||||
|
|
@ -983,3 +1010,47 @@ SEH_GameTickThiscall(void* fn, void* this_ptr, int* out_result,
|
|||
RC_SEH_LEAVE();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ── Out-of-process minidump (rundll32 entry) ─────────────────────────────
|
||||
* The engine's hang watchdog runs
|
||||
* %windir%\SysWOW64\rundll32.exe "<this dll>",RC_DumpProcess <pid> <dump path>
|
||||
* so the dump of a hung client is written from another process: MiniDumpWriteDump on the
|
||||
* client itself suspends every other thread and then needs the process heap, which a
|
||||
* suspended thread may hold (2026-10-31: a client deadlocked for good that way). dbghelp comes
|
||||
* from the system folder, not AC's own 2003 copy. The process exit code says how it went:
|
||||
* 0 written, 1 bad arguments, 2 OpenProcess, 3 CreateFile, 4 dbghelp, 5 MiniDumpWriteDump
|
||||
* (the file is deleted). Nothing runs in the client's process. */
|
||||
#include "DumpArgs.h"
|
||||
|
||||
typedef BOOL (WINAPI *Fn_MiniDumpWriteDump)(HANDLE, DWORD, HANDLE, DWORD, void*, void*, void*);
|
||||
|
||||
static UINT DumpProcessCore(const wchar_t* cmd)
|
||||
{
|
||||
unsigned long pid = 0;
|
||||
wchar_t path[MAX_PATH];
|
||||
if (!ParseDumpArgs(cmd, &pid, path, MAX_PATH)) return 1;
|
||||
|
||||
HANDLE proc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_DUP_HANDLE, FALSE, pid);
|
||||
if (!proc) return 2;
|
||||
HANDLE file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (file == INVALID_HANDLE_VALUE) { CloseHandle(proc); return 3; }
|
||||
HMODULE dbghelp = LoadLibraryExW(L"dbghelp.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
Fn_MiniDumpWriteDump write = dbghelp ? (Fn_MiniDumpWriteDump)GetProcAddress(dbghelp, "MiniDumpWriteDump") : NULL;
|
||||
UINT rc = 4;
|
||||
if (write) {
|
||||
/* MiniDumpNormal (every thread's stack) | WithHandleData | WithUnloadedModules | WithThreadInfo */
|
||||
rc = write(proc, pid, file, 0x00000000 | 0x00000004 | 0x00000020 | 0x00001000, NULL, NULL, NULL) ? 0 : 5;
|
||||
}
|
||||
CloseHandle(file);
|
||||
CloseHandle(proc);
|
||||
if (rc != 0) DeleteFileW(path);
|
||||
return rc;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void CALLBACK RC_DumpProcessW(HWND hwnd, HINSTANCE inst, LPWSTR cmdLine, int show)
|
||||
{
|
||||
(void)hwnd; (void)inst; (void)show;
|
||||
ExitProcess(DumpProcessCore(cmdLine));
|
||||
}
|
||||
/* rundll32 looks the entry up by its plain name (it tries RC_DumpProcessW first). */
|
||||
#pragma comment(linker, "/EXPORT:RC_DumpProcessW=_RC_DumpProcessW@16")
|
||||
|
|
|
|||
|
|
@ -222,8 +222,87 @@ static void ring_order_overflow_and_written(void)
|
|||
check(got == 1 && out[0].addr == 0x9999 && older == 0, "after a flush, only what came since");
|
||||
}
|
||||
|
||||
/* Review fix: Decal's handled null-ref AV at one JIT-code address about once a minute was
|
||||
* written on EVERY hit (the 30 s relog applied to noise). A day of it: 1,440 hits. */
|
||||
static void noise_once_a_minute_is_not_written_every_hit(void)
|
||||
{
|
||||
static clf_state s;
|
||||
unsigned int hits, i, written = 0, now = 100000u;
|
||||
for (i = 0; i < 1440; i++, now += 60000u)
|
||||
if (is_write(FC(&s, AV, 0x433620C8u, CLF_CLASS_NETFX, now))) written++;
|
||||
/* first + powers of two 2..1024 = 1 + 10 */
|
||||
check(written == 11, "1,440 once-a-minute hits of one noise address: 11 entries, not 1,440");
|
||||
check(s.counted == 0, "and none charged to the limit");
|
||||
check(s.noiseRepeats == 1440 - 11, "skipped noise repeats are counted");
|
||||
{
|
||||
static clf_state m;
|
||||
written = 0;
|
||||
for (i = 0; i < 1440; i++) if (is_write(FC(&m, AV, 0x70001000u, CLF_CLASS_MANAGED, 5000u + i * 60000u))) written++;
|
||||
check(written == 11, "managed noise is the same");
|
||||
}
|
||||
}
|
||||
|
||||
/* A genuine (AC) address keeps its 30 s relog, but only CLF_MAX_RELOGS times. */
|
||||
static void ac_relog_is_capped_per_address(void)
|
||||
{
|
||||
static clf_state s;
|
||||
unsigned int hits, i, written = 0, now = 1000u;
|
||||
check(FC(&s, AV, 0x00416C86u, CLF_CLASS_AC, now) == CLF_LOG_COUNTED, "first sighting written");
|
||||
for (i = 2; i <= 1500; i++) {
|
||||
now += 31000u;
|
||||
if (is_write(FC(&s, AV, 0x00416C86u, CLF_CLASS_AC, now))) written++;
|
||||
}
|
||||
{
|
||||
unsigned int pow2 = 0, v;
|
||||
for (v = 2; v <= 1500; v <<= 1) pow2++; /* 2..1024 = 10 */
|
||||
check(written == pow2 + CLF_MAX_RELOGS, "1,500 hits 31 s apart: the power-of-two ones + CLF_MAX_RELOGS time relogs");
|
||||
}
|
||||
check(s.relogCapped > 0, "the skipped relogs are counted");
|
||||
check(clf_find(&s, 0x00416C86u)->relogs == CLF_MAX_RELOGS, "the slot used its relog budget");
|
||||
}
|
||||
|
||||
/* A non-AV code at a known address is written, within the same per-address cap. */
|
||||
static void non_av_relog_is_capped(void)
|
||||
{
|
||||
static clf_state s;
|
||||
unsigned int hits, i, written = 0;
|
||||
FC(&s, AV, 0x00500000u, CLF_CLASS_AC, 100);
|
||||
for (i = 0; i < 200; i++)
|
||||
if (is_write(FC(&s, CLF_CODE_HEAP_CORRUPTION, 0x00500000u, CLF_CLASS_AC, 200 + i))) written++;
|
||||
/* hits 2..201: powers of two 2,4,..,128 = 7, plus the capped relogs */
|
||||
check(written == 7 + CLF_MAX_RELOGS, "non-AV repeats: powers of two + CLF_MAX_RELOGS, not every hit");
|
||||
}
|
||||
|
||||
/* The byte budget: ordinary entries stop after one marker; fatal ones get a reserve. */
|
||||
static void byte_budget(void)
|
||||
{
|
||||
static clf_state s;
|
||||
int i;
|
||||
check(clf_bytes_gate(&s, 0) == CLF_BYTES_OK, "an empty log accepts an entry");
|
||||
s.logBytes = CLF_MAX_LOG_BYTES - 1;
|
||||
check(clf_bytes_gate(&s, 0) == CLF_BYTES_OK, "one byte under the budget still accepts");
|
||||
s.logBytes = CLF_MAX_LOG_BYTES;
|
||||
check(clf_bytes_gate(&s, 0) == CLF_BYTES_MARK, "at the budget: the marker, once");
|
||||
for (i = 0; i < 5; i++)
|
||||
check(clf_bytes_gate(&s, 0) == CLF_BYTES_DENY, "then ordinary entries are dropped");
|
||||
check(s.byteDenied == 6, "and counted");
|
||||
check(clf_bytes_gate(&s, 1) == CLF_BYTES_OK, "a fatal entry still fits in the reserve");
|
||||
s.logBytes = CLF_MAX_LOG_BYTES + CLF_LOG_RESERVE_BYTES;
|
||||
check(clf_bytes_gate(&s, 1) == CLF_BYTES_DENY, "and not past the reserve");
|
||||
{
|
||||
static clf_state t; /* a log that starts over the budget (shared file already big) */
|
||||
t.logBytes = CLF_MAX_LOG_BYTES + 10;
|
||||
check(clf_bytes_gate(&t, 1) == CLF_BYTES_OK, "a fatal entry fits in the reserve of a log that opened over budget");
|
||||
check(clf_bytes_gate(&t, 0) == CLF_BYTES_MARK, "its first ordinary entry gets the marker");
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
noise_once_a_minute_is_not_written_every_hit();
|
||||
ac_relog_is_capped_per_address();
|
||||
non_av_relog_is_capped();
|
||||
byte_budget();
|
||||
fatal_repeat_recovered_by_flush(5);
|
||||
fatal_repeat_recovered_by_flush(100);
|
||||
fatal_repeat_recovered_by_flush(1000);
|
||||
|
|
|
|||
47
native/SehTrampoline/tests/DumpArgsTests.c
Normal file
47
native/SehTrampoline/tests/DumpArgsTests.c
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* DumpArgsTests.c - offline checks for DumpArgs.h (RC_DumpProcess's command line, the hang
|
||||
* dump written from rundll32). Build and run with Run-DumpArgsTests.ps1 (x86 MSVC). Exit 0 = pass.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include "../DumpArgs.h"
|
||||
|
||||
static int g_checks, g_failed;
|
||||
|
||||
static void check(int ok, const char* what)
|
||||
{
|
||||
g_checks++;
|
||||
if (ok) return;
|
||||
g_failed++;
|
||||
printf("[FAIL] %s\n", what);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned long pid;
|
||||
wchar_t path[260];
|
||||
|
||||
/* What HangDumpCommand.Arguments leaves for the entry (rundll32 passes the text after the entry name). */
|
||||
check(ParseDumpArgs(L"17132 C:\\Games\\RynthCore\\Logs\\dumps\\hang_17132_20261031_211714.dmp", &pid, path, 260)
|
||||
&& pid == 17132 && wcscmp(path, L"C:\\Games\\RynthCore\\Logs\\dumps\\hang_17132_20261031_211714.dmp") == 0,
|
||||
"pid and path");
|
||||
check(ParseDumpArgs(L" 42 C:\\Users\\Some One's PC\\a b.dmp ", &pid, path, 260)
|
||||
&& pid == 42 && wcscmp(path, L"C:\\Users\\Some One's PC\\a b.dmp") == 0,
|
||||
"spaces and an apostrophe in the path are kept, the ends trimmed");
|
||||
check(ParseDumpArgs(L"7 \"C:\\x y\\z.dmp\"", &pid, path, 260) && pid == 7 && wcscmp(path, L"C:\\x y\\z.dmp") == 0,
|
||||
"a quoted path loses its quotes");
|
||||
check(!ParseDumpArgs(L"", &pid, path, 260), "empty refused");
|
||||
check(!ParseDumpArgs(NULL, &pid, path, 260), "null refused");
|
||||
check(!ParseDumpArgs(L"123", &pid, path, 260), "no path refused");
|
||||
check(!ParseDumpArgs(L"0 C:\\a.dmp", &pid, path, 260), "pid 0 refused");
|
||||
check(!ParseDumpArgs(L"x C:\\a.dmp", &pid, path, 260), "no pid refused");
|
||||
check(!ParseDumpArgs(L"12x C:\\a.dmp", &pid, path, 260), "a pid run into text refused");
|
||||
check(!ParseDumpArgs(L"99999999999 C:\\a.dmp", &pid, path, 260), "an overflowing pid refused");
|
||||
check(ParseDumpArgs(L"4294967295 C:\\a.dmp", &pid, path, 260) && pid == 4294967295UL, "the largest pid");
|
||||
check(!ParseDumpArgs(L"5 C:\\abcdefgh.dmp", &pid, path, 8), "a path longer than the buffer refused, not cut");
|
||||
check(ParseDumpArgs(L"5 C:\\a.dmp", &pid, path, 9) && wcscmp(path, L"C:\\a.dmp") == 0, "a path that just fits");
|
||||
|
||||
printf("%d check(s), %d failed.\n", g_checks, g_failed);
|
||||
return g_failed == 0 ? 0 : 1;
|
||||
}
|
||||
28
native/SehTrampoline/tests/Run-DumpArgsTests.ps1
Normal file
28
native/SehTrampoline/tests/Run-DumpArgsTests.ps1
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Run-DumpArgsTests.ps1
|
||||
# Builds and runs DumpArgsTests.c (x86 MSVC, the same toolchain as the DLL).
|
||||
# -OutDir: where the test exe goes (default: native\SehTrampoline\tests\bin). Exit 0 = pass.
|
||||
|
||||
param([string]$OutDir = (Join-Path $PSScriptRoot "bin"))
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" `
|
||||
-latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
|
||||
-property installationPath 2>$null
|
||||
if (-not $vsPath) { Write-Error "Visual Studio with C++ tools not found."; exit 1 }
|
||||
|
||||
$vcVer = (Get-ChildItem "$vsPath\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1).Name
|
||||
$vcBase = "$vsPath\VC\Tools\MSVC\$vcVer"
|
||||
$cl = "$vcBase\bin\Hostx86\x86\cl.exe"
|
||||
$sdkVer = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\Include" | Sort-Object Name -Descending | Select-Object -First 1).Name
|
||||
$sdkInc = "C:\Program Files (x86)\Windows Kits\10\Include\$sdkVer"
|
||||
$sdkLib = "C:\Program Files (x86)\Windows Kits\10\Lib\$sdkVer"
|
||||
$env:INCLUDE = "$vcBase\include;$sdkInc\ucrt;$sdkInc\um;$sdkInc\shared"
|
||||
$env:LIB = "$vcBase\lib\x86;$sdkLib\ucrt\x86;$sdkLib\um\x86"
|
||||
|
||||
New-Item -ItemType Directory -Path $OutDir -Force | Out-Null
|
||||
$exe = Join-Path $OutDir "DumpArgsTests.exe"
|
||||
& $cl /nologo /W4 /WX "$PSScriptRoot\DumpArgsTests.c" /Fo"$OutDir\\" /Fe"$exe" /link /MACHINE:X86
|
||||
if ($LASTEXITCODE -ne 0) { Write-Error "Compilation failed."; exit $LASTEXITCODE }
|
||||
& $exe
|
||||
exit $LASTEXITCODE
|
||||
3
runtime-patches/.gitattributes
vendored
Normal file
3
runtime-patches/.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Byte for byte: a patch with CRLF line endings no longer applies.
|
||||
*.patch -text
|
||||
*.dll binary
|
||||
57
runtime-patches/coreclr-10.0.12-x86/README.md
Normal file
57
runtime-patches/coreclr-10.0.12-x86/README.md
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# Patched CoreCLR 10.0.12 (x86)
|
||||
|
||||
`coreclr.dll`, `mscordaccore.dll` (the DAC) and `mscordbi.dll` built from dotnet/runtime **v10.0.12**
|
||||
with one change, `tls-no-reuse.patch`. `scripts\Publish-EngineCoreClr.ps1` lays them over the
|
||||
runtime pack's own files in `Runtime\dotnet` (the installer's staging and a full local deploy). The
|
||||
official ReadyToRun `System.Private.CoreLib.dll` and `clrjit.dll` stay: their source is unchanged.
|
||||
|
||||
File version 10.0.1226.52301, product version `@Commit: f2f2e4642…` (the patch commit), so a crash
|
||||
event or dump shows which runtime it was.
|
||||
|
||||
## Why
|
||||
|
||||
Clients that had hot-reloaded the engine crashed minutes later: random statics of live engine and
|
||||
plugin types read null or garbage, then an access violation (.NET Runtime event 1023/1026, a 1 GB
|
||||
`clr_<pid>_*.dmp`). It is a CoreCLR bug, open upstream as dotnet/runtime #135441 (also #135588,
|
||||
#134928; Microsoft's fix, PR #134983, was unmerged on 2026-10-23 and in no released 10.0.x; 10.0.13
|
||||
has the bug too).
|
||||
|
||||
When a thread exits, `FreeLoaderAllocatorHandlesForTLSData` frees each of its collectible
|
||||
thread-static handles against whichever LoaderAllocator *now* owns that TLS index. Unloading a context
|
||||
only marks its indices cleared, and `GetTLSIndexForThreadStatic` hands a cleared index to the next
|
||||
type that asks. So a thread that touched a thread static before a hot reload (a ThreadPool worker,
|
||||
retiring ~20 s after it goes idle) frees an unrelated live slot in the new generation's handle table
|
||||
when it exits, and whatever was kept alive there is collected.
|
||||
|
||||
The patch: a cleared collectible index is never reused (always `g_NextTLSSlot++`). A thread's
|
||||
leftover handles then only ever point at cleared indices, which `CollectibleEntries()` skips, and
|
||||
they are dropped with the thread's arrays. Cost: the index space grows by the number of collectible
|
||||
types with thread statics per generation (a few bytes per thread per type).
|
||||
|
||||
## Tested (2026-10-23)
|
||||
|
||||
- Offline repro `C:\Projects\reloadbug` (Host.dll + Victim.dll, `run.ps1`, `test-patched.ps1`): stock
|
||||
10.0.12 and 10.0.13 corrupt 16 statics per round or crash (AV); patched, 0 in 300 rounds in every
|
||||
mode (dedicated thread, statics in the reused slots, ThreadPool workers retiring); the control
|
||||
(thread exits before the unload) is clean on both.
|
||||
- Freya (test client) on the patched runtime: 20 engine hot reloads 4 minutes apart, no crash, no
|
||||
dump, each old generation unloaded (+38 MB). On the stock runtime that morning both hot reloads
|
||||
crashed within 3-16 minutes.
|
||||
|
||||
## Build it again
|
||||
|
||||
```
|
||||
git clone --depth 1 -b v10.0.12 https://github.com/dotnet/runtime C:\Projects\rt (core.longpaths true)
|
||||
git -C C:\Projects\rt am tls-no-reuse.patch
|
||||
C:\Projects\rt\build.cmd -subset clr.runtime -arch x86 -c Release /p:NuGetAudit=false /p:OfficialBuildId=20261023.1
|
||||
```
|
||||
|
||||
Output: `artifacts\bin\coreclr\windows.x86.Release\` (symbols in `PDB\`; kept on Tom's PC at
|
||||
`C:\Projects\runtime-symbols\coreclr-10.0.1226.52301`). `NuGetAudit=false`: two build-time tasks use a
|
||||
package with advisories published after the tag; nothing of them ships. Needs ~10 GB free.
|
||||
|
||||
## When to drop it
|
||||
|
||||
When a 10.0.x with the upstream fix ships: move the runtime pack to it and delete this folder.
|
||||
A runtime pack of another version than 10.0.12 makes `Publish-EngineCoreClr.ps1` refuse (a coreclr
|
||||
must match its CoreLib): rebuild the patch for that version, or drop it.
|
||||
BIN
runtime-patches/coreclr-10.0.12-x86/coreclr.dll
Normal file
BIN
runtime-patches/coreclr-10.0.12-x86/coreclr.dll
Normal file
Binary file not shown.
BIN
runtime-patches/coreclr-10.0.12-x86/mscordaccore.dll
Normal file
BIN
runtime-patches/coreclr-10.0.12-x86/mscordaccore.dll
Normal file
Binary file not shown.
BIN
runtime-patches/coreclr-10.0.12-x86/mscordbi.dll
Normal file
BIN
runtime-patches/coreclr-10.0.12-x86/mscordbi.dll
Normal file
Binary file not shown.
44
runtime-patches/coreclr-10.0.12-x86/tls-no-reuse.patch
Normal file
44
runtime-patches/coreclr-10.0.12-x86/tls-no-reuse.patch
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
From f2f2e4642c7d86fd6cf4503762051b1ecb6f12f7 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Bohar <tombohar@gmail.com>
|
||||
Date: Fri, 23 Oct 2026 08:07:39 -0400
|
||||
Subject: [PATCH] Never reuse a cleared collectible thread-static TLS index
|
||||
(RynthCore hot-reload statics crash, dotnet/runtime #135441)
|
||||
|
||||
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
||||
---
|
||||
src/coreclr/vm/threadstatics.cpp | 19 +++++++++++++------
|
||||
1 file changed, 13 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/coreclr/vm/threadstatics.cpp b/src/coreclr/vm/threadstatics.cpp
|
||||
index dcff2bc8c..1b174463e 100644
|
||||
--- a/src/coreclr/vm/threadstatics.cpp
|
||||
+++ b/src/coreclr/vm/threadstatics.cpp
|
||||
@@ -766,12 +766,19 @@ void GetTLSIndexForThreadStatic(MethodTable* pMT, bool gcStatic, TLSIndex* pInde
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (!g_pThreadStaticCollectibleTypeIndices->FindClearedIndex(&newTLSIndex))
|
||||
- {
|
||||
- uint32_t tlsRawIndex = g_NextTLSSlot;
|
||||
- newTLSIndex = TLSIndex(TLSIndexType::Collectible, tlsRawIndex);
|
||||
- g_NextTLSSlot += 1;
|
||||
- }
|
||||
+ // RynthCore patch (2026-10-23, dotnet/runtime #135441 / #134928): never reuse a cleared
|
||||
+ // collectible index. A thread that outlived the old owner's unload still holds
|
||||
+ // pLoaderHandles[index] (and its TLS array entry) for it. Once the index was reused,
|
||||
+ // FreeLoaderAllocatorHandlesForTLSData freed that stale handle against the NEW owner's
|
||||
+ // LoaderAllocator when the thread exited, unrooting whatever live object the new owner kept
|
||||
+ // in that slot (random statics of live types read null or garbage, then crashed). A cleared
|
||||
+ // index is skipped by CollectibleEntries(), so its stale state is simply dropped with the
|
||||
+ // thread's arrays. Cost: the index space grows with every collectible type with thread
|
||||
+ // statics ever loaded (a few bytes per thread per type), which is bounded for a host that
|
||||
+ // unloads a context per hot reload.
|
||||
+ uint32_t tlsRawIndex = g_NextTLSSlot;
|
||||
+ newTLSIndex = TLSIndex(TLSIndexType::Collectible, tlsRawIndex);
|
||||
+ g_NextTLSSlot += 1;
|
||||
|
||||
g_pThreadStaticCollectibleTypeIndices->Set(newTLSIndex, pMT, gcStatic);
|
||||
pMT->GetLoaderAllocator()->GetTLSIndexList().Append(newTLSIndex);
|
||||
--
|
||||
2.54.0.windows.1
|
||||
|
||||
|
|
@ -140,6 +140,34 @@ if (-not $EngineOnly) {
|
|||
}
|
||||
else { Write-Warning "createdump.exe is missing from $dotnet and no runtime pack matches coreclr $have; a CoreCLR crash will leave no dump." }
|
||||
}
|
||||
|
||||
# Patched CoreCLR (2026-10-23, runtime-patches\coreclr-10.0.12-x86\README.md): the hot-reload
|
||||
# statics crash, dotnet/runtime #135441. Its coreclr.dll, DAC and DBI go over the runtime pack's;
|
||||
# the official CoreLib and JIT stay. Refused for a runtime of another version: a coreclr has to
|
||||
# match its CoreLib. In use by a running client: moved aside, as the loader and shim are.
|
||||
$patch = Join-Path $repo "runtime-patches\coreclr-10.0.12-x86"
|
||||
if (Test-Path "$patch\coreclr.dll") {
|
||||
$lib = (Get-Item "$dotnet\System.Private.CoreLib.dll").VersionInfo
|
||||
$pv = (Get-Item "$patch\coreclr.dll").VersionInfo
|
||||
if ($lib.FileMajorPart -ne $pv.FileMajorPart -or $lib.FileMinorPart -ne $pv.FileMinorPart -or $lib.FileBuildPart -ne $pv.FileBuildPart) {
|
||||
throw "runtime-patches\coreclr-10.0.12-x86 was built for runtime $($pv.FileMajorPart).$($pv.FileMinorPart).$($pv.FileBuildPart), but $dotnet has CoreLib $($lib.FileMajorPart).$($lib.FileMinorPart).$($lib.FileBuildPart): rebuild the patch for it or remove the folder (see its README)."
|
||||
}
|
||||
$dacName = "mscordaccore_x86_x86_{0}.{1}.{2}.{3}.dll" -f $pv.FileMajorPart, $pv.FileMinorPart, $pv.FileBuildPart, $pv.FilePrivatePart
|
||||
$copied = 0
|
||||
foreach ($pair in @(@('coreclr.dll', 'coreclr.dll'), @('mscordaccore.dll', 'mscordaccore.dll'), @('mscordbi.dll', 'mscordbi.dll'), @('mscordaccore.dll', $dacName))) {
|
||||
$src = Join-Path $patch $pair[0]
|
||||
$dest = Join-Path $dotnet $pair[1]
|
||||
if ((Test-Path $dest) -and (Get-FileHash $dest).Hash -eq (Get-FileHash $src).Hash) { continue }
|
||||
try { Copy-Item $src $dest -Force -ErrorAction Stop }
|
||||
catch {
|
||||
Rename-Item $dest ("{0}.old-{1:yyyyMMddHHmmss}" -f $pair[1], (Get-Date)) -ErrorAction Stop
|
||||
Copy-Item $src $dest -Force -ErrorAction Stop
|
||||
Write-Host "$($pair[1]) was in use: moved the old one aside; new launches get the patched one."
|
||||
}
|
||||
$copied++
|
||||
}
|
||||
if ($copied -gt 0) { Write-Host "Patched CoreCLR $($pv.FileVersion) -> $dotnet ($copied file(s); runtime-patches\coreclr-10.0.12-x86)" }
|
||||
}
|
||||
}
|
||||
|
||||
# Engine + dependencies. The canonical RynthCore.Engine.dll goes last: the loader's file
|
||||
|
|
|
|||
207
scripts/Run-AllTests.ps1
Normal file
207
scripts/Run-AllTests.ps1
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
#Requires -Version 7
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Builds and runs every offline test program in RynthCore, RynthSuite and RynthServers. Exit 0 only
|
||||
when every one passes.
|
||||
|
||||
.DESCRIPTION
|
||||
The test programs are console apps: RynthCore tools\*Tests, RynthSuite and RynthServers Tools\*Tests,
|
||||
each run as `dotnet run -c Release` from its own folder (exit 0 = pass, anything else = fail), and the
|
||||
loader's C tests (a Run-Tests.ps1 beside test.c, built with MSVC). None needs a game client, a server
|
||||
or the network, and none writes to %APPDATA% or C:\Games (each project's header says what it reads).
|
||||
|
||||
Publish-Update.ps1 runs this before it builds a release and refuses to publish when a test fails
|
||||
(2026-10-22: tests only ran when someone remembered to; a release went out with Missile Crafting
|
||||
broken while the tests that existed passed).
|
||||
|
||||
Each test program is also checked for test groups that exist but never run (a class with a static
|
||||
Register(...) that is never registered, a static RunXxx() that is never called): those fail the run.
|
||||
|
||||
Every folder whose name contains "Test" is run unless $Skip below names it with a reason; skipped ones
|
||||
are listed in the summary, never dropped silently. Each program's output goes to
|
||||
<LogDir>\<repo>.<name>.log, and the summary (also <LogDir>\summary.txt) shows each failure's last lines.
|
||||
|
||||
.EXAMPLE
|
||||
.\scripts\Run-AllTests.ps1 -RynthSuiteRoot C:\Projects\rel1002\RynthSuite
|
||||
.EXAMPLE
|
||||
.\scripts\Run-AllTests.ps1 -Only RynthCore.RynthAiHostTests, ChatFilterTests
|
||||
#>
|
||||
param(
|
||||
[string]$RynthCoreRoot = "", # defaults to this checkout
|
||||
[string]$RynthSuiteRoot = "", # defaults to ..\RynthSuite beside RynthCore
|
||||
[string]$RynthServersRoot = "", # defaults to ..\RynthServers beside RynthSuite
|
||||
[string[]]$Only = @(), # folder names (or repo.name) to run; empty = all
|
||||
[string]$LogDir = "", # defaults to %TEMP%\rynth-tests\<time>
|
||||
[int]$TimeoutMinutes = 10 # per program, build and run each
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
if (-not $RynthCoreRoot) { $RynthCoreRoot = Split-Path $PSScriptRoot -Parent }
|
||||
if (-not $RynthSuiteRoot) { $RynthSuiteRoot = Join-Path (Split-Path $RynthCoreRoot -Parent) "RynthSuite" }
|
||||
if (-not $RynthServersRoot) { $RynthServersRoot = Join-Path (Split-Path $RynthSuiteRoot -Parent) "RynthServers" }
|
||||
if (-not $LogDir) { $LogDir = Join-Path $env:TEMP ("rynth-tests\" + (Get-Date -Format "yyyyMMdd-HHmmss")) }
|
||||
New-Item -ItemType Directory -Force $LogDir | Out-Null
|
||||
$env:DOTNET_NOLOGO = "1"
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = "1"
|
||||
|
||||
# Folders with "Test" in the name that are not tests, and tests that can't run here. Each needs a reason.
|
||||
$Skip = @{
|
||||
"HookResolver.SmokeTest" = "prints the hooks it resolves in acclient.exe and checks nothing (always exits 0)"
|
||||
"TestClient" = "builds a stand-in acclient.exe for the reload scripts; not a test"
|
||||
}
|
||||
|
||||
$repos = @(
|
||||
@{ Name = "RynthCore"; Root = $RynthCoreRoot; Tools = "tools" },
|
||||
@{ Name = "RynthSuite"; Root = $RynthSuiteRoot; Tools = "Tools" },
|
||||
@{ Name = "RynthServers"; Root = $RynthServersRoot; Tools = "Tools" }
|
||||
)
|
||||
|
||||
$tests = [System.Collections.Generic.List[object]]::new()
|
||||
$skipped = [System.Collections.Generic.List[object]]::new()
|
||||
foreach ($r in $repos) {
|
||||
$dir = Join-Path $r.Root $r.Tools
|
||||
if (-not (Test-Path $dir)) { throw "No $($r.Tools) folder in $($r.Name) at $($r.Root)" }
|
||||
foreach ($d in Get-ChildItem $dir -Directory | Where-Object Name -like "*Test*" | Sort-Object Name) {
|
||||
$id = "$($r.Name).$($d.Name)"
|
||||
if ($Only.Count -gt 0 -and -not ($Only -contains $d.Name -or $Only -contains $id)) { continue }
|
||||
if ($Skip.ContainsKey($d.Name)) { $skipped.Add([pscustomobject]@{ Id = $id; Why = $Skip[$d.Name] }); continue }
|
||||
$proj = Get-ChildItem $d.FullName -Filter *.csproj | Select-Object -First 1
|
||||
$ps = Join-Path $d.FullName "Run-Tests.ps1"
|
||||
if ($proj) { $tests.Add([pscustomobject]@{ Id = $id; Dir = $d.FullName; Kind = "dotnet"; Path = $proj.FullName }) }
|
||||
elseif (Test-Path $ps) { $tests.Add([pscustomobject]@{ Id = $id; Dir = $d.FullName; Kind = "script"; Path = $ps }) }
|
||||
elseif (-not (Get-ChildItem $d.FullName -Force | Where-Object Name -notin "bin", "obj")) {
|
||||
# Git doesn't remove ignored build output, so a moved or deleted project leaves its bin\obj behind.
|
||||
$skipped.Add([pscustomobject]@{ Id = $id; Why = "only build output left (bin, obj): the project moved or was deleted" })
|
||||
}
|
||||
else { $tests.Add([pscustomobject]@{ Id = $id; Dir = $d.FullName; Kind = "none"; Path = "" }) }
|
||||
}
|
||||
}
|
||||
if ($Only.Count -gt 0 -and $tests.Count -eq 0 -and $skipped.Count -eq 0) { throw "-Only matched no test folder: $($Only -join ', ')" }
|
||||
|
||||
# Tests that exist but never run (2026-10-30: RynthAiHostTests' RingEscapeTests and RingEvadeTests
|
||||
# had stopped being registered in a merge, and PetDamageTintTests never was; their checks silently
|
||||
# didn't run). In each test program: every class with a static Register(...) must be registered
|
||||
# (Name.Register( somewhere in the program), and every parameterless "static void RunXxx()" group
|
||||
# must be called. A miss fails the run as "<repo>.<folder> (registration)".
|
||||
function Find-UnrunTests([string]$dir) {
|
||||
$files = @(Get-ChildItem $dir -Recurse -Filter *.cs | Where-Object { $_.FullName -notmatch '[\\/](bin|obj)[\\/]' })
|
||||
if ($files.Count -eq 0) { return @() }
|
||||
$src = @{}
|
||||
foreach ($f in $files) { $src[$f.FullName] = Get-Content $f.FullName -Raw }
|
||||
$all = ($src.Values -join "`n")
|
||||
$miss = [System.Collections.Generic.List[string]]::new()
|
||||
foreach ($kv in $src.GetEnumerator()) {
|
||||
$text = $kv.Value
|
||||
if ($text -notmatch 'static\s+void\s+Register\s*\(\s*Runner\b') { }
|
||||
else {
|
||||
foreach ($m in [regex]::Matches($text, '(?:internal|public)\s+(?:static\s+)?(?:sealed\s+)?(?:partial\s+)?class\s+(\w+)')) {
|
||||
$cls = $m.Groups[1].Value
|
||||
# the class's own Register: the first "static void Register(" after its declaration, before the next class
|
||||
$rest = $text.Substring($m.Index + $m.Length)
|
||||
$next = [regex]::Match($rest, '(?:internal|public)\s+(?:static\s+)?(?:sealed\s+)?(?:partial\s+)?class\s+\w+')
|
||||
$body = if ($next.Success) { $rest.Substring(0, $next.Index) } else { $rest }
|
||||
if ($body -match 'static\s+void\s+Register\s*\(\s*Runner\b' -and $all -notmatch "\b$cls\.Register\s*\(") {
|
||||
$miss.Add("$cls.Register(...) is never called ($([IO.Path]::GetRelativePath($dir, $kv.Key)))")
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($m in [regex]::Matches($text, 'static\s+void\s+(Run[A-Z]\w*)\s*\(\s*\)')) {
|
||||
$name = $m.Groups[1].Value
|
||||
if ($all -notmatch "\b$name\s*\(\s*\)\s*;") { $miss.Add("$name() is never called ($([IO.Path]::GetRelativePath($dir, $kv.Key)))") }
|
||||
}
|
||||
}
|
||||
return $miss
|
||||
}
|
||||
|
||||
$registration = [System.Collections.Generic.List[object]]::new()
|
||||
foreach ($t in $tests) {
|
||||
if ($t.Kind -ne "dotnet") { continue }
|
||||
$miss = @(Find-UnrunTests $t.Dir)
|
||||
if ($miss.Count -gt 0) { $registration.Add([pscustomobject]@{ Id = "$($t.Id) (registration)"; Lines = $miss }) }
|
||||
}
|
||||
|
||||
# Runs one program with its output captured; returns @{ Code; TimedOut; Output }.
|
||||
function Invoke-Captured([string]$file, [string[]]$argList, [string]$cwd) {
|
||||
$psi = [System.Diagnostics.ProcessStartInfo]::new($file)
|
||||
foreach ($a in $argList) { $psi.ArgumentList.Add($a) }
|
||||
$psi.WorkingDirectory = $cwd
|
||||
$psi.UseShellExecute = $false
|
||||
$psi.RedirectStandardOutput = $true
|
||||
$psi.RedirectStandardError = $true
|
||||
$psi.RedirectStandardInput = $true # a program that waits for a key gets end-of-input, not a hang
|
||||
$p = [System.Diagnostics.Process]::Start($psi)
|
||||
$p.StandardInput.Close()
|
||||
$out = $p.StandardOutput.ReadToEndAsync()
|
||||
$err = $p.StandardError.ReadToEndAsync()
|
||||
$timedOut = -not $p.WaitForExit($TimeoutMinutes * 60 * 1000)
|
||||
if ($timedOut) { try { $p.Kill($true) } catch { } ; $p.WaitForExit() }
|
||||
$p.WaitForExit() # drains the readers
|
||||
$text = $out.Result
|
||||
if ($err.Result) { $text += "`n--- stderr ---`n" + $err.Result }
|
||||
return @{ Code = $p.ExitCode; TimedOut = $timedOut; Output = $text }
|
||||
}
|
||||
|
||||
$results = [System.Collections.Generic.List[object]]::new()
|
||||
$i = 0
|
||||
foreach ($t in $tests) {
|
||||
$i++
|
||||
$log = Join-Path $LogDir "$($t.Id).log"
|
||||
$sw = [System.Diagnostics.Stopwatch]::StartNew()
|
||||
$status = "PASS"; $text = ""
|
||||
Write-Host ("[{0,2}/{1}] {2} ... " -f $i, $tests.Count, $t.Id) -NoNewline
|
||||
switch ($t.Kind) {
|
||||
"none" { $status = "FAIL"; $text = "no .csproj and no Run-Tests.ps1 in $($t.Dir) (add one, or list the folder in `$Skip with a reason)" }
|
||||
"script" {
|
||||
$r = Invoke-Captured "pwsh" @("-NoProfile", "-NonInteractive", "-File", $t.Path) $t.Dir
|
||||
$text = $r.Output
|
||||
if ($r.TimedOut) { $status = "TIMEOUT" } elseif ($r.Code -ne 0) { $status = "FAIL" }
|
||||
}
|
||||
"dotnet" {
|
||||
# The same as `dotnet run -c Release` from the project's folder, without dotnet run's
|
||||
# ~10 s of project evaluation per program: build, then start what was built. -t:Build is
|
||||
# needed: -getProperty alone only evaluates the project and builds nothing (an old build
|
||||
# would then be tested).
|
||||
$b = Invoke-Captured "dotnet" @("build", $t.Path, "-c", "Release", "-nologo", "-t:Build", "-getProperty:TargetPath") $t.Dir
|
||||
$text = "=== build ===`n" + $b.Output
|
||||
$dll = ($b.Output -split "`r?`n" | Where-Object { $_ -match '\.dll\s*$' } | Select-Object -Last 1)
|
||||
if ($b.TimedOut) { $status = "TIMEOUT (build)" }
|
||||
elseif ($b.Code -ne 0) { $status = "BUILD FAILED" }
|
||||
elseif (-not $dll -or -not (Test-Path $dll.Trim())) { $status = "BUILD FAILED"; $text += "`n(no built program found)" }
|
||||
else {
|
||||
$dll = $dll.Trim()
|
||||
$exe = [IO.Path]::ChangeExtension($dll, ".exe")
|
||||
$r = if (Test-Path $exe) { Invoke-Captured $exe @() $t.Dir } else { Invoke-Captured "dotnet" @($dll) $t.Dir }
|
||||
$text += "`n=== run ===`n" + $r.Output
|
||||
if ($r.TimedOut) { $status = "TIMEOUT" } elseif ($r.Code -ne 0) { $status = "FAIL (exit $($r.Code))" }
|
||||
}
|
||||
}
|
||||
}
|
||||
$sw.Stop()
|
||||
Set-Content $log $text
|
||||
$color = if ($status -eq "PASS") { "Green" } else { "Red" }
|
||||
Write-Host ("{0} ({1:0}s)" -f $status, $sw.Elapsed.TotalSeconds) -ForegroundColor $color
|
||||
$results.Add([pscustomobject]@{ Id = $t.Id; Status = $status; Seconds = [math]::Round($sw.Elapsed.TotalSeconds); Log = $log })
|
||||
}
|
||||
|
||||
foreach ($g in $registration) {
|
||||
$log = Join-Path $LogDir "$($g.Id -replace '[^\w.\-]', '_').log"
|
||||
Set-Content $log (@("Tests that exist but never run:") + $g.Lines)
|
||||
Write-Host ("{0}: {1} test group(s) never run" -f $g.Id, $g.Lines.Count) -ForegroundColor Red
|
||||
$results.Add([pscustomobject]@{ Id = $g.Id; Status = "NOT RUN"; Seconds = 0; Log = $log })
|
||||
}
|
||||
|
||||
$failed = @($results | Where-Object Status -ne "PASS")
|
||||
$summary = [System.Collections.Generic.List[string]]::new()
|
||||
$summary.Add("RynthCore $(git -C $RynthCoreRoot rev-parse --short HEAD) ($RynthCoreRoot), RynthSuite $(git -C $RynthSuiteRoot rev-parse --short HEAD) ($RynthSuiteRoot), RynthServers $(git -C $RynthServersRoot rev-parse --short HEAD) ($RynthServersRoot)")
|
||||
$summary.Add("$($results.Count - $failed.Count) of $($results.Count) test programs passed, $($failed.Count) failed, $($skipped.Count) skipped. Logs: $LogDir")
|
||||
foreach ($s in $skipped) { $summary.Add(" skipped $($s.Id): $($s.Why)") }
|
||||
foreach ($f in $failed) {
|
||||
$summary.Add("")
|
||||
$summary.Add("$($f.Status): $($f.Id) ($($f.Log))")
|
||||
$tail = @(Get-Content $f.Log -Tail 15)
|
||||
foreach ($line in $tail) { $summary.Add(" $line") }
|
||||
}
|
||||
Set-Content (Join-Path $LogDir "summary.txt") $summary
|
||||
Write-Host ""
|
||||
$summary | ForEach-Object { Write-Host $_ }
|
||||
exit [math]::Min($failed.Count, 1)
|
||||
234
scripts/Run-GameTest.ps1
Normal file
234
scripts/Run-GameTest.ps1
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
#Requires -Version 7
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Logs a test character in, has RynthAi run the self-test meta (RynthSuite GameTests\RynthSelfTest.af)
|
||||
and prints what passed. Exit 0 when nothing failed.
|
||||
|
||||
.DESCRIPTION
|
||||
The meta tests RynthAi in game, one check after another: a force rebuff, a kill, looting the corpse,
|
||||
and missile crafting from bundles with the ammo taken off. It saves rt_<check> = PASS / FAIL / SKIP
|
||||
and the reason in the character's RynthAi\pvars\<name>.txt, which this script reads. A check the
|
||||
character can't do (no bow, no monster in view) is a SKIP, not a FAIL.
|
||||
|
||||
The client is launched the way Test-ClrWorld.ps1 launches one: the injector's headless --launch with
|
||||
a saved account profile (the password stays in the launcher's settings), the test engine settings,
|
||||
its own panel layout, and its OWN dispatch file. Commands go only to that client; the shared
|
||||
%APPDATA%\RynthCore\dispatch.txt would reach every running client. Plugins are the installed ones
|
||||
(C:\Games\RynthSuite), so this tests what is deployed on this PC.
|
||||
|
||||
-ClientPid runs it in a client that is already in the world instead (logging the same account in
|
||||
again would drop that one). Commands then go through RynthRemote's per-client command files
|
||||
(C:\Games\RynthCore\Logs\status\commands\RynthCore.<pid>.*.cmd.json, the phone remote's path), which
|
||||
only that client reads, and the client is left running.
|
||||
|
||||
The meta switches Combat, Buffing, Looting and Nav on and off and puts them back when it finishes.
|
||||
At the end a client this script launched is closed normally (as the window's close button does)
|
||||
unless -Keep.
|
||||
|
||||
Only point it at a character that may fight and loot where it stands, on a server you run or
|
||||
may test on. The character should stand near easy monsters; for the crafting check it needs a
|
||||
bow, crossbow or atlatl and arrowhead and shaft bundles, and no finished ammo to test making it.
|
||||
|
||||
.EXAMPLE
|
||||
.\scripts\Run-GameTest.ps1 # +Buffi on the local ACEmulator server
|
||||
.EXAMPLE
|
||||
.\scripts\Run-GameTest.ps1 -Account <account> -Server Aelrynth -Character Freya -Keep
|
||||
.EXAMPLE
|
||||
.\scripts\Run-GameTest.ps1 -ClientPid 52000 # Freya, already logged in
|
||||
#>
|
||||
param(
|
||||
[string]$Account = "Buffi",
|
||||
[string]$Server = "ACEmulator",
|
||||
[string]$Character = "+Buffi",
|
||||
[string]$RynthSuiteRoot = "", # defaults to ..\RynthSuite beside this RynthCore
|
||||
[string]$Runtime = "C:\Games\RynthCore\Runtime",
|
||||
[string]$Settings = "C:\Games\RynthCore\Test\engine-plugins.json",
|
||||
[string]$SuiteDir = "C:\Games\RynthSuite",
|
||||
[int]$LoginTimeoutSeconds = 120,
|
||||
[int]$TimeoutMinutes = 15, # the meta itself gives up on each check well before this
|
||||
[int]$ClientPid = 0, # a client already in the world: test in it (no launch, left running)
|
||||
[switch]$Keep # leave the client running afterwards
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$repo = Split-Path $PSScriptRoot -Parent
|
||||
if (-not $RynthSuiteRoot) { $RynthSuiteRoot = Join-Path (Split-Path $repo -Parent) "RynthSuite" }
|
||||
$metaSource = Join-Path $RynthSuiteRoot "GameTests\RynthSelfTest.af"
|
||||
if (-not (Test-Path $metaSource)) { throw "No self-test meta at $metaSource (pass -RynthSuiteRoot)" }
|
||||
$metaDir = Join-Path $SuiteDir "RynthAi\MetaFiles"
|
||||
$pvarsDir = Join-Path $SuiteDir "RynthAi\pvars"
|
||||
if (-not (Test-Path $metaDir)) { throw "No RynthAi meta folder at $metaDir" }
|
||||
|
||||
if ($ClientPid) {
|
||||
# A running client: its character from the engine's status file, its commands through RynthRemote.
|
||||
if (-not (Get-Process -Id $ClientPid -ErrorAction SilentlyContinue)) { throw "no process $ClientPid" }
|
||||
$statusFile = "C:\Games\RynthCore\Logs\status\RynthCore.$ClientPid.status.json"
|
||||
if (-not (Test-Path $statusFile)) { throw "no engine status for client $ClientPid ($statusFile)" }
|
||||
$status = Get-Content $statusFile -Raw | ConvertFrom-Json
|
||||
if (-not $status.inWorld) { throw "client $ClientPid isn't in the world" }
|
||||
if (-not $PSBoundParameters.ContainsKey("Character")) { $Character = $status.character }
|
||||
elseif ($Character -ne $status.character) { throw "client $ClientPid is $($status.character), not $Character" }
|
||||
$log = "C:\Games\RynthCore\Logs\RynthCore.$ClientPid.log"
|
||||
if (-not (Select-String -Path $log -Pattern "loaded RynthCore\.Plugin\.RynthRemote\.dll" -Quiet)) {
|
||||
throw "client $ClientPid hasn't loaded RynthRemote, which takes the commands"
|
||||
}
|
||||
} else {
|
||||
$injector = "$repo\out\injector\RynthCore.Injector.exe"
|
||||
if (-not (Test-Path $injector)) {
|
||||
dotnet publish "$repo\src\RynthCore.Injector\RynthCore.Injector.csproj" -c Release -o "$repo\out\injector" -nologo -v q | Out-Null
|
||||
if (-not (Test-Path $injector)) { throw "could not build the injector" }
|
||||
}
|
||||
}
|
||||
|
||||
# The meta goes in as RynthSelfTest.af. /ra meta load of a name that isn't there would create and
|
||||
# load a BLANK meta, so the copy is checked first, and the run is checked to have started below.
|
||||
Copy-Item $metaSource (Join-Path $metaDir "RynthSelfTest.af") -Force
|
||||
if ((Get-FileHash $metaSource).Hash -ne (Get-FileHash (Join-Path $metaDir "RynthSelfTest.af")).Hash) { throw "the meta did not copy to $metaDir" }
|
||||
|
||||
# The character's pvars file: its name with the characters Windows won't take in a file name as '_'
|
||||
# (ExpressionEngine.SanitizeFileName).
|
||||
$invalid = [IO.Path]::GetInvalidFileNameChars()
|
||||
$fileName = -join ($Character.ToCharArray() | ForEach-Object { if ($invalid -contains $_) { '_' } else { $_ } })
|
||||
$pvars = Join-Path $pvarsDir "$fileName.txt"
|
||||
# True when the log has a heartbeat written since $since (by its time of day, past midnight too)
|
||||
# that says the character is in the world (login=1) with plugins ticking (plug=N/s, N > 0).
|
||||
function Test-ReadySince([string]$logPath, [datetime]$since) {
|
||||
if (-not (Test-Path $logPath)) { return $false }
|
||||
$window = ((Get-Date) - $since).TotalSeconds + 5
|
||||
foreach ($m in Select-String -Path $logPath -Pattern '^\[(\d\d):(\d\d):(\d\d)\.\d+\] .*hb #\d+ .*plug=([1-9]\d*)/s.*login=1') {
|
||||
$g = $m.Matches[0].Groups
|
||||
$at = New-TimeSpan -Hours ([int]$g[1].Value) -Minutes ([int]$g[2].Value) -Seconds ([int]$g[3].Value)
|
||||
$d = ($at - $since.TimeOfDay).TotalSeconds
|
||||
if ($d -lt -2) { $d += 86400 }
|
||||
if ($d -ge -2 -and $d -le $window) { return $true }
|
||||
}
|
||||
return $false
|
||||
}
|
||||
|
||||
function Read-Results {
|
||||
$r = @{}
|
||||
if (Test-Path $pvars) {
|
||||
foreach ($line in Get-Content $pvars) {
|
||||
$i = $line.IndexOf("`t")
|
||||
if ($i -gt 0 -and $line.StartsWith("rt_")) { $r[$line.Substring(0, $i)] = $line.Substring($i + 1) }
|
||||
}
|
||||
}
|
||||
return $r
|
||||
}
|
||||
|
||||
$started = [DateTimeOffset]::UtcNow.ToUnixTimeSeconds()
|
||||
if ($ClientPid) {
|
||||
# $gamePid, not $clientPid: PowerShell names ignore case, so that would BE the -ClientPid parameter,
|
||||
# and a launch would then read as "already in the world" and skip the wait (2026-10-22).
|
||||
$gamePid = $ClientPid
|
||||
$commandDir = "C:\Games\RynthCore\Logs\status\commands"
|
||||
New-Item -ItemType Directory -Force $commandDir | Out-Null
|
||||
# The file the status agent writes for a phone command (LocalStatusServer.cs): RynthRemote in that
|
||||
# client takes RynthCore.<its pid>.*.cmd.json in name order and hands "sendchat" to RynthAi.
|
||||
function Send([string]$command) {
|
||||
$name = "RynthCore.$gamePid.$('{0:D19}' -f [DateTime]::UtcNow.Ticks)-$([Guid]::NewGuid().ToString('N')).cmd.json"
|
||||
$json = @{ pid = $gamePid; action = "sendchat"; value = $command; ts = [DateTimeOffset]::UtcNow.ToString("o") } | ConvertTo-Json -Compress
|
||||
Set-Content "$commandDir\$name.tmp" $json -NoNewline
|
||||
Move-Item "$commandDir\$name.tmp" "$commandDir\$name" -Force
|
||||
Start-Sleep 2
|
||||
}
|
||||
Write-Host "Testing in client $gamePid ($Character), log $log"
|
||||
} else {
|
||||
# The same isolation as Test-ClrWorld.ps1: test engine settings, its own panel layout, its own dispatch file.
|
||||
$env:RYNTHCORE_ENGINE_SETTINGS = $Settings
|
||||
$env:RYNTHCORE_TEST_CLIENT = "Run-GameTest"
|
||||
$env:LOCALAPPDATA = "C:\Games\RynthCore\Test\localappdata"
|
||||
New-Item -ItemType Directory -Force $env:LOCALAPPDATA | Out-Null
|
||||
$dispatch = "C:\Games\RynthCore\Test\dispatch-gametest.txt"
|
||||
$env:RYNTHCORE_DISPATCH_FILE = $dispatch
|
||||
Set-Content $dispatch "# Run-GameTest dispatch file"
|
||||
function Send([string]$command) { Set-Content $dispatch "force:$command"; Start-Sleep 2 }
|
||||
|
||||
Write-Host "Launching $Character ($Account on $Server)..."
|
||||
$launchedAt = Get-Date
|
||||
$out = & $injector --launch --account $Account --server $Server --engine "$Runtime\RynthCore.Loader.dll" --character $Character 2>&1
|
||||
$m = $out | Select-String "LAUNCHED_PID=(\d+)"
|
||||
if (-not $m) { $out | ForEach-Object { Write-Host " $_" }; throw "the injector didn't launch a client" }
|
||||
$gamePid = [int]$m.Matches[0].Groups[1].Value
|
||||
$log = "C:\Games\RynthCore\Logs\RynthCore.$gamePid.log"
|
||||
Write-Host "client $gamePid, log $log"
|
||||
}
|
||||
|
||||
$exit = 1
|
||||
try {
|
||||
if (-not $ClientPid) {
|
||||
# In the world with plugins running: a heartbeat written since the launch says login=1 and
|
||||
# plug=N/s with N > 0. Only lines since the launch count: pids are reused and logs kept, so
|
||||
# RynthCore.<pid>.log can hold an old client's "login=1" (2026-10-22: the commands went out
|
||||
# before RynthAi had loaded, and the run never started).
|
||||
$deadline = (Get-Date).AddSeconds($LoginTimeoutSeconds)
|
||||
while (-not (Test-ReadySince $log $launchedAt)) {
|
||||
if (-not (Get-Process -Id $gamePid -ErrorAction SilentlyContinue)) { throw "the client exited before logging in" }
|
||||
if ((Get-Date) -gt $deadline) { throw "not in the world with plugins running after $LoginTimeoutSeconds s" }
|
||||
Start-Sleep 3
|
||||
}
|
||||
Start-Sleep 10 # plugins settle (RynthAi loads its profile, the character's own meta may start)
|
||||
}
|
||||
|
||||
# A meta's rules run only with the macro on AND RynthAi's Meta switch on (Freya's was off on the
|
||||
# first run, 2026-10-22: the meta loaded and nothing happened). Put the switch back afterwards.
|
||||
$statusFile = "C:\Games\RynthCore\Logs\status\RynthCore.$gamePid.status.json"
|
||||
$metaWasOn = $true
|
||||
try { $metaWasOn = [bool](Get-Content $statusFile -Raw | ConvertFrom-Json).bot.metaEnabled } catch { }
|
||||
Send "/ra stop"
|
||||
Send "/ra meta load RynthSelfTest"
|
||||
Send "/vt opt set EnableMeta true"
|
||||
Send "/ra start"
|
||||
|
||||
# Started: the meta's Default state writes rt_status RUNNING and rt_started (unix seconds).
|
||||
$deadline = (Get-Date).AddSeconds(45)
|
||||
do {
|
||||
Start-Sleep 3
|
||||
$r = Read-Results
|
||||
$fresh = $r.ContainsKey("rt_started") -and [long]$r["rt_started"] -ge $started
|
||||
if ((Get-Date) -gt $deadline) { throw "the self-test meta didn't start within 45 s (no fresh rt_started in $pvars)" }
|
||||
} until ($fresh)
|
||||
Write-Host "the self-test meta is running"
|
||||
|
||||
$deadline = (Get-Date).AddMinutes($TimeoutMinutes)
|
||||
$shown = @{}
|
||||
do {
|
||||
Start-Sleep 5
|
||||
if (-not (Get-Process -Id $gamePid -ErrorAction SilentlyContinue)) { throw "the client exited during the test" }
|
||||
$r = Read-Results
|
||||
foreach ($k in "rt_buff", "rt_fight", "rt_loot", "rt_craft") {
|
||||
if ($r[$k] -and $r[$k] -ne "PENDING" -and -not $shown[$k]) {
|
||||
$shown[$k] = $true
|
||||
Write-Host (" {0,-6} {1}" -f $r[$k], $k.Substring(3))
|
||||
}
|
||||
}
|
||||
if ((Get-Date) -gt $deadline) { throw "the self-test meta didn't finish within $TimeoutMinutes minutes" }
|
||||
} until ($r["rt_status"] -eq "DONE" -and $r.ContainsKey("rt_finished") -and [long]$r["rt_finished"] -ge $started)
|
||||
|
||||
Write-Host ""
|
||||
$names = [ordered]@{ meta = "self-test meta"; buff = "buffing"; fight = "fight (a kill)"; loot = "looting"; craft = "missile crafting" }
|
||||
$fails = 0
|
||||
foreach ($k in $names.Keys) {
|
||||
$result = $r["rt_$k"]; $why = $r["rt_${k}_why"]
|
||||
if ($result -eq "FAIL" -or -not $result) { $fails++ }
|
||||
$color = switch ($result) { "PASS" { "Green" } "SKIP" { "Yellow" } default { "Red" } }
|
||||
Write-Host ("{0,-5} {1,-17} {2}" -f $result, $names[$k], $why) -ForegroundColor $color
|
||||
}
|
||||
Write-Host ""
|
||||
Write-Host $(if ($fails -eq 0) { "No failures." } else { "$fails check(s) failed." })
|
||||
$exit = [math]::Min($fails, 1)
|
||||
}
|
||||
finally {
|
||||
$p = Get-Process -Id $gamePid -ErrorAction SilentlyContinue
|
||||
if ($p -and (Get-Variable metaWasOn -ErrorAction SilentlyContinue) -and -not $metaWasOn) {
|
||||
Send "/ra stop" # the meta stops the macro when it finishes; this covers a run that didn't
|
||||
Send "/vt opt set EnableMeta false"
|
||||
}
|
||||
if ($p -and -not $Keep -and -not $ClientPid) {
|
||||
# The normal close path (plugins stopped, engine shut down, logged off), not a kill.
|
||||
[void]$p.CloseMainWindow()
|
||||
if (-not $p.WaitForExit(30000)) { Write-Warning "client $gamePid didn't close within 30 s; left running" }
|
||||
else { Write-Host "client closed" }
|
||||
}
|
||||
}
|
||||
exit $exit
|
||||
|
|
@ -51,6 +51,10 @@ $env:RYNTHCORE_TEST_CLIENT = "Test-ClrWorld" # the loader logs "TestClient: ..
|
|||
# clients: a test client gets its own so it never moves the player's bar or panels.
|
||||
$env:LOCALAPPDATA = "C:\Games\RynthCore\Test\localappdata"
|
||||
New-Item -ItemType Directory -Force $env:LOCALAPPDATA | Out-Null
|
||||
# The engine finds %LOCALAPPDATA% through the known-folder API, which ignores the variable above:
|
||||
# the hotkeys (shared by every client, and changed by the item bar's keys) get their own file here.
|
||||
New-Item -ItemType Directory -Force "$env:LOCALAPPDATA\RynthCore" | Out-Null
|
||||
$env:RYNTHCORE_HOTKEYS_FILE = "$env:LOCALAPPDATA\RynthCore\hotkeys.txt"
|
||||
$dispatch = "C:\Games\RynthCore\Test\dispatch.txt"
|
||||
$env:RYNTHCORE_DISPATCH_FILE = $dispatch
|
||||
Set-Content $dispatch "# test dispatch file"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
WindowStartupLocation="CenterOwner"
|
||||
Title="Account Profile"
|
||||
Background="#132028">
|
||||
<Window.Resources>
|
||||
<!-- The "show password" eye (the same one in FirstLoginDialog.axaml). -->
|
||||
<StreamGeometry x:Key="EyeIcon">F0 M8,3 C4.4,3 1.6,5.3 0.5,8 C1.6,10.7 4.4,13 8,13 C11.6,13 14.4,10.7 15.5,8 C14.4,5.3 11.6,3 8,3 Z M8,4.3 C5.3,4.3 3,5.9 2,8 C3,10.1 5.3,11.7 8,11.7 C10.7,11.7 13,10.1 14,8 C13,5.9 10.7,4.3 8,4.3 Z M8,5.5 A2.5,2.5 0 1 1 8,10.5 A2.5,2.5 0 1 1 8,5.5 Z</StreamGeometry>
|
||||
</Window.Resources>
|
||||
<Grid RowDefinitions="*,Auto" Margin="18">
|
||||
<StackPanel Spacing="12">
|
||||
<TextBlock Text="Server" Foreground="#EAF0F4" />
|
||||
|
|
@ -14,10 +18,22 @@
|
|||
<TextBlock Text="Account" Foreground="#EAF0F4" />
|
||||
<TextBox x:Name="AccountBox" />
|
||||
<TextBlock Text="Password" Foreground="#EAF0F4" />
|
||||
<TextBox x:Name="PasswordBox"
|
||||
PasswordChar="*"
|
||||
RevealPassword="False"
|
||||
Watermark="Leave blank to keep the saved password hidden" />
|
||||
<!-- The eye shows the password; with the box empty, the saved one (SavedPasswordReveal). -->
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBox x:Name="PasswordBox"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,6,0"
|
||||
PasswordChar="*"
|
||||
RevealPassword="False"
|
||||
Watermark="Leave blank to keep the saved password" />
|
||||
<ToggleButton x:Name="ShowPasswordToggle"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Stretch"
|
||||
ToolTip.Tip="Show password"
|
||||
AutomationProperties.Name="Show password">
|
||||
<PathIcon Data="{StaticResource EyeIcon}" Width="16" Height="16" />
|
||||
</ToggleButton>
|
||||
</Grid>
|
||||
<CheckBox x:Name="ClearPasswordCheckBox"
|
||||
Content="Clear saved password"
|
||||
Foreground="#EAF0F4" />
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Avalonia.Automation;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using RynthCore.App;
|
||||
|
|
@ -13,6 +14,8 @@ internal partial class AccountProfileDialog : Window
|
|||
private readonly LaunchAccountProfile _profile;
|
||||
private readonly List<LaunchServerProfile> _servers;
|
||||
private readonly Func<string, string, List<string>> _knownCharactersFor;
|
||||
// The eye beside the password box; it keeps no copy of the password.
|
||||
private readonly SavedPasswordReveal _passwordReveal;
|
||||
|
||||
private List<string> _knownCharacters = [];
|
||||
// Set once the player picks in "Log in as"; until then the saved choice is kept as it is
|
||||
|
|
@ -31,6 +34,7 @@ internal partial class AccountProfileDialog : Window
|
|||
_profile = profile;
|
||||
_servers = servers;
|
||||
_knownCharactersFor = knownCharactersFor;
|
||||
_passwordReveal = SavedPasswordReveal.For(profile);
|
||||
_acClientPath = acClientPath;
|
||||
InitializeComponent();
|
||||
|
||||
|
|
@ -46,7 +50,7 @@ internal partial class AccountProfileDialog : Window
|
|||
? "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. 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.";
|
||||
: "A password is saved for this profile, encrypted for this Windows user. The eye shows it; type a new one to replace it.";
|
||||
|
||||
ServerComboBox.SelectionChanged += (_, _) => RefreshLoginAs();
|
||||
AccountBox.TextChanged += (_, _) => RefreshLoginAs();
|
||||
|
|
@ -57,12 +61,34 @@ internal partial class AccountProfileDialog : Window
|
|||
};
|
||||
RefreshLoginAs();
|
||||
|
||||
ShowPasswordToggle.IsCheckedChanged += (_, _) => OnShowPasswordChanged();
|
||||
// The plain text lives only in the box, and only while the dialog is open.
|
||||
Closed += (_, _) =>
|
||||
{
|
||||
PasswordBox.Text = string.Empty;
|
||||
_passwordReveal.Reset();
|
||||
};
|
||||
|
||||
SaveButton.Click += (_, _) => SaveAndClose();
|
||||
CancelButton.Click += (_, _) => Close(false);
|
||||
BrowseUserPrefsButton.Click += async (_, _) => await BrowseUserPrefsAsync();
|
||||
SnapshotUserPrefsButton.Click += (_, _) => SnapshotLiveUserPrefs();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The eye: on shows what's typed, or the saved password (decrypted now) when the box is empty;
|
||||
/// off hides it and empties the box again if it still holds the saved password unchanged.
|
||||
/// </summary>
|
||||
private void OnShowPasswordChanged()
|
||||
{
|
||||
bool show = ShowPasswordToggle.IsChecked == true;
|
||||
PasswordBox.Text = show ? _passwordReveal.EyeOn(PasswordBox.Text) : _passwordReveal.EyeOff(PasswordBox.Text);
|
||||
PasswordBox.RevealPassword = show;
|
||||
string tip = show ? SavedPasswordReveal.HideTip : SavedPasswordReveal.ShowTip;
|
||||
ToolTip.SetTip(ShowPasswordToggle, tip);
|
||||
AutomationProperties.SetName(ShowPasswordToggle, tip);
|
||||
}
|
||||
|
||||
/// <summary>Lists the characters known for the account on the chosen server in "Log in as".</summary>
|
||||
private void RefreshLoginAs()
|
||||
{
|
||||
|
|
@ -183,12 +209,14 @@ internal partial class AccountProfileDialog : Window
|
|||
{
|
||||
_profile.ClearPassword();
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(PasswordBox.Text))
|
||||
else if (_passwordReveal.PasswordToSave(PasswordBox.Text) is string newPassword)
|
||||
{
|
||||
// Encrypted at once (DPAPI, this Windows user); the plain text isn't kept on the profile.
|
||||
_profile.SetPassword(PasswordBox.Text);
|
||||
// A blank box, or the saved password the eye showed left unchanged, keeps the saved one.
|
||||
_profile.SetPassword(newPassword);
|
||||
}
|
||||
PasswordBox.Text = string.Empty;
|
||||
_passwordReveal.Reset();
|
||||
|
||||
_profile.Alias = AliasBox.Text?.Trim() ?? string.Empty;
|
||||
_profile.UserPrefsPath = UserPrefsPathBox.Text?.Trim() ?? string.Empty;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ internal static class CrashDumpWriters
|
|||
return result;
|
||||
}
|
||||
|
||||
private static string? TryGetCommandLine(int pid)
|
||||
internal static string? TryGetCommandLine(int pid)
|
||||
{
|
||||
IntPtr h = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, false, pid);
|
||||
if (h == IntPtr.Zero) return null;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace RynthCore.App.Avalonia;
|
|||
|
||||
/// <summary>
|
||||
/// Read-modify-write access to %APPDATA%\RynthCore\engine.json. The launcher
|
||||
/// owns a few engine-side flags (DComp overlay toggle, plugin paths, etc.)
|
||||
/// owns a few engine-side flags (plugin paths, etc.)
|
||||
/// but the engine has its own flags that the launcher should never overwrite
|
||||
/// (EnableImGuiShell, EnableImGuiBackend, EngineHookCount, ...). This helper
|
||||
/// preserves every field it doesn't touch so those don't get clobbered when
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
WindowStartupLocation="CenterOwner"
|
||||
Title="First Login"
|
||||
Background="#132028">
|
||||
<Window.Resources>
|
||||
<!-- The same eye as the account editor's (AccountProfileDialog.axaml). -->
|
||||
<StreamGeometry x:Key="EyeIcon">F0 M8,3 C4.4,3 1.6,5.3 0.5,8 C1.6,10.7 4.4,13 8,13 C11.6,13 14.4,10.7 15.5,8 C14.4,5.3 11.6,3 8,3 Z M8,4.3 C5.3,4.3 3,5.9 2,8 C3,10.1 5.3,11.7 8,11.7 C10.7,11.7 13,10.1 14,8 C13,5.9 10.7,4.3 8,4.3 Z M8,5.5 A2.5,2.5 0 1 1 8,10.5 A2.5,2.5 0 1 1 8,5.5 Z</StreamGeometry>
|
||||
</Window.Resources>
|
||||
<Grid RowDefinitions="*,Auto" Margin="18">
|
||||
<StackPanel Spacing="10">
|
||||
<TextBlock x:Name="HeaderText" Foreground="#EAF0F4" FontSize="16" FontWeight="SemiBold" TextWrapping="Wrap" />
|
||||
|
|
@ -22,9 +26,22 @@
|
|||
|
||||
<StackPanel x:Name="PasswordPanel" Spacing="10">
|
||||
<TextBlock Text="Password" Foreground="#EAF0F4" />
|
||||
<TextBox x:Name="PasswordBox" PasswordChar="*" RevealPassword="False" />
|
||||
<!-- The eyes only reveal what's typed (nothing is saved yet to show). -->
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBox x:Name="PasswordBox" Grid.Column="0" Margin="0,0,6,0" PasswordChar="*" RevealPassword="False" />
|
||||
<ToggleButton x:Name="ShowPasswordToggle" Grid.Column="1" VerticalAlignment="Stretch"
|
||||
ToolTip.Tip="Show password" AutomationProperties.Name="Show password">
|
||||
<PathIcon Data="{StaticResource EyeIcon}" Width="16" Height="16" />
|
||||
</ToggleButton>
|
||||
</Grid>
|
||||
<TextBlock Text="Confirm password" Foreground="#EAF0F4" />
|
||||
<TextBox x:Name="ConfirmBox" PasswordChar="*" RevealPassword="False" />
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBox x:Name="ConfirmBox" Grid.Column="0" Margin="0,0,6,0" PasswordChar="*" RevealPassword="False" />
|
||||
<ToggleButton x:Name="ShowConfirmToggle" Grid.Column="1" VerticalAlignment="Stretch"
|
||||
ToolTip.Tip="Show password" AutomationProperties.Name="Show password">
|
||||
<PathIcon Data="{StaticResource EyeIcon}" Width="16" Height="16" />
|
||||
</ToggleButton>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<TextBlock Text="The password is saved encrypted for this Windows user, like the other accounts."
|
||||
Foreground="#9AA8B3" TextWrapping="Wrap" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Avalonia.Automation;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using RynthCore.App;
|
||||
|
||||
namespace RynthCore.App.Avalonia;
|
||||
|
|
@ -53,12 +55,31 @@ internal partial class FirstLoginDialog : Window
|
|||
AccountBox.TextChanged += (_, _) => OnAccountChanged();
|
||||
ReuseSavedPasswordCheckBox.IsCheckedChanged += (_, _) => UpdatePasswordPanel();
|
||||
|
||||
ShowPasswordToggle.IsCheckedChanged += (_, _) => Reveal(PasswordBox, ShowPasswordToggle);
|
||||
ShowConfirmToggle.IsCheckedChanged += (_, _) => Reveal(ConfirmBox, ShowConfirmToggle);
|
||||
// The plain text lives only in the boxes, and only while the dialog is open.
|
||||
Closed += (_, _) =>
|
||||
{
|
||||
PasswordBox.Text = string.Empty;
|
||||
ConfirmBox.Text = string.Empty;
|
||||
};
|
||||
|
||||
LoginButton.Click += (_, _) => LogInAndClose();
|
||||
CancelButton.Click += (_, _) => Close(false);
|
||||
|
||||
OnAccountChanged();
|
||||
}
|
||||
|
||||
/// <summary>An eye: shows or hides what's typed in its box (nothing saved to fill in here).</summary>
|
||||
private static void Reveal(TextBox box, ToggleButton eye)
|
||||
{
|
||||
bool show = eye.IsChecked == true;
|
||||
box.RevealPassword = show;
|
||||
string tip = show ? SavedPasswordReveal.HideTip : SavedPasswordReveal.ShowTip;
|
||||
ToolTip.SetTip(eye, tip);
|
||||
AutomationProperties.SetName(eye, tip);
|
||||
}
|
||||
|
||||
/// <summary>Re-reads the account's characters and whether another profile's password can be reused.</summary>
|
||||
private void OnAccountChanged()
|
||||
{
|
||||
|
|
|
|||
221
src/RynthCore.App.Avalonia/HeadlessWindow.axaml
Normal file
221
src/RynthCore.App.Avalonia/HeadlessWindow.axaml
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="RynthCore.App.Avalonia.HeadlessWindow"
|
||||
Width="1100"
|
||||
Height="760"
|
||||
MinWidth="900"
|
||||
MinHeight="620"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Title="RynthCore - Headless clients"
|
||||
Background="#0B1218"
|
||||
Icon="avares://RynthCore.App.Avalonia/LogoCore.ico">
|
||||
<!-- What the headless characters (rynth-headless.exe) are doing, from their status files and logs
|
||||
(HeadlessWindow.axaml.cs; the file rules are in RynthCore.App\HeadlessMonitor.cs). -->
|
||||
<Window.Styles>
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="FontSize" Value="12.5" />
|
||||
<Setter Property="Foreground" Value="#EAF0F4" />
|
||||
</Style>
|
||||
<Style Selector="TextBlock.label">
|
||||
<Setter Property="Foreground" Value="#9AA8B3" />
|
||||
</Style>
|
||||
<Style Selector="TextBlock.title">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Foreground" Value="#26C1A6" />
|
||||
</Style>
|
||||
<Style Selector="Button">
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Padding" Value="12,8" />
|
||||
</Style>
|
||||
<Style Selector="TextBox">
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
</Style>
|
||||
<Style Selector="ListBox">
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
</Style>
|
||||
<Style Selector="Border.card">
|
||||
<Setter Property="Background" Value="#132028" />
|
||||
<Setter Property="CornerRadius" Value="16" />
|
||||
<Setter Property="Padding" Value="14" />
|
||||
</Style>
|
||||
<Style Selector="ProgressBar.vital">
|
||||
<Setter Property="Height" Value="10" />
|
||||
<Setter Property="MinHeight" Value="10" />
|
||||
<Setter Property="MinWidth" Value="0" />
|
||||
<Setter Property="Minimum" Value="0" />
|
||||
<Setter Property="Maximum" Value="1" />
|
||||
<Setter Property="Background" Value="#0F161D" />
|
||||
</Style>
|
||||
</Window.Styles>
|
||||
|
||||
<Grid ColumnDefinitions="280,Auto,*" Margin="14">
|
||||
<!-- Left: one row per headless character. -->
|
||||
<Border Grid.Column="0" Classes="card">
|
||||
<Grid RowDefinitions="Auto,Auto,*,Auto">
|
||||
<TextBlock Grid.Row="0" Classes="title" Text="Headless clients" />
|
||||
<TextBlock Grid.Row="1" Classes="label" TextWrapping="Wrap" Margin="0,4,0,8"
|
||||
Text="Green botting, blue idle, red dead, grey not in the world, amber not answering (no status for 10 s)." />
|
||||
<ListBox Grid.Row="2" x:Name="CharacterList"
|
||||
Background="#0F161D"
|
||||
BorderBrush="#243742"
|
||||
Foreground="#EAF0F4" />
|
||||
<TextBlock Grid.Row="3" x:Name="ListHintText" Classes="label" TextWrapping="Wrap" Margin="0,8,0,0" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<GridSplitter Grid.Column="1" Width="12" ResizeDirection="Columns" Background="Transparent" />
|
||||
|
||||
<!-- Right: the selected character. -->
|
||||
<Grid Grid.Column="2">
|
||||
<Border x:Name="EmptyPanel" Classes="card" IsVisible="True">
|
||||
<StackPanel Spacing="8" VerticalAlignment="Center" HorizontalAlignment="Center" MaxWidth="460">
|
||||
<TextBlock Classes="title" Text="No headless character selected" HorizontalAlignment="Center" />
|
||||
<TextBlock x:Name="EmptyText" Classes="label" TextWrapping="Wrap" TextAlignment="Center"
|
||||
Text="Accounts set to Headless (experimental) show up here while they run." />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Grid x:Name="DetailPanel" RowDefinitions="Auto,Auto,Auto,*" IsVisible="False">
|
||||
<!-- Header: who, where, and the actions. -->
|
||||
<Border Grid.Row="0" Classes="card" Margin="0,0,0,10">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto">
|
||||
<Ellipse Grid.Column="0" x:Name="DetailDot" Width="14" Height="14" Margin="0,0,10,0"
|
||||
VerticalAlignment="Center" Fill="#6F7F8A" />
|
||||
<StackPanel Grid.Column="1" Spacing="2" VerticalAlignment="Center">
|
||||
<TextBlock x:Name="DetailNameText" FontSize="19" FontWeight="Bold" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock x:Name="DetailStateText" Classes="label" TextWrapping="Wrap" />
|
||||
<TextBlock x:Name="WhereText" TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
<WrapPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center" Margin="10,0,0,0">
|
||||
<Button x:Name="MacroButton" Content="Start macro" Margin="0,0,8,0"
|
||||
ToolTip.Tip="Turns RynthAi's macro on or off for this character (the same command the phone sends)." />
|
||||
<Button x:Name="LogOutButton" Content="Log out" Margin="0,0,8,0"
|
||||
ToolTip.Tip="Asks this character's rynth-headless.exe to log out and exit (closed after 20 s if it doesn't). The stop request is per process: a process running several characters logs them all out. With AutoLaunch on, uncheck the account first or it is started again." />
|
||||
<Button x:Name="OpenLogFolderButton" Content="Open log folder"
|
||||
ToolTip.Tip="Opens the folder with this character's headless log." />
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Vitals, what it is doing and how the session is going. -->
|
||||
<Grid Grid.Row="1" ColumnDefinitions="*,10,*,10,1.3*" Margin="0,0,0,10">
|
||||
<Border Grid.Column="0" Classes="card">
|
||||
<StackPanel Spacing="6">
|
||||
<TextBlock Classes="title" Text="Vitals" />
|
||||
<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Classes="label" Text="Health" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="HealthText" HorizontalAlignment="Right" />
|
||||
<ProgressBar Grid.Row="1" Grid.ColumnSpan="2" x:Name="HealthBar" Classes="vital" Foreground="#E05A5A" Margin="0,2,0,6" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Classes="label" Text="Stamina" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" x:Name="StaminaText" HorizontalAlignment="Right" />
|
||||
<ProgressBar Grid.Row="3" Grid.ColumnSpan="2" x:Name="StaminaBar" Classes="vital" Foreground="#F2C14E" Margin="0,2,0,6" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Classes="label" Text="Mana" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" x:Name="ManaText" HorizontalAlignment="Right" />
|
||||
<ProgressBar Grid.Row="5" Grid.ColumnSpan="2" x:Name="ManaBar" Classes="vital" Foreground="#4A90E2" Margin="0,2,0,0" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Column="2" Classes="card">
|
||||
<StackPanel Spacing="6">
|
||||
<TextBlock Classes="title" Text="Doing" />
|
||||
<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto,Auto,Auto,Auto">
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Classes="label" Text="Action" Margin="0,0,10,4" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="ActionText" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Classes="label" Text="Macro" Margin="0,0,10,4" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="MacroText" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Classes="label" Text="Meta" Margin="0,0,10,4" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" x:Name="MetaText" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Classes="label" Text="Target" Margin="0,0,10,4" />
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" x:Name="TargetText" TextTrimming="CharacterEllipsis" />
|
||||
<ProgressBar Grid.Row="4" Grid.ColumnSpan="2" x:Name="TargetBar" Classes="vital" Foreground="#E05A5A" Margin="0,2,0,0" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Column="4" Classes="card">
|
||||
<StackPanel Spacing="6">
|
||||
<TextBlock Classes="title" Text="Session" />
|
||||
<!-- Wraps to one pair a row when the window is narrow. -->
|
||||
<WrapPanel Orientation="Horizontal" ItemWidth="134">
|
||||
<Grid ColumnDefinitions="68,*" Margin="0,0,0,4">
|
||||
<TextBlock Grid.Column="0" Classes="label" Text="XP/hour" />
|
||||
<TextBlock Grid.Column="1" x:Name="XpHourText" TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="68,*" Margin="0,0,0,4">
|
||||
<TextBlock Grid.Column="0" Classes="label" Text="XP session" />
|
||||
<TextBlock Grid.Column="1" x:Name="XpSessionText" TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="68,*" Margin="0,0,0,4">
|
||||
<TextBlock Grid.Column="0" Classes="label" Text="Kills" />
|
||||
<TextBlock Grid.Column="1" x:Name="KillsText" TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="68,*" Margin="0,0,0,4">
|
||||
<TextBlock Grid.Column="0" Classes="label" Text="Deaths" />
|
||||
<TextBlock Grid.Column="1" x:Name="DeathsText" TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="68,*" Margin="0,0,0,4">
|
||||
<TextBlock Grid.Column="0" Classes="label" Text="Vitae" />
|
||||
<TextBlock Grid.Column="1" x:Name="VitaeText" TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="68,*" Margin="0,0,0,4">
|
||||
<TextBlock Grid.Column="0" Classes="label" Text="Burden" />
|
||||
<TextBlock Grid.Column="1" x:Name="BurdenText" TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="68,*" Margin="0,0,0,4">
|
||||
<TextBlock Grid.Column="0" Classes="label" Text="Uptime" />
|
||||
<TextBlock Grid.Column="1" x:Name="UptimeText" TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="68,*" Margin="0,0,0,4">
|
||||
<TextBlock Grid.Column="0" Classes="label" Text="Process" />
|
||||
<TextBlock Grid.Column="1" x:Name="ProcessText" TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- Command box: /ra, /rnav, /mt, /rn through the character's command file. -->
|
||||
<Border Grid.Row="2" Classes="card" Margin="0,0,0,10">
|
||||
<Grid ColumnDefinitions="*,Auto" RowDefinitions="Auto,Auto">
|
||||
<TextBox Grid.Row="0" Grid.Column="0" x:Name="CommandBox"
|
||||
Watermark="/ra pause, /ra start, /rnav ..., /mt ..., /rn ... (Enter sends)"
|
||||
AcceptsReturn="False" Margin="0,0,8,0" />
|
||||
<Button Grid.Row="0" Grid.Column="1" x:Name="SendButton" Content="Send"
|
||||
Background="#26C1A6" Foreground="#0B1218" FontWeight="SemiBold" />
|
||||
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" x:Name="CommandStatusText" Classes="label"
|
||||
TextWrapping="Wrap" Margin="2,6,0,0" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Chat and log. -->
|
||||
<Grid Grid.Row="3" ColumnDefinitions="*,Auto,*">
|
||||
<Border Grid.Column="0" Classes="card">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<TextBlock Grid.Row="0" Classes="title" Text="Chat" Margin="0,0,0,6"
|
||||
ToolTip.Tip="The last 30 lines the character saw; combat damage lines are hidden." />
|
||||
<TextBox Grid.Row="1" x:Name="ChatBox" IsReadOnly="True" TextWrapping="Wrap"
|
||||
AcceptsReturn="True" FontFamily="Consolas,Menlo,monospace" FontSize="11.5"
|
||||
Background="#0F161D" BorderBrush="#243742" Foreground="#EAF0F4"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<GridSplitter Grid.Column="1" Width="10" ResizeDirection="Columns" Background="Transparent" />
|
||||
<Border Grid.Column="2" Classes="card">
|
||||
<Grid RowDefinitions="Auto,Auto,*">
|
||||
<TextBlock Grid.Row="0" Classes="title" Text="Log" Margin="0,0,0,2" />
|
||||
<TextBlock Grid.Row="1" x:Name="LogPathText" Classes="label" FontSize="11"
|
||||
TextTrimming="CharacterEllipsis" Margin="0,0,0,6" />
|
||||
<TextBox Grid.Row="2" x:Name="LogBox" IsReadOnly="True" TextWrapping="NoWrap"
|
||||
AcceptsReturn="True" FontFamily="Consolas,Menlo,monospace" FontSize="11"
|
||||
Background="#0F161D" BorderBrush="#243742" Foreground="#EAF0F4"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
722
src/RynthCore.App.Avalonia/HeadlessWindow.axaml.cs
Normal file
722
src/RynthCore.App.Avalonia/HeadlessWindow.axaml.cs
Normal file
|
|
@ -0,0 +1,722 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Shapes;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using Avalonia.VisualTree;
|
||||
using RynthCore.App;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace RynthCore.App.Avalonia;
|
||||
|
||||
/// <summary>What the Headless window needs from the launcher.</summary>
|
||||
internal sealed class HeadlessWindowHost
|
||||
{
|
||||
/// <summary>The launcher's settings (the window keeps its size and place in them).</summary>
|
||||
public required AppSettings Settings { get; init; }
|
||||
public required Action SaveSettings { get; init; }
|
||||
/// <summary>The status folder rynth-headless writes (AppSettings.HeadlessStatusDir or its default).</summary>
|
||||
public required Func<string> StatusDir { get; init; }
|
||||
/// <summary>AppSettings.HeadlessSuiteDir ("" = the default).</summary>
|
||||
public required Func<string> ConfiguredSuiteDir { get; init; }
|
||||
/// <summary>%APPDATA%\RynthCore\headless, where the launcher writes the run configs.</summary>
|
||||
public required string LaunchConfigDir { get; init; }
|
||||
/// <summary>Asks rynth-headless process <pid> to log out and exit; returns what happened.</summary>
|
||||
public required Func<int, string> LogOutProcess { get; init; }
|
||||
/// <summary>Whether AutoLaunch is on (a logged-out account is started again).</summary>
|
||||
public required Func<bool> AutoLaunch { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The launcher's Headless window: what each headless character (rynth-headless.exe, no game window)
|
||||
/// is doing, from its status file, its chat and its log, with a command box, macro on/off and log out.
|
||||
/// Reads files once a second off the UI thread and writes only command files
|
||||
/// (RynthCore.App\HeadlessMonitor.cs has the rules and the tests in tools\HeadlessWindowTests).
|
||||
/// Never shows a password or a config file; no account names (characters and servers only).
|
||||
/// </summary>
|
||||
internal partial class HeadlessWindow : Window
|
||||
{
|
||||
private static readonly IBrush BottingBrush = Brush("#26C1A6");
|
||||
private static readonly IBrush IdleBrush = Brush("#4A90E2");
|
||||
private static readonly IBrush DeadBrush = Brush("#E05A5A");
|
||||
private static readonly IBrush LoadingBrush = Brush("#6F7F8A");
|
||||
private static readonly IBrush StaleBrush = Brush("#F2C14E");
|
||||
private static readonly IBrush TextBrush = Brush("#EAF0F4");
|
||||
private static readonly IBrush MutedBrush = Brush("#9AA8B3");
|
||||
private static readonly IBrush WarnBrush = Brush("#F2C14E");
|
||||
|
||||
/// <summary>How long the window waits for a chat line after a command.</summary>
|
||||
private static readonly TimeSpan ReplyWait = TimeSpan.FromSeconds(20);
|
||||
/// <summary>A command file nobody took in this long is removed (the StatusAgent prunes at 60 s too).</summary>
|
||||
private static readonly TimeSpan UntakenLimit = TimeSpan.FromSeconds(60);
|
||||
/// <summary>How long a found log path is trusted before it is looked up again.</summary>
|
||||
private static readonly TimeSpan LogLookupEvery = TimeSpan.FromSeconds(15);
|
||||
|
||||
private readonly HeadlessWindowHost? _host;
|
||||
private readonly DispatcherTimer _timer = new() { Interval = TimeSpan.FromSeconds(1) };
|
||||
private readonly HeadlessRoster _roster = new();
|
||||
private readonly ObservableCollection<Control> _items = new();
|
||||
private readonly Dictionary<int, Row> _rows = new();
|
||||
private int? _selectedId;
|
||||
private bool _suppressSelection;
|
||||
private bool _refreshing;
|
||||
private bool _closed;
|
||||
private bool _autoSelected;
|
||||
|
||||
// The log of the selected character (touched by the background read only while _refreshing).
|
||||
private string? _logAccount;
|
||||
private string? _logPath;
|
||||
private List<string> _logDirs = new();
|
||||
private DateTime _logLookedUpUtc;
|
||||
private (long Length, DateTime Written)? _logStamp;
|
||||
private int _logForId;
|
||||
|
||||
// The last command sent from the box, until its reply shows or the wait is over.
|
||||
private PendingCommand? _pending;
|
||||
// Command files written here and not taken yet (path, written).
|
||||
private readonly List<(string Path, DateTime WrittenUtc)> _untaken = new();
|
||||
|
||||
private sealed class Row
|
||||
{
|
||||
public required Border Root { get; init; }
|
||||
public required Ellipse Dot { get; init; }
|
||||
public required TextBlock Name { get; init; }
|
||||
public required TextBlock Server { get; init; }
|
||||
public required ProgressBar Health { get; init; }
|
||||
}
|
||||
|
||||
private sealed class PendingCommand
|
||||
{
|
||||
public required int Id { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public required string Path { get; init; }
|
||||
public required DateTime SentUtc { get; init; }
|
||||
public required IReadOnlyList<HeadlessChatLine> ChatAtSend { get; init; }
|
||||
public bool Taken { get; set; }
|
||||
}
|
||||
|
||||
private sealed class ReadResult
|
||||
{
|
||||
public List<HeadlessCharacterStatus> Found { get; init; } = new();
|
||||
public List<int> Unreadable { get; init; } = new();
|
||||
public int LogForId { get; init; }
|
||||
public string? LogPath { get; init; }
|
||||
/// <summary>Null = unchanged since the last read (or no log).</summary>
|
||||
public List<string>? LogLines { get; init; }
|
||||
public bool LogMissing { get; init; }
|
||||
public string? PendingPath { get; init; }
|
||||
public bool PendingFileExists { get; init; }
|
||||
public int RemovedUntaken { get; init; }
|
||||
public string? Error { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>For the XAML designer only.</summary>
|
||||
public HeadlessWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public HeadlessWindow(HeadlessWindowHost host)
|
||||
{
|
||||
_host = host;
|
||||
InitializeComponent();
|
||||
RestoreLayout();
|
||||
CharacterList.ItemsSource = _items;
|
||||
CharacterList.SelectionChanged += (_, _) => OnSelectionChanged();
|
||||
SendButton.Click += async (_, _) => await SendCommandAsync();
|
||||
// Tunnel: Enter reaches us before the text box can take it.
|
||||
CommandBox.AddHandler(KeyDownEvent, async (_, e) =>
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
e.Handled = true;
|
||||
await SendCommandAsync();
|
||||
}
|
||||
}, RoutingStrategies.Tunnel);
|
||||
MacroButton.Click += async (_, _) => await ToggleMacroAsync();
|
||||
LogOutButton.Click += async (_, _) => await LogOutAsync();
|
||||
OpenLogFolderButton.Click += (_, _) => OpenLogFolder();
|
||||
_timer.Tick += async (_, _) => await RefreshAsync();
|
||||
Opened += async (_, _) =>
|
||||
{
|
||||
_timer.Start();
|
||||
await RefreshAsync();
|
||||
};
|
||||
Closing += (_, _) => SaveLayout();
|
||||
Closed += (_, _) =>
|
||||
{
|
||||
_closed = true;
|
||||
_timer.Stop();
|
||||
};
|
||||
}
|
||||
|
||||
private static IBrush Brush(string hex) => new SolidColorBrush(Color.Parse(hex));
|
||||
|
||||
// ── size and place ──────────────────────────────────────────────────────
|
||||
|
||||
private void RestoreLayout()
|
||||
{
|
||||
AppSettings s = _host!.Settings;
|
||||
if (s.HeadlessWindowWidth is double w && w >= MinWidth) Width = w;
|
||||
if (s.HeadlessWindowHeight is double h && h >= MinHeight) Height = h;
|
||||
// The launcher's own rule (MainWindow.LoadSettings): never restore a minimized (-32000) or
|
||||
// far off-screen point, which would open the window where nobody can see it.
|
||||
if (s.HeadlessWindowX is double x && s.HeadlessWindowY is double y &&
|
||||
x > -2000 && y > -2000 && x < 30000 && y < 30000)
|
||||
{
|
||||
Position = new PixelPoint((int)x, (int)y);
|
||||
WindowStartupLocation = WindowStartupLocation.Manual;
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveLayout()
|
||||
{
|
||||
if (_host == null || WindowState == WindowState.Minimized || Position.X <= -2000 || Position.Y <= -2000)
|
||||
return;
|
||||
_host.Settings.HeadlessWindowWidth = Width;
|
||||
_host.Settings.HeadlessWindowHeight = Height;
|
||||
_host.Settings.HeadlessWindowX = Position.X;
|
||||
_host.Settings.HeadlessWindowY = Position.Y;
|
||||
_host.SaveSettings();
|
||||
}
|
||||
|
||||
// ── refresh: files off the UI thread, then the controls ─────────────────
|
||||
|
||||
private async Task RefreshAsync()
|
||||
{
|
||||
if (_host == null || _refreshing || _closed)
|
||||
return;
|
||||
_refreshing = true;
|
||||
try
|
||||
{
|
||||
string statusDir = _host.StatusDir();
|
||||
string configuredSuite = _host.ConfiguredSuiteDir();
|
||||
HeadlessCharacterStatus? selected = _selectedId is int sid && _roster.TryGet(sid, out var st) ? st : null;
|
||||
PendingCommand? pending = _pending;
|
||||
DateTime nowUtc = DateTime.UtcNow;
|
||||
ReadResult result = await Task.Run(() => Read(statusDir, configuredSuite, selected, pending, nowUtc));
|
||||
if (!_closed)
|
||||
Apply(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ListHintText.Text = "Couldn't read the status files: " + ex.Message;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_refreshing = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Runs on a pool thread: every file the window needs, read once.</summary>
|
||||
private ReadResult Read(string statusDir, string configuredSuite, HeadlessCharacterStatus? selected, PendingCommand? pending, DateTime nowUtc)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<HeadlessCharacterStatus> found = HeadlessStatusScanner.Scan(statusDir, nowUtc, out List<int> unreadable);
|
||||
|
||||
// Command files nobody took within a minute: the character isn't reading its inbox.
|
||||
int removed = 0;
|
||||
lock (_untaken)
|
||||
{
|
||||
for (int i = _untaken.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var (path, written) = _untaken[i];
|
||||
bool exists = File.Exists(path);
|
||||
if (exists && nowUtc - written > UntakenLimit)
|
||||
{
|
||||
try { File.Delete(path); removed++; } catch (IOException) { } catch (UnauthorizedAccessException) { }
|
||||
exists = File.Exists(path);
|
||||
}
|
||||
if (!exists)
|
||||
_untaken.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
// The selected character's log.
|
||||
int logFor = selected?.Id ?? 0;
|
||||
string? logPath = null;
|
||||
List<string>? lines = null;
|
||||
bool missing = false;
|
||||
if (selected != null && selected.Account.Length > 0)
|
||||
{
|
||||
if (_logForId != selected.Id || _logAccount != selected.Account)
|
||||
{
|
||||
_logForId = selected.Id;
|
||||
_logAccount = selected.Account;
|
||||
_logPath = null;
|
||||
_logStamp = null;
|
||||
_logLookedUpUtc = DateTime.MinValue;
|
||||
}
|
||||
if (_logPath == null || !File.Exists(_logPath) || nowUtc - _logLookedUpUtc > LogLookupEvery)
|
||||
{
|
||||
_logDirs = HeadlessLogs.CandidateSuiteDirs(selected.Account, _host!.LaunchConfigDir, configuredSuite, HeadlessLogs.DefaultSuiteDir);
|
||||
string? path = HeadlessLogs.Find(selected.Account, _logDirs);
|
||||
if (path != _logPath) _logStamp = null;
|
||||
_logPath = path;
|
||||
_logLookedUpUtc = nowUtc;
|
||||
}
|
||||
logPath = _logPath;
|
||||
if (logPath == null)
|
||||
{
|
||||
missing = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = new FileInfo(logPath);
|
||||
var stamp = (info.Length, info.LastWriteTimeUtc);
|
||||
if (_logStamp != stamp)
|
||||
{
|
||||
lines = HeadlessLogs.Tail(logPath);
|
||||
if (lines != null) _logStamp = stamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ReadResult
|
||||
{
|
||||
Found = found,
|
||||
Unreadable = unreadable,
|
||||
LogForId = logFor,
|
||||
LogPath = logPath,
|
||||
LogLines = lines,
|
||||
LogMissing = missing,
|
||||
PendingPath = pending?.Path,
|
||||
PendingFileExists = pending != null && File.Exists(pending.Path),
|
||||
RemovedUntaken = removed,
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ReadResult { Error = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
private void Apply(ReadResult r)
|
||||
{
|
||||
DateTime nowUtc = DateTime.UtcNow;
|
||||
if (r.Error != null)
|
||||
{
|
||||
ListHintText.Text = "Couldn't read the status files: " + r.Error;
|
||||
return;
|
||||
}
|
||||
|
||||
List<HeadlessCharacterStatus> list = _roster.Update(r.Found, r.Unreadable, nowUtc);
|
||||
SyncRows(list, nowUtc);
|
||||
string folder = _host!.StatusDir();
|
||||
ListHintText.Text = list.Count == 0
|
||||
? $"No headless character is running. Status folder: {folder}"
|
||||
: list.Count == 1 ? "1 headless character." : $"{list.Count} headless characters.";
|
||||
ToolTip.SetTip(ListHintText, "Status folder: " + folder);
|
||||
|
||||
if (_selectedId is int id && !_roster.TryGet(id, out _))
|
||||
{
|
||||
_selectedId = null;
|
||||
EmptyText.Text = "That character left: no status for 30 s (logged out, or its process ended).";
|
||||
}
|
||||
// The first character is picked once, when the window opens; after that the player picks.
|
||||
if (!_autoSelected && _selectedId == null && list.Count > 0)
|
||||
{
|
||||
_autoSelected = true;
|
||||
HeadlessCharacterStatus first = list.FirstOrDefault(c => HeadlessStatusRules.Activity(c, nowUtc) is
|
||||
HeadlessActivity.Botting or HeadlessActivity.Idle or HeadlessActivity.Dead) ?? list[0];
|
||||
Select(first.Id);
|
||||
}
|
||||
|
||||
if (_selectedId is int sel && _roster.TryGet(sel, out HeadlessCharacterStatus? s))
|
||||
{
|
||||
ShowDetail(s, nowUtc);
|
||||
if (r.LogForId == sel)
|
||||
ShowLog(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
DetailPanel.IsVisible = false;
|
||||
EmptyPanel.IsVisible = true;
|
||||
if (list.Count == 0)
|
||||
EmptyText.Text = "Accounts set to Headless (experimental) show up here while they run.";
|
||||
}
|
||||
|
||||
UpdatePending(r, nowUtc);
|
||||
}
|
||||
|
||||
// ── the list ────────────────────────────────────────────────────────────
|
||||
|
||||
private void SyncRows(List<HeadlessCharacterStatus> list, DateTime nowUtc)
|
||||
{
|
||||
_suppressSelection = true;
|
||||
try
|
||||
{
|
||||
var ids = list.Select(s => s.Id).ToHashSet();
|
||||
foreach (int gone in _rows.Keys.Where(k => !ids.Contains(k)).ToList())
|
||||
{
|
||||
_items.Remove(_rows[gone].Root);
|
||||
_rows.Remove(gone);
|
||||
}
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
HeadlessCharacterStatus s = list[i];
|
||||
if (!_rows.TryGetValue(s.Id, out Row? row))
|
||||
{
|
||||
row = NewRow(s.Id);
|
||||
_rows[s.Id] = row;
|
||||
}
|
||||
int at = _items.IndexOf(row.Root);
|
||||
if (at != i)
|
||||
{
|
||||
if (at >= 0) _items.RemoveAt(at);
|
||||
_items.Insert(i, row.Root);
|
||||
}
|
||||
HeadlessActivity a = HeadlessStatusRules.Activity(s, nowUtc);
|
||||
row.Dot.Fill = DotBrush(a);
|
||||
ToolTip.SetTip(row.Root, HeadlessStatusRules.ActivityText(a));
|
||||
row.Name.Text = s.Character.Length > 0 ? s.Character : "(character not known yet)";
|
||||
row.Server.Text = s.Server;
|
||||
row.Health.Value = s.HasVitals ? HeadlessFormat.Fraction(s.Health, s.MaxHealth) : 0;
|
||||
row.Health.Opacity = s.HasVitals ? 1 : 0.3;
|
||||
}
|
||||
if (_selectedId is int sel && _rows.TryGetValue(sel, out Row? selRow) && !ReferenceEquals(CharacterList.SelectedItem, selRow.Root))
|
||||
CharacterList.SelectedItem = selRow.Root;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_suppressSelection = false;
|
||||
}
|
||||
}
|
||||
|
||||
private Row NewRow(int id)
|
||||
{
|
||||
var dot = new Ellipse { Width = 10, Height = 10, Fill = LoadingBrush, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 8, 0) };
|
||||
var name = new TextBlock { FontWeight = FontWeight.SemiBold, Foreground = TextBrush, TextTrimming = TextTrimming.CharacterEllipsis };
|
||||
var server = new TextBlock { FontSize = 11, Foreground = MutedBrush, TextTrimming = TextTrimming.CharacterEllipsis };
|
||||
var hp = new ProgressBar
|
||||
{
|
||||
Minimum = 0, Maximum = 1, Height = 4, MinHeight = 4, MinWidth = 0, Margin = new Thickness(0, 4, 0, 0),
|
||||
Foreground = DeadBrush, Background = Brush("#0B1218"),
|
||||
};
|
||||
var text = new StackPanel { Spacing = 1, Children = { name, server, hp } };
|
||||
Grid.SetColumn(text, 1);
|
||||
var grid = new Grid { ColumnDefinitions = new ColumnDefinitions("Auto,*"), Children = { dot, text } };
|
||||
var root = new Border { Padding = new Thickness(4, 4), Tag = id, Child = grid };
|
||||
return new Row { Root = root, Dot = dot, Name = name, Server = server, Health = hp };
|
||||
}
|
||||
|
||||
private static IBrush DotBrush(HeadlessActivity a) => a switch
|
||||
{
|
||||
HeadlessActivity.Botting => BottingBrush,
|
||||
HeadlessActivity.Idle => IdleBrush,
|
||||
HeadlessActivity.Dead => DeadBrush,
|
||||
HeadlessActivity.Stale => StaleBrush,
|
||||
_ => LoadingBrush,
|
||||
};
|
||||
|
||||
private void Select(int id)
|
||||
{
|
||||
_selectedId = id;
|
||||
if (_rows.TryGetValue(id, out Row? row))
|
||||
{
|
||||
_suppressSelection = true;
|
||||
try { CharacterList.SelectedItem = row.Root; }
|
||||
finally { _suppressSelection = false; }
|
||||
}
|
||||
ResetDetailViews();
|
||||
}
|
||||
|
||||
private void OnSelectionChanged()
|
||||
{
|
||||
if (_suppressSelection)
|
||||
return;
|
||||
int? id = (CharacterList.SelectedItem as Control)?.Tag as int?;
|
||||
if (id == _selectedId)
|
||||
return;
|
||||
_selectedId = id;
|
||||
ResetDetailViews();
|
||||
_ = RefreshAsync();
|
||||
}
|
||||
|
||||
private void ResetDetailViews()
|
||||
{
|
||||
ChatBox.Text = string.Empty;
|
||||
LogBox.Text = string.Empty;
|
||||
LogPathText.Text = "Looking for the log...";
|
||||
CommandStatusText.Text = string.Empty;
|
||||
_pending = null;
|
||||
_logForId = 0; // the next read looks the log up again and shows it whole
|
||||
}
|
||||
|
||||
// ── details ─────────────────────────────────────────────────────────────
|
||||
|
||||
private void ShowDetail(HeadlessCharacterStatus s, DateTime nowUtc)
|
||||
{
|
||||
EmptyPanel.IsVisible = false;
|
||||
DetailPanel.IsVisible = true;
|
||||
|
||||
TimeSpan age = HeadlessStatusRules.Age(s, nowUtc);
|
||||
HeadlessActivity a = HeadlessStatusRules.Activity(s, nowUtc);
|
||||
DetailDot.Fill = DotBrush(a);
|
||||
DetailNameText.Text = s.Character.Length > 0 ? s.Character : "(character not known yet)";
|
||||
string state = HeadlessStatusRules.ActivityText(a);
|
||||
if (a == HeadlessActivity.Stale)
|
||||
state += $" (no status for {age.TotalSeconds:0} s)";
|
||||
DetailStateText.Text = s.Server.Length > 0 ? $"{s.Server} - {state}" : state;
|
||||
|
||||
if (s.HasVitals)
|
||||
{
|
||||
HealthText.Text = HeadlessFormat.Vital(s.Health, s.MaxHealth);
|
||||
StaminaText.Text = HeadlessFormat.Vital(s.Stamina, s.MaxStamina);
|
||||
ManaText.Text = HeadlessFormat.Vital(s.Mana, s.MaxMana);
|
||||
}
|
||||
else
|
||||
{
|
||||
HealthText.Text = StaminaText.Text = ManaText.Text = "-";
|
||||
}
|
||||
HealthBar.Value = s.HasVitals ? HeadlessFormat.Fraction(s.Health, s.MaxHealth) : 0;
|
||||
StaminaBar.Value = s.HasVitals ? HeadlessFormat.Fraction(s.Stamina, s.MaxStamina) : 0;
|
||||
ManaBar.Value = s.HasVitals ? HeadlessFormat.Fraction(s.Mana, s.MaxMana) : 0;
|
||||
|
||||
if (!s.HasBot)
|
||||
{
|
||||
string why = s.InWorld ? "no RynthAi status (is RynthAi loaded?)" : "not in the world";
|
||||
ActionText.Text = why;
|
||||
MacroText.Text = MetaText.Text = TargetText.Text = "-";
|
||||
TargetBar.Value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ActionText.Text = s.BotAction.Length > 0 ? s.BotAction : "-";
|
||||
MacroText.Text = s.MacroRunning ? "on" : "off";
|
||||
MacroText.Foreground = s.MacroRunning ? BottingBrush : TextBrush;
|
||||
string meta = s.MetaName.Length > 0 && !s.MetaName.Equals("None", StringComparison.OrdinalIgnoreCase) ? s.MetaName : "none";
|
||||
MetaText.Text = s.CurrentState.Length > 0 && meta != "none" ? $"{meta} (state {s.CurrentState})" : meta;
|
||||
TargetText.Text = s.HasTarget
|
||||
? $"{s.TargetLabel} ({s.TargetHealthPercent:0}%)"
|
||||
: "none";
|
||||
TargetBar.Value = s.HasTarget ? Math.Clamp(s.TargetHealthPercent / 100.0, 0, 1) : 0;
|
||||
}
|
||||
|
||||
WhereText.Text = s.InWorld ? HeadlessCoords.Where(s) : "Not in the world";
|
||||
XpHourText.Text = HeadlessFormat.Number(s.XpPerHour);
|
||||
XpSessionText.Text = HeadlessFormat.Number(s.XpSession);
|
||||
KillsText.Text = s.HasBot
|
||||
? (s.KillsPerHour > 0 ? $"{s.SessionKills}, {HeadlessFormat.Number(s.KillsPerHour)}/h" : s.SessionKills.ToString())
|
||||
: "-";
|
||||
DeathsText.Text = s.DeathsSession.ToString();
|
||||
VitaeText.Text = s.VitaePct > 0 ? $"{s.VitaePct:0.#}%" : "none";
|
||||
VitaeText.Foreground = s.VitaePct > 0 ? WarnBrush : TextBrush;
|
||||
BurdenText.Text = $"{s.BurdenPct:0.#}%";
|
||||
BurdenText.Foreground = s.BurdenPct > 100 ? WarnBrush : TextBrush;
|
||||
UptimeText.Text = HeadlessFormat.Duration(s.UptimeSec);
|
||||
ProcessText.Text = s.HostPid > 0 ? $"PID {s.HostPid}" : "-";
|
||||
|
||||
bool fresh = a != HeadlessActivity.Stale;
|
||||
MacroButton.Content = s.MacroRunning ? "Stop macro" : "Start macro";
|
||||
MacroButton.IsEnabled = s.HasBot && s.InWorld && fresh;
|
||||
LogOutButton.IsEnabled = s.HostPid > 0;
|
||||
SendButton.IsEnabled = true;
|
||||
|
||||
string chat = string.Join(Environment.NewLine, HeadlessChat.Visible(s.RecentChat).Select(l => l.Text));
|
||||
if (s.RecentChat.Count == 0)
|
||||
chat = s.HasBot ? "(no chat yet)" : "(no chat: RynthAi's status isn't there)";
|
||||
SetLiveText(ChatBox, chat);
|
||||
}
|
||||
|
||||
private void ShowLog(ReadResult r)
|
||||
{
|
||||
if (r.LogMissing)
|
||||
{
|
||||
LogPathText.Text = "No log found. Looked in: " + string.Join("; ", _logDirs);
|
||||
if (LogBox.Text?.Length > 0) LogBox.Text = string.Empty;
|
||||
return;
|
||||
}
|
||||
if (r.LogPath != null)
|
||||
LogPathText.Text = r.LogPath;
|
||||
if (r.LogLines != null)
|
||||
SetLiveText(LogBox, string.Join(Environment.NewLine, r.LogLines));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces a read-only box's text when it changed. It follows the newest line unless the player
|
||||
/// has scrolled up to read (then it stays where it is).
|
||||
/// </summary>
|
||||
private static void SetLiveText(TextBox box, string text)
|
||||
{
|
||||
if (box.Text == text)
|
||||
return;
|
||||
ScrollViewer? scroll = box.GetVisualDescendants().OfType<ScrollViewer>().FirstOrDefault();
|
||||
bool follow = string.IsNullOrEmpty(box.Text) || scroll == null ||
|
||||
scroll.Offset.Y >= scroll.Extent.Height - scroll.Viewport.Height - 4;
|
||||
box.Text = text;
|
||||
if (!follow)
|
||||
return;
|
||||
// The start of the last line: the box shows the newest line from its left edge (a long log
|
||||
// line would otherwise scroll the box sideways).
|
||||
box.CaretIndex = text.LastIndexOf('\n') + 1;
|
||||
if (scroll == null)
|
||||
return;
|
||||
// The new text's height is known only after the next layout pass.
|
||||
EventHandler? once = null;
|
||||
once = (_, _) =>
|
||||
{
|
||||
box.LayoutUpdated -= once;
|
||||
scroll.ScrollToEnd();
|
||||
scroll.Offset = new Vector(0, scroll.Offset.Y);
|
||||
};
|
||||
box.LayoutUpdated += once;
|
||||
}
|
||||
|
||||
// ── commands ────────────────────────────────────────────────────────────
|
||||
|
||||
private bool TrySelected(out HeadlessCharacterStatus s)
|
||||
{
|
||||
s = null!;
|
||||
return _selectedId is int id && _roster.TryGet(id, out s!);
|
||||
}
|
||||
|
||||
private async Task SendCommandAsync()
|
||||
{
|
||||
if (!TrySelected(out HeadlessCharacterStatus s))
|
||||
return;
|
||||
string text = (CommandBox.Text ?? string.Empty).Trim();
|
||||
if (HeadlessCommandFile.ChatCommandProblem(text) is string problem)
|
||||
{
|
||||
ShowCommandStatus(problem, warn: true);
|
||||
return;
|
||||
}
|
||||
string? path = await WriteCommandAsync(s, HeadlessCommandFile.SendChatAction, text);
|
||||
if (path == null)
|
||||
return;
|
||||
_pending = new PendingCommand
|
||||
{
|
||||
Id = s.Id, Text = text, Path = path, SentUtc = DateTime.UtcNow, ChatAtSend = s.RecentChat,
|
||||
};
|
||||
CommandBox.Text = string.Empty;
|
||||
TimeSpan age = HeadlessStatusRules.Age(s, DateTime.UtcNow);
|
||||
ShowCommandStatus(HeadlessStatusRules.Freshness(age) == HeadlessFreshness.Fresh
|
||||
? $"Sent: {text}"
|
||||
: $"Sent: {text}, but this character isn't answering (no status for {age.TotalSeconds:0} s).", warn: false);
|
||||
}
|
||||
|
||||
private async Task ToggleMacroAsync()
|
||||
{
|
||||
if (!TrySelected(out HeadlessCharacterStatus s))
|
||||
return;
|
||||
bool turnOn = !s.MacroRunning;
|
||||
if (await WriteCommandAsync(s, HeadlessCommandFile.MacroAction, turnOn ? "on" : "off") != null)
|
||||
ShowCommandStatus(turnOn ? "Asked to start the macro." : "Asked to stop the macro.", warn: false);
|
||||
}
|
||||
|
||||
/// <summary>Writes one command file for <paramref name="s"/> (off the UI thread); null when it failed.</summary>
|
||||
private async Task<string?> WriteCommandAsync(HeadlessCharacterStatus s, string action, string value)
|
||||
{
|
||||
string commandsDir = Path.Combine(_host!.StatusDir(), HeadlessCommandFile.CommandsFolderName);
|
||||
int id = s.Id;
|
||||
try
|
||||
{
|
||||
string path = await Task.Run(() => HeadlessCommandFile.Write(commandsDir, id, action, value, DateTime.UtcNow));
|
||||
lock (_untaken)
|
||||
_untaken.Add((path, DateTime.UtcNow));
|
||||
return path;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowCommandStatus($"Couldn't write the command: {ex.Message}", warn: true);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdatePending(ReadResult r, DateTime nowUtc)
|
||||
{
|
||||
if (r.RemovedUntaken > 0)
|
||||
ShowCommandStatus("The character didn't take the command within a minute (not reading its commands?): it was removed.", warn: true);
|
||||
|
||||
PendingCommand? p = _pending;
|
||||
if (p == null)
|
||||
return;
|
||||
if (!p.Taken && r.PendingPath == p.Path && !r.PendingFileExists)
|
||||
{
|
||||
p.Taken = true;
|
||||
ShowCommandStatus($"Taken: {p.Text}. Waiting for a reply...", warn: false);
|
||||
}
|
||||
if (_roster.TryGet(p.Id, out HeadlessCharacterStatus? s))
|
||||
{
|
||||
HeadlessChatLine? reply = HeadlessChat.FirstReply(HeadlessChat.NewLines(p.ChatAtSend, s.RecentChat));
|
||||
if (reply is HeadlessChatLine line)
|
||||
{
|
||||
ShowCommandStatus($"{p.Text} -> {line.Text}", warn: false);
|
||||
_pending = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (nowUtc - p.SentUtc > ReplyWait)
|
||||
{
|
||||
ShowCommandStatus(p.Taken
|
||||
? $"{p.Text}: taken, no chat reply in {ReplyWait.TotalSeconds:0} s (see the log)."
|
||||
: $"{p.Text}: not taken yet after {ReplyWait.TotalSeconds:0} s.", warn: true);
|
||||
_pending = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowCommandStatus(string text, bool warn)
|
||||
{
|
||||
CommandStatusText.Text = text;
|
||||
CommandStatusText.Foreground = warn ? WarnBrush : MutedBrush;
|
||||
}
|
||||
|
||||
// ── log out, log folder ─────────────────────────────────────────────────
|
||||
|
||||
private async Task LogOutAsync()
|
||||
{
|
||||
if (!TrySelected(out HeadlessCharacterStatus s) || s.HostPid <= 0)
|
||||
return;
|
||||
string name = s.Character.Length > 0 ? s.Character : "this character";
|
||||
var others = _roster.All.Where(o => o.HostPid == s.HostPid && o.Id != s.Id).Select(o => o.Character).ToList();
|
||||
string message =
|
||||
$"Log {name} out? This asks its rynth-headless.exe (PID {s.HostPid}) to log out and exit; it is closed after " +
|
||||
$"{HeadlessLaunch.StopGrace.TotalSeconds:0} s if it doesn't.";
|
||||
if (others.Count > 0)
|
||||
message += $"\n\nThe stop request is per process, and this process also runs {others.Count} other character(s) " +
|
||||
$"({string.Join(", ", others)}): they log out too.";
|
||||
if (_host!.AutoLaunch())
|
||||
message += "\n\nAutoLaunch is on: a checked account is started again. Uncheck it first to keep it out.";
|
||||
if (!await DecalBridgeDialog.AskAsync(this, "Log out headless character", message, "Log out", "Cancel"))
|
||||
return;
|
||||
string result;
|
||||
try { result = _host.LogOutProcess(s.HostPid); }
|
||||
catch (Exception ex) { result = "Couldn't stop it: " + ex.Message; }
|
||||
ShowCommandStatus(result, warn: false);
|
||||
}
|
||||
|
||||
private void OpenLogFolder()
|
||||
{
|
||||
try
|
||||
{
|
||||
string? log = _logPath;
|
||||
if (log != null && File.Exists(log))
|
||||
{
|
||||
Process.Start(new ProcessStartInfo("explorer.exe", "/select,\"" + log + "\"") { UseShellExecute = false });
|
||||
return;
|
||||
}
|
||||
string? dir = _logDirs.FirstOrDefault(Directory.Exists);
|
||||
if (dir != null)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo("explorer.exe") { ArgumentList = { dir }, UseShellExecute = false });
|
||||
return;
|
||||
}
|
||||
ShowCommandStatus("No log folder found yet. Looked in: " + string.Join("; ", _logDirs), warn: true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowCommandStatus("Couldn't open the folder: " + ex.Message, warn: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -110,8 +110,9 @@
|
|||
<Grid Grid.Row="1" ColumnDefinitions="3*,Auto,2*">
|
||||
<TabControl x:Name="MainTabs" Grid.Column="0" Margin="14,0,0,0" Padding="0">
|
||||
<TabItem Header="Launcher">
|
||||
<!-- Named so we can reset Offset on tab select; * rows inside this scroll
|
||||
must not be used (they claim infinite height and clip Updates/Launch Targets). -->
|
||||
<!-- Named so the tab keeps the player's scroll position (MainWindow.KeepLauncherScroll);
|
||||
* rows inside this scroll must not be used (they claim infinite height and clip
|
||||
Updates/Launch Targets). -->
|
||||
<ScrollViewer x:Name="LauncherScroll"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Disabled">
|
||||
|
|
@ -130,6 +131,8 @@
|
|||
<Button x:Name="UpdateCardActionButton" IsVisible="False" Margin="0,0,8,6"
|
||||
Background="#26C1A6" Foreground="#0B1218" FontWeight="SemiBold" />
|
||||
<Button x:Name="CheckUpdatesButton" Content="Check for updates" Margin="0,0,0,6" />
|
||||
<Button x:Name="RollbackButton" Content="Roll back…" Margin="8,0,0,6" IsVisible="False"
|
||||
ToolTip.Tip="Go back to an earlier RynthCore release if this one broke something. Updates then wait for a newer release." />
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<StackPanel x:Name="UpdateCardWhatsNewPanel" Spacing="2" IsVisible="False" />
|
||||
|
|
@ -317,7 +320,7 @@
|
|||
<Border Background="#132028" CornerRadius="16" Padding="18">
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock Text="Plugins" FontSize="16" FontWeight="SemiBold" Foreground="#26C1A6" />
|
||||
<TextBlock Text="The plugins RynthCore loads. Untick one to skip it; the X takes it out of the list (its files stay on disk). RynthSuite plugins you don't have are under Available plugins below; Add Plugin is for any other plugin DLL."
|
||||
<TextBlock Text="The plugins RynthCore loads. Untick one to skip it; the X takes it out of the list (its files stay on disk). RynthSuite plugins you don't have are under Available plugins below; plugins for one game server are on the Server plugins tab. Add Plugin is for any other plugin DLL."
|
||||
TextWrapping="Wrap"
|
||||
Foreground="#9AA8B3" />
|
||||
<StackPanel x:Name="PluginLoadoutPanel" Spacing="10" />
|
||||
|
|
@ -338,6 +341,36 @@
|
|||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
<!-- Server plugins: one per game server, kept apart from the regular plugins. RynthCore loads
|
||||
one only when you connect to its server, so installing several costs nothing elsewhere. -->
|
||||
<TabItem x:Name="ServerPluginsTab" Header="Server plugins">
|
||||
<ScrollViewer>
|
||||
<StackPanel Spacing="12" Margin="6">
|
||||
<Border Background="#132028" CornerRadius="16" Padding="18">
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock Text="Your server plugins" FontSize="16" FontWeight="SemiBold" Foreground="#26C1A6" />
|
||||
<TextBlock Text="Extras for one game server each. RynthCore loads a server plugin only when you connect to its server; everywhere else it stays off. Untick one to skip it; the X takes it out of the list (its files stay on disk)."
|
||||
TextWrapping="Wrap"
|
||||
Foreground="#9AA8B3" />
|
||||
<TextBlock x:Name="ServerPluginsEmptyText" Text="No server plugins installed."
|
||||
Foreground="#6F7F8A" IsVisible="False" />
|
||||
<StackPanel x:Name="ServerPluginLoadoutPanel" Spacing="10" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Background="#132028" CornerRadius="16" Padding="18">
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock Text="Available server plugins" FontSize="16" FontWeight="SemiBold" Foreground="#26C1A6" />
|
||||
<TextBlock x:Name="AvailableServerPluginsHint"
|
||||
Text="Server plugins you can add appear here after the first update check."
|
||||
TextWrapping="Wrap"
|
||||
Foreground="#9AA8B3" />
|
||||
<StackPanel x:Name="AvailableServerPluginsPanel" Spacing="10" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Runtime">
|
||||
<ScrollViewer>
|
||||
<StackPanel Spacing="12" Margin="6">
|
||||
|
|
@ -354,10 +387,32 @@
|
|||
<TextBox x:Name="EnginePathTextBox" Watermark="C:\Games\RynthCore\Runtime\RynthCore.Engine.dll" />
|
||||
<TextBlock Text="Extra Launch Arguments" Foreground="#EAF0F4" />
|
||||
<TextBox x:Name="LaunchArgumentsTextBox"
|
||||
Watermark="Optional arguments appended by the host"
|
||||
AcceptsReturn="True"
|
||||
MinHeight="64"
|
||||
Watermark="Optional arguments added after each account's login"
|
||||
ToolTip.Tip="Added to the end of every launch's command line, after the account, password and server the profiles set. It can't contain -a, -v, -h, -p or -rodat: set those in the account and server profiles. One line."
|
||||
AcceptsReturn="False"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock Text="Headless client (experimental)" Foreground="#26C1A6" FontWeight="SemiBold" Margin="0,6,0,0" />
|
||||
<TextBlock Text="For accounts set to Headless (experimental): no game window, rynth-headless.exe logs in and runs the 64-bit plugins below (empty = the RynthAi that comes with RynthCore). ACE servers only."
|
||||
TextWrapping="Wrap"
|
||||
Foreground="#9AA8B3" />
|
||||
<TextBlock Text="rynth-headless.exe" Foreground="#EAF0F4" />
|
||||
<TextBox x:Name="HeadlessExePathTextBox"
|
||||
Watermark="Empty = Headless\rynth-headless.exe beside the launcher" />
|
||||
<TextBlock Text="Headless plugins (64-bit DLLs, one per line)" Foreground="#EAF0F4" />
|
||||
<TextBox x:Name="HeadlessPluginPathsTextBox"
|
||||
Watermark="Empty = Headless\plugins\RynthAi (comes with RynthCore)"
|
||||
ToolTip.Tip="Loaded by every Headless account. Empty = the 64-bit plugins that come with RynthCore, in Headless\plugins beside the launcher (RynthAi). rynth-headless is a 64-bit process: list only x64 builds here, never the ones in the Plugins tab."
|
||||
AcceptsReturn="True"
|
||||
TextWrapping="NoWrap"
|
||||
MinHeight="56" />
|
||||
<Button x:Name="ShowHeadlessWindowButton"
|
||||
Content="Show headless clients"
|
||||
ToolTip.Tip="Opens the Headless window: what each headless character is doing (vitals, target, place, XP, chat and its log), with a command box, macro on/off and log out."
|
||||
HorizontalAlignment="Left" />
|
||||
<Button x:Name="StopHeadlessButton"
|
||||
Content="Log out headless clients"
|
||||
ToolTip.Tip="A headless client has no window to close: this asks every running rynth-headless.exe to log its character out and exit (closed after 20 s if it doesn't). With AutoLaunch on, uncheck the account first or it is started again."
|
||||
HorizontalAlignment="Left" />
|
||||
<Button x:Name="SavePathsButton"
|
||||
Content="Save Runtime Paths"
|
||||
HorizontalAlignment="Left" />
|
||||
|
|
@ -441,9 +496,6 @@
|
|||
<TextBlock Text="These flags are read by RynthCore.Engine on each AC client launch. They write to %APPDATA%\RynthCore\engine.json — other engine flags in that file are preserved untouched."
|
||||
TextWrapping="Wrap"
|
||||
Foreground="#9AA8B3" />
|
||||
<CheckBox x:Name="EnableDcompOverlayCheckBox"
|
||||
Content="Use DComp overlay (experimental, GPU-rendered)"
|
||||
ToolTip.Tip="When ON, the engine starts the new DirectComposition overlay instead of the production AvaloniaOverlay. Mutually exclusive — Avalonia is single-app-per-process. Toggle takes effect on next AC client launch (a hot reload won't switch overlays)." />
|
||||
<CheckBox x:Name="EnableImGuiBackendCheckBox"
|
||||
Content="ImGui panels (preview)"
|
||||
ToolTip.Tip="When ON, the engine runs its in-client ImGui layer, which docked panels move to as their ImGui versions are finished (choose per panel with /rc ui). Popped-out panels stay Avalonia windows. Costs nothing while no ImGui panel is open. Takes effect on next AC client launch or engine reload (RL)." />
|
||||
|
|
@ -579,6 +631,10 @@
|
|||
Background="#0F161D"
|
||||
BorderBrush="#243742"
|
||||
Foreground="#EAF0F4" />
|
||||
<Button x:Name="SessionsHeadlessButton"
|
||||
Content="Headless clients"
|
||||
ToolTip.Tip="Headless characters have no game window: this window shows what they are doing, their chat and log, and takes commands."
|
||||
HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
46
src/RynthCore.App.Avalonia/PluginNames.cs
Normal file
46
src/RynthCore.App.Avalonia/PluginNames.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using RynthCore.App;
|
||||
|
||||
namespace RynthCore.App.Avalonia;
|
||||
|
||||
/// <summary>
|
||||
/// How the launcher names a plugin, and which plugins are server plugins. The plugin list used to
|
||||
/// show each DLL's file name ("RynthCore.Plugin.RynthAi") over its full path; it shows "RynthAi", a line
|
||||
/// about what it does and its folder instead. A server plugin (one per game server, KnownServerCatalog)
|
||||
/// goes on the Server plugins tab, not among the regular plugins.
|
||||
/// </summary>
|
||||
internal static class PluginNames
|
||||
{
|
||||
private const string Prefix = "RynthCore.Plugin.";
|
||||
|
||||
/// <summary>"RynthCore.Plugin.RynthAi.dll" or "RynthCore.Plugin.RynthAi" or "RynthAi" -> "RynthAi".</summary>
|
||||
public static string Friendly(string fileOrName)
|
||||
{
|
||||
string n = Path.GetFileName(fileOrName ?? string.Empty);
|
||||
if (n.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) n = n[..^4];
|
||||
if (n.StartsWith(Prefix, StringComparison.OrdinalIgnoreCase) && n.Length > Prefix.Length) n = n[Prefix.Length..];
|
||||
return n;
|
||||
}
|
||||
|
||||
/// <summary>Plugins for one server besides its own server plugin (catalog id of that server).</summary>
|
||||
private static readonly (string Plugin, string ServerId)[] AlsoForOneServer =
|
||||
{
|
||||
("RynthThreads", "dreamweave"), // DreamWeave's Fragment Press recorder
|
||||
};
|
||||
|
||||
/// <summary>The server a plugin belongs to, or null for a regular plugin.</summary>
|
||||
public static KnownServer? ServerOf(string fileOrName)
|
||||
{
|
||||
string n = Friendly(fileOrName);
|
||||
KnownServer? s = KnownServerCatalog.All.FirstOrDefault(k => string.Equals(k.PluginName, n, StringComparison.OrdinalIgnoreCase));
|
||||
if (s != null) return s;
|
||||
foreach (var (plugin, id) in AlsoForOneServer)
|
||||
if (string.Equals(plugin, n, StringComparison.OrdinalIgnoreCase))
|
||||
return KnownServerCatalog.All.FirstOrDefault(k => k.Id == id);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool IsServerPlugin(string fileOrName) => ServerOf(fileOrName) != null;
|
||||
}
|
||||
26
src/RynthCore.App.Avalonia/RollbackDialog.axaml
Normal file
26
src/RynthCore.App.Avalonia/RollbackDialog.axaml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="RynthCore.App.Avalonia.RollbackDialog"
|
||||
Width="600"
|
||||
SizeToContent="Height"
|
||||
CanResize="False"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Title="Roll back"
|
||||
Background="#132028">
|
||||
<Grid RowDefinitions="*,Auto" Margin="18">
|
||||
<StackPanel Spacing="10">
|
||||
<TextBlock x:Name="HeaderText" Foreground="#EAF0F4" FontSize="16" FontWeight="SemiBold" TextWrapping="Wrap" />
|
||||
<TextBlock Foreground="#9AA8B3" TextWrapping="Wrap"
|
||||
Text="Pick the release to go back to. Your settings, profiles and accounts stay as they are." />
|
||||
<ScrollViewer MaxHeight="380" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel x:Name="ReleasesPanel" Spacing="10" />
|
||||
</ScrollViewer>
|
||||
<TextBlock x:Name="HoldText" Foreground="#9AA8B3" TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="8" Margin="0,16,0,0">
|
||||
<Button x:Name="CancelButton" Content="Cancel" />
|
||||
<Button x:Name="RollbackButton" Content="Go back" IsEnabled="False"
|
||||
Background="#26C1A6" Foreground="#0B1218" FontWeight="SemiBold" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
60
src/RynthCore.App.Avalonia/RollbackDialog.axaml.cs
Normal file
60
src/RynthCore.App.Avalonia/RollbackDialog.axaml.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace RynthCore.App.Avalonia;
|
||||
|
||||
/// <summary>
|
||||
/// Roll back's choice (RynthUpdater.Rollback.cs): the earlier releases whose signed manifests verified,
|
||||
/// newest first, each with its date and first changes. Closes with the chosen target, or null.
|
||||
/// </summary>
|
||||
internal partial class RollbackDialog : Window
|
||||
{
|
||||
private const int ChangesShown = 3;
|
||||
private RynthUpdater.RollbackTarget? _chosen;
|
||||
|
||||
public RollbackDialog() : this(new List<RynthUpdater.RollbackTarget>(), "") { } // the XAML previewer
|
||||
|
||||
public RollbackDialog(IReadOnlyList<RynthUpdater.RollbackTarget> targets, string installedVersion)
|
||||
{
|
||||
InitializeComponent();
|
||||
HeaderText.Text = $"Go back from RynthCore {installedVersion}";
|
||||
HoldText.Text = "Every game client must be closed. The launcher installs that release and restarts; " +
|
||||
"updates then wait until a release newer than this one comes out, or until you press Update RynthCore.";
|
||||
|
||||
foreach (RynthUpdater.RollbackTarget t in targets)
|
||||
{
|
||||
var choice = new RadioButton { GroupName = "release", Tag = t };
|
||||
var body = new StackPanel { Spacing = 2 };
|
||||
body.Children.Add(new TextBlock
|
||||
{
|
||||
Text = $"RynthCore {t.Version} · {t.Manifest.PublishedUtc.ToLocalTime():MMM d}",
|
||||
Foreground = Brush.Parse("#EAF0F4"), FontWeight = FontWeight.SemiBold,
|
||||
});
|
||||
IReadOnlyList<string> lines = t.Manifest.Changes.Count > 0
|
||||
? t.Manifest.Changes.Take(ChangesShown).ToList()
|
||||
: (t.Manifest.Notes.Length > 0 ? new[] { t.Manifest.Notes } : new string[0]);
|
||||
foreach (string line in lines)
|
||||
body.Children.Add(new TextBlock
|
||||
{
|
||||
Text = "• " + (line.Length > 160 ? line[..159].TrimEnd() + "…" : line),
|
||||
Foreground = Brush.Parse("#C5D0D8"), TextWrapping = TextWrapping.Wrap,
|
||||
});
|
||||
if (t.Manifest.Changes.Count > ChangesShown)
|
||||
body.Children.Add(new TextBlock { Text = $"…and {t.Manifest.Changes.Count - ChangesShown} more.", Foreground = Brush.Parse("#9AA8B3") });
|
||||
choice.Content = body;
|
||||
choice.IsCheckedChanged += (_, _) =>
|
||||
{
|
||||
if (choice.IsChecked != true) return;
|
||||
_chosen = (RynthUpdater.RollbackTarget)choice.Tag!;
|
||||
RollbackButton.Content = $"Go back to {_chosen.Version}";
|
||||
RollbackButton.IsEnabled = true;
|
||||
};
|
||||
ReleasesPanel.Children.Add(choice);
|
||||
}
|
||||
|
||||
CancelButton.Click += (_, _) => Close(null);
|
||||
RollbackButton.Click += (_, _) => Close(_chosen);
|
||||
}
|
||||
}
|
||||
|
|
@ -46,6 +46,7 @@
|
|||
<Compile Include="..\RynthCore.App\KnownServerCatalog.cs" Link="Shared\KnownServerCatalog.cs" />
|
||||
<Compile Include="..\RynthCore.App\LaunchAccountProfile.cs" Link="Shared\LaunchAccountProfile.cs" />
|
||||
<Compile Include="..\RynthCore.App\AccountPasswordProtection.cs" Link="Shared\AccountPasswordProtection.cs" />
|
||||
<Compile Include="..\RynthCore.App\SavedPasswordReveal.cs" Link="Shared\SavedPasswordReveal.cs" />
|
||||
<Compile Include="..\RynthCore.App\InjectionMode.cs" Link="Shared\InjectionMode.cs" />
|
||||
<Compile Include="..\RynthCore.App\DecalLocator.cs" Link="Shared\DecalLocator.cs" />
|
||||
<Compile Include="..\RynthCore.App\DecalBridgeRegistration.cs" Link="Shared\DecalBridgeRegistration.cs" />
|
||||
|
|
@ -53,8 +54,11 @@
|
|||
<Compile Include="..\RynthCore.App\DecalBridgeCheck.cs" Link="Shared\DecalBridgeCheck.cs" />
|
||||
<Compile Include="..\RynthCore.App\RealDecalCheckHost.cs" Link="Shared\RealDecalCheckHost.cs" />
|
||||
<Compile Include="..\RynthCore.App\AcLaunchArgumentBuilder.cs" Link="Shared\AcLaunchArgumentBuilder.cs" />
|
||||
<Compile Include="..\RynthCore.App\AcClientCommandLine.cs" Link="Shared\AcClientCommandLine.cs" />
|
||||
<Compile Include="..\RynthCore.App\FirstLoginRules.cs" Link="Shared\FirstLoginRules.cs" />
|
||||
<Compile Include="..\RynthCore.App\AccountServerRules.cs" Link="Shared\AccountServerRules.cs" />
|
||||
<Compile Include="..\RynthCore.App\CrashDumpWriterRule.cs" Link="Shared\CrashDumpWriterRule.cs" />
|
||||
<Compile Include="..\RynthCore.App\AcWindowPlacementRule.cs" Link="Shared\AcWindowPlacementRule.cs" />
|
||||
<Compile Include="..\RynthCore.App\AcClientLaunchSettingsService.cs" Link="Shared\AcClientLaunchSettingsService.cs" />
|
||||
<Compile Include="..\RynthCore.App\DxvkPackageService.cs" Link="Shared\DxvkPackageService.cs" />
|
||||
<Compile Include="..\RynthCore.App\UserPrefsSwapRecovery.cs" Link="Shared\UserPrefsSwapRecovery.cs" />
|
||||
|
|
@ -68,6 +72,9 @@
|
|||
<Compile Include="..\RynthCore.App\AppSettings.cs" Link="Shared\AppSettings.cs" />
|
||||
<Compile Include="..\RynthCore.App\AppSettingsStore.cs" Link="Shared\AppSettingsStore.cs" />
|
||||
<Compile Include="..\RynthCore.App\DecalAccountModes.cs" Link="Shared\DecalAccountModes.cs" />
|
||||
<Compile Include="..\RynthCore.App\HeadlessAccountModes.cs" Link="Shared\HeadlessAccountModes.cs" />
|
||||
<Compile Include="..\RynthCore.App\HeadlessLaunch.cs" Link="Shared\HeadlessLaunch.cs" />
|
||||
<Compile Include="..\RynthCore.App\HeadlessMonitor.cs" Link="Shared\HeadlessMonitor.cs" />
|
||||
<Compile Include="..\RynthCore.App\PluginDefinition.cs" Link="Shared\PluginDefinition.cs" />
|
||||
<!-- The plugin API of the engine installed with this launcher (RynthUpdater.InstalledEngineApi). -->
|
||||
<Compile Include="..\RynthCore.Engine\Plugins\PluginContractVersion.cs" Link="Shared\PluginContractVersion.cs" />
|
||||
|
|
|
|||
|
|
@ -65,8 +65,13 @@ internal sealed partial class RynthUpdater
|
|||
["RynthNav"] = "Walks you to coordinates and towns, with route planning and the Atlas. Downloads its map (about 540 MB).",
|
||||
["RynthVision"] = "Shows unclimbable slopes, impassable water and your radar range in the world.",
|
||||
["RynthLua"] = "Lua scripting for metas and your own scripts.",
|
||||
["RynthOracle"] = "Quests, character, titles and leaderboards.",
|
||||
["RynthOracle"] = "Quests, character and titles.",
|
||||
["RynthInventory"] = "Search every character's items.",
|
||||
["RynthSort"] = "Keeps your packs sorted: new loot goes to the pack its rule names.",
|
||||
["RynthILT"] = "Infinite Leaftide only: the ILT Hub, the Guardian, bounty tracking and progression planning.",
|
||||
["RynthThreads"] = "DreamWeave only: records Fragment Press results and works out what each component brings.",
|
||||
["RynthNet"] = "Links your characters on this PC: broadcast commands, shared vitals and the Characters panel.",
|
||||
["RynthDefective"] = "A shortcut bar with AC's own keys, buttons for AC's panels and the Selection, in place of the retail toolbar.",
|
||||
};
|
||||
|
||||
/// <summary>The feed's description, else the launcher's own line, else "".</summary>
|
||||
|
|
@ -74,6 +79,10 @@ internal sealed partial class RynthUpdater
|
|||
e.Description.Length > 0 ? e.Description
|
||||
: BuiltInDescriptions.TryGetValue(e.Name, out string? d) ? d : "";
|
||||
|
||||
/// <summary>The launcher's own line for a RynthSuite plugin by name (no feed entry at hand), else "".</summary>
|
||||
public static string DescribeByName(string name) =>
|
||||
BuiltInDescriptions.TryGetValue(name, out string? d) ? d : "";
|
||||
|
||||
private string? _suiteDirOverride;
|
||||
/// <summary>Tests: the folder to use when no plugin in the list shows where RynthSuite lives.</summary>
|
||||
internal void SetDefaultSuiteDir(string dir) => _suiteDirOverride = dir;
|
||||
|
|
|
|||
198
src/RynthCore.App.Avalonia/RynthUpdater.Rollback.cs
Normal file
198
src/RynthCore.App.Avalonia/RynthUpdater.Rollback.cs
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RynthCore.App.Avalonia;
|
||||
|
||||
/// <summary>
|
||||
/// Roll back: go back to an earlier release when a new one broke something (2026-10-21).
|
||||
///
|
||||
/// Every release keeps its own signed manifest beside its files on the server
|
||||
/// (releases/<release>/update.json; Publish-Update.ps1 uploads it, and did by hand for 2026.10.19.1
|
||||
/// on). Which releases exist comes from releases.json (unsigned; only used to find candidates); each
|
||||
/// candidate is offered only once its own manifest verifies, and everything a rollback downloads is
|
||||
/// checked against that manifest's signed sizes and hashes, exactly like an update. Only releases older
|
||||
/// than the installed one, and not older than <see cref="FirstRollbackRelease"/>.
|
||||
///
|
||||
/// A rollback puts back that release's build of every plugin the player has (the files it ships; other
|
||||
/// plugins are left alone), then runs that release's installer (the core: engine, launcher, RynthAi),
|
||||
/// with every game client closed, like a core update. Afterwards updates are held
|
||||
/// (<see cref="StartHold"/>): no automatic plugin updates while the feed offers nothing newer than the
|
||||
/// release left behind, so the launcher doesn't put it straight back. The hold ends by itself when a
|
||||
/// newer release comes out, or when the player updates by hand.
|
||||
///
|
||||
/// A launcher from before this feature (the rolled-back one may be) knows nothing of the hold, so a
|
||||
/// rollback also turns "Update plugins automatically" off, and a later launcher turns it back on when
|
||||
/// the hold ends (<see cref="HoldTurnedOffAutoUpdate"/>).
|
||||
/// </summary>
|
||||
internal sealed partial class RynthUpdater
|
||||
{
|
||||
/// <summary>The oldest release whose signed manifest is kept on the server (2026.10.19.1).</summary>
|
||||
public const int FirstRollbackRelease = 2026101901;
|
||||
|
||||
/// <summary>How many earlier releases Roll back offers.</summary>
|
||||
public const int RollbackChoices = 5;
|
||||
|
||||
private const long MaxReleasesListBytes = 4L << 20;
|
||||
|
||||
/// <summary>Tests lower it; the launcher uses <see cref="FirstRollbackRelease"/>.</summary>
|
||||
internal int RollbackFloor { get; set; } = FirstRollbackRelease;
|
||||
|
||||
/// <summary>An earlier release Roll back can install, from its own verified manifest.</summary>
|
||||
public sealed record RollbackTarget(Manifest Manifest)
|
||||
{
|
||||
public int Release => Manifest.Release;
|
||||
public string Version => Manifest.Version;
|
||||
}
|
||||
|
||||
/// <summary>What a prepared rollback installs: the verified installer and the player's plugins, staged.</summary>
|
||||
public sealed record RollbackPlan(Manifest Manifest, int LeavingRelease, string InstallerPath,
|
||||
IReadOnlyList<(PluginEntry Entry, string Path, string Staged)> Plugins);
|
||||
|
||||
/// <summary>"2026.10.21.2" → 2026102102 (Publish-Update.ps1's numbering); 0 when it isn't a release version.</summary>
|
||||
public static int ReleaseOf(string? version)
|
||||
{
|
||||
string[] p = (version ?? "").Trim().Split('.');
|
||||
if (p.Length != 4) return 0;
|
||||
if (!int.TryParse(p[0], out int y) || !int.TryParse(p[1], out int m) || !int.TryParse(p[2], out int d) || !int.TryParse(p[3], out int n))
|
||||
return 0;
|
||||
if (y < 2000 || y > 2999 || m < 1 || m > 12 || d < 1 || d > 31 || n < 0 || n > 99) return 0;
|
||||
return y * 1000000 + m * 10000 + d * 100 + n;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The earlier releases Roll back offers, newest first: up to <paramref name="max"/>, older than the
|
||||
/// installed release, not older than <see cref="RollbackFloor"/>, each with a manifest that verifies.
|
||||
/// A release whose manifest is missing or doesn't verify is skipped.
|
||||
/// </summary>
|
||||
public async Task<IReadOnlyList<RollbackTarget>> ListRollbackTargetsAsync(int max = RollbackChoices, CancellationToken ct = default)
|
||||
{
|
||||
if (!IsConfigured)
|
||||
throw new InvalidOperationException("updates are not set up in this build (no signing key)");
|
||||
int installed = InstalledCoreRelease;
|
||||
if (installed <= 0)
|
||||
throw new InvalidOperationException("this RynthCore wasn't installed from a release, so there's nothing to go back from");
|
||||
|
||||
byte[] list = await DownloadBytesAsync(_allowedPrefix + "releases.json", MaxReleasesListBytes, ct);
|
||||
var candidates = new List<int>();
|
||||
using (JsonDocument doc = JsonDocument.Parse(list))
|
||||
{
|
||||
foreach (JsonElement r in doc.RootElement.GetProperty("releases").EnumerateArray())
|
||||
{
|
||||
int release = r.TryGetProperty("version", out JsonElement v) ? ReleaseOf(v.GetString()) : 0;
|
||||
if (release > 0 && release < installed && release >= RollbackFloor && !candidates.Contains(release))
|
||||
candidates.Add(release);
|
||||
}
|
||||
}
|
||||
|
||||
var targets = new List<RollbackTarget>();
|
||||
foreach (int release in candidates.OrderByDescending(r => r))
|
||||
{
|
||||
if (targets.Count >= max) break;
|
||||
try { targets.Add(new RollbackTarget(await LoadReleaseManifestAsync(release, ct))); }
|
||||
catch (OperationCanceledException) { throw; }
|
||||
catch { /* no signed manifest kept for it, or it doesn't verify: not offered */ }
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <paramref name="release"/>'s own signed manifest (releases/<release>/update.json). Throws unless a
|
||||
/// trusted key signed it, it is that release (not another one served under its name) and it is
|
||||
/// older than the installed release.
|
||||
/// </summary>
|
||||
public async Task<Manifest> LoadReleaseManifestAsync(int release, CancellationToken ct = default)
|
||||
{
|
||||
byte[] envelope = await DownloadBytesAsync($"{_allowedPrefix}releases/{release}/update.json", MaxFeedBytes, ct);
|
||||
Manifest m = ParseManifest(VerifyEnvelope(envelope, _trustedKeys));
|
||||
if (m.Release != release || m.Core.Release != release)
|
||||
throw new InvalidDataException($"releases/{release} holds the manifest of release {m.Release}");
|
||||
if (m.Release >= InstalledCoreRelease)
|
||||
throw new InvalidDataException($"{m.Version} isn't older than the installed release");
|
||||
return m;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Downloads and verifies everything <paramref name="target"/> installs: its installer, and its build of
|
||||
/// each plugin in <paramref name="pluginPaths"/> that it ships (staged, not installed yet). Nothing is
|
||||
/// changed if any download fails.
|
||||
/// </summary>
|
||||
public async Task<RollbackPlan> PrepareRollbackAsync(RollbackTarget target, IEnumerable<string> pluginPaths,
|
||||
IProgress<DownloadProgress>? progress = null, CancellationToken ct = default)
|
||||
{
|
||||
Manifest m = target.Manifest;
|
||||
int leaving = InstalledCoreRelease;
|
||||
string installer = await DownloadInstallerAsync(m.Core, progress, ct);
|
||||
|
||||
string stage = Path.Combine(UpdatesDir, $"rollback-{m.Release}");
|
||||
Directory.CreateDirectory(stage);
|
||||
var byFile = m.Plugins.ToDictionary(p => p.File, StringComparer.OrdinalIgnoreCase);
|
||||
var staged = new Dictionary<PluginEntry, string>();
|
||||
var plugins = new List<(PluginEntry, string, string)>();
|
||||
foreach (string path in pluginPaths.Distinct(StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!File.Exists(path) || !byFile.TryGetValue(Path.GetFileName(path), out PluginEntry? e)) continue;
|
||||
if (!staged.TryGetValue(e, out string? file))
|
||||
{
|
||||
file = Path.Combine(stage, e.File);
|
||||
bool have = File.Exists(file) && new FileInfo(file).Length == e.Size &&
|
||||
string.Equals(Sha256File(file), e.Sha256, StringComparison.OrdinalIgnoreCase);
|
||||
if (!have)
|
||||
{
|
||||
string part = file + ".part";
|
||||
await DownloadVerifiedAsync(e.Url, e.Size, e.Sha256, MaxPluginBytes, part, ct, $"{e.Name} {m.Version}", progress);
|
||||
File.Move(part, file, overwrite: true);
|
||||
}
|
||||
staged[e] = file;
|
||||
}
|
||||
plugins.Add((e, path, file));
|
||||
}
|
||||
return new RollbackPlan(m, leaving, installer, plugins);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Puts the staged plugins in place (the replaced file kept as .previous, as an update does) and
|
||||
/// returns what changed. Stamped with the release's time, so a later check doesn't take them for a
|
||||
/// local build. Call with every game client closed, before running the installer.
|
||||
/// </summary>
|
||||
public List<string> ApplyRollbackPlugins(RollbackPlan plan)
|
||||
{
|
||||
var done = new List<string>();
|
||||
foreach (var (entry, path, file) in plan.Plugins)
|
||||
{
|
||||
string fresh = path + ".new";
|
||||
File.Copy(file, fresh, overwrite: true);
|
||||
File.SetLastWriteTimeUtc(fresh, plan.Manifest.PublishedUtc);
|
||||
File.Copy(path, path + ".previous", overwrite: true);
|
||||
File.Move(fresh, path, overwrite: true);
|
||||
done.Add($"{entry.Name} → {plan.Manifest.Version}");
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
// ── The hold ───────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>The release the player rolled back from (0: no hold).</summary>
|
||||
public int HeldThroughRelease => ReadStateInt("holdThrough");
|
||||
|
||||
/// <summary>True when the rollback turned "Update plugins automatically" off (turned back on when the hold ends).</summary>
|
||||
public bool HoldTurnedOffAutoUpdate => ReadStateBool("holdTurnedOffAutoUpdate");
|
||||
|
||||
/// <summary>Holds updates through <paramref name="leavingRelease"/> (the release rolled back from).</summary>
|
||||
public void StartHold(int leavingRelease, bool turnedOffAutoUpdate) => WriteState(s =>
|
||||
{
|
||||
s["holdThrough"] = leavingRelease;
|
||||
s["holdTurnedOffAutoUpdate"] = turnedOffAutoUpdate;
|
||||
});
|
||||
|
||||
/// <summary>Ends a rollback's hold (a newer release is out, or the player updated by hand).</summary>
|
||||
public void EndHold() => WriteState(s =>
|
||||
{
|
||||
s.Remove("holdThrough");
|
||||
s.Remove("holdTurnedOffAutoUpdate");
|
||||
});
|
||||
}
|
||||
|
|
@ -95,6 +95,15 @@ internal sealed partial class RynthUpdater
|
|||
public bool NavDataUpdateAvailable => NavData is { State: NavDataState.NeedsUpdate };
|
||||
/// <summary>The optional World Map sizes: what the feed offers and what is installed. Not part of "Update plugins": the player chooses.</summary>
|
||||
public IReadOnlyList<MapPackStatus> MapPacks { get; init; } = Array.Empty<MapPackStatus>();
|
||||
/// <summary>
|
||||
/// The release the player went back from with Roll back (0: none; RynthUpdater.Rollback.cs). While
|
||||
/// the feed offers nothing newer and the player hasn't updated past it, updates are held.
|
||||
/// </summary>
|
||||
public int HoldThrough { get; init; }
|
||||
/// <summary>Held after a rollback: no automatic plugin updates; the card says so.</summary>
|
||||
public bool Held => HoldThrough > 0 && Manifest.Release <= HoldThrough && InstalledCoreRelease < HoldThrough;
|
||||
/// <summary>A rollback's hold is over: a newer release is out, or the player updated past it by hand.</summary>
|
||||
public bool HoldEnded => HoldThrough > 0 && !Held;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -153,6 +162,10 @@ internal sealed partial class RynthUpdater
|
|||
return coreBringsIt ? $"needs RynthCore {core.Version}" : $"needs a newer RynthCore (API {e.MinEngineApi})";
|
||||
}
|
||||
|
||||
/// <summary>Where installers (and a rollback's plugins) are downloaded: %LOCALAPPDATA%\RynthCore\updates. Tests set it.</summary>
|
||||
internal string UpdatesDir { get; set; } = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "RynthCore", "updates");
|
||||
|
||||
/// <summary>False until the signing keys exist: with no trusted key nothing can verify.</summary>
|
||||
public bool IsConfigured => _trustedKeys.Count > 0;
|
||||
|
||||
|
|
@ -224,6 +237,7 @@ internal sealed partial class RynthUpdater
|
|||
MapPacks = CheckMapPacks(manifest),
|
||||
Available = available,
|
||||
NewlyAnnounced = available.Where(a => fresh.Contains(a.Entry.Name)).ToList(),
|
||||
HoldThrough = HeldThroughRelease,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -321,11 +335,13 @@ internal sealed partial class RynthUpdater
|
|||
// ── Core ──────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Downloads (or reuses) the release installer, verified, and returns its path.</summary>
|
||||
public async Task<string> DownloadInstallerAsync(CheckResult check, IProgress<DownloadProgress>? progress = null, CancellationToken ct = default)
|
||||
public Task<string> DownloadInstallerAsync(CheckResult check, IProgress<DownloadProgress>? progress = null, CancellationToken ct = default) =>
|
||||
DownloadInstallerAsync(check.Manifest.Core, progress, ct);
|
||||
|
||||
/// <summary>Downloads (or reuses) <paramref name="core"/>'s installer, verified, and returns its path.</summary>
|
||||
public async Task<string> DownloadInstallerAsync(InstallerEntry core, IProgress<DownloadProgress>? progress = null, CancellationToken ct = default)
|
||||
{
|
||||
InstallerEntry core = check.Manifest.Core;
|
||||
string dir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"RynthCore", "updates", core.Release.ToString());
|
||||
string dir = Path.Combine(UpdatesDir, core.Release.ToString());
|
||||
Directory.CreateDirectory(dir);
|
||||
string path = Path.Combine(dir, "RynthCore-Setup.exe");
|
||||
if (File.Exists(path) && new FileInfo(path).Length == core.Size &&
|
||||
|
|
@ -526,24 +542,45 @@ internal sealed partial class RynthUpdater
|
|||
catch { }
|
||||
}
|
||||
|
||||
private int ReadHighestRelease()
|
||||
private int ReadHighestRelease() => ReadStateInt("highestRelease");
|
||||
|
||||
private void WriteHighestRelease(int release) => WriteState(s => s["highestRelease"] = release);
|
||||
|
||||
// update-state.json holds several values (the replay guard's highest release, a rollback's hold):
|
||||
// each write changes its own keys and keeps the rest.
|
||||
|
||||
private System.Text.Json.Nodes.JsonObject ReadState()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!File.Exists(StatePath)) return 0;
|
||||
using var doc = JsonDocument.Parse(File.ReadAllText(StatePath));
|
||||
return doc.RootElement.TryGetProperty("highestRelease", out JsonElement v) ? v.GetInt32() : 0;
|
||||
if (File.Exists(StatePath) && System.Text.Json.Nodes.JsonNode.Parse(File.ReadAllText(StatePath)) is System.Text.Json.Nodes.JsonObject o)
|
||||
return o;
|
||||
}
|
||||
catch { }
|
||||
return new System.Text.Json.Nodes.JsonObject();
|
||||
}
|
||||
|
||||
private int ReadStateInt(string key)
|
||||
{
|
||||
try { return ReadState()[key]?.GetValue<int>() ?? 0; }
|
||||
catch { return 0; }
|
||||
}
|
||||
|
||||
private void WriteHighestRelease(int release)
|
||||
private bool ReadStateBool(string key)
|
||||
{
|
||||
try { return ReadState()[key]?.GetValue<bool>() ?? false; }
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
private void WriteState(Action<System.Text.Json.Nodes.JsonObject> change)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Text.Json.Nodes.JsonObject state = ReadState();
|
||||
change(state);
|
||||
Directory.CreateDirectory(_stateDir);
|
||||
string tmp = StatePath + ".tmp";
|
||||
File.WriteAllText(tmp, $"{{\"highestRelease\": {release}}}", Encoding.UTF8);
|
||||
File.WriteAllText(tmp, state.ToJsonString(), Encoding.UTF8);
|
||||
File.Move(tmp, StatePath, overwrite: true);
|
||||
}
|
||||
catch { }
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ internal partial class ServerProfileDialog : Window
|
|||
private void ShowKnownServerNote(KnownServer? server)
|
||||
{
|
||||
KnownServerNote.Text = server == null
|
||||
? "Any server works. Known servers fill in the connection details and have a RynthSuite server plugin."
|
||||
: $"{server.Note} Server plugin: {server.PluginName} (RynthCore loads it when you connect to {server.Host}).";
|
||||
? "Any server works. Known servers fill in the connection details; each has a RynthSuite server plugin name."
|
||||
: $"{server.Note} Server plugin: {server.PluginName} (RynthCore loads it when you connect to {server.Host}, if it is installed).";
|
||||
}
|
||||
|
||||
private void SaveAndClose()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.Linq;
|
|||
namespace RynthCore.App.Avalonia;
|
||||
|
||||
/// <summary>What the update card on the launcher's front page is showing.</summary>
|
||||
public enum UpdateCardKind { NotConfigured, NotChecked, Checking, Error, UpToDate, CoreUpdate, PluginUpdates, Downloading }
|
||||
public enum UpdateCardKind { NotConfigured, NotChecked, Checking, Error, UpToDate, CoreUpdate, PluginUpdates, Downloading, Held }
|
||||
|
||||
/// <summary>Everything the card needs to know, gathered by the window (no UI types, so tests can build it).</summary>
|
||||
public sealed record UpdateCardInput
|
||||
|
|
@ -32,6 +32,8 @@ public sealed record UpdateCardInput
|
|||
public int ClientsRunning { get; init; }
|
||||
/// <summary>The download in progress, if any.</summary>
|
||||
public DownloadProgress? Download { get; init; }
|
||||
/// <summary>After Roll back: the version the player went back from, while updates are held (else "").</summary>
|
||||
public string HeldFromVersion { get; init; } = "";
|
||||
public bool CanCancel { get; init; }
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +55,7 @@ public sealed record UpdateCard(
|
|||
/// <summary>
|
||||
/// The front page's update card as a pure function of <see cref="UpdateCardInput"/>: up to date,
|
||||
/// RynthCore update (installs once every game client is closed), plugin updates, downloading
|
||||
/// (bar, MB, speed, time left, step), errors, and a line about new plugins.
|
||||
/// (bar, MB, speed, time left, step), errors, a line about new plugins, and the hold after a Roll back.
|
||||
/// </summary>
|
||||
public static class UpdateCardModel
|
||||
{
|
||||
|
|
@ -105,6 +107,18 @@ public static class UpdateCardModel
|
|||
string checkedLine = i.LastChecked is { } lc ? $"Last checked {FormatWhen(lc)}." : "";
|
||||
IReadOnlyList<string> whatsNew = WhatsNew(i.Changes, i.Notes);
|
||||
|
||||
if (i.HeldFromVersion.Length > 0)
|
||||
{
|
||||
// Roll back: the launcher doesn't push the release the player left straight back.
|
||||
var detail = new List<string> { $"You went back from {i.HeldFromVersion}. Updates are on hold until a newer release comes out." };
|
||||
if (i.CoreUpdateAvailable)
|
||||
detail.Add($"{UpdateCoreButton} goes forward to {i.AvailableVersion} now.");
|
||||
if (checkedLine.Length > 0) detail.Add(checkedLine);
|
||||
return new UpdateCard(UpdateCardKind.Held, $"RynthCore {installed} - rolled back", string.Join(" ", detail),
|
||||
Array.Empty<string>(), true, i.CoreUpdateAvailable ? UpdateCoreButton : null, false, null, false, newLine,
|
||||
$"RynthCore {installed} - rolled back from {i.HeldFromVersion}; updates on hold.");
|
||||
}
|
||||
|
||||
if (i.CoreUpdateAvailable)
|
||||
{
|
||||
var detail = new List<string> { $"You have {installed}. The update installs once every game client is closed." };
|
||||
|
|
|
|||
75
src/RynthCore.App/AcClientCommandLine.cs
Normal file
75
src/RynthCore.App/AcClientCommandLine.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace RynthCore.App;
|
||||
|
||||
/// <summary>
|
||||
/// acclient.exe's own command-line rules, and how to write a value so the client reads it back.
|
||||
///
|
||||
/// The client splits its command line itself (ConvertCommandLineToArgList, 0x004098F0, called from
|
||||
/// WinMain; ArgumentParser::ParseCommandLine uses the same template), not with the C runtime's rules:
|
||||
/// * arguments are split on spaces (only ' ') outside quotes;
|
||||
/// * a " switches quoting on or off and is dropped; it is never part of an argument;
|
||||
/// * nothing is escaped: a backslash is an ordinary character;
|
||||
/// * a quote left open refuses the whole command line ("Unmatched quote"), so the client starts
|
||||
/// without the account, password or host.
|
||||
/// The launcher used to write the C runtime's form ("\"" around the value, \\ for \, \" for ") for a
|
||||
/// value with a space or a quote; the client kept the backslashes, so a password with a quote mark
|
||||
/// reached the server changed and the login failed (2026-10-21, a 30-character password with most
|
||||
/// special characters on Conquest; ThwargLauncher, which passes the password as it is, worked).
|
||||
/// </summary>
|
||||
internal static class AcClientCommandLine
|
||||
{
|
||||
/// <summary>
|
||||
/// <paramref name="value"/> as one argument the client reads back as <see cref="ClientValue"/> of it:
|
||||
/// as it is when it has no space (what ThwargLauncher passes), else in quotes. Quote marks in it are
|
||||
/// left out, as the client would drop them anyway; that also keeps the quotes balanced.
|
||||
/// </summary>
|
||||
public static string Token(string? value)
|
||||
{
|
||||
string v = ClientValue(value);
|
||||
if (v.Length == 0)
|
||||
return "\"\"";
|
||||
return v.IndexOf(' ') >= 0 ? "\"" + v + "\"" : v;
|
||||
}
|
||||
|
||||
/// <summary>What the client can receive of <paramref name="value"/>: everything but its quote marks.</summary>
|
||||
public static string ClientValue(string? value) => (value ?? string.Empty).Replace("\"", string.Empty);
|
||||
|
||||
/// <summary>True when the client can't receive <paramref name="value"/> as it is (it has a quote mark).</summary>
|
||||
public static bool LosesCharacters(string? value) => !string.IsNullOrEmpty(value) && value.IndexOf('"') >= 0;
|
||||
|
||||
/// <summary>
|
||||
/// The arguments the client reads from <paramref name="commandLine"/>, by its own rules; null when it
|
||||
/// refuses the line (a quote left open). For tests, and for reading the client's -h the way it does.
|
||||
/// </summary>
|
||||
public static List<string>? Split(string? commandLine)
|
||||
{
|
||||
var args = new List<string>();
|
||||
if (commandLine == null)
|
||||
return null;
|
||||
var cur = new StringBuilder();
|
||||
bool inArg = false, quoted = false;
|
||||
foreach (char c in commandLine)
|
||||
{
|
||||
if (c == ' ' && !quoted)
|
||||
{
|
||||
if (inArg) { args.Add(cur.ToString()); cur.Clear(); inArg = false; }
|
||||
}
|
||||
else if (c == '"')
|
||||
{
|
||||
quoted = !quoted;
|
||||
}
|
||||
else
|
||||
{
|
||||
inArg = true;
|
||||
cur.Append(c);
|
||||
}
|
||||
}
|
||||
if (quoted)
|
||||
return null;
|
||||
if (inArg)
|
||||
args.Add(cur.ToString());
|
||||
return args;
|
||||
}
|
||||
}
|
||||
|
|
@ -128,27 +128,59 @@ internal sealed class AcLaunchArgumentBuilder
|
|||
return null;
|
||||
}
|
||||
|
||||
private static string Quote(string value)
|
||||
/// <summary>
|
||||
/// The switches the launcher writes itself from the account and its server profile (ACE and
|
||||
/// GDLE lines above). Extra Launch Arguments may not repeat them.
|
||||
/// </summary>
|
||||
public static readonly IReadOnlyList<string> LoginSwitches = ["-a", "-v", "-h", "-p", "-rodat"];
|
||||
|
||||
/// <summary>
|
||||
/// Checks the Runtime tab's "Extra Launch Arguments" and gives them as one line
|
||||
/// (<paramref name="normalized"/>) to put after each account's own arguments with
|
||||
/// <see cref="WithExtraArguments"/>. Null = fine (an empty box is fine); else why the launch
|
||||
/// can't go ahead, and <paramref name="normalized"/> is empty.
|
||||
///
|
||||
/// The box used to replace the whole command line, account, password and host included (and
|
||||
/// only for one manual launch at a time), though it was labelled "appended". It now appends,
|
||||
/// for every launch. So it may not carry the login switches (<see cref="LoginSwitches"/>): a
|
||||
/// saved old override would otherwise ride along on every account and could log each of them
|
||||
/// in as the override's account, or send their passwords to the override's host. Line breaks
|
||||
/// and tabs become spaces (the client splits on spaces only), and a quote left open is refused
|
||||
/// (the client would then drop the whole line, login included).
|
||||
/// </summary>
|
||||
public static string? ExtraArgumentsProblem(string? extra, out string normalized)
|
||||
{
|
||||
value ??= string.Empty;
|
||||
normalized = string.Empty;
|
||||
string line = (extra ?? string.Empty).Replace("\r\n", " ").Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' ').Trim();
|
||||
if (line.Length == 0)
|
||||
return null;
|
||||
|
||||
if (value.Length == 0)
|
||||
return "\"\"";
|
||||
List<string>? args = AcClientCommandLine.Split(line);
|
||||
if (args == null)
|
||||
return "Extra Launch Arguments have a quote mark left open; the client would ignore its whole command line, login included. Close or remove the quote.";
|
||||
|
||||
if (!NeedsQuoting(value))
|
||||
return value;
|
||||
|
||||
return "\"" + value.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\"";
|
||||
}
|
||||
|
||||
private static bool NeedsQuoting(string value)
|
||||
{
|
||||
foreach (char ch in value)
|
||||
foreach (string arg in args)
|
||||
{
|
||||
if (char.IsWhiteSpace(ch) || ch == '"')
|
||||
return true;
|
||||
foreach (string loginSwitch in LoginSwitches)
|
||||
{
|
||||
if (string.Equals(arg, loginSwitch, StringComparison.OrdinalIgnoreCase))
|
||||
return $"Extra Launch Arguments can't contain {loginSwitch}: the account and its server profile set " +
|
||||
$"{string.Join(", ", LoginSwitches)} themselves. Remove it (an old whole-line override goes in the account and server profiles now).";
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
normalized = line;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <paramref name="accountArguments"/> (from <see cref="BuildArguments"/> or
|
||||
/// <see cref="BuildMaskedArguments"/>) followed by extra arguments already checked by
|
||||
/// <see cref="ExtraArgumentsProblem"/>.
|
||||
/// </summary>
|
||||
public static string WithExtraArguments(string accountArguments, string normalizedExtra) =>
|
||||
string.IsNullOrWhiteSpace(normalizedExtra) ? accountArguments : accountArguments + " " + normalizedExtra;
|
||||
|
||||
/// <summary>One argument by acclient's own rules (AcClientCommandLine), not the C runtime's.</summary>
|
||||
private static string Quote(string value) => AcClientCommandLine.Token(value);
|
||||
}
|
||||
|
|
|
|||
226
src/RynthCore.App/AcWindowPlacementRule.cs
Normal file
226
src/RynthCore.App/AcWindowPlacementRule.cs
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RynthCore.App;
|
||||
|
||||
/// <summary>
|
||||
/// The launcher's per-account memory of where the AC window sits: what it puts back after the login,
|
||||
/// and when it writes a new rect to the profile. Pure: MainWindow does the window calls. Checked in
|
||||
/// tools\LauncherSettingsTests.
|
||||
///
|
||||
/// 2026-11-15, a #rynth-issues report, 2026-11-14 ("login changes resolution"): a few seconds after the
|
||||
/// login the window shrank, half the picture was cut off and the HUD could not be clicked; a second
|
||||
/// player saw it on mules but not on the main. The launcher had saved 1008x786 at (296,76) six seconds
|
||||
/// before the client closed (AC's logout / character-select window, 52.6% of the 1608x936 in-game area,
|
||||
/// so the old "under half" guard let it through), then put that size back on the next login. AC draws
|
||||
/// at its own resolution whatever the window size, so the smaller window crops the game and leaves the
|
||||
/// HUD outside the clickable area, and the resolution setting cannot be reached to fix it.
|
||||
/// So:
|
||||
/// - Only the position is ever put back. AC sizes its own window from its resolution setting (in the
|
||||
/// per-account UserPreferences.ini the prefs swap brings in); the launcher never resizes it. This
|
||||
/// replaces the 2026-10-27 put-back of a shrunk window (AcWindowRestoreRule), which resized it too.
|
||||
/// - The saved position is used only when the window is about the size it was saved at: a position
|
||||
/// saved for the small centred login window would put a full-size window half off the screen.
|
||||
/// It waits for the size to hold (<see cref="RestoreSettle"/>) and, while AC is still at its login
|
||||
/// size, for it to grow (<see cref="RestoreWatch"/>), then gives up.
|
||||
/// - The position is pulled onto a monitor's work area at the window's real size.
|
||||
/// - A new rect is saved only after it held for <see cref="StableFor"/>: the shrink right before
|
||||
/// the client closes, and AC's own moves at startup and portal-in, never reach the profile.
|
||||
/// The saved width and height are still written: they are what the size checks compare against.
|
||||
///
|
||||
/// 2026-11-15, report R-20261115-160655-1201: the engine's opt-in Remember Game Window Position
|
||||
/// (UI/AcWindowChrome) had the same bug and now uses this rule too (compiled into the engine, so keep
|
||||
/// it free of launcher types). While that option is on, the launcher leaves the window to the engine.
|
||||
/// </summary>
|
||||
internal static class AcWindowPlacementRule
|
||||
{
|
||||
/// <summary>A window rect: outer position and size, as GetWindowRect reports it.</summary>
|
||||
public readonly record struct Placement(int X, int Y, int Width, int Height);
|
||||
|
||||
/// <summary>A monitor's work area (the screen minus the taskbar).</summary>
|
||||
public readonly record struct WorkArea(int Left, int Top, int Right, int Bottom)
|
||||
{
|
||||
public int Width => Right - Left;
|
||||
public int Height => Bottom - Top;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// How long a new rect must hold before it is saved. AC's own moves (startup, the login window,
|
||||
/// portal-in) settle within a few seconds; the report's shrink came 6 s before the client closed.
|
||||
/// 30 s clears both with room, and the cost is small: a window moved and closed within 30 s keeps
|
||||
/// its old spot.
|
||||
/// </summary>
|
||||
public static readonly TimeSpan StableFor = TimeSpan.FromSeconds(30);
|
||||
|
||||
/// <summary>How long after the login the restore waits for AC to reach the saved size.</summary>
|
||||
public static readonly TimeSpan RestoreWatch = TimeSpan.FromSeconds(60);
|
||||
|
||||
/// <summary>
|
||||
/// How long the window's size must hold before the restore is decided: AC may still be growing its
|
||||
/// window from the login size to its resolution when the login is reported, and a position judged
|
||||
/// (and pulled onto the screen) at the passing size is wrong for the final one. Two 2 s launcher ticks.
|
||||
/// </summary>
|
||||
public static readonly TimeSpan RestoreSettle = TimeSpan.FromSeconds(4);
|
||||
|
||||
/// <summary>Pixels of change ignored (DWM frame fudge).</summary>
|
||||
public const int Tolerance = 2;
|
||||
|
||||
/// <summary>
|
||||
/// How far the outer rect may hang past the work area. Windows 10/11 frames have invisible resize
|
||||
/// borders (about 7 px at 100% scaling) outside the visible edge, so a window snapped to the screen
|
||||
/// edge reports (-7, 0); the report's own saves were (-4,1). Within this the spot is left alone.
|
||||
/// </summary>
|
||||
public const int EdgeSlack = 16;
|
||||
|
||||
/// <summary>The saved size and the window's are this close (each side within a quarter) for the saved position to apply.</summary>
|
||||
public static bool SizeMatches(int width, int height, int savedWidth, int savedHeight) =>
|
||||
savedWidth > 0 && savedHeight > 0 && width > 0 && height > 0
|
||||
&& Math.Abs(width - savedWidth) * 4L <= Math.Max(width, savedWidth)
|
||||
&& Math.Abs(height - savedHeight) * 4L <= Math.Max(height, savedHeight);
|
||||
|
||||
/// <summary>The window collapsed below half the reference in-game area: AC's login / character-select window.</summary>
|
||||
public static bool IsLoginShrink(int width, int height, int refWidth, int refHeight) =>
|
||||
refWidth > 0 && refHeight > 0 && (long)width * height * 2L < (long)refWidth * refHeight;
|
||||
|
||||
/// <summary>
|
||||
/// A rect worth looking at: big enough to be the game window, and not AC's startup parking spot at
|
||||
/// (-10000,-10000) (multi-monitor setups have negative coordinates, never this negative).
|
||||
/// </summary>
|
||||
public static bool IsCapturable(Placement p) => p.Width >= 200 && p.Height >= 200 && p.X >= -2000 && p.Y >= -2000;
|
||||
|
||||
public static bool Near(Placement a, Placement b) =>
|
||||
Math.Abs(a.X - b.X) <= Tolerance && Math.Abs(a.Y - b.Y) <= Tolerance
|
||||
&& Math.Abs(a.Width - b.Width) <= Tolerance && Math.Abs(a.Height - b.Height) <= Tolerance;
|
||||
|
||||
// ── Restore ───────────────────────────────────────────────────────────
|
||||
|
||||
public enum RestoreAction
|
||||
{
|
||||
/// <summary>AC is not at the saved size yet: look again next tick.</summary>
|
||||
Wait,
|
||||
/// <summary>Move the window to (X, Y), size untouched.</summary>
|
||||
Move,
|
||||
/// <summary>Leave the window where AC put it; the restore is over.</summary>
|
||||
Skip,
|
||||
}
|
||||
|
||||
public readonly record struct RestoreDecision(RestoreAction Action, int X, int Y, bool Clamped, string Why);
|
||||
|
||||
/// <summary>
|
||||
/// What to do with the saved position, given the window's current size, how long that size has
|
||||
/// held, the time since the login was first seen, and the monitors' work areas.
|
||||
/// </summary>
|
||||
public static RestoreDecision DecideRestore(Placement saved, int width, int height, TimeSpan sizeHeldFor,
|
||||
TimeSpan sinceLogin, IReadOnlyList<WorkArea> workAreas)
|
||||
{
|
||||
if (sizeHeldFor < RestoreSettle && sinceLogin <= RestoreWatch)
|
||||
return new RestoreDecision(RestoreAction.Wait, 0, 0, false, "window size still changing");
|
||||
if (!SizeMatches(width, height, saved.Width, saved.Height))
|
||||
{
|
||||
return sinceLogin <= RestoreWatch
|
||||
? new RestoreDecision(RestoreAction.Wait, 0, 0, false, "window not at the saved size yet")
|
||||
: new RestoreDecision(RestoreAction.Skip, 0, 0, false,
|
||||
$"window is {width}x{height}, the position was saved for {saved.Width}x{saved.Height}");
|
||||
}
|
||||
if (workAreas.Count == 0)
|
||||
return new RestoreDecision(RestoreAction.Skip, 0, 0, false, "no monitor information");
|
||||
|
||||
(int x, int y) = ClampToWorkArea(saved.X, saved.Y, width, height, workAreas);
|
||||
bool clamped = x != saved.X || y != saved.Y;
|
||||
return new RestoreDecision(RestoreAction.Move, x, y, clamped, clamped ? "pulled onto the screen" : "saved position");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The position nearest (x, y) at which a width x height window lies on a work area (give or take
|
||||
/// <see cref="EdgeSlack"/>): the area it overlaps most, else the nearest one. A window wider or taller
|
||||
/// than the area goes to its left / top edge, so the title bar stays reachable.
|
||||
/// </summary>
|
||||
public static (int X, int Y) ClampToWorkArea(int x, int y, int width, int height, IReadOnlyList<WorkArea> workAreas)
|
||||
{
|
||||
if (workAreas.Count == 0) return (x, y);
|
||||
WorkArea a = PickArea(x, y, width, height, workAreas);
|
||||
return (ClampAxis(x, width, a.Left, a.Right), ClampAxis(y, height, a.Top, a.Bottom));
|
||||
}
|
||||
|
||||
private static int ClampAxis(int pos, int size, int lo, int hi)
|
||||
{
|
||||
int min = lo - EdgeSlack;
|
||||
int max = hi - size + EdgeSlack;
|
||||
if (max < min) return lo; // bigger than the area: pin the leading edge
|
||||
return Math.Clamp(pos, min, max);
|
||||
}
|
||||
|
||||
private static WorkArea PickArea(int x, int y, int width, int height, IReadOnlyList<WorkArea> areas)
|
||||
{
|
||||
WorkArea best = areas[0];
|
||||
long bestOverlap = -1;
|
||||
foreach (WorkArea a in areas)
|
||||
{
|
||||
long ow = Math.Min(x + width, a.Right) - Math.Max(x, a.Left);
|
||||
long oh = Math.Min(y + height, a.Bottom) - Math.Max(y, a.Top);
|
||||
long overlap = ow > 0 && oh > 0 ? ow * oh : 0;
|
||||
if (overlap > bestOverlap) { bestOverlap = overlap; best = a; }
|
||||
}
|
||||
if (bestOverlap > 0) return best;
|
||||
|
||||
// Entirely off every monitor: the area nearest the window's centre.
|
||||
long cx = x + width / 2, cy = y + height / 2;
|
||||
long bestDist = long.MaxValue;
|
||||
foreach (WorkArea a in areas)
|
||||
{
|
||||
long dx = cx < a.Left ? a.Left - cx : cx > a.Right ? cx - a.Right : 0;
|
||||
long dy = cy < a.Top ? a.Top - cy : cy > a.Bottom ? cy - a.Bottom : 0;
|
||||
long d = dx * dx + dy * dy;
|
||||
if (d < bestDist) { bestDist = d; best = a; }
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
// ── Save ──────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>A rect that differs from the saved one, and since when it has held.</summary>
|
||||
public sealed record Pending(Placement Rect, DateTime SinceUtc);
|
||||
|
||||
public enum SaveAction
|
||||
{
|
||||
/// <summary>Nothing new: not capturable, or the same as the reference.</summary>
|
||||
None,
|
||||
/// <summary>A new rect, not held for <see cref="StableFor"/> yet.</summary>
|
||||
Waiting,
|
||||
/// <summary>AC's login / character-select window: never saved.</summary>
|
||||
LoginShrink,
|
||||
/// <summary>Held long enough: write it to the profile.</summary>
|
||||
Save,
|
||||
}
|
||||
|
||||
/// <param name="FirstSeen">The rect just changed (for logging once instead of every tick).</param>
|
||||
public readonly record struct SaveDecision(SaveAction Action, bool FirstSeen);
|
||||
|
||||
/// <summary>
|
||||
/// One tick of the save tracker. <paramref name="reference"/> is the saved rect, else the first rect
|
||||
/// seen after the login (so AC's own placement is never saved until the player moves the window).
|
||||
/// <paramref name="pending"/> is the tracker's state, kept per client by the caller.
|
||||
/// </summary>
|
||||
public static SaveDecision DecideSave(Placement current, Placement? reference, ref Pending? pending, DateTime nowUtc)
|
||||
{
|
||||
if (!IsCapturable(current))
|
||||
return new SaveDecision(SaveAction.None, false);
|
||||
if (reference is Placement r && Near(current, r))
|
||||
{
|
||||
pending = null; // back where it was: a shrink that came and went is forgotten
|
||||
return new SaveDecision(SaveAction.None, false);
|
||||
}
|
||||
|
||||
bool firstSeen = pending is null || !Near(pending.Rect, current);
|
||||
if (firstSeen)
|
||||
pending = new Pending(current, nowUtc);
|
||||
|
||||
if (reference is Placement rr && IsLoginShrink(current.Width, current.Height, rr.Width, rr.Height))
|
||||
return new SaveDecision(SaveAction.LoginShrink, firstSeen);
|
||||
if (nowUtc - pending!.SinceUtc < StableFor)
|
||||
return new SaveDecision(SaveAction.Waiting, firstSeen);
|
||||
|
||||
pending = null;
|
||||
return new SaveDecision(SaveAction.Save, firstSeen);
|
||||
}
|
||||
}
|
||||
81
src/RynthCore.App/AccountServerRules.cs
Normal file
81
src/RynthCore.App/AccountServerRules.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace RynthCore.App;
|
||||
|
||||
/// <summary>
|
||||
/// Which server an account logs on to, and when a server profile may be deleted. Pure: no UI,
|
||||
/// no files.
|
||||
///
|
||||
/// An account's name and password belong to one server, so an account only ever resolves to the
|
||||
/// server profile it names (<see cref="LaunchAccountProfile.ServerId"/>). There is no fallback to
|
||||
/// the selected or the first server: that fallback re-pointed every account of a deleted server
|
||||
/// at another one and saved it, so the next launch (or an automatic relaunch within seconds) sent
|
||||
/// one server's account name and password to a different server's operator, with nothing on
|
||||
/// screen (structural audit 2026-10-21, F2). An account whose server profile is missing has no
|
||||
/// server until the player picks one in its editor, and it doesn't launch.
|
||||
///
|
||||
/// Deleting a server that accounts still use is refused, with the accounts named, rather than
|
||||
/// leaving them with no server. Refusing changes nothing behind the player's back: they move each
|
||||
/// account to its new server (or delete it) and then delete the server. The other choice, clearing
|
||||
/// the accounts' server, would quietly stop checked accounts from auto-launching (overnight
|
||||
/// multi-boxing) with only a line in Activity. The no-server rule above stays as the backstop for
|
||||
/// accounts whose server went some other way (settings copied from another PC, a second
|
||||
/// launcher, a hand edit).
|
||||
/// </summary>
|
||||
internal static class AccountServerRules
|
||||
{
|
||||
/// <summary>
|
||||
/// The server profile <paramref name="account"/> names, or null when it names none or one
|
||||
/// that isn't in <paramref name="servers"/>. Never another server.
|
||||
/// </summary>
|
||||
public static LaunchServerProfile? ServerFor(LaunchAccountProfile account, IEnumerable<LaunchServerProfile> servers)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(account);
|
||||
string id = account.ServerId?.Trim() ?? string.Empty;
|
||||
if (id.Length == 0 || servers == null)
|
||||
return null;
|
||||
return servers.FirstOrDefault(s => s != null && string.Equals(s.Id, id, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
/// <summary>The accounts that log on to <paramref name="server"/>.</summary>
|
||||
public static List<LaunchAccountProfile> AccountsOn(LaunchServerProfile server, IEnumerable<LaunchAccountProfile> accounts)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(server);
|
||||
if (accounts == null || string.IsNullOrWhiteSpace(server.Id))
|
||||
return [];
|
||||
return accounts
|
||||
.Where(a => a != null && string.Equals(a.ServerId?.Trim(), server.Id.Trim(), StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Why <paramref name="server"/> can't be deleted (it names the accounts that use it), or null
|
||||
/// when no account uses it.
|
||||
/// </summary>
|
||||
public static string? DeleteBlocker(LaunchServerProfile server, IEnumerable<LaunchAccountProfile> accounts)
|
||||
{
|
||||
List<LaunchAccountProfile> users = AccountsOn(server, accounts);
|
||||
if (users.Count == 0)
|
||||
return null;
|
||||
|
||||
const int MaxNamed = 8;
|
||||
IEnumerable<string> names = users.Take(MaxNamed).Select(a => " - " + a.DisplayName);
|
||||
string more = users.Count > MaxNamed ? $"\n ...and {users.Count - MaxNamed} more" : string.Empty;
|
||||
return $"{server.DisplayName} can't be deleted while {users.Count} account(s) log on to it:\n" +
|
||||
string.Join("\n", names) + more + "\n\n" +
|
||||
"Their names and passwords belong to that server, so they are never moved to another one for you. " +
|
||||
"Edit each account and pick its server (or delete the account), then delete the server.";
|
||||
}
|
||||
|
||||
/// <summary>Why <paramref name="account"/> can't launch: it has no server profile.</summary>
|
||||
public static string NoServerMessage(LaunchAccountProfile account, bool anyServerProfiles)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(account);
|
||||
return anyServerProfiles
|
||||
? $"account '{account.AccountName}' has no server (its server profile was deleted or never set). " +
|
||||
"Edit the account and pick the server it logs on to; it isn't sent to another server in the meantime."
|
||||
: $"account '{account.AccountName}' has no server. Add a server profile, then edit the account and pick it.";
|
||||
}
|
||||
}
|
||||
|
|
@ -89,6 +89,25 @@ internal sealed class AppSettings
|
|||
/// </summary>
|
||||
public string? AppliedInstallerPluginRegistration { get; set; }
|
||||
|
||||
// ── Headless accounts (InjectionMode.Headless, experimental; HeadlessLaunch) ──
|
||||
// Plain values with "use the default" defaults: launchers without Headless ignore them.
|
||||
|
||||
/// rynth-headless.exe. Empty = <launcher folder>\Headless\rynth-headless.exe.
|
||||
public string HeadlessExePath { get; set; } = string.Empty;
|
||||
|
||||
/// Plugin DLLs every Headless account loads. x64 builds (rynth-headless is a 64-bit
|
||||
/// process), not the x86 ones in PluginDllPaths. Empty = the ones the installer ships in
|
||||
/// <launcher folder>\Headless\plugins (HeadlessLaunch.DefaultPluginPaths: RynthAi).
|
||||
public List<string> HeadlessPluginPaths { get; set; } = [];
|
||||
|
||||
/// The plugins' RynthSuite folder (the run config's suiteDir). Empty = rynth-headless's default,
|
||||
/// %LOCALAPPDATA%\RynthCore\headless.
|
||||
public string HeadlessSuiteDir { get; set; } = string.Empty;
|
||||
|
||||
/// Where rynth-headless writes per-character status files (statusDir). Empty = its default,
|
||||
/// <RynthCore>\Logs\status (the game clients' and the StatusAgent's folder).
|
||||
public string HeadlessStatusDir { get; set; } = string.Empty;
|
||||
|
||||
public List<LaunchServerProfile> ServerProfiles { get; set; } = [];
|
||||
public List<LaunchAccountProfile> AccountProfiles { get; set; } = [];
|
||||
|
||||
|
|
@ -96,4 +115,10 @@ internal sealed class AppSettings
|
|||
public double? WindowY { get; set; }
|
||||
public double? WindowWidth { get; set; }
|
||||
public double? WindowHeight { get; set; }
|
||||
|
||||
/// The Headless window's last size and place (HeadlessWindow; null = default, centred).
|
||||
public double? HeadlessWindowX { get; set; }
|
||||
public double? HeadlessWindowY { get; set; }
|
||||
public double? HeadlessWindowWidth { get; set; }
|
||||
public double? HeadlessWindowHeight { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ internal static class AppSettingsStore
|
|||
Converters =
|
||||
{
|
||||
// Before the general enum converter: InjectionMode is written so that every
|
||||
// launcher can read it ("Decal + RynthCore" lives in decal-accounts.json).
|
||||
// launcher can read it ("Decal + RynthCore" lives in decal-accounts.json,
|
||||
// Headless in headless-accounts.json).
|
||||
new SharedInjectionModeConverter(),
|
||||
new JsonStringEnumConverter()
|
||||
}
|
||||
|
|
@ -30,6 +31,13 @@ internal static class AppSettingsStore
|
|||
private static string SettingsPath => Path.Combine(SettingsDirectory, "appsettings.json");
|
||||
private static string BackupPath => SettingsPath + ".bak";
|
||||
private static string DecalAccountsPath => DecalAccountModes.PathIn(SettingsDirectory);
|
||||
private static string HeadlessAccountsPath => HeadlessAccountModes.PathIn(SettingsDirectory);
|
||||
|
||||
/// <summary>
|
||||
/// The folder appsettings.json lives in (%APPDATA%\RynthCore, or <see cref="DirectoryOverride"/>).
|
||||
/// Other launcher files that tests redirect along with it go here too (the headless run configs).
|
||||
/// </summary>
|
||||
internal static string SettingsDirectoryPath => SettingsDirectory;
|
||||
|
||||
/// <summary>
|
||||
/// Set when the last Load() hit a corrupt/unreadable file (quarantined it,
|
||||
|
|
@ -42,7 +50,8 @@ internal static class AppSettingsStore
|
|||
/// <summary>
|
||||
/// Set when the last Load() moved "Decal + RynthCore" accounts out of appsettings.json
|
||||
/// into decal-accounts.json (a file written by a pre-release Decal bridge build), or found
|
||||
/// decal-accounts.json unreadable. Null otherwise.
|
||||
/// decal-accounts.json unreadable; the same for Headless accounts and headless-accounts.json.
|
||||
/// Null otherwise.
|
||||
/// </summary>
|
||||
public static string? LastMigrationNote { get; private set; }
|
||||
|
||||
|
|
@ -65,9 +74,10 @@ internal static class AppSettingsStore
|
|||
LastMigrationNote = null;
|
||||
LastPasswordMigrationNote = null;
|
||||
LastPasswordProblemNote = null;
|
||||
// Passwords after the Decal accounts: a save before ApplyDecalAccounts would drop
|
||||
// decal-accounts.json (every account still reads as RynthCore at that point).
|
||||
AppSettings settings = ApplyDecalAccounts(LoadShared());
|
||||
// Passwords after the Decal and Headless accounts: a save before ApplyAccountModeFiles
|
||||
// would drop decal-accounts.json and headless-accounts.json (every account still reads
|
||||
// as RynthCore at that point).
|
||||
AppSettings settings = ApplyAccountModeFiles(LoadShared());
|
||||
MigratePasswords(settings);
|
||||
return settings;
|
||||
}
|
||||
|
|
@ -208,36 +218,47 @@ internal static class AppSettingsStore
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Puts back the "Decal + RynthCore" accounts listed in decal-accounts.json (those that
|
||||
/// appsettings.json still lists as RynthCore). An appsettings.json that itself says
|
||||
/// "DecalBridge" (written by a pre-release bridge build) is rewritten at once, .bak
|
||||
/// included, so no launcher finds that value there again.
|
||||
/// Puts back the "Decal + RynthCore" accounts listed in decal-accounts.json and the Headless
|
||||
/// accounts listed in headless-accounts.json (those that appsettings.json still lists as
|
||||
/// RynthCore; an id in both files is Decal + RynthCore). An appsettings.json that itself says
|
||||
/// "DecalBridge" (written by a pre-release bridge build) or "Headless" is rewritten at once,
|
||||
/// .bak included, so no launcher finds that value there again.
|
||||
/// </summary>
|
||||
private static AppSettings ApplyDecalAccounts(AppSettings settings)
|
||||
private static AppSettings ApplyAccountModeFiles(AppSettings settings)
|
||||
{
|
||||
List<LaunchAccountProfile> accounts = settings.AccountProfiles ?? new List<LaunchAccountProfile>();
|
||||
int legacy = accounts.Count(a => a.InjectionMode == InjectionMode.DecalBridge);
|
||||
int legacyDecal = accounts.Count(a => a.InjectionMode == InjectionMode.DecalBridge);
|
||||
int legacyHeadless = accounts.Count(a => a.InjectionMode == InjectionMode.Headless);
|
||||
|
||||
HashSet<string> ids = DecalAccountModes.ReadIds(DecalAccountsPath, out string? error);
|
||||
if (error != null)
|
||||
LastMigrationNote = error;
|
||||
HashSet<string> decalIds = DecalAccountModes.ReadIds(DecalAccountsPath, out string? decalError);
|
||||
HashSet<string> headlessIds = HeadlessAccountModes.ReadIds(HeadlessAccountsPath, out string? headlessError);
|
||||
if (decalError != null || headlessError != null)
|
||||
LastMigrationNote = string.Join(" ", new[] { decalError, headlessError }.Where(e => e != null));
|
||||
foreach (LaunchAccountProfile account in accounts)
|
||||
if (DecalAccountModes.IsDecalBridge(ids, account.Id, account.InjectionMode))
|
||||
account.InjectionMode = InjectionMode.DecalBridge;
|
||||
|
||||
if (legacy > 0)
|
||||
{
|
||||
if (DecalAccountModes.IsDecalBridge(decalIds, account.Id, account.InjectionMode))
|
||||
account.InjectionMode = InjectionMode.DecalBridge;
|
||||
else if (HeadlessAccountModes.IsHeadless(headlessIds, account.Id, account.InjectionMode))
|
||||
account.InjectionMode = InjectionMode.Headless;
|
||||
}
|
||||
|
||||
if (legacyDecal + legacyHeadless > 0)
|
||||
{
|
||||
var moved = new List<string>(2);
|
||||
if (legacyDecal > 0)
|
||||
moved.Add($"{legacyDecal} \"Decal + RynthCore\" account(s) to {DecalAccountModes.FileName}");
|
||||
if (legacyHeadless > 0)
|
||||
moved.Add($"{legacyHeadless} Headless account(s) to {HeadlessAccountModes.FileName}");
|
||||
string what = string.Join(" and ", moved);
|
||||
try
|
||||
{
|
||||
Save(settings);
|
||||
File.Copy(SettingsPath, BackupPath, overwrite: true);
|
||||
LastMigrationNote = $"Moved {legacy} \"Decal + RynthCore\" account(s) from appsettings.json to " +
|
||||
$"{DecalAccountModes.FileName}, so older launchers can still read appsettings.json.";
|
||||
LastMigrationNote = $"Moved {what} from appsettings.json, so older launchers can still read appsettings.json.";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LastMigrationNote = $"Could not move \"Decal + RynthCore\" accounts to {DecalAccountModes.FileName} " +
|
||||
$"({ex.GetType().Name}: {ex.Message}); the next save retries.";
|
||||
LastMigrationNote = $"Could not move {what} ({ex.GetType().Name}: {ex.Message}); the next save retries.";
|
||||
}
|
||||
}
|
||||
return settings;
|
||||
|
|
@ -245,13 +266,15 @@ internal static class AppSettingsStore
|
|||
|
||||
public static void Save(AppSettings settings)
|
||||
{
|
||||
// "Decal + RynthCore" accounts go to decal-accounts.json first; appsettings.json
|
||||
// lists them as RynthCore (SharedInjectionModeConverter).
|
||||
// "Decal + RynthCore" accounts go to decal-accounts.json and Headless accounts to
|
||||
// headless-accounts.json first; appsettings.json lists both as RynthCore
|
||||
// (SharedInjectionModeConverter).
|
||||
Directory.CreateDirectory(SettingsDirectory);
|
||||
List<LaunchAccountProfile> accounts = settings.AccountProfiles ?? new List<LaunchAccountProfile>();
|
||||
DecalAccountModes.WriteIds(DecalAccountsPath,
|
||||
(settings.AccountProfiles ?? new List<LaunchAccountProfile>())
|
||||
.Where(a => a.InjectionMode == InjectionMode.DecalBridge)
|
||||
.Select(a => a.Id));
|
||||
accounts.Where(a => a.InjectionMode == InjectionMode.DecalBridge).Select(a => a.Id));
|
||||
HeadlessAccountModes.WriteIds(HeadlessAccountsPath,
|
||||
accounts.Where(a => a.InjectionMode == InjectionMode.Headless).Select(a => a.Id));
|
||||
|
||||
// Atomic write: serialize to a temp file, then swap it in. A crash or
|
||||
// power cut mid-write can no longer truncate the live file (which holds
|
||||
|
|
@ -266,9 +289,9 @@ internal static class AppSettingsStore
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// InjectionMode in appsettings.json. Writes only names every launcher knows: DecalBridge is
|
||||
/// written as <see cref="DecalAccountModes.SharedMode"/> (decal-accounts.json holds the real
|
||||
/// choice). Reads names and numbers; a name or number this build doesn't know reads as RynthCore
|
||||
/// InjectionMode in appsettings.json. Writes only names every launcher knows: DecalBridge and
|
||||
/// Headless are written as <see cref="AccountModeSidecar.SharedMode"/> (decal-accounts.json and
|
||||
/// headless-accounts.json hold the real choice). Reads names and numbers; a name or number this build doesn't know reads as RynthCore
|
||||
/// instead of making the whole file unreadable.
|
||||
/// </summary>
|
||||
private sealed class SharedInjectionModeConverter : JsonConverter<InjectionMode>
|
||||
|
|
@ -288,7 +311,9 @@ internal static class AppSettingsStore
|
|||
|
||||
public override void Write(Utf8JsonWriter writer, InjectionMode value, JsonSerializerOptions options)
|
||||
{
|
||||
InjectionMode shared = value == InjectionMode.DecalBridge ? DecalAccountModes.SharedMode : value;
|
||||
InjectionMode shared = value is InjectionMode.DecalBridge or InjectionMode.Headless
|
||||
? AccountModeSidecar.SharedMode
|
||||
: value;
|
||||
writer.WriteStringValue(shared.ToString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,38 +21,80 @@ namespace RynthCore.App;
|
|||
/// An entry only counts while appsettings.json still says RynthCore for that account: an older
|
||||
/// launcher that switched the account to Decal (or that deleted it) wins, and the next save of a
|
||||
/// newer launcher drops the stale entry. Shared with the injector (LaunchCommand).
|
||||
/// "Headless" accounts follow the same rules in a file of their own (HeadlessAccountModes.cs).
|
||||
/// </summary>
|
||||
internal static class DecalAccountModes
|
||||
{
|
||||
public const string FileName = "decal-accounts.json";
|
||||
|
||||
/// <summary>What appsettings.json says for a "Decal + RynthCore" account.</summary>
|
||||
public const InjectionMode SharedMode = InjectionMode.RynthCore;
|
||||
public const InjectionMode SharedMode = AccountModeSidecar.SharedMode;
|
||||
|
||||
private const int SchemaVersion = 1;
|
||||
|
||||
private const string Note =
|
||||
private static readonly AccountModeSidecar Sidecar = new(
|
||||
FileName,
|
||||
"DecalBridgeAccountIds",
|
||||
"Accounts the RynthCore launcher runs as \"Decal + RynthCore\" (experimental). " +
|
||||
"appsettings.json lists them as RynthCore, so launchers without that mode can still read it. " +
|
||||
"Delete this file to set them all back to RynthCore.";
|
||||
"Delete this file to set them all back to RynthCore.");
|
||||
|
||||
private sealed class FileModel
|
||||
{
|
||||
public int Version { get; set; } = SchemaVersion;
|
||||
public string Note { get; set; } = DecalAccountModes.Note;
|
||||
public List<string> DecalBridgeAccountIds { get; set; } = new();
|
||||
}
|
||||
|
||||
private static readonly JsonSerializerOptions WriteOptions = new() { WriteIndented = true };
|
||||
|
||||
public static string PathIn(string settingsDirectory) => Path.Combine(settingsDirectory, FileName);
|
||||
public static string PathIn(string settingsDirectory) => Sidecar.PathIn(settingsDirectory);
|
||||
|
||||
/// <summary>
|
||||
/// The account ids listed in <paramref name="path"/>. An absent file is an empty set; an
|
||||
/// unreadable one too, with the reason in <paramref name="error"/> (the accounts then run
|
||||
/// as appsettings.json says, which is RynthCore).
|
||||
/// </summary>
|
||||
public static HashSet<string> ReadIds(string path, out string? error)
|
||||
public static HashSet<string> ReadIds(string path, out string? error) => Sidecar.ReadIds(path, out error);
|
||||
|
||||
/// <summary>
|
||||
/// True when an account that appsettings.json lists with <paramref name="sharedMode"/> is a
|
||||
/// "Decal + RynthCore" account: it is in <paramref name="ids"/> and still says RynthCore.
|
||||
/// </summary>
|
||||
public static bool IsDecalBridge(IReadOnlySet<string> ids, string? accountId, InjectionMode sharedMode) =>
|
||||
AccountModeSidecar.Lists(ids, accountId, sharedMode);
|
||||
|
||||
/// <summary>
|
||||
/// Records <paramref name="ids"/> as the "Decal + RynthCore" accounts. Writes only when the
|
||||
/// list changed; with no accounts left, the file is removed. Atomic (temp file + swap).
|
||||
/// </summary>
|
||||
public static void WriteIds(string path, IEnumerable<string> ids) => Sidecar.WriteIds(path, ids);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One file beside appsettings.json listing the account ids that really run in a mode older
|
||||
/// launchers don't know (appsettings.json says <see cref="SharedMode"/> for them). Used by
|
||||
/// DecalAccountModes (decal-accounts.json) and HeadlessAccountModes (headless-accounts.json).
|
||||
/// Each mode has a file of its own, so a launcher that knows only one of them never rewrites the
|
||||
/// other's list. File: { "Version": 1, "Note": "...", "<IdsProperty>": [ "id", ... ] }.
|
||||
/// </summary>
|
||||
internal sealed class AccountModeSidecar
|
||||
{
|
||||
/// <summary>What appsettings.json says for an account listed in a sidecar.</summary>
|
||||
public const InjectionMode SharedMode = InjectionMode.RynthCore;
|
||||
|
||||
private const int SchemaVersion = 1;
|
||||
|
||||
private static readonly JsonWriterOptions WriteOptions = new() { Indented = true };
|
||||
|
||||
public AccountModeSidecar(string fileName, string idsProperty, string note)
|
||||
{
|
||||
FileName = fileName;
|
||||
IdsProperty = idsProperty;
|
||||
Note = note;
|
||||
}
|
||||
|
||||
public string FileName { get; }
|
||||
public string IdsProperty { get; }
|
||||
public string Note { get; }
|
||||
|
||||
public string PathIn(string settingsDirectory) => Path.Combine(settingsDirectory, FileName);
|
||||
|
||||
/// <summary>True when <paramref name="accountId"/> is in <paramref name="ids"/> and appsettings.json still says RynthCore for it.</summary>
|
||||
public static bool Lists(IReadOnlySet<string> ids, string? accountId, InjectionMode sharedMode) =>
|
||||
sharedMode == SharedMode && !string.IsNullOrEmpty(accountId) && ids.Contains(accountId);
|
||||
|
||||
/// <summary>The ids listed in <paramref name="path"/>: absent = none; unreadable = none, with the reason in <paramref name="error"/>.</summary>
|
||||
public HashSet<string> ReadIds(string path, out string? error)
|
||||
{
|
||||
error = null;
|
||||
var ids = new HashSet<string>(StringComparer.Ordinal);
|
||||
|
|
@ -60,10 +102,26 @@ internal static class DecalAccountModes
|
|||
{
|
||||
if (!File.Exists(path))
|
||||
return ids;
|
||||
FileModel? model = JsonSerializer.Deserialize<FileModel>(File.ReadAllText(path));
|
||||
foreach (string id in model?.DecalBridgeAccountIds ?? new List<string>())
|
||||
using JsonDocument document = JsonDocument.Parse(File.ReadAllText(path));
|
||||
JsonElement root = document.RootElement;
|
||||
if (root.ValueKind == JsonValueKind.Null)
|
||||
return ids;
|
||||
if (root.ValueKind != JsonValueKind.Object)
|
||||
throw new JsonException($"expected an object, found {root.ValueKind}");
|
||||
if (!root.TryGetProperty(IdsProperty, out JsonElement list) || list.ValueKind == JsonValueKind.Null)
|
||||
return ids;
|
||||
if (list.ValueKind != JsonValueKind.Array)
|
||||
throw new JsonException($"{IdsProperty}: expected a list, found {list.ValueKind}");
|
||||
foreach (JsonElement item in list.EnumerateArray())
|
||||
{
|
||||
if (item.ValueKind == JsonValueKind.Null)
|
||||
continue;
|
||||
if (item.ValueKind != JsonValueKind.String)
|
||||
throw new JsonException($"{IdsProperty}: expected text, found {item.ValueKind}");
|
||||
string? id = item.GetString();
|
||||
if (!string.IsNullOrWhiteSpace(id))
|
||||
ids.Add(id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -75,17 +133,10 @@ internal static class DecalAccountModes
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// True when an account that appsettings.json lists with <paramref name="sharedMode"/> is a
|
||||
/// "Decal + RynthCore" account: it is in <paramref name="ids"/> and still says RynthCore.
|
||||
/// Records <paramref name="ids"/>. Writes only when the list changed; with no accounts left,
|
||||
/// the file is removed. Atomic (temp file + swap).
|
||||
/// </summary>
|
||||
public static bool IsDecalBridge(IReadOnlySet<string> ids, string? accountId, InjectionMode sharedMode) =>
|
||||
sharedMode == SharedMode && !string.IsNullOrEmpty(accountId) && ids.Contains(accountId);
|
||||
|
||||
/// <summary>
|
||||
/// Records <paramref name="ids"/> as the "Decal + RynthCore" accounts. Writes only when the
|
||||
/// list changed; with no accounts left, the file is removed. Atomic (temp file + swap).
|
||||
/// </summary>
|
||||
public static void WriteIds(string path, IEnumerable<string> ids)
|
||||
public void WriteIds(string path, IEnumerable<string> ids)
|
||||
{
|
||||
List<string> sorted = ids.Where(id => !string.IsNullOrWhiteSpace(id))
|
||||
.Distinct(StringComparer.Ordinal)
|
||||
|
|
@ -107,7 +158,18 @@ internal static class DecalAccountModes
|
|||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
|
||||
string tmp = path + ".tmp";
|
||||
File.WriteAllText(tmp, JsonSerializer.Serialize(new FileModel { DecalBridgeAccountIds = sorted }, WriteOptions));
|
||||
using (var stream = new FileStream(tmp, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||
using (var writer = new Utf8JsonWriter(stream, WriteOptions))
|
||||
{
|
||||
writer.WriteStartObject();
|
||||
writer.WriteNumber("Version", SchemaVersion);
|
||||
writer.WriteString("Note", Note);
|
||||
writer.WriteStartArray(IdsProperty);
|
||||
foreach (string id in sorted)
|
||||
writer.WriteStringValue(id);
|
||||
writer.WriteEndArray();
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
File.Move(tmp, path, overwrite: true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
43
src/RynthCore.App/HeadlessAccountModes.cs
Normal file
43
src/RynthCore.App/HeadlessAccountModes.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace RynthCore.App;
|
||||
|
||||
/// <summary>
|
||||
/// Which accounts run headless (<see cref="InjectionMode.Headless"/>: rynth-headless.exe instead
|
||||
/// of acclient.exe), kept in <c>headless-accounts.json</c> next to appsettings.json and keyed by
|
||||
/// account profile id. The same arrangement as "Decal + RynthCore" (DecalAccountModes, which
|
||||
/// explains why): appsettings.json lists a Headless account as RynthCore, so every launcher and
|
||||
/// the injector can still read it, and this file says which of those are really Headless. An
|
||||
/// entry only counts while appsettings.json still says RynthCore for that account.
|
||||
///
|
||||
/// A file of its own rather than a second list in decal-accounts.json: a launcher that knows the
|
||||
/// Decal bridge but not Headless rewrites decal-accounts.json with only its own list, and would
|
||||
/// drop the Headless one. It never touches this file. (Such a launcher launches a Headless
|
||||
/// account as RynthCore in acclient.exe, which is what its appsettings.json entry says.)
|
||||
/// </summary>
|
||||
internal static class HeadlessAccountModes
|
||||
{
|
||||
public const string FileName = "headless-accounts.json";
|
||||
|
||||
/// <summary>What appsettings.json says for a Headless account.</summary>
|
||||
public const InjectionMode SharedMode = AccountModeSidecar.SharedMode;
|
||||
|
||||
private static readonly AccountModeSidecar Sidecar = new(
|
||||
FileName,
|
||||
"HeadlessAccountIds",
|
||||
"Accounts the RynthCore launcher runs headless (rynth-headless.exe, experimental). " +
|
||||
"appsettings.json lists them as RynthCore, so launchers without that mode can still read it. " +
|
||||
"Delete this file to set them all back to RynthCore.");
|
||||
|
||||
public static string PathIn(string settingsDirectory) => Sidecar.PathIn(settingsDirectory);
|
||||
|
||||
/// <summary>The account ids listed in <paramref name="path"/> (absent or unreadable = none; see <paramref name="error"/>).</summary>
|
||||
public static HashSet<string> ReadIds(string path, out string? error) => Sidecar.ReadIds(path, out error);
|
||||
|
||||
/// <summary>True when an account appsettings.json lists with <paramref name="sharedMode"/> is a Headless account.</summary>
|
||||
public static bool IsHeadless(IReadOnlySet<string> ids, string? accountId, InjectionMode sharedMode) =>
|
||||
AccountModeSidecar.Lists(ids, accountId, sharedMode);
|
||||
|
||||
/// <summary>Records <paramref name="ids"/> as the Headless accounts (only when changed; none left = file removed).</summary>
|
||||
public static void WriteIds(string path, IEnumerable<string> ids) => Sidecar.WriteIds(path, ids);
|
||||
}
|
||||
252
src/RynthCore.App/HeadlessLaunch.cs
Normal file
252
src/RynthCore.App/HeadlessLaunch.cs
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
|
||||
namespace RynthCore.App;
|
||||
|
||||
/// <summary>One character of a headless run config (one "sessions" entry).</summary>
|
||||
internal sealed class HeadlessSessionSpec
|
||||
{
|
||||
/// <summary>LaunchAccountProfile.Id: rynth-headless --launcher reads that profile's saved password.</summary>
|
||||
public string LauncherProfileId { get; set; } = string.Empty;
|
||||
public string Account { get; set; } = string.Empty;
|
||||
/// <summary>The character to log in; null/empty = rynth-headless picks.</summary>
|
||||
public string? Character { get; set; }
|
||||
/// <summary>Chat commands sent after login (the account's OnLogin commands for that character).</summary>
|
||||
public List<string> Commands { get; set; } = new();
|
||||
/// <summary>0 = stay until stopped.</summary>
|
||||
public int StaySeconds { get; set; }
|
||||
public bool Reconnect { get; set; } = true;
|
||||
}
|
||||
|
||||
/// <summary>What one rynth-headless process runs: the server, the plugins and its characters.</summary>
|
||||
internal sealed class HeadlessRunSpec
|
||||
{
|
||||
public string Host { get; set; } = string.Empty;
|
||||
public int Port { get; set; }
|
||||
/// <summary>The launcher's server profile Name (what session files and the account keys use).</summary>
|
||||
public string ServerName { get; set; } = string.Empty;
|
||||
/// <summary>Empty = left out, so rynth-headless uses its default.</summary>
|
||||
public string SuiteDir { get; set; } = string.Empty;
|
||||
/// <summary>Empty = left out, so rynth-headless uses its default.</summary>
|
||||
public string StatusDir { get; set; } = string.Empty;
|
||||
public List<string> Plugins { get; set; } = new();
|
||||
public List<HeadlessSessionSpec> Sessions { get; set; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The launcher side of <see cref="InjectionMode.Headless"/>, without the UI: where
|
||||
/// rynth-headless.exe is, the run config the launcher writes for an account, its command line,
|
||||
/// and the stop channel. BCL only: rynth-headless (src\RynthCore.Headless.Cli) compiles this file
|
||||
/// too, so both sides agree on the stop event's name.
|
||||
///
|
||||
/// The launcher runs one rynth-headless process per Headless account:
|
||||
/// rynth-headless.exe run --config %APPDATA%\RynthCore\headless\launch_<profile id>.json
|
||||
/// --launcher [--ac-folder <AC folder>]
|
||||
/// --launcher: the process writes sessions\session_<its pid>.json and the character cache as the
|
||||
/// engine does, and reads the account's password from appsettings.json by launcherProfileId (the
|
||||
/// config never holds a password). Stopping: <see cref="TrySignalStop"/>, then a kill after
|
||||
/// <see cref="StopGrace"/> if it is still running.
|
||||
/// </summary>
|
||||
internal static class HeadlessLaunch
|
||||
{
|
||||
/// <summary>Process name (Process.GetProcessesByName) of the headless client.</summary>
|
||||
public const string ProcessName = "rynth-headless";
|
||||
public const string ExeName = ProcessName + ".exe";
|
||||
|
||||
/// <summary>Default install folder of rynth-headless.exe, beside the launcher.</summary>
|
||||
public const string DefaultFolderName = "Headless";
|
||||
|
||||
/// <summary>Folder under the launcher's settings folder holding the run configs.</summary>
|
||||
public const string ConfigFolderName = "headless";
|
||||
|
||||
/// <summary>
|
||||
/// Folder under the Headless folder with the 64-bit plugin builds the installer ships, one folder
|
||||
/// per plugin with its dependencies: Headless\plugins\<Name>\RynthCore.Plugin.<Name>.dll.
|
||||
/// </summary>
|
||||
public const string PluginsFolderName = "plugins";
|
||||
|
||||
/// <summary>How long a stop request may take (every character logs out) before the launcher kills the process.</summary>
|
||||
public static readonly TimeSpan StopGrace = TimeSpan.FromSeconds(20);
|
||||
|
||||
/// <summary>
|
||||
/// Name of the stop event of rynth-headless process <paramref name="pid"/> (a manual-reset
|
||||
/// EventWaitHandle the process creates). Set = every character logs out cleanly, then it exits.
|
||||
/// </summary>
|
||||
public static string StopEventName(int pid) => $@"Local\RynthHeadless.Stop.{pid}";
|
||||
|
||||
/// <summary>
|
||||
/// Asks rynth-headless process <paramref name="pid"/> to log out and exit. False when it has no
|
||||
/// stop event (not a rynth-headless, too old, still starting, or gone): the caller kills it then.
|
||||
/// </summary>
|
||||
public static bool TrySignalStop(int pid)
|
||||
{
|
||||
if (!OperatingSystem.IsWindows())
|
||||
return false;
|
||||
try
|
||||
{
|
||||
if (!EventWaitHandle.TryOpenExisting(StopEventName(pid), out EventWaitHandle? stop))
|
||||
return false;
|
||||
using (stop)
|
||||
return stop.Set();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rynth-headless.exe: <paramref name="configured"/> (AppSettings.HeadlessExePath, environment
|
||||
/// variables expanded) when set, else <<paramref name="launcherDirectory"/>>\Headless\rynth-headless.exe.
|
||||
/// </summary>
|
||||
public static string ResolveExePath(string? configured, string launcherDirectory)
|
||||
{
|
||||
string path = (configured ?? string.Empty).Trim().Trim('"');
|
||||
if (path.Length > 0)
|
||||
return Environment.ExpandEnvironmentVariables(path);
|
||||
return Path.Combine(launcherDirectory, DefaultFolderName, ExeName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The shipped 64-bit plugins: every <<paramref name="launcherDirectory"/>>\Headless\plugins\<Name>\RynthCore.Plugin.<Name>.dll
|
||||
/// that exists, by name. Empty when the install has none (an older install, a dev launcher).
|
||||
/// </summary>
|
||||
public static List<string> DefaultPluginPaths(string launcherDirectory)
|
||||
{
|
||||
var found = new List<string>();
|
||||
try
|
||||
{
|
||||
string root = Path.Combine(launcherDirectory, DefaultFolderName, PluginsFolderName);
|
||||
if (!Directory.Exists(root))
|
||||
return found;
|
||||
foreach (string dir in Directory.GetDirectories(root))
|
||||
{
|
||||
string dll = Path.Combine(dir, $"RynthCore.Plugin.{Path.GetFileName(dir)}.dll");
|
||||
if (File.Exists(dll))
|
||||
found.Add(dll);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Unreadable folder: no default plugins.
|
||||
}
|
||||
found.Sort(StringComparer.OrdinalIgnoreCase);
|
||||
return found;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The plugins a Headless account loads: <paramref name="configured"/> (AppSettings.HeadlessPluginPaths,
|
||||
/// blank entries dropped) when it names any, else the shipped ones (<see cref="DefaultPluginPaths"/>).
|
||||
/// </summary>
|
||||
public static List<string> ResolvePluginPaths(IEnumerable<string>? configured, string launcherDirectory)
|
||||
{
|
||||
var list = new List<string>();
|
||||
foreach (string entry in configured ?? Array.Empty<string>())
|
||||
{
|
||||
string path = (entry ?? string.Empty).Trim().Trim('"').Trim();
|
||||
if (path.Length > 0)
|
||||
list.Add(path);
|
||||
}
|
||||
return list.Count > 0 ? list : DefaultPluginPaths(launcherDirectory);
|
||||
}
|
||||
|
||||
/// <summary>The run config for account profile <paramref name="profileId"/>, under <paramref name="settingsDirectory"/>\headless.</summary>
|
||||
public static string ConfigPath(string settingsDirectory, string profileId)
|
||||
{
|
||||
var name = new StringBuilder(profileId.Length);
|
||||
foreach (char c in profileId)
|
||||
name.Append(Array.IndexOf(Path.GetInvalidFileNameChars(), c) >= 0 ? '_' : c);
|
||||
if (name.Length == 0)
|
||||
name.Append("account");
|
||||
return Path.Combine(settingsDirectory, ConfigFolderName, $"launch_{name}.json");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The --ac-folder value: the folder of the AC client path, or null when none is set (the
|
||||
/// argument is left out then).
|
||||
/// </summary>
|
||||
public static string? AcFolderFor(string? acClientPath)
|
||||
{
|
||||
string path = (acClientPath ?? string.Empty).Trim().Trim('"');
|
||||
if (path.Length == 0)
|
||||
return null;
|
||||
string? dir = Path.GetDirectoryName(path);
|
||||
return string.IsNullOrWhiteSpace(dir) ? null : dir;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The run config as rynth-headless reads it (camelCase JSON). There is no password field:
|
||||
/// with --launcher the process reads it from appsettings.json by launcherProfileId.
|
||||
/// </summary>
|
||||
public static string BuildConfigJson(HeadlessRunSpec spec)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(spec);
|
||||
using var stream = new MemoryStream();
|
||||
using (var w = new Utf8JsonWriter(stream, new JsonWriterOptions { Indented = true }))
|
||||
{
|
||||
w.WriteStartObject();
|
||||
w.WriteString("host", spec.Host ?? string.Empty);
|
||||
w.WriteNumber("port", spec.Port);
|
||||
w.WriteString("serverName", spec.ServerName ?? string.Empty);
|
||||
if (!string.IsNullOrWhiteSpace(spec.SuiteDir))
|
||||
w.WriteString("suiteDir", spec.SuiteDir.Trim());
|
||||
if (!string.IsNullOrWhiteSpace(spec.StatusDir))
|
||||
w.WriteString("statusDir", spec.StatusDir.Trim());
|
||||
w.WriteStartArray("plugins");
|
||||
foreach (string plugin in spec.Plugins ?? new List<string>())
|
||||
if (!string.IsNullOrWhiteSpace(plugin))
|
||||
w.WriteStringValue(plugin.Trim());
|
||||
w.WriteEndArray();
|
||||
w.WriteStartArray("sessions");
|
||||
foreach (HeadlessSessionSpec s in spec.Sessions ?? new List<HeadlessSessionSpec>())
|
||||
{
|
||||
w.WriteStartObject();
|
||||
w.WriteString("launcherProfileId", s.LauncherProfileId ?? string.Empty);
|
||||
w.WriteString("account", s.Account ?? string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(s.Character))
|
||||
w.WriteNull("character");
|
||||
else
|
||||
w.WriteString("character", s.Character.Trim());
|
||||
w.WriteStartArray("commands");
|
||||
foreach (string command in s.Commands ?? new List<string>())
|
||||
if (!string.IsNullOrWhiteSpace(command))
|
||||
w.WriteStringValue(command);
|
||||
w.WriteEndArray();
|
||||
w.WriteNumber("staySeconds", Math.Max(0, s.StaySeconds));
|
||||
w.WriteBoolean("reconnect", s.Reconnect);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteEndArray();
|
||||
w.WriteEndObject();
|
||||
}
|
||||
return Encoding.UTF8.GetString(stream.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>Writes <paramref name="configJson"/> to <paramref name="path"/> (UTF-8, no BOM; temp file + swap).</summary>
|
||||
public static void WriteConfig(string path, string configJson)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
|
||||
string tmp = path + ".tmp";
|
||||
File.WriteAllText(tmp, configJson, new UTF8Encoding(false));
|
||||
File.Move(tmp, path, overwrite: true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// rynth-headless's arguments, one per entry (for ProcessStartInfo.ArgumentList, which quotes
|
||||
/// them): run --config FILE --launcher [--ac-folder DIR].
|
||||
/// </summary>
|
||||
public static List<string> BuildArguments(string configPath, string? acFolder)
|
||||
{
|
||||
var args = new List<string> { "run", "--config", configPath, "--launcher" };
|
||||
if (!string.IsNullOrWhiteSpace(acFolder))
|
||||
{
|
||||
args.Add("--ac-folder");
|
||||
args.Add(acFolder);
|
||||
}
|
||||
return args;
|
||||
}
|
||||
}
|
||||
723
src/RynthCore.App/HeadlessMonitor.cs
Normal file
723
src/RynthCore.App/HeadlessMonitor.cs
Normal file
|
|
@ -0,0 +1,723 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace RynthCore.App;
|
||||
|
||||
// ============================================================================
|
||||
// The launcher's Headless window (RynthCore.App.Avalonia\HeadlessWindow), without the UI.
|
||||
// BCL only, so tools\HeadlessWindowTests compiles it as it is.
|
||||
//
|
||||
// What a headless character tells the world is in files (src\RynthCore.Headless\Host\Status\
|
||||
// StatusExporter.cs is the writer and the authority on the schema):
|
||||
// <statusDir>\RynthCore.<id>.status.json every 1 s: the engine's "rynthcore.client-status/1"
|
||||
// fields, RynthAi's snapshot in "bot", "opos", and headless: true, hostPid, hostProcess.
|
||||
// <id> is a synthetic per-character id (odd, above a billion), not a process id.
|
||||
// <statusDir>\commands\RynthCore.<id>.<ticks>-<guid>.cmd.json the inbox, drained every
|
||||
// 200 ms, oldest first, each file deleted before it runs (the StatusAgent's format).
|
||||
// <suiteDir>\headless-<account>.log the character's own log (Bot.cs).
|
||||
// The window only reads these and writes command files; it never opens a socket or a process.
|
||||
// ============================================================================
|
||||
|
||||
/// <summary>A status dot: what one headless character is doing, as the status file says.</summary>
|
||||
internal enum HeadlessActivity
|
||||
{
|
||||
/// <summary>In the world with the macro running.</summary>
|
||||
Botting,
|
||||
/// <summary>In the world, macro off.</summary>
|
||||
Idle,
|
||||
/// <summary>In the world with no health left.</summary>
|
||||
Dead,
|
||||
/// <summary>Connecting, at the character list, or waiting to reconnect (inWorld false).</summary>
|
||||
Loading,
|
||||
/// <summary>The status file stopped changing (over <see cref="HeadlessStatusRules.StaleAfter"/>).</summary>
|
||||
Stale,
|
||||
}
|
||||
|
||||
internal enum HeadlessFreshness { Fresh, Stale, Gone }
|
||||
|
||||
internal enum HeadlessParseResult { Ok, NotHeadless, Broken }
|
||||
|
||||
/// <summary>One line of bot.recentChat: {"t": text, "c": AC chat type}.</summary>
|
||||
internal readonly record struct HeadlessChatLine(string Text, int Type);
|
||||
|
||||
/// <summary>What the window shows of one headless character, read from its status file.</summary>
|
||||
internal sealed class HeadlessCharacterStatus
|
||||
{
|
||||
public int Id { get; init; }
|
||||
public string Character { get; init; } = string.Empty;
|
||||
public string Server { get; init; } = string.Empty;
|
||||
/// <summary>Used only to find the character's log file (headless-<account>.log); never shown.</summary>
|
||||
public string Account { get; init; } = string.Empty;
|
||||
/// <summary>The file's "ts" (UTC); the file's write time when "ts" is missing or unreadable.</summary>
|
||||
public DateTime TimestampUtc { get; init; }
|
||||
public bool InWorld { get; init; }
|
||||
public int HostPid { get; init; }
|
||||
public string HostProcess { get; init; } = string.Empty;
|
||||
public long UptimeSec { get; init; }
|
||||
|
||||
public double VitaePct { get; init; }
|
||||
public double XpPerHour { get; init; }
|
||||
public long XpSession { get; init; }
|
||||
public int DeathsSession { get; init; }
|
||||
public double BurdenPct { get; init; }
|
||||
|
||||
public string Landblock { get; init; } = string.Empty;
|
||||
public bool Indoor { get; init; }
|
||||
public string Cell { get; init; } = string.Empty;
|
||||
/// <summary>World position from "opos" (192 units a landblock); null without one.</summary>
|
||||
public double? WorldX { get; init; }
|
||||
public double? WorldY { get; init; }
|
||||
public double? Z { get; init; }
|
||||
public double? Heading { get; init; }
|
||||
|
||||
/// <summary>False when "bot" is null (not in the world, or no RynthAi loaded).</summary>
|
||||
public bool HasBot { get; init; }
|
||||
public bool MacroRunning { get; init; }
|
||||
public string BotAction { get; init; } = string.Empty;
|
||||
public string CurrentState { get; init; } = string.Empty;
|
||||
public string MetaName { get; init; } = string.Empty;
|
||||
public string NavName { get; init; } = string.Empty;
|
||||
public long TargetId { get; init; }
|
||||
public string TargetLabel { get; init; } = string.Empty;
|
||||
public double TargetHealthPercent { get; init; }
|
||||
public long Health { get; init; }
|
||||
public long MaxHealth { get; init; }
|
||||
public long Stamina { get; init; }
|
||||
public long MaxStamina { get; init; }
|
||||
public long Mana { get; init; }
|
||||
public long MaxMana { get; init; }
|
||||
public long SessionKills { get; init; }
|
||||
public double KillsPerHour { get; init; }
|
||||
public IReadOnlyList<HeadlessChatLine> RecentChat { get; init; } = Array.Empty<HeadlessChatLine>();
|
||||
|
||||
public bool HasTarget => TargetId != 0;
|
||||
public bool HasVitals => HasBot && MaxHealth > 0;
|
||||
}
|
||||
|
||||
/// <summary>Parses a status file into <see cref="HeadlessCharacterStatus"/>.</summary>
|
||||
internal static class HeadlessStatusParser
|
||||
{
|
||||
/// <summary>
|
||||
/// Parses <paramref name="json"/> (one status file). False for anything that isn't a headless
|
||||
/// character's status (a game client's own status file, a half-written or empty file).
|
||||
/// <paramref name="fileWriteUtc"/> stands in for a missing "ts".
|
||||
/// </summary>
|
||||
public static bool TryParse(string json, DateTime fileWriteUtc, out HeadlessCharacterStatus status) =>
|
||||
Parse(json, fileWriteUtc, out status) == HeadlessParseResult.Ok;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="TryParse"/> telling a complete file that isn't a headless character's
|
||||
/// (<see cref="HeadlessParseResult.NotHeadless"/>) from one that can't be read as JSON now: empty,
|
||||
/// truncated, caught mid-replace (<see cref="HeadlessParseResult.Broken"/>).
|
||||
/// </summary>
|
||||
public static HeadlessParseResult Parse(string json, DateTime fileWriteUtc, out HeadlessCharacterStatus status)
|
||||
{
|
||||
status = null!;
|
||||
if (string.IsNullOrWhiteSpace(json))
|
||||
return HeadlessParseResult.Broken;
|
||||
try
|
||||
{
|
||||
using JsonDocument doc = JsonDocument.Parse(json);
|
||||
JsonElement r = doc.RootElement;
|
||||
if (r.ValueKind != JsonValueKind.Object || !Bool(r, "headless"))
|
||||
return HeadlessParseResult.NotHeadless;
|
||||
int id = (int)Long(r, "pid");
|
||||
if (id <= 0)
|
||||
return HeadlessParseResult.NotHeadless;
|
||||
|
||||
DateTime ts = DateTime.TryParse(Str(r, "ts"), CultureInfo.InvariantCulture,
|
||||
DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime t)
|
||||
? DateTime.SpecifyKind(t, DateTimeKind.Utc)
|
||||
: fileWriteUtc;
|
||||
|
||||
r.TryGetProperty("opos", out JsonElement opos);
|
||||
bool hasOpos = opos.ValueKind == JsonValueKind.Object;
|
||||
r.TryGetProperty("bot", out JsonElement bot);
|
||||
bool hasBot = bot.ValueKind == JsonValueKind.Object;
|
||||
|
||||
status = new HeadlessCharacterStatus
|
||||
{
|
||||
Id = id,
|
||||
Character = Str(r, "character"),
|
||||
Server = Str(r, "server"),
|
||||
Account = Str(r, "account"),
|
||||
TimestampUtc = ts,
|
||||
InWorld = Bool(r, "inWorld"),
|
||||
HostPid = (int)Long(r, "hostPid"),
|
||||
HostProcess = Str(r, "hostProcess"),
|
||||
UptimeSec = Long(r, "uptimeSec"),
|
||||
VitaePct = Dbl(r, "vitaePct"),
|
||||
XpPerHour = Dbl(r, "xpPerHour"),
|
||||
XpSession = Long(r, "xpSession"),
|
||||
DeathsSession = (int)Long(r, "deathsSession"),
|
||||
BurdenPct = Dbl(r, "burdenPct"),
|
||||
Landblock = Str(r, "landblock"),
|
||||
Indoor = hasOpos && opos.TryGetProperty("indoor", out _) ? Bool(opos, "indoor") : Bool(r, "indoor"),
|
||||
Cell = hasOpos ? Str(opos, "cell") : string.Empty,
|
||||
WorldX = hasOpos ? NDbl(opos, "wx") : null,
|
||||
WorldY = hasOpos ? NDbl(opos, "wy") : null,
|
||||
Z = hasOpos ? NDbl(opos, "z") : null,
|
||||
Heading = hasOpos ? NDbl(opos, "heading") : null,
|
||||
HasBot = hasBot,
|
||||
MacroRunning = hasBot && Bool(bot, "macroRunning"),
|
||||
BotAction = hasBot ? Str(bot, "botAction") : string.Empty,
|
||||
CurrentState = hasBot ? Str(bot, "currentState") : string.Empty,
|
||||
MetaName = hasBot ? Str(bot, "currentMetaName") : string.Empty,
|
||||
NavName = hasBot ? Str(bot, "currentNavName") : string.Empty,
|
||||
TargetId = hasBot ? Long(bot, "currentTargetId") : 0,
|
||||
TargetLabel = hasBot ? Str(bot, "targetLabel") : string.Empty,
|
||||
TargetHealthPercent = hasBot ? Dbl(bot, "targetHealthPercent") : 0,
|
||||
Health = hasBot ? Long(bot, "playerHealth") : 0,
|
||||
MaxHealth = hasBot ? Long(bot, "playerMaxHealth") : 0,
|
||||
Stamina = hasBot ? Long(bot, "playerStamina") : 0,
|
||||
MaxStamina = hasBot ? Long(bot, "playerMaxStamina") : 0,
|
||||
Mana = hasBot ? Long(bot, "playerMana") : 0,
|
||||
MaxMana = hasBot ? Long(bot, "playerMaxMana") : 0,
|
||||
SessionKills = hasBot ? Long(bot, "sessionKills") : 0,
|
||||
KillsPerHour = hasBot ? Dbl(bot, "killsPerHour") : 0,
|
||||
RecentChat = hasBot ? Chat(bot) : Array.Empty<HeadlessChatLine>(),
|
||||
};
|
||||
return HeadlessParseResult.Ok;
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return HeadlessParseResult.Broken; // mid-replace or truncated: the caller keeps what it had
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
return HeadlessParseResult.NotHeadless; // a field of an unexpected kind at the top
|
||||
}
|
||||
}
|
||||
|
||||
private static List<HeadlessChatLine> Chat(JsonElement bot)
|
||||
{
|
||||
var lines = new List<HeadlessChatLine>();
|
||||
if (!bot.TryGetProperty("recentChat", out JsonElement chat) || chat.ValueKind != JsonValueKind.Array)
|
||||
return lines;
|
||||
foreach (JsonElement e in chat.EnumerateArray())
|
||||
{
|
||||
if (e.ValueKind == JsonValueKind.Object)
|
||||
lines.Add(new HeadlessChatLine(Str(e, "t"), (int)Long(e, "c")));
|
||||
else if (e.ValueKind == JsonValueKind.String)
|
||||
lines.Add(new HeadlessChatLine(e.GetString() ?? string.Empty, 0));
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
private static string Str(JsonElement o, string name) =>
|
||||
o.TryGetProperty(name, out JsonElement v)
|
||||
? v.ValueKind switch
|
||||
{
|
||||
JsonValueKind.String => v.GetString() ?? string.Empty,
|
||||
JsonValueKind.Number => v.GetRawText(),
|
||||
_ => string.Empty,
|
||||
}
|
||||
: string.Empty;
|
||||
|
||||
private static bool Bool(JsonElement o, string name) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.True;
|
||||
|
||||
private static double? NDbl(JsonElement o, string name) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.Number && v.TryGetDouble(out double d) ? d : null;
|
||||
|
||||
private static double Dbl(JsonElement o, string name) => NDbl(o, name) ?? 0;
|
||||
|
||||
private static long Long(JsonElement o, string name)
|
||||
{
|
||||
if (!o.TryGetProperty(name, out JsonElement v) || v.ValueKind != JsonValueKind.Number)
|
||||
return 0;
|
||||
if (v.TryGetInt64(out long l))
|
||||
return l;
|
||||
return v.TryGetDouble(out double d) && !double.IsNaN(d) ? (long)Math.Clamp(d, long.MinValue, long.MaxValue) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The stale and gone rules, and the status dot.</summary>
|
||||
internal static class HeadlessStatusRules
|
||||
{
|
||||
/// <summary>The exporter writes every second: older than this, the character isn't ticking.</summary>
|
||||
public static readonly TimeSpan StaleAfter = TimeSpan.FromSeconds(10);
|
||||
/// <summary>Older than this, the character is gone (the process ended without removing its files).</summary>
|
||||
public static readonly TimeSpan GoneAfter = TimeSpan.FromSeconds(30);
|
||||
|
||||
public static TimeSpan Age(HeadlessCharacterStatus s, DateTime nowUtc)
|
||||
{
|
||||
TimeSpan age = nowUtc - s.TimestampUtc;
|
||||
return age < TimeSpan.Zero ? TimeSpan.Zero : age;
|
||||
}
|
||||
|
||||
public static HeadlessFreshness Freshness(TimeSpan age) =>
|
||||
age > GoneAfter ? HeadlessFreshness.Gone : age > StaleAfter ? HeadlessFreshness.Stale : HeadlessFreshness.Fresh;
|
||||
|
||||
public static HeadlessActivity Activity(HeadlessCharacterStatus s, DateTime nowUtc)
|
||||
{
|
||||
if (Freshness(Age(s, nowUtc)) != HeadlessFreshness.Fresh)
|
||||
return HeadlessActivity.Stale;
|
||||
if (!s.InWorld)
|
||||
return HeadlessActivity.Loading;
|
||||
if (s.HasVitals && s.Health <= 0)
|
||||
return HeadlessActivity.Dead;
|
||||
return s.MacroRunning ? HeadlessActivity.Botting : HeadlessActivity.Idle;
|
||||
}
|
||||
|
||||
public static string ActivityText(HeadlessActivity a) => a switch
|
||||
{
|
||||
HeadlessActivity.Botting => "botting",
|
||||
HeadlessActivity.Idle => "idle",
|
||||
HeadlessActivity.Dead => "dead",
|
||||
HeadlessActivity.Loading => "not in the world",
|
||||
_ => "not answering",
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Keeps the window's list: the last good status per character. A file that couldn't be read this
|
||||
/// time (being replaced) keeps its last status; a character whose file is gone, or whose status is
|
||||
/// older than <see cref="HeadlessStatusRules.GoneAfter"/>, leaves the list.
|
||||
/// </summary>
|
||||
internal sealed class HeadlessRoster
|
||||
{
|
||||
private readonly Dictionary<int, HeadlessCharacterStatus> _byId = new();
|
||||
|
||||
public IReadOnlyCollection<HeadlessCharacterStatus> All => _byId.Values;
|
||||
|
||||
public bool TryGet(int id, out HeadlessCharacterStatus status) => _byId.TryGetValue(id, out status!);
|
||||
|
||||
/// <summary>
|
||||
/// <paramref name="parsed"/>: the files read this time. <paramref name="unreadable"/>: ids whose
|
||||
/// file exists but didn't parse. Returns the list sorted by character name, then id.
|
||||
/// </summary>
|
||||
public List<HeadlessCharacterStatus> Update(IEnumerable<HeadlessCharacterStatus> parsed, IEnumerable<int> unreadable, DateTime nowUtc)
|
||||
{
|
||||
var seen = new HashSet<int>();
|
||||
foreach (HeadlessCharacterStatus s in parsed)
|
||||
{
|
||||
seen.Add(s.Id);
|
||||
// A file mid-replace can't go back in time: keep the newer status.
|
||||
if (!_byId.TryGetValue(s.Id, out HeadlessCharacterStatus? old) || s.TimestampUtc >= old.TimestampUtc)
|
||||
_byId[s.Id] = s;
|
||||
}
|
||||
foreach (int id in unreadable)
|
||||
seen.Add(id);
|
||||
foreach (int id in _byId.Keys.ToList())
|
||||
{
|
||||
if (!seen.Contains(id) ||
|
||||
HeadlessStatusRules.Freshness(HeadlessStatusRules.Age(_byId[id], nowUtc)) == HeadlessFreshness.Gone)
|
||||
_byId.Remove(id);
|
||||
}
|
||||
return _byId.Values
|
||||
.OrderBy(s => s.Character, StringComparer.OrdinalIgnoreCase)
|
||||
.ThenBy(s => s.Id)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>bot.recentChat: the combat spam filter and the lines new since an earlier snapshot.</summary>
|
||||
internal static class HeadlessChat
|
||||
{
|
||||
/// <summary>How many chat lines the window shows.</summary>
|
||||
public const int ShownLines = 30;
|
||||
|
||||
/// <summary>
|
||||
/// AC chat types that are pure combat spam (our hits, their hits, evades): hidden (21 and 22).
|
||||
/// </summary>
|
||||
public static bool IsCombatSpam(int type) => type is 21 or 22;
|
||||
|
||||
/// <summary>The last <paramref name="max"/> lines that aren't combat spam, oldest first.</summary>
|
||||
public static List<HeadlessChatLine> Visible(IReadOnlyList<HeadlessChatLine> lines, int max = ShownLines)
|
||||
{
|
||||
var shown = lines.Where(l => !IsCombatSpam(l.Type)).ToList();
|
||||
return shown.Count > max ? shown.GetRange(shown.Count - max, max) : shown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The lines of <paramref name="current"/> after its overlap with the end of
|
||||
/// <paramref name="previous"/>. The export keeps the last 60 lines, so a newer list is the older
|
||||
/// one shifted left with new lines at the end (observe.py's new_chat). No overlap at all = every
|
||||
/// line is new.
|
||||
/// </summary>
|
||||
public static List<HeadlessChatLine> NewLines(IReadOnlyList<HeadlessChatLine> previous, IReadOnlyList<HeadlessChatLine> current)
|
||||
{
|
||||
if (previous.Count == 0)
|
||||
return current.ToList();
|
||||
for (int k = Math.Min(previous.Count, current.Count); k > 0; k--)
|
||||
{
|
||||
bool match = true;
|
||||
for (int i = 0; i < k && match; i++)
|
||||
match = previous[previous.Count - k + i] == current[i];
|
||||
if (match)
|
||||
return current.Skip(k).ToList();
|
||||
}
|
||||
return current.ToList();
|
||||
}
|
||||
|
||||
/// <summary>The first line in <paramref name="lines"/> that isn't combat spam, or null.</summary>
|
||||
public static HeadlessChatLine? FirstReply(IEnumerable<HeadlessChatLine> lines)
|
||||
{
|
||||
foreach (HeadlessChatLine l in lines)
|
||||
if (!IsCombatSpam(l.Type) && l.Text.Length > 0)
|
||||
return l;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map coordinates from a status file's opos world position.</summary>
|
||||
internal static class HeadlessCoords
|
||||
{
|
||||
/// <summary>
|
||||
/// (north/south, east/west) from world units (192 a landblock), north and east positive: the
|
||||
/// conversion of the StatusAgent's NavAtlasService.FromWorld and observe.py's map_of.
|
||||
/// </summary>
|
||||
public static (double Ns, double Ew) FromWorld(double wx, double wy) =>
|
||||
((wy / 24.0 - 1019.5) / 10.0, (wx / 24.0 - 1019.5) / 10.0);
|
||||
|
||||
/// <summary>"42.1N 33.6E" (RynthNet's CharactersModel.CoordsText).</summary>
|
||||
public static string Text(double ns, double ew) =>
|
||||
Math.Abs(ns).ToString("0.0", CultureInfo.InvariantCulture) + (ns >= 0 ? "N " : "S ") +
|
||||
Math.Abs(ew).ToString("0.0", CultureInfo.InvariantCulture) + (ew >= 0 ? "E" : "W");
|
||||
|
||||
/// <summary>
|
||||
/// Where the character is: "Outdoors 42.1N 33.6E (landblock A9B3)", "Indoors (landblock 01F5,
|
||||
/// cell 01F501BE)", or "unknown".
|
||||
/// </summary>
|
||||
public static string Where(HeadlessCharacterStatus s)
|
||||
{
|
||||
string lb = s.Landblock.Length >= 4 ? s.Landblock[^4..] : s.Landblock;
|
||||
if (s.Indoor)
|
||||
{
|
||||
if (lb.Length == 0) return "Indoors";
|
||||
return s.Cell.Length > 0 ? $"Indoors (landblock {lb}, cell {s.Cell})" : $"Indoors (landblock {lb})";
|
||||
}
|
||||
if (s.WorldX is double wx && s.WorldY is double wy)
|
||||
{
|
||||
var (ns, ew) = FromWorld(wx, wy);
|
||||
return lb.Length > 0 ? $"Outdoors {Text(ns, ew)} (landblock {lb})" : $"Outdoors {Text(ns, ew)}";
|
||||
}
|
||||
return lb.Length > 0 ? $"Outdoors (landblock {lb})" : "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Short numbers and durations for the details panel.</summary>
|
||||
internal static class HeadlessFormat
|
||||
{
|
||||
/// <summary>"950", "12.3k", "36.8M", "2.4B".</summary>
|
||||
public static string Number(double n)
|
||||
{
|
||||
double a = Math.Abs(n);
|
||||
string s = a >= 1e9 ? (n / 1e9).ToString("0.0", CultureInfo.InvariantCulture) + "B"
|
||||
: a >= 1e6 ? (n / 1e6).ToString("0.0", CultureInfo.InvariantCulture) + "M"
|
||||
: a >= 1e4 ? (n / 1e3).ToString("0.0", CultureInfo.InvariantCulture) + "k"
|
||||
: Math.Round(n).ToString("0", CultureInfo.InvariantCulture);
|
||||
return s;
|
||||
}
|
||||
|
||||
/// <summary>"45s", "12m 05s", "3h 12m", "2d 18h".</summary>
|
||||
public static string Duration(long seconds)
|
||||
{
|
||||
if (seconds < 0) seconds = 0;
|
||||
long d = seconds / 86400, h = seconds / 3600 % 24, m = seconds / 60 % 60, s = seconds % 60;
|
||||
if (d > 0) return $"{d}d {h}h";
|
||||
if (h > 0) return $"{h}h {m:00}m";
|
||||
if (m > 0) return $"{m}m {s:00}s";
|
||||
return $"{s}s";
|
||||
}
|
||||
|
||||
/// <summary>"165 / 230" (no maximum = "-").</summary>
|
||||
public static string Vital(long cur, long max) =>
|
||||
max <= 0 ? "-" : $"{cur.ToString(CultureInfo.InvariantCulture)} / {max.ToString(CultureInfo.InvariantCulture)}";
|
||||
|
||||
public static double Fraction(long cur, long max) => max <= 0 ? 0 : Math.Clamp((double)cur / max, 0, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The command inbox: the file the StatusAgent writes for the phone (LocalStatusServer.HandleCommand,
|
||||
/// Models.CommandFile), so a headless character takes it the same way (StatusExporter.DrainCommands).
|
||||
/// </summary>
|
||||
internal static class HeadlessCommandFile
|
||||
{
|
||||
public const string CommandsFolderName = "commands";
|
||||
public const string SendChatAction = "sendChat";
|
||||
public const string MacroAction = "macro";
|
||||
|
||||
/// <summary>Chat commands the window's command box sends (RynthAi, RynthNav, meta tools, RynthNet).</summary>
|
||||
public static readonly IReadOnlyList<string> AllowedPrefixes = new[] { "/ra", "/rnav", "/mt", "/rn" };
|
||||
|
||||
public const int MaxCommandLength = 400;
|
||||
|
||||
/// <summary>Why <paramref name="text"/> can't be sent (null = it can): one line starting with an allowed prefix.</summary>
|
||||
public static string? ChatCommandProblem(string? text)
|
||||
{
|
||||
string t = (text ?? string.Empty).Trim();
|
||||
if (t.Length == 0)
|
||||
return "Type a command first, for example /ra pause.";
|
||||
if (t.IndexOfAny(new[] { '\r', '\n' }) >= 0)
|
||||
return "One command per line.";
|
||||
if (t.Length > MaxCommandLength)
|
||||
return $"That command is longer than {MaxCommandLength} characters.";
|
||||
foreach (string p in AllowedPrefixes)
|
||||
{
|
||||
if (t.Length == p.Length && t.Equals(p, StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
if (t.Length > p.Length && t.StartsWith(p, StringComparison.OrdinalIgnoreCase) && t[p.Length] == ' ')
|
||||
return null;
|
||||
}
|
||||
return "Only " + string.Join(", ", AllowedPrefixes) + " commands can be sent from here.";
|
||||
}
|
||||
|
||||
/// <summary>RynthCore.<id>.<ticks, 19 digits>-<guid>.cmd.json: sorts in submit order.</summary>
|
||||
public static string FileName(int id, DateTime nowUtc, Guid guid) =>
|
||||
$"RynthCore.{id.ToString(CultureInfo.InvariantCulture)}.{nowUtc.Ticks.ToString("D19", CultureInfo.InvariantCulture)}-{guid:N}.cmd.json";
|
||||
|
||||
/// <summary>{"schema":"rynthcore.command/1","pid":id,"action":..,"value":..,"ts":..}.</summary>
|
||||
public static string Json(int id, string action, string value, DateTime nowUtc)
|
||||
{
|
||||
using var stream = new MemoryStream();
|
||||
using (var w = new Utf8JsonWriter(stream))
|
||||
{
|
||||
w.WriteStartObject();
|
||||
w.WriteString("schema", "rynthcore.command/1");
|
||||
w.WriteNumber("pid", id);
|
||||
w.WriteString("action", action);
|
||||
w.WriteString("value", value);
|
||||
w.WriteString("ts", new DateTimeOffset(DateTime.SpecifyKind(nowUtc, DateTimeKind.Utc)));
|
||||
w.WriteEndObject();
|
||||
}
|
||||
return Encoding.UTF8.GetString(stream.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes one command for character <paramref name="id"/> into <paramref name="commandsDir"/>:
|
||||
/// a temp file (".tmp", which the drain's *.cmd.json pattern never matches), then a rename, so
|
||||
/// the character never reads half a command. Returns the command file's path.
|
||||
/// </summary>
|
||||
public static string Write(string commandsDir, int id, string action, string value, DateTime nowUtc)
|
||||
{
|
||||
if (id <= 0) throw new ArgumentOutOfRangeException(nameof(id));
|
||||
if (string.IsNullOrWhiteSpace(action)) throw new ArgumentException("No action.", nameof(action));
|
||||
Directory.CreateDirectory(commandsDir);
|
||||
string dest = Path.Combine(commandsDir, FileName(id, nowUtc, Guid.NewGuid()));
|
||||
string tmp = dest + ".tmp";
|
||||
File.WriteAllText(tmp, Json(id, action, value ?? string.Empty, nowUtc), new UTF8Encoding(false));
|
||||
File.Move(tmp, dest, overwrite: false);
|
||||
return dest;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Finds and reads the status files.</summary>
|
||||
internal static class HeadlessStatusScanner
|
||||
{
|
||||
/// <summary>
|
||||
/// Reads every headless status file in <paramref name="statusDir"/>. Files not written for a
|
||||
/// minute are skipped without being opened (the game clients' old ones stay in the folder).
|
||||
/// <paramref name="unreadable"/> gets the ids whose file couldn't be read or parsed this time.
|
||||
/// </summary>
|
||||
public static List<HeadlessCharacterStatus> Scan(string statusDir, DateTime nowUtc, out List<int> unreadable)
|
||||
{
|
||||
unreadable = new List<int>();
|
||||
var found = new List<HeadlessCharacterStatus>();
|
||||
string[] files;
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(statusDir))
|
||||
return found;
|
||||
files = Directory.GetFiles(statusDir, "RynthCore.*.status.json");
|
||||
}
|
||||
catch (IOException) { return found; }
|
||||
catch (UnauthorizedAccessException) { return found; }
|
||||
|
||||
foreach (string path in files)
|
||||
{
|
||||
if (!TryIdOf(path, out int id))
|
||||
continue;
|
||||
DateTime written;
|
||||
try { written = File.GetLastWriteTimeUtc(path); }
|
||||
catch (IOException) { continue; }
|
||||
catch (UnauthorizedAccessException) { continue; }
|
||||
if (nowUtc - written > HeadlessStatusRules.GoneAfter + TimeSpan.FromSeconds(30))
|
||||
continue;
|
||||
string? text = ReadShared(path);
|
||||
if (text == null)
|
||||
{
|
||||
unreadable.Add(id);
|
||||
continue;
|
||||
}
|
||||
switch (HeadlessStatusParser.Parse(text, written, out HeadlessCharacterStatus s))
|
||||
{
|
||||
case HeadlessParseResult.Ok:
|
||||
found.Add(s);
|
||||
break;
|
||||
case HeadlessParseResult.Broken:
|
||||
// Caught mid-write. The list keeps the character's last status if it had one
|
||||
// (HeadlessRoster); a game client's file in this state is simply not listed.
|
||||
unreadable.Add(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/// <summary>The <id> of RynthCore.<id>.status.json.</summary>
|
||||
public static bool TryIdOf(string path, out int id)
|
||||
{
|
||||
id = 0;
|
||||
string name = Path.GetFileName(path);
|
||||
const string prefix = "RynthCore.", suffix = ".status.json";
|
||||
if (!name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) || !name.EndsWith(suffix, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
string mid = name.Substring(prefix.Length, name.Length - prefix.Length - suffix.Length);
|
||||
return int.TryParse(mid, NumberStyles.None, CultureInfo.InvariantCulture, out id) && id > 0;
|
||||
}
|
||||
|
||||
/// <summary>The whole file, read while others may write or replace it; null when it can't be read now.</summary>
|
||||
public static string? ReadShared(string path)
|
||||
{
|
||||
for (int attempt = 0; attempt < 2; attempt++)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
|
||||
using var reader = new StreamReader(fs, Encoding.UTF8);
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
catch (FileNotFoundException) { return null; }
|
||||
catch (IOException) { }
|
||||
catch (UnauthorizedAccessException) { }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A headless character's own log: where it is and its last lines.</summary>
|
||||
internal static class HeadlessLogs
|
||||
{
|
||||
public const int ShownLines = 50;
|
||||
|
||||
/// <summary>
|
||||
/// The suite folder rynth-headless 2026.10.31.1 and later use when the run config names none
|
||||
/// (HeadlessDefaults.SuiteDir in the CLI).
|
||||
/// </summary>
|
||||
public static string DefaultSuiteDir =>
|
||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "RynthCore", "headless");
|
||||
|
||||
/// <summary>The builds before 2026.10.31.1 used the development sandbox (docs\HEADLESS.md, P3).</summary>
|
||||
public const string LegacySuiteDir = @"C:\Projects\headless\sandbox\suite";
|
||||
|
||||
/// <summary>headless-<account>.log, the account's letters and digits kept (Bot.cs's Safe).</summary>
|
||||
public static string LogFileName(string account) =>
|
||||
"headless-" + string.Concat((account ?? string.Empty).Select(c => char.IsLetterOrDigit(c) ? c : '_')) + ".log";
|
||||
|
||||
/// <summary>
|
||||
/// The folders a log of <paramref name="account"/> may be in, most likely first: the suiteDir of
|
||||
/// every launcher run config (%APPDATA%\RynthCore\headless\launch_*.json) with a session for the
|
||||
/// account (no suiteDir = the default), then <paramref name="configuredSuiteDir"/>
|
||||
/// (AppSettings.HeadlessSuiteDir), the default and the legacy folder.
|
||||
/// </summary>
|
||||
public static List<string> CandidateSuiteDirs(string account, string? launchConfigDir, string? configuredSuiteDir,
|
||||
string defaultSuiteDir, string? legacySuiteDir = LegacySuiteDir)
|
||||
{
|
||||
var dirs = new List<string>();
|
||||
void Add(string? d)
|
||||
{
|
||||
d = (d ?? string.Empty).Trim().Trim('"');
|
||||
if (d.Length > 0 && !dirs.Contains(d, StringComparer.OrdinalIgnoreCase))
|
||||
dirs.Add(Environment.ExpandEnvironmentVariables(d));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(launchConfigDir) && Directory.Exists(launchConfigDir) && account.Length > 0)
|
||||
{
|
||||
foreach (string file in Directory.GetFiles(launchConfigDir, "launch_*.json").OrderBy(f => f, StringComparer.Ordinal))
|
||||
{
|
||||
string? text = HeadlessStatusScanner.ReadShared(file);
|
||||
if (text == null) continue;
|
||||
try
|
||||
{
|
||||
using JsonDocument doc = JsonDocument.Parse(text);
|
||||
JsonElement r = doc.RootElement;
|
||||
if (!r.TryGetProperty("sessions", out JsonElement sessions) || sessions.ValueKind != JsonValueKind.Array)
|
||||
continue;
|
||||
bool mine = sessions.EnumerateArray().Any(s =>
|
||||
s.ValueKind == JsonValueKind.Object &&
|
||||
(Matches(s, "account", account) || Matches(s, "launcherAccount", account)));
|
||||
if (!mine) continue;
|
||||
Add(r.TryGetProperty("suiteDir", out JsonElement sd) && sd.ValueKind == JsonValueKind.String
|
||||
? sd.GetString()
|
||||
: defaultSuiteDir);
|
||||
}
|
||||
catch (JsonException) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException) { }
|
||||
catch (UnauthorizedAccessException) { }
|
||||
|
||||
Add(configuredSuiteDir);
|
||||
Add(defaultSuiteDir);
|
||||
Add(legacySuiteDir);
|
||||
return dirs;
|
||||
}
|
||||
|
||||
private static bool Matches(JsonElement o, string name, string account) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.String &&
|
||||
string.Equals(v.GetString(), account, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>The first existing log of <paramref name="account"/> in <paramref name="dirs"/>, or null.</summary>
|
||||
public static string? Find(string account, IEnumerable<string> dirs)
|
||||
{
|
||||
string name = LogFileName(account);
|
||||
foreach (string d in dirs)
|
||||
{
|
||||
try
|
||||
{
|
||||
string p = Path.Combine(d, name);
|
||||
if (File.Exists(p)) return p;
|
||||
}
|
||||
catch (ArgumentException) { }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The last <paramref name="maxLines"/> lines of <paramref name="path"/>, reading at most the
|
||||
/// last <paramref name="maxBytes"/> (the logs grow to 100 MB and more). Opened shared, so the
|
||||
/// writing process is never disturbed. Null when it can't be read.
|
||||
/// </summary>
|
||||
public static List<string>? Tail(string path, int maxLines = ShownLines, int maxBytes = 128 * 1024)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
|
||||
long start = Math.Max(0, fs.Length - maxBytes);
|
||||
fs.Seek(start, SeekOrigin.Begin);
|
||||
var buffer = new byte[fs.Length - start];
|
||||
int read = 0;
|
||||
while (read < buffer.Length)
|
||||
{
|
||||
int n = fs.Read(buffer, read, buffer.Length - read);
|
||||
if (n <= 0) break;
|
||||
read += n;
|
||||
}
|
||||
return LastLines(Encoding.UTF8.GetString(buffer, 0, read), maxLines, startsMidFile: start > 0);
|
||||
}
|
||||
catch (IOException) { return null; }
|
||||
catch (UnauthorizedAccessException) { return null; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The last <paramref name="maxLines"/> lines of <paramref name="text"/>. With
|
||||
/// <paramref name="startsMidFile"/> the first (partial) line is dropped; an unfinished last line is kept.
|
||||
/// </summary>
|
||||
public static List<string> LastLines(string text, int maxLines, bool startsMidFile)
|
||||
{
|
||||
var lines = text.Split('\n').Select(l => l.TrimEnd('\r')).ToList();
|
||||
if (startsMidFile && lines.Count > 0) lines.RemoveAt(0);
|
||||
if (lines.Count > 0 && lines[^1].Length == 0) lines.RemoveAt(lines.Count - 1);
|
||||
return lines.Count > maxLines ? lines.GetRange(lines.Count - maxLines, maxLines) : lines;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,4 +20,11 @@ internal enum InjectionMode
|
|||
/// registers for this Windows user before the launch (DecalBridgeRegistration;
|
||||
/// docs/DECAL_BRIDGE_PLAN.md).</summary>
|
||||
DecalBridge = 2,
|
||||
|
||||
/// <summary>No acclient.exe: the launcher starts rynth-headless.exe (our own headless client,
|
||||
/// src\RynthCore.Headless.Cli) for the account, with the x64 plugins set in
|
||||
/// AppSettings.HeadlessPluginPaths (HeadlessLaunch). Experimental, ACE servers only.
|
||||
/// appsettings.json lists such an account as RynthCore; headless-accounts.json says which
|
||||
/// are really Headless (HeadlessAccountModes).</summary>
|
||||
Headless = 3,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,9 +37,10 @@ internal sealed record KnownServer(
|
|||
/// The servers RynthSuite has a server plugin for, so an account can be set up on one by picking
|
||||
/// it. Hosts, ports and emulators come from the public server list
|
||||
/// (github.com/acresources/serverslist, Servers.xml, checked 2026-10-13); Aelrynth is not on
|
||||
/// that list and uses aelrynth.com:9020. Each Host must stay inside the matching plugin's
|
||||
/// RynthPluginServerHosts, or RynthCore's load gate won't pick the plugin for it
|
||||
/// (RynthServerPack.Tests checks this).
|
||||
/// that list and uses aelrynth.com:9020. A PluginName is the server plugin's folder under
|
||||
/// C:\Games\RynthSuite when one is installed; the picker works the same without it. A Host
|
||||
/// should stay inside that plugin's manifest "server" hosts, or RynthCore's server gate won't
|
||||
/// pick the plugin for it.
|
||||
/// </summary>
|
||||
internal static class KnownServerCatalog
|
||||
{
|
||||
|
|
|
|||
85
src/RynthCore.App/SavedPasswordReveal.cs
Normal file
85
src/RynthCore.App/SavedPasswordReveal.cs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
using System;
|
||||
|
||||
namespace RynthCore.App;
|
||||
|
||||
/// <summary>
|
||||
/// The "show password" eye beside the account editor's password box. Pure: no UI.
|
||||
///
|
||||
/// The box starts empty ("leave blank to keep the saved password"). Turning the eye on with the
|
||||
/// box empty fills it with the saved password, decrypted at that moment, so the player can read
|
||||
/// it; with something typed, the eye only reveals what was typed. Turning the eye off empties the
|
||||
/// box again when it still holds the saved password it was filled with, so blank = keep holds,
|
||||
/// and saving it unchanged keeps the saved password as it is (nothing re-encrypted). A saved
|
||||
/// password that can't be read on this Windows user (needs re-entering) is never filled in.
|
||||
///
|
||||
/// Keeps no copy of the password: only whether the box was filled; the box's text is compared
|
||||
/// with a fresh decrypt. Never log what these return.
|
||||
/// </summary>
|
||||
internal sealed class SavedPasswordReveal
|
||||
{
|
||||
public const string ShowTip = "Show password";
|
||||
public const string HideTip = "Hide password";
|
||||
|
||||
// The saved password decrypted now; null when none is saved or it can't be read here.
|
||||
private readonly Func<string?> _readSaved;
|
||||
|
||||
public SavedPasswordReveal(Func<string?> readSaved)
|
||||
{
|
||||
_readSaved = readSaved ?? throw new ArgumentNullException(nameof(readSaved));
|
||||
}
|
||||
|
||||
/// <summary>For an account profile (the editor's draft): its saved password, if readable.</summary>
|
||||
public static SavedPasswordReveal For(LaunchAccountProfile profile)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(profile);
|
||||
return new SavedPasswordReveal(() =>
|
||||
profile.HasSavedPassword && !profile.PasswordNeedsReentry
|
||||
&& profile.TryGetPasswordForLaunch(out string saved, out _) && saved.Length > 0
|
||||
? saved
|
||||
: null);
|
||||
}
|
||||
|
||||
/// <summary>True while the box holds the saved password the eye filled in.</summary>
|
||||
public bool FilledFromSaved { get; private set; }
|
||||
|
||||
/// <summary>The eye turned on: the box's text, or the saved password when the box is empty.</summary>
|
||||
public string EyeOn(string? boxText)
|
||||
{
|
||||
if (string.IsNullOrEmpty(boxText) && _readSaved() is string saved)
|
||||
{
|
||||
FilledFromSaved = true;
|
||||
return saved;
|
||||
}
|
||||
FilledFromSaved = false;
|
||||
return boxText ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The eye turned off: the box's new text. Empty again when it still holds the saved password
|
||||
/// it was filled with; anything the player typed or changed stays.
|
||||
/// </summary>
|
||||
public string EyeOff(string? boxText)
|
||||
{
|
||||
string text = boxText ?? string.Empty;
|
||||
bool unchanged = HoldsSaved(text);
|
||||
FilledFromSaved = false;
|
||||
return unchanged ? string.Empty : text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What Save does with the box: null = keep the saved password as it is (the box is blank, or
|
||||
/// holds the saved password the eye showed, unchanged); otherwise the new password to save.
|
||||
/// </summary>
|
||||
public string? PasswordToSave(string? boxText)
|
||||
{
|
||||
if (string.IsNullOrEmpty(boxText) || HoldsSaved(boxText))
|
||||
return null;
|
||||
return boxText;
|
||||
}
|
||||
|
||||
/// <summary>Forgets the fill (the dialog closes).</summary>
|
||||
public void Reset() => FilledFromSaved = false;
|
||||
|
||||
private bool HoldsSaved(string text) =>
|
||||
FilledFromSaved && text.Length > 0 && _readSaved() is string saved && string.Equals(saved, text, StringComparison.Ordinal);
|
||||
}
|
||||
93
src/RynthCore.Engine/Assets/Fonts/Barlow.LICENSE
Normal file
93
src/RynthCore.Engine/Assets/Fonts/Barlow.LICENSE
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
Copyright 2017 The Barlow Project Authors (https://github.com/jpt/barlow)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
BIN
src/RynthCore.Engine/Assets/Fonts/BarlowSemiCondensed-Bold.ttf
Normal file
BIN
src/RynthCore.Engine/Assets/Fonts/BarlowSemiCondensed-Bold.ttf
Normal file
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue