Test improving object manager.

This commit is contained in:
Ottermandias 2024-03-21 23:02:07 +01:00
parent cc88738e3e
commit 1a9239a358
8 changed files with 17 additions and 18 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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);
}