From a7d5f791c814d275596ce03b4a2b7d9b49ff768c Mon Sep 17 00:00:00 2001 From: Tom Bohar Date: Mon, 23 Nov 2026 11:13:46 -0500 Subject: [PATCH] RynthCore as of 2026-11-23 (internal 115e628): release 2026.11.23.1 --- installer/RynthCore.iss | 147 ++ .../DecalBridgeDialog.cs | 27 + .../MainWindow.VTankImport.cs | 160 ++ src/RynthCore.App.Avalonia/MainWindow.axaml | 19 + .../MainWindow.axaml.cs | 13 + src/RynthCore.App.Avalonia/Program.cs | 10 + .../RynthCore.App.Avalonia.csproj | 1 + src/RynthCore.App/AcWindowPlacementRule.cs | 22 + src/RynthCore.App/AppSettings.cs | 6 + src/RynthCore.App/VTankFileImport.cs | 646 +++++++++ .../Compatibility/AcMainThreadQueue.cs | 12 +- .../Compatibility/AcMouseOver.cs | 18 +- .../Compatibility/AcMouseOverRules.cs | 28 +- .../Compatibility/AcPanels.cs | 112 +- .../Compatibility/LauncherSettings.cs | 19 + .../Compatibility/PaletteLeakFix.cs | 96 ++ .../Compatibility/PaletteLeakSites.cs | 82 ++ .../Compatibility/PanelSwapPolicy.cs | 59 + .../Compatibility/RynthCoreChatCommands.cs | 30 +- .../Compatibility/TrainingApi.cs | 9 +- .../Compatibility/WorldTransitionState.cs | 14 + src/RynthCore.Engine/D3D9/AcGameDevice.cs | 246 ++++ .../D3D9/AcGameDevicePolicy.cs | 76 + src/RynthCore.Engine/D3D9/D3D9Bootstrapper.cs | 51 +- src/RynthCore.Engine/D3D9/D3D9VTable.cs | 2 + src/RynthCore.Engine/D3D9/DeviceResetHook.cs | 3 +- src/RynthCore.Engine/D3D9/EndSceneHook.cs | 10 +- .../D3D9/OverlayTextureRenderer.cs | 15 + src/RynthCore.Engine/EntryPoint.cs | 3 + src/RynthCore.Engine/ImGui/DX9Backend.cs | 37 + .../ImGui/EngineFrameController.cs | 2 +- src/RynthCore.Engine/ImGui/ImGuiPanelHost.cs | 3 +- src/RynthCore.Engine/ImGui/Panels/ChatFace.cs | 23 +- src/RynthCore.Engine/ImGui/Panels/ChatView.cs | 75 +- .../ImGui/Panels/Classic/ClassicLootTab.cs | 5 +- .../ImGui/Panels/Classic/ClassicRouteTab.cs | 16 + .../ImGui/Panels/LootEditorFace.cs | 107 +- src/RynthCore.Engine/ImGui/Panels/NavFace.cs | 16 + .../ImGui/Panels/RadarFace.cs | 29 + .../ImGui/Panels/RynthNavArrowFace.cs | 13 +- .../ImGui/Panels/RynthNavFace.cs | 43 +- .../ImGui/Panels/SenseFace.cs | 148 +- .../ImGui/Panels/SettingsFace.cs | 16 + .../ImGui/Panels/SkillsFace.cs | 17 +- .../ImGui/Panels/WorldMapFace.cs | 19 +- src/RynthCore.Engine/ImGui/PhosphorIcons.cs | 2 + src/RynthCore.Engine/UI/AcWindowChrome.cs | 132 +- .../UI/AcWindowChromePolicy.cs | 113 +- src/RynthCore.Engine/UI/Data/ChatData.cs | 79 +- src/RynthCore.Engine/UI/Data/ChatHistory.cs | 90 ++ .../UI/Data/ChatPlayerText.cs | 76 + src/RynthCore.Engine/UI/Data/ChatRouting.cs | 11 +- .../UI/Data/ChatSettingsDto.cs | 4 + src/RynthCore.Engine/UI/Data/LootEditData.cs | 20 +- .../UI/Data/LootProfilePick.cs | 39 + src/RynthCore.Engine/UI/Data/NavData.cs | 5 + src/RynthCore.Engine/UI/Data/RynthNavData.cs | 42 +- src/RynthCore.Engine/UI/Data/SenseData.cs | 72 + src/RynthCore.Engine/UI/Data/SenseModel.cs | 120 +- src/RynthCore.Engine/UI/Data/SettingsData.cs | 53 +- .../UI/Panels/RadarSettingsStore.cs | 17 + .../AcGameDeviceTests.csproj | 24 + tools/AcGameDeviceTests/Program.cs | 121 ++ tools/AcMouseOverTests/Program.cs | 28 + tools/ChatFilterTests/ChatFilterTests.csproj | 3 + tools/ChatFilterTests/Program.PlayerChat.cs | 228 +++ tools/ChatFilterTests/Program.cs | 8 +- .../ChatHistoryBench/ChatHistoryBench.csproj | 6 + tools/ChatHistoryBench/Program.cs | 24 +- tools/CombatSettingsTests/Program.cs | 6 +- tools/EngineRobustnessTests/Program.cs | 44 + tools/EngineSettingsTests/Program.cs | 114 +- tools/LauncherSettingsTests/Program.cs | 35 + tools/LootAddWireTests/Program.cs | 53 + .../PaletteLeakFixTests.csproj | 23 + tools/PaletteLeakFixTests/Program.cs | 96 ++ .../PanelSwapPolicyTests.csproj | 23 + tools/PanelSwapPolicyTests/Program.cs | 279 ++++ tools/RadarSettingsTests/Program.cs | 21 + tools/SenseTests/Program.cs | 61 +- tools/SettingsLayoutTests/Program.cs | 33 +- tools/VTankFileImportTests/Program.cs | 630 ++++++++ .../VTankFileImportTests.csproj | 26 + tools/navdata/NavData/locations.json | 192 +-- tools/navdata/NavData/portals.tsv | 1292 ++++++++--------- 85 files changed, 5889 insertions(+), 861 deletions(-) create mode 100644 src/RynthCore.App.Avalonia/MainWindow.VTankImport.cs create mode 100644 src/RynthCore.App/VTankFileImport.cs create mode 100644 src/RynthCore.Engine/Compatibility/PaletteLeakFix.cs create mode 100644 src/RynthCore.Engine/Compatibility/PaletteLeakSites.cs create mode 100644 src/RynthCore.Engine/Compatibility/PanelSwapPolicy.cs create mode 100644 src/RynthCore.Engine/D3D9/AcGameDevice.cs create mode 100644 src/RynthCore.Engine/D3D9/AcGameDevicePolicy.cs create mode 100644 src/RynthCore.Engine/UI/Data/ChatPlayerText.cs create mode 100644 src/RynthCore.Engine/UI/Data/LootProfilePick.cs create mode 100644 tools/AcGameDeviceTests/AcGameDeviceTests.csproj create mode 100644 tools/AcGameDeviceTests/Program.cs create mode 100644 tools/ChatFilterTests/Program.PlayerChat.cs create mode 100644 tools/PaletteLeakFixTests/PaletteLeakFixTests.csproj create mode 100644 tools/PaletteLeakFixTests/Program.cs create mode 100644 tools/PanelSwapPolicyTests/PanelSwapPolicyTests.csproj create mode 100644 tools/PanelSwapPolicyTests/Program.cs create mode 100644 tools/VTankFileImportTests/Program.cs create mode 100644 tools/VTankFileImportTests/VTankFileImportTests.csproj diff --git a/installer/RynthCore.iss b/installer/RynthCore.iss index 1c21008..3172e25 100644 --- a/installer/RynthCore.iss +++ b/installer/RynthCore.iss @@ -239,9 +239,156 @@ begin Log('Decal bridge: per-user step did not start: ' + SysErrorMessage(Code)); end; +(* ------------------------------------------------------------------------------------- + VirindiTank files: offer to copy the player's VTank metas (*.met, and metaf's *.af), nav + routes (*.nav) and loot profiles (*.utl) into RynthAi's MetaFiles, NavProfiles and + LootProfiles, which RynthAi loads as they are. VTank's "--_" state files + and character settings (.usd) are not part of this (settings are imported per character in + game). Nothing about Decal changes. The same copy is in the launcher (Runtime > Coming from + VirindiTank > Import VirindiTank files), which can also pick a folder and keep both copies + when RynthAi has a different file of the same name; Setup only ever skips those. + + - Interactive installs only: never with /SILENT or /VERYSILENT (the launcher's updates) or + on the /RELAUNCH update path. + - Asked once per PC: the answer, Yes or No, is recorded in VTankAskedMarker (in RynthAi's + folder, which uninstall never removes), and Setup never asks again while it exists. + - Files first: RynthCore.exe --vtank-import scan (src\RynthCore.App\VTankFileImport.cs, + tested by tools\VTankFileImportTests) looks at the top level of VTank's folder(s): Decal's + VTank entry (read only) and the usual install locations. Nothing new to copy: no question + and nothing recorded. + - Yes: --vtank-import copy. Never overwrites a file RynthAi has, never changes, moves or + deletes anything in a VTank folder. Every copied and skipped file goes to the setup log; + one closing message gives the counts. + Both commands run as the user who started Setup (their Documents, their files). + ------------------------------------------------------------------------------------- *) +const + VTankRynthAiDir = 'C:\Games\RynthSuite\RynthAi'; + VTankAskedMarker = 'C:\Games\RynthSuite\RynthAi\vtank-import-asked.txt'; + +function VTankReportValue(const Lines: TArrayOfString; const Key: String): Integer; +var + I: Integer; +begin + Result := 0; + for I := 0 to GetArrayLength(Lines) - 1 do + if Pos(Key + '=', Lines[I]) = 1 then + begin + Result := StrToIntDef(Copy(Lines[I], Length(Key) + 2, MaxInt), 0); + Exit; + end; +end; + +function RunVTankImport(const Mode: String; var Lines: TArrayOfString): Boolean; +var + Report: String; + Code, I: Integer; +begin + Result := False; + Report := ExpandConstant('{tmp}\rynthcore-vtank-import-' + Mode + '.txt'); + DeleteFile(Report); + if not ExecAsOriginalUser(ExpandConstant('{app}\RynthCore.exe'), + '--vtank-import ' + Mode + ' "' + VTankRynthAiDir + '" --report "' + Report + '"', + ExpandConstant('{app}'), SW_HIDE, ewWaitUntilTerminated, Code) then + begin + Log('VTank import: ' + Mode + ' did not start: ' + SysErrorMessage(Code)); + Exit; + end; + Log('VTank import: ' + Mode + ' exit code ' + IntToStr(Code)); + if not LoadStringsFromFile(Report, Lines) then + begin + Log('VTank import: no ' + Mode + ' report - nothing more done.'); + Exit; + end; + for I := 0 to GetArrayLength(Lines) - 1 do + if Pos('log=', Lines[I]) = 1 then + Log(Copy(Lines[I], 5, MaxInt)); + Result := True; +end; + +function VTankCount(N: Integer; const One, Many: String): String; +begin + if N = 1 then + Result := '1 ' + One + else + Result := IntToStr(N) + ' ' + Many; +end; + +procedure VTankAddPart(var List: String; N: Integer; const One, Many: String); +begin + if N <= 0 then Exit; + if List <> '' then List := List + ', '; + List := List + VTankCount(N, One, Many); +end; + +procedure OfferVTankImport; +var + Scan, Done: TArrayOfString; + Found, Answer, Msg: String; + Copied, Skipped, Already, Failed: Integer; +begin + if WizardSilent or CmdLineParamExists('/RELAUNCH') then Exit; + if FileExists(VTankAskedMarker) then + begin + Log('VTank import: asked before (' + VTankAskedMarker + ') - not asked again.'); + Exit; + end; + if not DirExists(VTankRynthAiDir) then Exit; + if not RunVTankImport('scan', Scan) then Exit; + if VTankReportValue(Scan, 'new') <= 0 then + begin + Log('VTank import: no VirindiTank files that RynthAi does not have already - nothing asked.'); + Exit; + end; + + Found := ''; + VTankAddPart(Found, VTankReportValue(Scan, 'metas'), 'meta', 'metas'); + VTankAddPart(Found, VTankReportValue(Scan, 'navs'), 'nav route', 'nav routes'); + VTankAddPart(Found, VTankReportValue(Scan, 'loot'), 'loot profile', 'loot profiles'); + if MsgBox('RynthCore found your VirindiTank files: ' + Found + '.' + #13#10#13#10 + + 'Copy them to RynthAi so you can use them there? Files you already have in RynthAi are not replaced, ' + + 'and nothing in your VirindiTank folder is changed.' + #13#10#13#10 + + 'You can also do this later from the launcher: Runtime tab, Import VirindiTank files.', + mbConfirmation, MB_YESNO) = IDYES then + Answer := 'Yes' + else + Answer := 'No'; + Log('VTank import: offered ' + Found + '; answer ' + Answer + '.'); + if not SaveStringToFile(VTankAskedMarker, + 'RynthCore Setup asked on ' + GetDateTimeString('yyyy/mm/dd hh:nn', '-', ':') + + ' whether to copy the VirindiTank files (' + Found + ') to RynthAi. Answer: ' + Answer + '.' + #13#10 + + 'While this file exists Setup does not ask again.' + #13#10, False) then + Log('VTank import: could not record the answer in ' + VTankAskedMarker + ' - Setup may ask again next time.'); + if Answer <> 'Yes' then Exit; + + WizardForm.StatusLabel.Caption := 'Copying your VirindiTank files to RynthAi...'; + if not RunVTankImport('copy', Done) then + begin + MsgBox('RynthCore could not copy your VirindiTank files. Nothing in your VirindiTank folder was changed.', + mbError, MB_OK); + Exit; + end; + Copied := VTankReportValue(Done, 'copied'); + Skipped := VTankReportValue(Done, 'skipped'); + Failed := VTankReportValue(Done, 'failed'); + Already := VTankReportValue(Done, 'already'); + Msg := 'Copied ' + VTankCount(Copied, 'VirindiTank file', 'VirindiTank files') + ' to RynthAi.'; + if Already > 0 then + Msg := Msg + #13#10 + VTankCount(Already, 'file was', 'files were') + ' already in RynthAi.'; + if Skipped > 0 then + Msg := Msg + #13#10 + VTankCount(Skipped, 'file was', 'files were') + + ' skipped: RynthAi already has a different file of that name (yours was kept). ' + + 'The launcher''s Import VirindiTank files button (Runtime tab) can copy them beside yours.'; + if Failed > 0 then + Msg := Msg + #13#10 + VTankCount(Failed, 'file', 'files') + ' could not be copied (the setup log says why).'; + MsgBox(Msg, mbInformation, MB_OK); +end; + procedure CurStepChanged(CurStep: TSetupStep); begin { After the files, before [Run] (which relaunches the launcher after an update). } if CurStep = ssPostInstall then + begin RegisterDecalBridge; + OfferVTankImport; + end; end; diff --git a/src/RynthCore.App.Avalonia/DecalBridgeDialog.cs b/src/RynthCore.App.Avalonia/DecalBridgeDialog.cs index 8f449c3..f7c460a 100644 --- a/src/RynthCore.App.Avalonia/DecalBridgeDialog.cs +++ b/src/RynthCore.App.Avalonia/DecalBridgeDialog.cs @@ -10,6 +10,7 @@ namespace RynthCore.App.Avalonia; /// /// Small code-built dialogs for the Decal bridge: the "Check Decal bridge" report (with /// Repair / Copy), the yes/no before an administrator step or Repair Decal, and plain messages. +/// Also used by other launcher actions (Fix folder permissions, Import VirindiTank files). /// internal static class DecalBridgeDialog { @@ -33,6 +34,32 @@ internal static class DecalBridgeDialog return result == true; } + /// + /// A message with several buttons (selectable text). Returns the index of the button pressed, + /// -1 when the window was closed. The first button is the default; the last is Cancel (Esc). + /// + public static async Task ChooseAsync(Window owner, string title, string message, params string[] buttons) + { + var dialog = NewWindow(title, 640); + var controls = new Control[buttons.Length]; + for (int i = 0; i < buttons.Length; i++) + { + int index = i; + var b = new Button { Content = buttons[i], IsDefault = i == 0, IsCancel = i == buttons.Length - 1 }; + b.Click += (_, _) => dialog.Close(index); + controls[i] = b; + } + dialog.Content = Layout(title, + new ScrollViewer + { + MaxHeight = 460, + Content = new SelectableTextBlock { Text = message, TextWrapping = TextWrapping.Wrap, Foreground = Text }, + }, + controls); + int? result = await dialog.ShowDialog(owner); + return result ?? -1; + } + /// A message with one OK button (selectable text, so paths can be copied). public static async Task InfoAsync(Window owner, string title, string message) { diff --git a/src/RynthCore.App.Avalonia/MainWindow.VTankImport.cs b/src/RynthCore.App.Avalonia/MainWindow.VTankImport.cs new file mode 100644 index 0000000..c7d7ac4 --- /dev/null +++ b/src/RynthCore.App.Avalonia/MainWindow.VTankImport.cs @@ -0,0 +1,160 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Avalonia.Platform.Storage; +using RynthCore.Install; +using static RynthCore.App.VTankFileImport; + +namespace RynthCore.App.Avalonia; + +/// +/// Runtime > "Coming from VirindiTank" > Import VirindiTank files: copies the player's VTank metas, +/// navs and loot profiles into RynthAi's folders. The search, the plan and the copy are +/// src\RynthCore.App\VTankFileImport.cs (shared with the installer's offer, tested by +/// tools\VTankFileImportTests); this is only the questions and the messages. +/// +internal partial class MainWindow +{ + private const string VTankImportTitle = "Import VirindiTank files"; + private bool _vtankImportBusy; + + private enum VTankChoice { Copy, KeepBoth, PickFolder, Cancel } + + private async Task ImportVTankFilesAsync() + { + if (_vtankImportBusy) return; + _vtankImportBusy = true; + ImportVTankFilesButton.IsEnabled = false; + try + { + await ImportVTankFilesCoreAsync(); + } + catch (Exception ex) + { + LauncherDiag.Info($"VTANKIMPORT: failed ({ex.GetType().Name}: {ex.Message})"); + AppendActivity($"Import VirindiTank files: failed ({ex.Message})."); + await DecalBridgeDialog.InfoAsync(this, VTankImportTitle, $"The import stopped: {ex.Message}\n\nNothing in your VirindiTank folder was changed."); + } + finally + { + _vtankImportBusy = false; + ImportVTankFilesButton.IsEnabled = true; + } + } + + private async Task ImportVTankFilesCoreAsync() + { + string ai = RynthInstallPaths.RynthAiDir; + if (!Directory.Exists(ai)) + { + AppendActivity($"Import VirindiTank files: RynthAi's folder {ai} doesn't exist; nothing copied."); + await DecalBridgeDialog.InfoAsync(this, VTankImportTitle, + $"RynthAi isn't installed here yet: {ai} doesn't exist. Install RynthSuite first, then import."); + return; + } + + ScanResult scan = await ScanVTankAsync(null, ai); + ConflictMode mode; + while (true) + { + if (scan.TotalFound == 0) + { + string why = scan.Roots.Count == 0 + ? "RynthCore didn't find a VirindiTank folder in the usual places (Decal's plugin list, " + + @"C:\Games\VirindiPlugins\VirindiTank, Documents, Program Files)." + : "There are no VirindiTank metas (.met, .af), nav routes (.nav) or loot profiles (.utl) in " + + string.Join(", ", scan.Roots) + "."; + int pick = await DecalBridgeDialog.ChooseAsync(this, VTankImportTitle, + why + "\n\nChoose the folder VirindiTank is installed in?", "Choose folder...", "Cancel"); + if (pick != 0 || !await RescanPickedFolderAsync(ai, s => scan = s)) + { + AppendActivity("Import VirindiTank files: cancelled; nothing copied."); + return; + } + continue; + } + + var choices = new List<(string Label, VTankChoice Choice)>(); + if (scan.NewCount > 0) choices.Add(("Copy", VTankChoice.Copy)); + if (scan.ConflictCount > 0) choices.Add(("Copy, keep both", VTankChoice.KeepBoth)); + choices.Add(("Choose another folder...", VTankChoice.PickFolder)); + choices.Add((choices.Count == 1 ? "Close" : "Cancel", VTankChoice.Cancel)); + + string plan = DescribePlan(scan); + if (scan.NewCount == 0 && scan.ConflictCount == 0) + plan += "\n\nEverything here is already in RynthAi."; + int i = await DecalBridgeDialog.ChooseAsync(this, VTankImportTitle, plan, choices.Select(c => c.Label).ToArray()); + VTankChoice choice = i >= 0 && i < choices.Count ? choices[i].Choice : VTankChoice.Cancel; + if (choice == VTankChoice.PickFolder) + { + if (!await RescanPickedFolderAsync(ai, s => scan = s)) + { + AppendActivity("Import VirindiTank files: cancelled; nothing copied."); + return; + } + continue; + } + if (choice == VTankChoice.Cancel) + { + AppendActivity("Import VirindiTank files: cancelled; nothing copied."); + return; + } + mode = choice == VTankChoice.KeepBoth ? ConflictMode.KeepBoth : ConflictMode.Skip; + break; + } + + AppendActivity($"Import VirindiTank files: copying from {string.Join(", ", scan.Roots)}{(mode == ConflictMode.KeepBoth ? " (keep both)" : "")}..."); + CopyResult result = await Task.Run(() => Copy(scan, mode)); + foreach (string line in result.Log) LauncherDiag.Info("VTANKIMPORT: " + line); + string summary = $"{result.Copied} copied ({result.KeptBoth} kept both), {result.Skipped} skipped, " + + $"{result.AlreadyThere} already there, {result.Failed} failed."; + LauncherDiag.Info("VTANKIMPORT: (launcher) " + summary); + AppendActivity("Import VirindiTank files: " + summary); + await DecalBridgeDialog.InfoAsync(this, VTankImportTitle, DescribeResult(result, ai)); + } + + /// Scans (null = this PC's usual VTank folders) off the UI thread; logs it. + private static async Task ScanVTankAsync(IEnumerable? roots, string ai) + { + ScanResult scan = await Task.Run(() => Find(roots ?? DefaultRoots(), ai)); + foreach (string r in scan.Roots) LauncherDiag.Info("VTANKIMPORT: looked in " + r); + foreach (string line in scan.Log) LauncherDiag.Info("VTANKIMPORT: " + line); + LauncherDiag.Info($"VTANKIMPORT: scan: {scan.TotalFound} found, {scan.NewCount} new, {scan.ConflictCount} name conflicts, " + + $"{scan.SameCount} already there, {scan.StateFilesLeftOut} VTank state files left out."); + return scan; + } + + /// Folder picker, then a scan of that folder. False when the player cancelled the picker. + private async Task RescanPickedFolderAsync(string ai, Action set) + { + string? picked = await PickVTankFolderAsync(); + if (picked == null) return false; + string root = ResolvePickedFolder(picked); + set(await ScanVTankAsync(new[] { root }, ai)); + return true; + } + + private async Task PickVTankFolderAsync() + { + var topLevel = GetTopLevel(this); + if (topLevel == null) return null; + IStorageFolder? start = null; + try + { + string guess = Directory.Exists(@"C:\Games\VirindiPlugins") ? @"C:\Games\VirindiPlugins" : @"C:\Games"; + if (Directory.Exists(guess)) start = await topLevel.StorageProvider.TryGetFolderFromPathAsync(guess); + } + catch { } + var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions + { + Title = "Choose your VirindiTank folder", + AllowMultiple = false, + SuggestedStartLocation = start, + }); + if (folders.Count == 0) return null; + string? path = folders[0].TryGetLocalPath(); + return string.IsNullOrEmpty(path) ? null : path; + } +} diff --git a/src/RynthCore.App.Avalonia/MainWindow.axaml b/src/RynthCore.App.Avalonia/MainWindow.axaml index c275320..0d23494 100644 --- a/src/RynthCore.App.Avalonia/MainWindow.axaml +++ b/src/RynthCore.App.Avalonia/MainWindow.axaml @@ -440,6 +440,14 @@ Content="Rewrite AC window titles per account" ToolTip.Tip="Replaces "Asheron's Call" with "Account / Character @ Server" on tracked clients so multi-box taskbars are readable. Untracked external clients are left alone." /> + + @@ -548,6 +556,17 @@ Foreground="#9AA8B3" /> + + + + + +