Add crash handler stuff.

This commit is contained in:
Ottermandias 2024-03-16 16:20:34 +01:00
parent 9ba6e4d0af
commit e08e9c4d13
35 changed files with 1472 additions and 237 deletions

View file

@ -12,24 +12,14 @@ using Penumbra.String.Classes;
namespace Penumbra.UI.Tabs;
public class ResourceTab : ITab
public class ResourceTab(Configuration config, ResourceManagerService resourceManager, ISigScanner sigScanner)
: ITab
{
private readonly Configuration _config;
private readonly ResourceManagerService _resourceManager;
private readonly ISigScanner _sigScanner;
public ResourceTab(Configuration config, ResourceManagerService resourceManager, ISigScanner sigScanner)
{
_config = config;
_resourceManager = resourceManager;
_sigScanner = sigScanner;
}
public ReadOnlySpan<byte> Label
=> "Resource Manager"u8;
public bool IsVisible
=> _config.DebugMode;
=> config.DebugMode;
/// <summary> Draw a tab to iterate over the main resource maps and see what resources are currently loaded. </summary>
public void DrawContent()
@ -44,15 +34,15 @@ public class ResourceTab : ITab
unsafe
{
_resourceManager.IterateGraphs(DrawCategoryContainer);
resourceManager.IterateGraphs(DrawCategoryContainer);
}
ImGui.NewLine();
unsafe
{
ImGui.TextUnformatted(
$"Static Address: 0x{(ulong)_resourceManager.ResourceManagerAddress:X} (+0x{(ulong)_resourceManager.ResourceManagerAddress - (ulong)_sigScanner.Module.BaseAddress:X})");
ImGui.TextUnformatted($"Actual Address: 0x{(ulong)_resourceManager.ResourceManager:X}");
$"Static Address: 0x{(ulong)resourceManager.ResourceManagerAddress:X} (+0x{(ulong)resourceManager.ResourceManagerAddress - (ulong)sigScanner.Module.BaseAddress:X})");
ImGui.TextUnformatted($"Actual Address: 0x{(ulong)resourceManager.ResourceManager:X}");
}
}
@ -82,7 +72,7 @@ public class ResourceTab : ITab
ImGui.TableSetupColumn("Refs", ImGuiTableColumnFlags.WidthFixed, _refsColumnWidth);
ImGui.TableHeadersRow();
_resourceManager.IterateResourceMap(map, (hash, r) =>
resourceManager.IterateResourceMap(map, (hash, r) =>
{
// Filter unwanted names.
if (_resourceManagerFilter.Length != 0
@ -125,7 +115,7 @@ public class ResourceTab : ITab
if (tree)
{
SetTableWidths();
_resourceManager.IterateExtMap(map, (ext, m) => DrawResourceMap(category, ext, m));
resourceManager.IterateExtMap(map, (ext, m) => DrawResourceMap(category, ext, m));
}
}