Snapshot for release 2026.10.12.1 (internal ef4d41d)

This commit is contained in:
Tom Bohar 2026-10-12 00:33:12 -04:00
commit b0f9d74b21
54 changed files with 5062 additions and 935 deletions

View file

@ -30,6 +30,7 @@ internal static class EngineSettings
private static bool _enableImGuiBackend = true;
private static bool _enableHangMinidump = true;
private static bool _preventIdleLogoff = true;
private static bool _closeOnServerDisconnect = true;
private static DecalBridgeMode _decalBridgeMode = DecalBridgeMode.Auto;
private static bool _decalInGameImGui = true;
private static bool _decalStandDown = true;
@ -231,6 +232,27 @@ internal static class EngineSettings
}
}
/// <summary>"CloseOnServerDisconnect" in engine.json (default true, 2026-10-11): when AC shows
/// its "The server has disconnected" screen (UIFlow mode Disconnected, only a Quit Game
/// button), the engine closes the client a few seconds later the way the window's close
/// button does (Compatibility/ServerDisconnectClose.cs), so a launcher's auto-relaunch can
/// bring it back. Off: the client stays on that screen. Set in game in Settings > Misc.</summary>
public static bool CloseOnServerDisconnect
{
get
{
EnsureLoaded();
return _closeOnServerDisconnect;
}
set
{
EnsureLoaded(); // populate _pluginPaths before Save() rewrites the file
if (_closeOnServerDisconnect == value) return;
_closeOnServerDisconnect = value;
Save();
}
}
/// <summary>"DecalBridge" in engine.json: Auto (default), On or Off. Only matters when
/// Decal is loaded in the same client (docs/DECAL_BRIDGE_PLAN.md):
/// Auto - bridge mode when the RynthCore Decal bridge is registered and says hello
@ -552,6 +574,10 @@ internal static class EngineSettings
_preventIdleLogoff = pilEl.GetBoolean();
}
if (doc.RootElement.TryGetProperty("CloseOnServerDisconnect", out var cosdEl) &&
(cosdEl.ValueKind == JsonValueKind.True || cosdEl.ValueKind == JsonValueKind.False))
_closeOnServerDisconnect = cosdEl.GetBoolean();
if (doc.RootElement.TryGetProperty("IltServerNames", out var ilnEl) &&
ilnEl.ValueKind == JsonValueKind.Array)
_iltServerNames = ReadStringList(ilnEl);
@ -601,7 +627,7 @@ internal static class EngineSettings
"EnableImGuiBackend", "EnableHangMinidump", "PreventIdleLogoff", "DecalBridge",
"DecalInGameImGui", "DecalStandDown", "DisabledUiHooks", "ServerMessageStream",
"FlightRecorder", "InsertReleasesUi", "IltServerNames", "IltHosts", "EnableLargeAddressAlignmentFix",
"MaxHotReloads", "ReportEndpoint",
"MaxHotReloads", "ReportEndpoint", "CloseOnServerDisconnect",
};
private static void Save()
@ -650,6 +676,8 @@ internal static class EngineSettings
w.WriteBoolean("EnableLargeAddressAlignmentFix", false);
if (_insertReleasesUi) // default false: leave the file as it was
w.WriteBoolean("InsertReleasesUi", true);
if (!_closeOnServerDisconnect) // default true: leave the file as it was
w.WriteBoolean("CloseOnServerDisconnect", false);
if (_maxHotReloads != ReloadCapNotice.DefaultMaxHotReloads) // only a hand-set value is written
w.WriteNumber("MaxHotReloads", _maxHotReloads);
if (_reportEndpoint != null) // only a hand-set value is written

View file

