feat: port aelrynth 2026.9.27.2 snapshot onto GitHub history

Overlay upstream/main (9b5e276) onto BlankenshipG main without rewriting
history. Keep origin-only Decal/plugin/docs trees. Re-apply aelrynth.com
and sibling-fork URL fixes that aelrynth git still has as tombohar links.

Co-authored-by: BlankenshipG <BlankenshipG@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-10-04 15:43:50 +00:00
commit 4ddbb52eb2
No known key found for this signature in database
244 changed files with 59710 additions and 3067 deletions

View file

@ -16,35 +16,35 @@ internal readonly record struct CreatureVitals(
/// </summary>
internal static class ObjectQualityCache
{
private static readonly Dictionary<IntPtr, uint> _maxHealthByPtr = new();
// NOTE: a former _maxHealthByPtr (keyed by reusable CWeenieObject heap
// pointers, populated per stat-update from an UnmanagedCallersOnly detour)
// was removed 2026-06-11: it was write-only — zero readers — pure
// allocation churn in a detour plus an unbounded pointer-keyed dictionary.
private static readonly Dictionary<uint, CreatureVitals> _vitalsByObjectId = new();
private static readonly object _lock = new();
public static void SetMaxHealth(IntPtr objectPtr, uint maxHealth)
{
if (objectPtr == IntPtr.Zero)
return;
lock (_lock)
_maxHealthByPtr[objectPtr] = maxHealth;
}
public static bool TryGetMaxHealth(IntPtr objectPtr, out uint maxHealth)
{
if (objectPtr == IntPtr.Zero)
{
maxHealth = 0;
return false;
}
lock (_lock)
return _maxHealthByPtr.TryGetValue(objectPtr, out maxHealth);
}
// Bound the cache: ids accumulate for the whole session otherwise. The
// cache is advisory (resolvers fall back to ratio-only); a rare wholesale
// clear is cheaper and safer than LRU bookkeeping inside detour paths.
private const int MaxEntries = 4096;
public static void SetCreatureVitals(uint objectId, CreatureVitals vitals)
{
if (objectId == 0)
return;
lock (_lock)
{
if (_vitalsByObjectId.Count >= MaxEntries && !_vitalsByObjectId.ContainsKey(objectId))
_vitalsByObjectId.Clear();
_vitalsByObjectId[objectId] = vitals;
}
}
/// <summary>Drop all cached vitals at logout — object ids don't survive the session.</summary>
public static void ClearSession()
{
lock (_lock)
_vitalsByObjectId.Clear();
}
public static bool TryGetCreatureVitals(uint objectId, out CreatureVitals vitals)