Add debug tab for meta changes (pretty useless...) and maybe fix reset problem.

This commit is contained in:
Ottermandias 2022-09-24 15:16:03 +02:00
parent b7b15532f8
commit b359c18360
4 changed files with 37 additions and 7 deletions

View file

@ -11,6 +11,9 @@ public unsafe partial class CharacterUtility
public readonly InternalIndex Index;
public readonly Structs.CharacterUtility.Index GlobalIndex;
public IReadOnlyCollection< MetaReverter > Entries
=> _entries;
private IntPtr _defaultResourceData = IntPtr.Zero;
private int _defaultResourceSize = 0;
public bool Ready { get; private set; } = false;
@ -93,8 +96,8 @@ public unsafe partial class CharacterUtility
if( _entries.Count > 0 )
{
_entries.Clear();
ResetResourceInternal();
}
ResetResourceInternal();
}
public sealed class MetaReverter : IDisposable

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Dalamud.Utility.Signatures;
@ -43,6 +44,9 @@ public unsafe partial class CharacterUtility : IDisposable
.Select( idx => new List( new InternalIndex( idx ) ) )
.ToArray();
public IReadOnlyList< List > Lists
=> _lists;
public (IntPtr Address, int Size) DefaultResource( InternalIndex idx )
=> _lists[ idx.Value ].DefaultResource;

View file

@ -160,7 +160,7 @@ public unsafe partial class PathResolver
var ret = _characterBaseCreateHook.Original( a, b, c, d );
using( meta )
{
if( LastGameObject != null )
if( LastGameObject != null && ret != IntPtr.Zero )
{
_drawObjectToObject[ ret ] = ( _lastCreatedCollection!, LastGameObject->ObjectIndex );
CreatedCharacterBase?.Invoke( ( IntPtr )LastGameObject, _lastCreatedCollection!.ModCollection, ret );

View file

@ -58,6 +58,8 @@ public partial class ConfigWindow
ImGui.NewLine();
DrawDebugCharacterUtility();
ImGui.NewLine();
DrawDebugTabMetaLists();
ImGui.NewLine();
DrawDebugResidentResources();
ImGui.NewLine();
DrawResourceProblems();
@ -274,6 +276,27 @@ public partial class ConfigWindow
}
}
private static void DrawDebugTabMetaLists()
{
if( !ImGui.CollapsingHeader( "Metadata Changes" ) )
{
return;
}
using var table = ImRaii.Table( "##DebugMetaTable", 3, ImGuiTableFlags.SizingFixedFit );
if( !table )
{
return;
}
foreach( var list in Penumbra.CharacterUtility.Lists )
{
ImGuiUtil.DrawTableColumn( list.GlobalIndex.ToString() );
ImGuiUtil.DrawTableColumn( list.Entries.Count.ToString() );
ImGuiUtil.DrawTableColumn( string.Join( ", ", list.Entries.Select( e => $"0x{e.Data:X}" ) ) );
}
}
// Draw information about the resident resource files.
public unsafe void DrawDebugResidentResources()
{