mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 12:44:19 +01:00
Test improving object manager.
This commit is contained in:
parent
cc88738e3e
commit
1a9239a358
8 changed files with 17 additions and 18 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 529e18115023732794994bfb8df4818b68951ea4
|
||||
Subproject commit 9a1e5e7294a6929ee1cc72b1b5d76e12c000c327
|
||||
|
|
@ -442,8 +442,8 @@ public class IpcTester : IDisposable
|
|||
DrawIntro(Ipc.RedrawObjectByIndex.Label, "Redraw by Index");
|
||||
var tmp = _redrawIndex;
|
||||
ImGui.SetNextItemWidth(100 * UiHelpers.Scale);
|
||||
if (ImGui.DragInt("##redrawIndex", ref tmp, 0.1f, 0, _objects.Count))
|
||||
_redrawIndex = Math.Clamp(tmp, 0, _objects.Count);
|
||||
if (ImGui.DragInt("##redrawIndex", ref tmp, 0.1f, 0, _objects.TotalCount))
|
||||
_redrawIndex = Math.Clamp(tmp, 0, _objects.TotalCount);
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button("Redraw##Index"))
|
||||
|
|
@ -460,7 +460,7 @@ public class IpcTester : IDisposable
|
|||
private void SetLastRedrawn(IntPtr address, int index)
|
||||
{
|
||||
if (index < 0
|
||||
|| index > _objects.Count
|
||||
|| index > _objects.TotalCount
|
||||
|| address == IntPtr.Zero
|
||||
|| _objects[index].Address != address)
|
||||
_lastRedrawnString = "Invalid";
|
||||
|
|
|
|||
|
|
@ -929,7 +929,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
{
|
||||
CheckInitialized();
|
||||
|
||||
if (actorIndex < 0 || actorIndex >= _objects.Count)
|
||||
if (actorIndex < 0 || actorIndex >= _objects.TotalCount)
|
||||
return PenumbraApiEc.InvalidArgument;
|
||||
|
||||
var identifier = _actors.FromObject(_objects[actorIndex], out _, false, false, true);
|
||||
|
|
@ -1166,7 +1166,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
private unsafe bool AssociatedCollection(int gameObjectIdx, out ModCollection collection)
|
||||
{
|
||||
collection = _collectionManager.Active.Default;
|
||||
if (gameObjectIdx < 0 || gameObjectIdx >= _objects.Count)
|
||||
if (gameObjectIdx < 0 || gameObjectIdx >= _objects.TotalCount)
|
||||
return false;
|
||||
|
||||
var ptr = _objects[gameObjectIdx];
|
||||
|
|
@ -1180,7 +1180,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
private unsafe ActorIdentifier AssociatedIdentifier(int gameObjectIdx)
|
||||
{
|
||||
if (gameObjectIdx < 0 || gameObjectIdx >= _objects.Count)
|
||||
if (gameObjectIdx < 0 || gameObjectIdx >= _objects.TotalCount)
|
||||
return ActorIdentifier.Invalid;
|
||||
|
||||
var ptr = _objects[gameObjectIdx];
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public sealed unsafe class LoadTimelineResources : FastHook<LoadTimelineResource
|
|||
{
|
||||
var getGameObjectIdx = ((delegate* unmanaged<nint, int>**)timeline)[0][Offsets.GetGameObjectIdxVfunc];
|
||||
var idx = getGameObjectIdx(timeline);
|
||||
if (idx >= 0 && idx < objects.Count)
|
||||
if (idx >= 0 && idx < objects.TotalCount)
|
||||
{
|
||||
var obj = objects[idx];
|
||||
return obj.Valid ? resolver.IdentifyCollection(obj.AsObject, true) : ResolveData.Invalid;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public sealed unsafe class SomePapLoad : FastHook<SomePapLoad.Delegate>
|
|||
if (timelinePtr != nint.Zero)
|
||||
{
|
||||
var actorIdx = (int)(*(*(ulong**)timelinePtr + 1) >> 3);
|
||||
if (actorIdx >= 0 && actorIdx < _objects.Count)
|
||||
if (actorIdx >= 0 && actorIdx < _objects.TotalCount)
|
||||
{
|
||||
var newData = _collectionResolver.IdentifyCollection(_objects[actorIdx].AsObject, true);
|
||||
var last = _state.SetAnimationData(newData);
|
||||
|
|
|
|||
|
|
@ -94,11 +94,10 @@ public sealed class DrawObjectState : IDisposable, IReadOnlyDictionary<nint, (ni
|
|||
/// </summary>
|
||||
private unsafe void InitializeDrawObjects()
|
||||
{
|
||||
for (var i = 0; i < _objects.Count; ++i)
|
||||
{
|
||||
var ptr = _objects[i];
|
||||
if (ptr is { IsCharacter: true, Model.Valid: true })
|
||||
IterateDrawObjectTree((Object*)ptr.Model.Address, ptr, false, false);
|
||||
foreach(var actor in _objects)
|
||||
{
|
||||
if (actor is { IsCharacter: true, Model.Valid: true })
|
||||
IterateDrawObjectTree((Object*)actor.Model.Address, actor, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ public sealed unsafe partial class RedrawService : IDisposable
|
|||
|
||||
public void RedrawObject(int tableIndex, RedrawType settings)
|
||||
{
|
||||
if (tableIndex >= 0 && tableIndex < _objects.Count)
|
||||
if (tableIndex >= 0 && tableIndex < _objects.TotalCount)
|
||||
RedrawObject(_objects.GetDalamudObject(tableIndex), settings);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -431,16 +431,16 @@ public class DebugTab : Window, ITab
|
|||
DrawSpecial("Current Card", _actors.GetCardPlayer());
|
||||
DrawSpecial("Current Glamour", _actors.GetGlamourPlayer());
|
||||
|
||||
foreach (var obj in _objects.Objects)
|
||||
foreach (var obj in _objects)
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn($"{((GameObject*)obj.Address)->ObjectIndex}");
|
||||
ImGuiUtil.DrawTableColumn($"0x{obj.Address:X}");
|
||||
ImGuiUtil.DrawTableColumn(obj.Address == nint.Zero
|
||||
? string.Empty
|
||||
: $"0x{(nint)((Character*)obj.Address)->GameObject.GetDrawObject():X}");
|
||||
var identifier = _actors.FromObject(obj, false, true, false);
|
||||
var identifier = _actors.FromObject(obj, out _, false, true, false);
|
||||
ImGuiUtil.DrawTableColumn(_actors.ToString(identifier));
|
||||
var id = obj.ObjectKind == ObjectKind.BattleNpc ? $"{identifier.DataId} | {obj.DataId}" : identifier.DataId.ToString();
|
||||
var id = obj.AsObject->ObjectKind ==(byte) ObjectKind.BattleNpc ? $"{identifier.DataId} | {obj.AsObject->DataID}" : identifier.DataId.ToString();
|
||||
ImGuiUtil.DrawTableColumn(id);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue