Snapshot for release 2026.10.6.1 (internal 1cbe514)

This commit is contained in:
Tom Bohar 2026-10-06 08:47:11 -04:00
commit abf9146a5b
93 changed files with 10168 additions and 597 deletions

View file

@ -1407,6 +1407,7 @@ internal static partial class PluginManager
}
RynthLog.Plugin("PluginManager: Rescanning plugins...");
Net.FlightRecorder.Mark(Net.FlightMark.PluginReload, text: "all plugins unloaded and loaded again (rescan)");
UnloadAllPlugins();
PluginLoader.CleanupShadowCopies(_shadowRootDir);
@ -2334,7 +2335,7 @@ internal static partial class PluginManager
// bundled Plugins\ folder — that historically caused stray DLLs to
// load on next start (or after hot-reload) without the user knowing.
var extraPaths = EngineSettings.PluginPaths;
var candidates = new List<string>(extraPaths.Count);
var present = new List<string>(extraPaths.Count);
for (int i = 0; i < extraPaths.Count; i++)
{
string dllPath = extraPaths[i];
@ -2343,33 +2344,26 @@ internal static partial class PluginManager
RynthLog.Plugin($"PluginManager: Extra plugin not found: {dllPath}");
continue;
}
// Skip if a plugin with the same filename was already loaded from the default directory.
// Both paths share the same session shadow dir — loading the same filename twice would
// try to overwrite a locked shadow copy and crash.
string extraFileName = Path.GetFileName(dllPath);
bool alreadyLoaded = false;
for (int j = 0; j < _plugins.Count; j++)
{
if (string.Equals(Path.GetFileName(_plugins[j].SourceFilePath), extraFileName, StringComparison.OrdinalIgnoreCase))
{
alreadyLoaded = true;
break;
}
}
for (int j = 0; j < candidates.Count && !alreadyLoaded; j++)
{
if (string.Equals(Path.GetFileName(candidates[j]), extraFileName, StringComparison.OrdinalIgnoreCase))
alreadyLoaded = true;
}
if (alreadyLoaded)
{
RynthLog.Plugin($"PluginManager: Extra plugin {extraFileName} already loaded from default directory — skipping.");
continue;
}
candidates.Add(dllPath);
present.Add(dllPath);
}
// One plugin per file name, before any shadow copy: every shadow copy shares the session
// folder, so a second DLL of the same name would overwrite a mapped copy. The same file
// listed twice loads once; the same name from two folders is a conflict - the first wins
// (PluginPathDedupe).
var loadedSources = new List<string>(_plugins.Count);
for (int j = 0; j < _plugins.Count; j++)
loadedSources.Add(_plugins[j].SourceFilePath);
PluginPathDedupe.Result deduped = PluginPathDedupe.Dedupe(present, loadedSources);
foreach (PluginPathDedupe.Skipped skipped in deduped.Skipped)
{
if (skipped.SameFile)
RynthLog.Plugin($"PluginManager: {skipped.Message}");
else
RynthLog.Warn($"PluginManager: {skipped.Message}");
}
List<string> candidates = deduped.Load;
// Manifests (embedded in the DLLs, read without loading them): refuse a plugin that needs
// a newer engine API or a missing plugin, and put required plugins first. Without
// manifests the list loads exactly as before.
@ -3056,6 +3050,7 @@ internal static partial class PluginManager
private static int CancelAttack()
{
Compatibility.AcActionTrace.Record("CancelAttack");
return ToAbiBool(ClientActionHooks.CancelAttack());
}
@ -3584,6 +3579,7 @@ internal static partial class PluginManager
private static int UseObjectOn(uint sourceObjectId, uint targetObjectId)
{
Compatibility.AcActionTrace.Record("UseObjectOn", sourceObjectId, targetObjectId);
LogPluginUse("UseObjectOn", sourceObjectId, targetObjectId);
return ToAbiBool(ClientHelperHooks.UseObjectOn(sourceObjectId, targetObjectId));
}
@ -3633,31 +3629,37 @@ internal static partial class PluginManager
private static int UseEquippedItem(uint sourceObjectId, uint targetObjectId)
{
Compatibility.AcActionTrace.Record("UseEquippedItem", sourceObjectId, targetObjectId);
return ToAbiBool(ClientHelperHooks.UseEquippedItem(sourceObjectId, targetObjectId));
}
private static int MoveItemExternal(uint objectId, uint targetContainerId, int amount)
{
Compatibility.AcActionTrace.Record("MoveItemExternal", objectId, targetContainerId);
return ToAbiBool(ClientHelperHooks.MoveItemExternal(objectId, targetContainerId, amount));
}
private static int MoveItemInternal(uint objectId, uint targetContainerId, int slot, int amount)
{
Compatibility.AcActionTrace.Record("MoveItemInternal", objectId, targetContainerId);
return ToAbiBool(ClientHelperHooks.MoveItemInternal(objectId, targetContainerId, slot, amount));
}
private static int SplitStackInternal(uint objectId, uint targetContainerId, int slot, int amount)
{
Compatibility.AcActionTrace.Record("SplitStackInternal", objectId, targetContainerId);
return ToAbiBool(ClientHelperHooks.SplitStackInternal(objectId, targetContainerId, slot, amount));
}
private static int MergeStackInternal(uint sourceObjectId, uint targetObjectId)
{
Compatibility.AcActionTrace.Record("MergeStackInternal", sourceObjectId, targetObjectId);
return ToAbiBool(ClientHelperHooks.MergeStackInternal(sourceObjectId, targetObjectId));
}
private static int GiveObjectTo(uint objectId, uint targetId, int amount)
{
Compatibility.AcActionTrace.Record("GiveObjectTo", objectId, targetId);
return ToAbiBool(ClientHelperHooks.GiveObjectTo(objectId, targetId, amount));
}
@ -4129,6 +4131,7 @@ internal static partial class PluginManager
/// <summary>v70: wield into a chosen slot (see PluginContract.WieldItemFn).</summary>
private static int WieldItemAction(uint objectId, uint equipMask)
{
Compatibility.AcActionTrace.Record("WieldItem", objectId, equipMask);
return ToAbiBool(ClientHelperHooks.WieldItem(objectId, equipMask));
}
@ -4140,6 +4143,16 @@ internal static partial class PluginManager
if (string.IsNullOrEmpty(name))
return 0;
// The flight recorder answers to a reserved name (no plugin export, no API bump):
// an engine without it finds no such plugin and returns 0, so a plugin can call it
// on any engine.
if (name == Net.FlightRecorder.PluginCommandTarget)
{
string? action = actionAnsi != IntPtr.Zero ? Marshal.PtrToStringAnsi(actionAnsi) : null;
string? value = valueAnsi != IntPtr.Zero ? Marshal.PtrToStringAnsi(valueAnsi) : null;
return Net.FlightRecorder.HandlePluginCommand(action, value) ? 1 : 0;
}
IntPtr export = ResolvePluginExport(name, "RynthPluginApplyRemoteCommand");
if (export == IntPtr.Zero)
return 0;
@ -4245,7 +4258,11 @@ internal static partial class PluginManager
catch { return 0; }
}
private static void ForceResetBusyCountAction() => BusyCountHooks.ForceResetBusyCount();
private static void ForceResetBusyCountAction()
{
Net.FlightRecorder.Mark(Net.FlightMark.BusyForceClearAsk, text: "a plugin (host ForceResetBusyCount)");
BusyCountHooks.ForceResetBusyCount();
}
private static unsafe int GetObjectSpellIdsAction(uint guid, uint* spellIds, int maxCount)
{