Some more information in ResourceManager

This commit is contained in:
Ottermandias 2021-11-16 16:04:11 +01:00
parent 743f83d12e
commit ba2ffcc790

View file

@ -6,19 +6,19 @@ using FFXIVClientStructs.STD;
using ImGuiNET;
using Penumbra.UI.Custom;
namespace Penumbra.UI
namespace Penumbra.UI;
public partial class SettingsInterface
{
public partial class SettingsInterface
{
private static string GetNodeLabel( string label, uint type, ulong count )
private static string GetNodeLabel( uint label, uint type, ulong count )
{
var byte1 = type >> 24;
var byte2 = ( type >> 16 ) & 0xFF;
var byte3 = ( type >> 8 ) & 0xFF;
var byte4 = type & 0xFF;
return byte1 == 0
? $"{( char )byte2}{( char )byte3}{( char )byte4} - {count}###{label}{type}Debug"
: $"{( char )byte1}{( char )byte2}{( char )byte3}{( char )byte4} - {count}###{label}{type}Debug";
? $"({type:X8}) {( char )byte2}{( char )byte3}{( char )byte4} - {count}###{label}{type}Debug"
: $"({type:X8}) {( char )byte1}{( char )byte2}{( char )byte3}{( char )byte4} - {count}###{label}{type}Debug";
}
private unsafe void DrawResourceMap( string label, StdMap< uint, Pointer< ResourceHandle > >* typeMap )
@ -39,7 +39,8 @@ namespace Penumbra.UI
ImGui.TableSetupColumn( "Hash", ImGuiTableColumnFlags.WidthFixed, 100 * ImGuiHelpers.GlobalScale );
ImGui.TableSetupColumn( "Ptr", ImGuiTableColumnFlags.WidthFixed, 100 * ImGuiHelpers.GlobalScale );
ImGui.TableSetupColumn( "Path", ImGuiTableColumnFlags.WidthFixed, ImGui.GetWindowContentRegionWidth() - 300 * ImGuiHelpers.GlobalScale );
ImGui.TableSetupColumn( "Path", ImGuiTableColumnFlags.WidthFixed,
ImGui.GetWindowContentRegionWidth() - 300 * ImGuiHelpers.GlobalScale );
ImGui.TableSetupColumn( "Refs", ImGuiTableColumnFlags.WidthFixed, 30 * ImGuiHelpers.GlobalScale );
ImGui.TableHeadersRow();
@ -48,7 +49,7 @@ namespace Penumbra.UI
{
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text( node->KeyValuePair.Item1.ToString() );
ImGui.Text( $"0x{node->KeyValuePair.Item1:X8}" );
ImGui.TableNextColumn();
var address = $"0x{( ulong )node->KeyValuePair.Item2.Value:X}";
ImGui.Text( address );
@ -65,10 +66,10 @@ namespace Penumbra.UI
}
}
private unsafe void DrawCategoryContainer( string label, ResourceGraph.CategoryContainer container )
private unsafe void DrawCategoryContainer( ResourceCategory category, ResourceGraph.CategoryContainer container )
{
var map = container.MainMap;
if( map == null || !ImGui.TreeNodeEx( $"{label} - {map->Count}###{label}Debug" ) )
if( map == null || !ImGui.TreeNodeEx( $"({( uint )category:D2}) {category} - {map->Count}###{( uint )category}Debug" ) )
{
return;
}
@ -78,7 +79,7 @@ namespace Penumbra.UI
var node = map->SmallestValue;
while( !node->IsNil )
{
DrawResourceMap( GetNodeLabel( label, node->KeyValuePair.Item1, node->KeyValuePair.Item2.Value->Count ),
DrawResourceMap( GetNodeLabel( ( uint )category, node->KeyValuePair.Item1, node->KeyValuePair.Item2.Value->Count ),
node->KeyValuePair.Item2.Value );
node = node->Next();
}
@ -106,21 +107,20 @@ namespace Penumbra.UI
return;
}
DrawCategoryContainer( "Common", resourceHandler->ResourceGraph->CommonContainer );
DrawCategoryContainer( "BgCommon", resourceHandler->ResourceGraph->BgCommonContainer );
DrawCategoryContainer( "Bg", resourceHandler->ResourceGraph->BgContainer );
DrawCategoryContainer( "Cut", resourceHandler->ResourceGraph->CutContainer );
DrawCategoryContainer( "Chara", resourceHandler->ResourceGraph->CharaContainer );
DrawCategoryContainer( "Shader", resourceHandler->ResourceGraph->ShaderContainer );
DrawCategoryContainer( "Ui", resourceHandler->ResourceGraph->UiContainer );
DrawCategoryContainer( "Sound", resourceHandler->ResourceGraph->SoundContainer );
DrawCategoryContainer( "Vfx", resourceHandler->ResourceGraph->VfxContainer );
DrawCategoryContainer( "UiScript", resourceHandler->ResourceGraph->UiScriptContainer );
DrawCategoryContainer( "Exd", resourceHandler->ResourceGraph->ExdContainer );
DrawCategoryContainer( "GameScript", resourceHandler->ResourceGraph->GameScriptContainer );
DrawCategoryContainer( "Music", resourceHandler->ResourceGraph->MusicContainer );
DrawCategoryContainer( "SqpackTest", resourceHandler->ResourceGraph->SqpackTestContainer );
DrawCategoryContainer( "Debug", resourceHandler->ResourceGraph->DebugContainer );
}
DrawCategoryContainer( ResourceCategory.Common, resourceHandler->ResourceGraph->CommonContainer );
DrawCategoryContainer( ResourceCategory.BgCommon, resourceHandler->ResourceGraph->BgCommonContainer );
DrawCategoryContainer( ResourceCategory.Bg, resourceHandler->ResourceGraph->BgContainer );
DrawCategoryContainer( ResourceCategory.Cut, resourceHandler->ResourceGraph->CutContainer );
DrawCategoryContainer( ResourceCategory.Chara, resourceHandler->ResourceGraph->CharaContainer );
DrawCategoryContainer( ResourceCategory.Shader, resourceHandler->ResourceGraph->ShaderContainer );
DrawCategoryContainer( ResourceCategory.Ui, resourceHandler->ResourceGraph->UiContainer );
DrawCategoryContainer( ResourceCategory.Sound, resourceHandler->ResourceGraph->SoundContainer );
DrawCategoryContainer( ResourceCategory.Vfx, resourceHandler->ResourceGraph->VfxContainer );
DrawCategoryContainer( ResourceCategory.UiScript, resourceHandler->ResourceGraph->UiScriptContainer );
DrawCategoryContainer( ResourceCategory.Exd, resourceHandler->ResourceGraph->ExdContainer );
DrawCategoryContainer( ResourceCategory.GameScript, resourceHandler->ResourceGraph->GameScriptContainer );
DrawCategoryContainer( ResourceCategory.Music, resourceHandler->ResourceGraph->MusicContainer );
DrawCategoryContainer( ResourceCategory.SqpackTest, resourceHandler->ResourceGraph->SqpackTestContainer );
DrawCategoryContainer( ResourceCategory.Debug, resourceHandler->ResourceGraph->DebugContainer );
}
}