Skip to content

Commit 3beef61

Browse files
committed
Some debug vis improvements, disable .atch file modding for the moment until modular .atch file modding is implemented.
1 parent 11d0cfd commit 3beef61

File tree

3 files changed

+39
-14
lines changed

3 files changed

+39
-14
lines changed

Penumbra/Interop/PathResolving/PathResolver.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public PathResolver(PerformanceTracker performance, Configuration config, Collec
5252
if (resourceType is ResourceType.Lvb or ResourceType.Lgb or ResourceType.Sgb)
5353
return (null, ResolveData.Invalid);
5454

55+
// Prevent .atch loading to prevent crashes on outdated .atch files. TODO: handle atch modding differently.
56+
if (resourceType is ResourceType.Atch)
57+
return (null, ResolveData.Invalid);
58+
5559
return category switch
5660
{
5761
// Only Interface collection.

Penumbra/UI/Tabs/Debug/AtchDrawer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static void Draw(AtchFile file)
3131
foreach (var (entry, index) in file.Entries.WithIndex())
3232
{
3333
using var id = ImUtf8.PushId(index);
34-
using var tree = ImUtf8.TreeNode(entry.Name.Span);
34+
using var tree = ImUtf8.TreeNode($"{index:D3}: {entry.Name.Span}");
3535
if (tree)
3636
{
3737
ImUtf8.TreeNode(entry.Accessory ? "Accessory"u8 : "Weapon"u8, ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();

Penumbra/UI/Tabs/Debug/DebugTab.cs

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
using Penumbra.Interop.Hooks.PostProcessing;
4343
using Penumbra.Interop.Hooks.ResourceLoading;
4444
using Penumbra.GameData.Files.StainMapStructs;
45+
using Penumbra.String.Classes;
4546
using Penumbra.UI.AdvancedWindow.Materials;
4647

4748
namespace Penumbra.UI.Tabs.Debug;
@@ -196,7 +197,7 @@ public void DrawContent()
196197
}
197198

198199

199-
private void DrawCollectionCaches()
200+
private unsafe void DrawCollectionCaches()
200201
{
201202
if (!ImGui.CollapsingHeader(
202203
$"Collections ({_collectionManager.Caches.Count}/{_collectionManager.Storage.Count - 1} Caches)###Collections"))
@@ -207,25 +208,35 @@ private void DrawCollectionCaches()
207208
if (collection.HasCache)
208209
{
209210
using var color = PushColor(ImGuiCol.Text, ColorId.FolderExpanded.Value());
210-
using var node = TreeNode($"{collection.AnonymizedName} (Change Counter {collection.ChangeCounter})");
211+
using var node = TreeNode($"{collection.Name} (Change Counter {collection.ChangeCounter})###{collection.Name}");
211212
if (!node)
212213
continue;
213214

214215
color.Pop();
215-
foreach (var (mod, paths, manips) in collection._cache!.ModData.Data.OrderBy(t => t.Item1.Name))
216+
using (var resourceNode = ImUtf8.TreeNode("Custom Resources"u8))
216217
{
217-
using var id = mod is TemporaryMod t ? PushId(t.Priority.Value) : PushId(((Mod)mod).ModPath.Name);
218-
using var node2 = TreeNode(mod.Name.Text);
219-
if (!node2)
220-
continue;
218+
if (resourceNode)
219+
foreach (var (path, resource) in collection._cache!.CustomResources)
220+
ImUtf8.TreeNode($"{path} -> 0x{(ulong)resource.ResourceHandle:X}",
221+
ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
222+
}
221223

222-
foreach (var path in paths)
224+
using var modNode = ImUtf8.TreeNode("Enabled Mods"u8);
225+
if (modNode)
226+
foreach (var (mod, paths, manips) in collection._cache!.ModData.Data.OrderBy(t => t.Item1.Name))
227+
{
228+
using var id = mod is TemporaryMod t ? PushId(t.Priority.Value) : PushId(((Mod)mod).ModPath.Name);
229+
using var node2 = TreeNode(mod.Name.Text);
230+
if (!node2)
231+
continue;
223232

224-
TreeNode(path.ToString(), ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
233+
foreach (var path in paths)
225234

226-
foreach (var manip in manips)
227-
TreeNode(manip.ToString(), ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
228-
}
235+
TreeNode(path.ToString(), ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
236+
237+
foreach (var manip in manips)
238+
TreeNode(manip.ToString(), ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose();
239+
}
229240
}
230241
else
231242
{
@@ -1051,17 +1062,27 @@ private unsafe void DrawGlobalVariableInfo()
10511062
DrawDebugResidentResources();
10521063
}
10531064

1065+
private string _crcInput = string.Empty;
1066+
private FullPath _crcPath = FullPath.Empty;
1067+
10541068
private unsafe void DrawCrcCache()
10551069
{
10561070
var header = ImUtf8.CollapsingHeader("CRC Cache"u8);
10571071
if (!header)
10581072
return;
10591073

1074+
if (ImUtf8.InputText("##crcInput"u8, ref _crcInput, "Input path for CRC..."u8))
1075+
_crcPath = new FullPath(_crcInput);
1076+
1077+
using var font = ImRaii.PushFont(UiBuilder.MonoFont);
1078+
ImUtf8.Text($" CRC32: {_crcPath.InternalName.CiCrc32:X8}");
1079+
ImUtf8.Text($"CI CRC32: {_crcPath.InternalName.Crc32:X8}");
1080+
ImUtf8.Text($" CRC64: {_crcPath.Crc64:X16}");
1081+
10601082
using var table = ImUtf8.Table("table"u8, 2);
10611083
if (!table)
10621084
return;
10631085

1064-
using var font = ImRaii.PushFont(UiBuilder.MonoFont);
10651086
ImUtf8.TableSetupColumn("Hash"u8, ImGuiTableColumnFlags.WidthFixed, 18 * UiBuilder.MonoFont.GetCharAdvance('0'));
10661087
ImUtf8.TableSetupColumn("Type"u8, ImGuiTableColumnFlags.WidthFixed, 5 * UiBuilder.MonoFont.GetCharAdvance('0'));
10671088
ImGui.TableHeadersRow();

0 commit comments

Comments
 (0)