Some debug vis improvements, disable .atch file modding for the moment until modular .atch file modding is implemented.

This commit is contained in:
Ottermandias 2024-11-20 10:44:09 +01:00
parent 11d0cfd1e2
commit 3beef61c6f
3 changed files with 41 additions and 16 deletions

View file

@ -52,6 +52,10 @@ public class PathResolver : IDisposable, IService
if (resourceType is ResourceType.Lvb or ResourceType.Lgb or ResourceType.Sgb) if (resourceType is ResourceType.Lvb or ResourceType.Lgb or ResourceType.Sgb)
return (null, ResolveData.Invalid); return (null, ResolveData.Invalid);
// Prevent .atch loading to prevent crashes on outdated .atch files. TODO: handle atch modding differently.
if (resourceType is ResourceType.Atch)
return (null, ResolveData.Invalid);
return category switch return category switch
{ {
// Only Interface collection. // Only Interface collection.

View file

@ -31,7 +31,7 @@ public static class AtchDrawer
foreach (var (entry, index) in file.Entries.WithIndex()) foreach (var (entry, index) in file.Entries.WithIndex())
{ {
using var id = ImUtf8.PushId(index); using var id = ImUtf8.PushId(index);
using var tree = ImUtf8.TreeNode(entry.Name.Span); using var tree = ImUtf8.TreeNode($"{index:D3}: {entry.Name.Span}");
if (tree) if (tree)
{ {
ImUtf8.TreeNode(entry.Accessory ? "Accessory"u8 : "Weapon"u8, ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose(); ImUtf8.TreeNode(entry.Accessory ? "Accessory"u8 : "Weapon"u8, ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();

View file

@ -42,6 +42,7 @@ using Penumbra.Api.IpcTester;
using Penumbra.Interop.Hooks.PostProcessing; using Penumbra.Interop.Hooks.PostProcessing;
using Penumbra.Interop.Hooks.ResourceLoading; using Penumbra.Interop.Hooks.ResourceLoading;
using Penumbra.GameData.Files.StainMapStructs; using Penumbra.GameData.Files.StainMapStructs;
using Penumbra.String.Classes;
using Penumbra.UI.AdvancedWindow.Materials; using Penumbra.UI.AdvancedWindow.Materials;
namespace Penumbra.UI.Tabs.Debug; namespace Penumbra.UI.Tabs.Debug;
@ -196,7 +197,7 @@ public class DebugTab : Window, ITab, IUiService
} }
private void DrawCollectionCaches() private unsafe void DrawCollectionCaches()
{ {
if (!ImGui.CollapsingHeader( if (!ImGui.CollapsingHeader(
$"Collections ({_collectionManager.Caches.Count}/{_collectionManager.Storage.Count - 1} Caches)###Collections")) $"Collections ({_collectionManager.Caches.Count}/{_collectionManager.Storage.Count - 1} Caches)###Collections"))
@ -207,25 +208,35 @@ public class DebugTab : Window, ITab, IUiService
if (collection.HasCache) if (collection.HasCache)
{ {
using var color = PushColor(ImGuiCol.Text, ColorId.FolderExpanded.Value()); using var color = PushColor(ImGuiCol.Text, ColorId.FolderExpanded.Value());
using var node = TreeNode($"{collection.AnonymizedName} (Change Counter {collection.ChangeCounter})"); using var node = TreeNode($"{collection.Name} (Change Counter {collection.ChangeCounter})###{collection.Name}");
if (!node) if (!node)
continue; continue;
color.Pop(); color.Pop();
foreach (var (mod, paths, manips) in collection._cache!.ModData.Data.OrderBy(t => t.Item1.Name)) using (var resourceNode = ImUtf8.TreeNode("Custom Resources"u8))
{ {
using var id = mod is TemporaryMod t ? PushId(t.Priority.Value) : PushId(((Mod)mod).ModPath.Name); if (resourceNode)
using var node2 = TreeNode(mod.Name.Text); foreach (var (path, resource) in collection._cache!.CustomResources)
if (!node2) ImUtf8.TreeNode($"{path} -> 0x{(ulong)resource.ResourceHandle:X}",
continue; ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
foreach (var path in paths)
TreeNode(path.ToString(), ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
foreach (var manip in manips)
TreeNode(manip.ToString(), ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
} }
using var modNode = ImUtf8.TreeNode("Enabled Mods"u8);
if (modNode)
foreach (var (mod, paths, manips) in collection._cache!.ModData.Data.OrderBy(t => t.Item1.Name))
{
using var id = mod is TemporaryMod t ? PushId(t.Priority.Value) : PushId(((Mod)mod).ModPath.Name);
using var node2 = TreeNode(mod.Name.Text);
if (!node2)
continue;
foreach (var path in paths)
TreeNode(path.ToString(), ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
foreach (var manip in manips)
TreeNode(manip.ToString(), ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
}
} }
else else
{ {
@ -1051,17 +1062,27 @@ public class DebugTab : Window, ITab, IUiService
DrawDebugResidentResources(); DrawDebugResidentResources();
} }
private string _crcInput = string.Empty;
private FullPath _crcPath = FullPath.Empty;
private unsafe void DrawCrcCache() private unsafe void DrawCrcCache()
{ {
var header = ImUtf8.CollapsingHeader("CRC Cache"u8); var header = ImUtf8.CollapsingHeader("CRC Cache"u8);
if (!header) if (!header)
return; return;
if (ImUtf8.InputText("##crcInput"u8, ref _crcInput, "Input path for CRC..."u8))
_crcPath = new FullPath(_crcInput);
using var font = ImRaii.PushFont(UiBuilder.MonoFont);
ImUtf8.Text($" CRC32: {_crcPath.InternalName.CiCrc32:X8}");
ImUtf8.Text($"CI CRC32: {_crcPath.InternalName.Crc32:X8}");
ImUtf8.Text($" CRC64: {_crcPath.Crc64:X16}");
using var table = ImUtf8.Table("table"u8, 2); using var table = ImUtf8.Table("table"u8, 2);
if (!table) if (!table)
return; return;
using var font = ImRaii.PushFont(UiBuilder.MonoFont);
ImUtf8.TableSetupColumn("Hash"u8, ImGuiTableColumnFlags.WidthFixed, 18 * UiBuilder.MonoFont.GetCharAdvance('0')); ImUtf8.TableSetupColumn("Hash"u8, ImGuiTableColumnFlags.WidthFixed, 18 * UiBuilder.MonoFont.GetCharAdvance('0'));
ImUtf8.TableSetupColumn("Type"u8, ImGuiTableColumnFlags.WidthFixed, 5 * UiBuilder.MonoFont.GetCharAdvance('0')); ImUtf8.TableSetupColumn("Type"u8, ImGuiTableColumnFlags.WidthFixed, 5 * UiBuilder.MonoFont.GetCharAdvance('0'));
ImGui.TableHeadersRow(); ImGui.TableHeadersRow();