@ -844,6 +844,26 @@ internal struct RynthCoreAPI
/// must equal that price; 0 skips the comparison. Same results and threading as Raise.
/// Requires API v79+.</summary>
public IntPtr TrainSkillFn;
/// <summary>v80: <c>int GetContainerOrder(uint containerId, int slotKind, uint* ids, int maxIds)</c>:
/// the items in one of the player's containers in their real slot order, as the server keeps it
/// (Net/InventoryOrder: the login message, a pack's contents list and every item move), where
/// GetContainerContents is in object-id order. slotKind 0 = the ordinary items (slot 0 first);
/// 1 = the side packs and foci in the main pack (the pack column, top first). Writes at most
/// maxIds ids (ids may be null with maxIds 0 to ask the count) and returns how many there are,
/// or -1 when no full list for that container has been seen (a side pack the server hasn't
/// listed yet): then the order is unknown, never guessed. Any thread. Requires API v80+.</summary>
public IntPtr GetContainerOrderFn;
/// <summary>v80: <c>int PutItemInContainer(uint itemId, uint containerId, int placement)</c>: move an
/// item into a container at a slot (the 0x19 PutItemInContainer game action, the packet only:
/// CM_Inventory::Event_PutItemInContainer), as a drop on a cell of the pack grid does. Within one
/// container it reorders: placement is the index the item should end at, counted without it.
/// MoveItemInternal ignores its slot argument (first empty slot); this doesn't. The server decides
/// (full pack, busy) and answers as for any move. Queued to AC's main thread when called off it.
/// Returns 1 sent or queued, 0 refused before sending (bad ids, negative placement), -1 the
/// sender isn't bound on this client. Requires API v80+.</summary>
public IntPtr PutItemInContainerFn;
}
/// <summary>v79 <see cref="TrainingInfoNative.Flags"/> bits.</summary>
@ -1664,3 +1684,9 @@ internal unsafe delegate int RaiseCallbackDelegate(uint kind, uint stype, uint r
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int TrainSkillCallbackDelegate(uint stype, int expectedCredits);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal unsafe delegate int GetContainerOrderCallbackDelegate(uint containerId, int slotKind, uint* ids, int maxIds);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int PutItemInContainerCallbackDelegate(uint itemId, uint containerId, int placement);

View file

@ -15,5 +15,5 @@ namespace RynthCore.Engine.Plugins;
/// <summary>Current API version. Bump when adding fields to RynthCoreAPI (and the SDK's RynthCoreApiNative).</summary>
internal static class PluginContractVersion
{
public const uint Current = 79;
public const uint Current = 80;
}

View file

@ -264,6 +264,8 @@ internal static partial class PluginManager
private static GetTrainingInfoCallbackDelegate? _getTrainingInfoCallback; // v79
private static RaiseCallbackDelegate? _raiseCallback; // v79
private static TrainSkillCallbackDelegate? _trainSkillCallback; // v79
private static GetContainerOrderCallbackDelegate? _getContainerOrderCallback; // v80
private static PutItemInContainerCallbackDelegate? _putItemInContainerCallback; // v80
private static GetVendorInfoCallbackDelegate? _getVendorInfoCallback;
private static GetVendorItemsCallbackDelegate? _getVendorItemsCallback;
private static VendorBuyCallbackDelegate? _vendorBuyCallback;
@ -2787,6 +2789,8 @@ internal static partial class PluginManager
unsafe { _getTrainingInfoCallback ??= GetTrainingInfoAction; } // v79
unsafe { _raiseCallback ??= RaiseAction; }
_trainSkillCallback ??= TrainSkillAction;
unsafe { _getContainerOrderCallback ??= GetContainerOrderAction; } // v80
_putItemInContainerCallback ??= PutItemInContainerAction;
_getVendorInfoCallback ??= GetVendorInfoAction;
_getVendorItemsCallback ??= GetVendorItemsAction;
_vendorBuyCallback ??= VendorBuyAction;
@ -2930,6 +2934,8 @@ internal static partial class PluginManager
_api.GetTrainingInfoFn = Marshal.GetFunctionPointerForDelegate(_getTrainingInfoCallback);
_api.RaiseFn = Marshal.GetFunctionPointerForDelegate(_raiseCallback);
_api.TrainSkillFn = Marshal.GetFunctionPointerForDelegate(_trainSkillCallback);
_api.GetContainerOrderFn = Marshal.GetFunctionPointerForDelegate(_getContainerOrderCallback);
_api.PutItemInContainerFn = Marshal.GetFunctionPointerForDelegate(_putItemInContainerCallback);
_api.GetVendorInfoFn = Marshal.GetFunctionPointerForDelegate(_getVendorInfoCallback);
_api.GetVendorItemsFn = Marshal.GetFunctionPointerForDelegate(_getVendorItemsCallback);
_api.VendorBuyFn = Marshal.GetFunctionPointerForDelegate(_vendorBuyCallback);
@ -4041,6 +4047,41 @@ internal static partial class PluginManager
}
}
// ── v80: slot order and placed moves (Net/InventoryOrder, ClientHelperHooks) ──
/// <summary>v80: see PluginContract.GetContainerOrderFn.</summary>
private static unsafe int GetContainerOrderAction(uint containerId, int slotKind, uint* ids, int maxIds)
{
try
{
if (containerId == 0 || slotKind is < 0 or > 1 || maxIds < 0 || (ids == null && maxIds > 0)) return -1;
if (!Net.InventoryOrder.TryGetOrder(containerId, slotKind == 1, out uint[] order)) return -1;
int n = Math.Min(order.Length, maxIds);
for (int i = 0; i < n; i++) ids[i] = order[i];
return order.Length;
}
catch
{
return -1;
}
}
/// <summary>v80: see PluginContract.PutItemInContainerFn.</summary>
private static int PutItemInContainerAction(uint itemId, uint containerId, int placement)
{
try
{
if (!ClientHelperHooks.HasPutItemInContainer) return -1;
Compatibility.AcActionTrace.Record("PutItemInContainer", itemId, containerId);
return ToAbiBool(ClientHelperHooks.PutItemInContainerAt(itemId, containerId, placement));
}
catch (Exception ex)
{
RynthLog.Compat($"PutItemInContainer failed - {ex.GetType().Name}: {ex.Message}");
return 0;
}
}
/// <summary>v78: see PluginContract.SetServerMessageInterestFn.</summary>
private static unsafe int SetServerMessageInterestAction(uint* opcodes, int opcodeCount, uint* gameEvents, int eventCount)
{