Skip to content

Commit

Permalink
Minor pbd stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
PassiveModding committed Jul 28, 2024
1 parent 9c5f103 commit 1dc395e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Meddle/Meddle.UI/Windows/Views/PbdView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ namespace Meddle.UI.Windows.Views;
public class PbdView : IView
{
private readonly PbdFile file;
private readonly HexView hexView;

public PbdView(PbdFile file)
{
this.file = file;
this.hexView = new HexView(file.RawData);
}

public void Draw()
Expand Down Expand Up @@ -82,5 +84,19 @@ public void Draw()
}
}
}

if (ImGui.CollapsingHeader("Links"))
{
foreach (var link in file.Links)
{
ImGui.Text($"ParentLinkIdx: {link.ParentLinkIdx}");
ImGui.Text($"HeaderIdx: {link.HeaderIdx}");
}
}

if (ImGui.CollapsingHeader("Raw Data"))
{
hexView.DrawHexDump();
}
}
}
3 changes: 3 additions & 0 deletions Meddle/Meddle.Utils/Files/PbdFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ public class PbdFile
public readonly Header[] Headers;
public readonly Link[] Links; // header.deformerId -> link
public readonly Dictionary<int, Deformer> Deformers; // offset -> deformer
private readonly byte[] _data;
public ReadOnlySpan<byte> RawData => _data;

public PbdFile(byte[] data) : this((ReadOnlySpan<byte>)data) { }

public PbdFile(ReadOnlySpan<byte> data)
{
_data = data.ToArray();
var reader = new SpanBinaryReader(data);
var entryCount = reader.ReadInt32();

Expand Down

0 comments on commit 1dc395e

Please sign in to comment.