diff --git a/Penumbra.GameData b/Penumbra.GameData index 529e1811..9a1e5e72 160000 --- a/Penumbra.GameData +++ b/Penumbra.GameData @@ -1 +1 @@ -Subproject commit 529e18115023732794994bfb8df4818b68951ea4 +Subproject commit 9a1e5e7294a6929ee1cc72b1b5d76e12c000c327 diff --git a/Penumbra/Api/IpcTester.cs b/Penumbra/Api/IpcTester.cs index e1dd81cb..30f3c80f 100644 --- a/Penumbra/Api/IpcTester.cs +++ b/Penumbra/Api/IpcTester.cs @@ -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"; diff --git a/Penumbra/Api/PenumbraApi.cs b/Penumbra/Api/PenumbraApi.cs index 5146383d..c8be90aa 100644 --- a/Penumbra/Api/PenumbraApi.cs +++ b/Penumbra/Api/PenumbraApi.cs @@ -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]; diff --git a/Penumbra/Interop/Hooks/Animation/LoadTimelineResources.cs b/Penumbra/Interop/Hooks/Animation/LoadTimelineResources.cs index 4bae084e..018892a0 100644 --- a/Penumbra/Interop/Hooks/Animation/LoadTimelineResources.cs +++ b/Penumbra/Interop/Hooks/Animation/LoadTimelineResources.cs @@ -64,7 +64,7 @@ public sealed unsafe class LoadTimelineResources : FastHook**)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; diff --git a/Penumbra/Interop/Hooks/Animation/SomePapLoad.cs b/Penumbra/Interop/Hooks/Animation/SomePapLoad.cs index a4563bf3..fad1f819 100644 --- a/Penumbra/Interop/Hooks/Animation/SomePapLoad.cs +++ b/Penumbra/Interop/Hooks/Animation/SomePapLoad.cs @@ -35,7 +35,7 @@ public sealed unsafe class SomePapLoad : FastHook 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); diff --git a/Penumbra/Interop/PathResolving/DrawObjectState.cs b/Penumbra/Interop/PathResolving/DrawObjectState.cs index 784ac3fb..2a9ec7a9 100644 --- a/Penumbra/Interop/PathResolving/DrawObjectState.cs +++ b/Penumbra/Interop/PathResolving/DrawObjectState.cs @@ -94,11 +94,10 @@ public sealed class DrawObjectState : IDisposable, IReadOnlyDictionary 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); } } diff --git a/Penumbra/Interop/Services/RedrawService.cs b/Penumbra/Interop/Services/RedrawService.cs index a6fec0b5..21ecfd4f 100644 --- a/Penumbra/Interop/Services/RedrawService.cs +++ b/Penumbra/Interop/Services/RedrawService.cs @@ -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); } diff --git a/Penumbra/UI/Tabs/Debug/DebugTab.cs b/Penumbra/UI/Tabs/Debug/DebugTab.cs index 2003f0ef..06f1d126 100644 --- a/Penumbra/UI/Tabs/Debug/DebugTab.cs +++ b/Penumbra/UI/Tabs/Debug/DebugTab.cs @@ -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); }