Snapshot for release 2026.10.22.2 (internal 466f796)
This commit is contained in:
parent
c4efe5821d
commit
2be3668232
12 changed files with 666 additions and 27 deletions
|
|
@ -4320,8 +4320,10 @@ internal partial class MainWindow : Window
|
|||
}
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static extern bool SetWindowTextW(IntPtr hWnd, string lpString);
|
||||
private static extern IntPtr SendMessageTimeoutW(IntPtr hWnd, uint msg, IntPtr wParam, string lParam, uint flags, uint timeoutMs, out IntPtr result);
|
||||
|
||||
private const uint WM_SETTEXT = 0x000C;
|
||||
private const uint SMTO_ABORTIFHUNG = 0x0002;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct WinRect { public int Left, Top, Right, Bottom; }
|
||||
|
|
@ -4347,6 +4349,11 @@ internal partial class MainWindow : Window
|
|||
|
||||
private const uint SWP_NOZORDER = 0x0004;
|
||||
private const uint SWP_NOACTIVATE = 0x0010;
|
||||
// Posts the move to the client's thread instead of waiting for it: a plain
|
||||
// SetWindowPos on a frozen client's window never returns, and this runs on
|
||||
// the launcher's UI thread (2026-10-22: a frozen +Buffy kept the launcher
|
||||
// from ever showing its window).
|
||||
private const uint SWP_ASYNCWINDOWPOS = 0x4000;
|
||||
private const int GWL_EXSTYLE = -20;
|
||||
private const int WS_EX_LAYERED = 0x00080000;
|
||||
|
||||
|
|
@ -4466,7 +4473,7 @@ internal partial class MainWindow : Window
|
|||
profile.WindowY!.Value,
|
||||
profile.WindowWidth!.Value,
|
||||
profile.WindowHeight!.Value,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_ASYNCWINDOWPOS);
|
||||
LauncherDiag.Info($"WindowPos PID {process.Id} ({accountName}@{serverName}): restored to ({profile.WindowX},{profile.WindowY},{profile.WindowWidth}x{profile.WindowHeight}).");
|
||||
return;
|
||||
}
|
||||
|
|
@ -4593,7 +4600,17 @@ internal partial class MainWindow : Window
|
|||
if (hwnd == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
SetWindowTextW(hwnd, desired);
|
||||
// SetWindowText waits for the client's thread to take WM_SETTEXT, with no
|
||||
// time limit, and this runs on the launcher's UI thread every tick: one
|
||||
// frozen client froze the launcher (2026-10-22, +Buffy). Reading the title
|
||||
// never waits on another process, so skip the send when it already reads
|
||||
// right; otherwise give up on a hung or busy window and try next tick.
|
||||
string current;
|
||||
try { current = process.MainWindowTitle; } catch { current = string.Empty; }
|
||||
if (string.Equals(current, desired, StringComparison.Ordinal))
|
||||
return;
|
||||
|
||||
SendMessageTimeoutW(hwnd, WM_SETTEXT, IntPtr.Zero, desired, SMTO_ABORTIFHUNG, 250, out _);
|
||||
}
|
||||
|
||||
private static string ComputeDesiredWindowTitle(
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@
|
|||
// (RynthNav itself owns favorites, recent, the arrow and routing). The file's
|
||||
// path comes from RynthNav's status, so both read the same file.
|
||||
//
|
||||
// RynthNavAtlas the loaded places (a background load, UiBackgroundWriter),
|
||||
// and the player's map position from the pose snapshot.
|
||||
// RynthNavAtlas the loaded places (a background load, UiBackgroundWriter):
|
||||
// the locations, then the recall spells' landing spots as
|
||||
// places of type Recall (RynthNavAtlasRecalls.cs), and the
|
||||
// player's map position from the pose snapshot.
|
||||
// RynthNavAtlasSource the rows the face shows for its query (search by name
|
||||
// and type, typed coordinates as the first row, Nearby,
|
||||
// Favorites, Recent; Saved = favorites then recent, the Go
|
||||
|
|
@ -28,21 +30,6 @@ using RynthCore.Engine.Compatibility;
|
|||
|
||||
namespace RynthCore.Engine.UI.Data;
|
||||
|
||||
/// <summary>One place from locations.json, with its display strings.</summary>
|
||||
internal sealed class NavPlace
|
||||
{
|
||||
public int Id;
|
||||
public string Name = "", Type = "", Desc = "", Place = "", Lb = "", Cell = "";
|
||||
public bool OnMap;
|
||||
public double Ns, Ew;
|
||||
public bool HasDest, DestOnMap;
|
||||
public double DestNs, DestEw;
|
||||
public string DestName = "";
|
||||
public int MinLevel, MaxLevel;
|
||||
public bool Quest, Closed;
|
||||
public string CoordText = "", DestText = "", LevelText = "";
|
||||
}
|
||||
|
||||
/// <summary>Saved: favorites, then recent places (the Go tab's list while its box is empty).</summary>
|
||||
internal enum AtlasMode { Search, Nearby, Favorites, Recent, Saved }
|
||||
|
||||
|
|
@ -72,7 +59,7 @@ internal sealed class AtlasView
|
|||
internal static class RynthNavAtlas
|
||||
{
|
||||
public static readonly string[] Types =
|
||||
{ "All", "Town", "Dungeon", "Portal", "Lifestone", "Bindstone", "Vendor", "NPC", "Landmark" };
|
||||
{ "All", "Town", "Dungeon", "Portal", "Lifestone", "Bindstone", "Vendor", "NPC", "Landmark", RynthNavAtlasRecalls.Type };
|
||||
|
||||
private static readonly object Sync = new();
|
||||
private static string _requested = "";
|
||||
|
|
@ -140,6 +127,13 @@ internal static class RynthNavAtlas
|
|||
list.Add(p);
|
||||
}
|
||||
}
|
||||
// The recall spells' landing spots, as places of type Recall (RynthNavAtlasRecalls).
|
||||
foreach (NavPlace p in RynthNavAtlasRecalls.Read(doc.RootElement, RynthNavStatus.Coord))
|
||||
{
|
||||
if (p.OnMap && p.Cell.Length == 8 && uint.TryParse(p.Cell.AsSpan(0, 4), NumberStyles.HexNumber, null, out uint lb))
|
||||
lbs.Add(lb);
|
||||
list.Add(p);
|
||||
}
|
||||
_places = list.ToArray();
|
||||
_mapLandblocks = lbs;
|
||||
_dungeonNames = dungeons;
|
||||
|
|
@ -238,7 +232,7 @@ internal static class RynthNavAtlas
|
|||
|
||||
public static int TypeRank(string type) => type switch
|
||||
{
|
||||
"Town" => 0, "Dungeon" => 1, "Landmark" => 2, "Lifestone" => 3, "Bindstone" => 4,
|
||||
"Town" => 0, "Dungeon" => 1, "Landmark" => 2, RynthNavAtlasRecalls.Type => 2, "Lifestone" => 3, "Bindstone" => 4,
|
||||
"Portal" => 5, "Vendor" => 6, "NPC" => 7, _ => 8,
|
||||
};
|
||||
|
||||
|
|
|
|||
79
src/RynthCore.Engine/UI/Data/RynthNavAtlasRecalls.cs
Normal file
79
src/RynthCore.Engine/UI/Data/RynthNavAtlasRecalls.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// ============================================================================
|
||||
// RynthCore.Engine - UI/Data/RynthNavAtlasRecalls.cs
|
||||
// NavPlace (one Atlas place) and the recall spells as Atlas places.
|
||||
//
|
||||
// locations.json's "recalls" are the spells that land at a fixed spot. They are
|
||||
// searchable places of type "Recall" (2026-10-22): the world database names only
|
||||
// the /telepoi towns, so a place like Neftet had no entry and a search for "neft"
|
||||
// found nothing, while "Lost City of Neftet Recall" lands right there (22.2S, 6.2E).
|
||||
// The spell's name stays the place's name, so it reads as what it is.
|
||||
//
|
||||
// Pure (no engine state), so tools\AtlasRecallsTests compiles it on its own.
|
||||
// ============================================================================
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace RynthCore.Engine.UI.Data;
|
||||
|
||||
/// <summary>One place from locations.json, with its display strings.</summary>
|
||||
internal sealed class NavPlace
|
||||
{
|
||||
public int Id;
|
||||
public string Name = "", Type = "", Desc = "", Place = "", Lb = "", Cell = "";
|
||||
public bool OnMap;
|
||||
public double Ns, Ew;
|
||||
public bool HasDest, DestOnMap;
|
||||
public double DestNs, DestEw;
|
||||
public string DestName = "";
|
||||
public int MinLevel, MaxLevel;
|
||||
public bool Quest, Closed;
|
||||
public string CoordText = "", DestText = "", LevelText = "";
|
||||
}
|
||||
|
||||
internal static class RynthNavAtlasRecalls
|
||||
{
|
||||
public const string Type = "Recall";
|
||||
|
||||
/// <summary>
|
||||
/// The places <paramref name="root"/>'s "recalls" array names: each spell's landing spot,
|
||||
/// on the map when it has coordinates, else "in" its dungeon. A spell listed twice at the
|
||||
/// same cell is one place; an entry with no name is left out. <paramref name="coord"/>
|
||||
/// formats map coordinates (RynthNavStatus.Coord).
|
||||
/// </summary>
|
||||
public static List<NavPlace> Read(JsonElement root, Func<double, double, string> coord)
|
||||
{
|
||||
var places = new List<NavPlace>();
|
||||
if (!root.TryGetProperty("recalls", out JsonElement arr) || arr.ValueKind != JsonValueKind.Array) return places;
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (JsonElement e in arr.EnumerateArray())
|
||||
{
|
||||
if (e.ValueKind != JsonValueKind.Object) continue;
|
||||
string name = Str(e, "name").Trim(), cell = Str(e, "cell"), dungeon = Str(e, "in");
|
||||
if (name.Length == 0 || !seen.Add(name + "|" + cell)) continue;
|
||||
// TryGetInt32 throws (not false) on a non-number: check the kind first.
|
||||
int spell = e.TryGetProperty("spell", out JsonElement s) && s.ValueKind == JsonValueKind.Number && s.TryGetInt32(out int id) ? id : 0;
|
||||
var p = new NavPlace
|
||||
{
|
||||
Id = -spell, // locations have positive ids
|
||||
Name = name, Type = Type, Place = Str(e, "place"), Cell = cell,
|
||||
Desc = "Where this recall spell lands" + (dungeon.Length > 0 ? ", in " + dungeon : "") + ".",
|
||||
};
|
||||
if (cell.Length >= 4) p.Lb = cell.Substring(0, 4);
|
||||
p.OnMap = Num(e, "ns", out p.Ns) & Num(e, "ew", out p.Ew);
|
||||
p.CoordText = p.OnMap ? coord(p.Ns, p.Ew) : dungeon.Length > 0 ? "in " + dungeon : "in a dungeon";
|
||||
places.Add(p);
|
||||
}
|
||||
return places;
|
||||
}
|
||||
|
||||
private static string Str(JsonElement e, string name) =>
|
||||
e.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.String ? v.GetString() ?? "" : "";
|
||||
|
||||
private static bool Num(JsonElement e, string name, out double value)
|
||||
{
|
||||
value = double.NaN;
|
||||
return e.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.Number && v.TryGetDouble(out value);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue