Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a408af7
Update Rely
bbdd2729 Jun 27, 2026
df22ba9
Update Rely
bbdd2729 Jun 27, 2026
3934cae
add memorypack
bbdd2729 Jun 27, 2026
516f469
add ExportListType.MessagePack to ParseAssetMap and BuildAssetMap metod
bbdd2729 Jun 27, 2026
0c074a0
supported memorypack fin
bbdd2729 Jun 27, 2026
de9c4d8
perf: optimize Matches method filtering performance
bbdd2729 Jun 28, 2026
232c938
getrawdata
bbdd2729 Jun 28, 2026
a142e31
no fail shader
bbdd2729 Jun 28, 2026
c0adeb9
Refactor asset data list building
bbdd2729 Jun 28, 2026
c62688d
Extract asset data scene tree build
bbdd2729 Jun 28, 2026
bfc1c5d
Extract asset data tree helpers
bbdd2729 Jun 28, 2026
4524c10
Optimize asset filter lookups
bbdd2729 Jun 28, 2026
e075e55
Avoid tree filter asset item allocations
bbdd2729 Jun 28, 2026
3168210
Reduce asset item dictionary lookups
bbdd2729 Jun 28, 2026
0cc3504
Reduce scene tree grouping allocations
bbdd2729 Jun 28, 2026
9bd7716
Remove unused asset bundle container name calculation
bbdd2729 Jun 28, 2026
33b5569
Optimize exportable asset item loop
bbdd2729 Jun 28, 2026
48efbdb
Cache export type flags during asset build
bbdd2729 Jun 28, 2026
00a82b0
Optimize asset entry filter matching
bbdd2729 Jun 28, 2026
ffc22fd
Skip non game objects faster in scene tree build
bbdd2729 Jun 28, 2026
7729003
Preallocate scene tree node map
bbdd2729 Jun 28, 2026
afcf76a
Simplify asset tree node assignment
bbdd2729 Jun 28, 2026
e7ad5b2
Simplify exportable asset item loop
bbdd2729 Jun 28, 2026
d253ec0
Refactor asset export workflow
bbdd2729 Jun 28, 2026
394f2b8
Refactor split object export workflow
bbdd2729 Jun 28, 2026
d067b11
Refactor container updates
bbdd2729 Jun 28, 2026
0f4c154
Clear asset map string cache
bbdd2729 Jun 28, 2026
55319cd
Reduce asset map load peak memory
bbdd2729 Jun 28, 2026
fa19cca
Clear asset browser retained lists
bbdd2729 Jun 28, 2026
fed4128
Make asset list display values lazy
bbdd2729 Jun 28, 2026
0f595e1
Lazy compute asset hashes
bbdd2729 Jun 28, 2026
f8295bf
Tighten null-terminated string reads
bbdd2729 Jun 28, 2026
b0c35b1
GetRawData
bbdd2729 Jun 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AnimeStudio.CLI/AnimeStudio.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.10" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1"/>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.9"/>
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion AnimeStudio.GUI/AnimeStudio.GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="OpenTK" Version="4.9.4" />
<PackageReference Include="OpenTK.GLControl" Version="4.0.2" />
<PackageReference Include="System.Drawing.Common" Version="9.0.10" />
<PackageReference Include="System.Drawing.Common" Version="10.0.9"/>
</ItemGroup>

<ItemGroup>
Expand Down
47 changes: 35 additions & 12 deletions AnimeStudio.GUI/AssetBrowser.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
Expand All @@ -16,17 +15,17 @@ namespace AnimeStudio.GUI
{
partial class AssetBrowser : Form
{
private readonly MainForm _parent;
private readonly List<AssetEntry> _assetEntries;
private readonly List<AssetEntry> _backupAssetEntries;
private readonly List<AssetEntry> _firstAssetEntries;
private readonly List<AssetEntry> _secondAssetEntries;
private readonly List<AssetEntry> _assetEntries;
private readonly List<AssetEntry> _backupAssetEntries;
private readonly Dictionary<string, Regex> _filters;
private readonly List<AssetEntry> _firstAssetEntries;
private readonly MainForm _parent;
private readonly List<AssetEntry> _secondAssetEntries;
private DataGridViewColumn _sortedColumn;

private SortOrder _sortOrder;
private DataGridViewColumn _sortedColumn;
private List<String> types = new();
private SortOrder _sortOrder;
private List<String> selectedTypes = new();
private List<string> types = new List<string>();

public AssetBrowser(MainForm form)
{
Expand All @@ -44,7 +43,11 @@ private async void loadAssetMap_Click(object sender, EventArgs e)
{
loadAssetMap.Enabled = false;

var openFileDialog = new OpenFileDialog() { Multiselect = false, Filter = "MessagePack AssetMap File|*.map|JSON AssetMap File|*.json" };
var openFileDialog = new OpenFileDialog
{
Multiselect = false, Filter = "MessagePack AssetMap File|*" +
".map|JSON AssetMap File|*.json|MemoryPack AssetMap File|*.memory"
};
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
{
try
Expand All @@ -61,6 +64,8 @@ private async void loadAssetMap_Click(object sender, EventArgs e)
_sortedColumn = null;

_firstAssetEntries.Clear();
_secondAssetEntries.Clear();
_backupAssetEntries.Clear();
_firstAssetEntries.AddRange(ResourceMap.GetEntries());

updateDisplay();
Expand Down Expand Up @@ -172,12 +177,14 @@ private void bringMainToFront()
_parent.TopMost = false;
_parent.Focus();
}

private void clear_Click(object sender, EventArgs e)
{
Clear();
updateButtons();
Logger.Info($"Cleared !!");
}

private void loadSelected_Click(object sender, EventArgs e)
{
var files = assetDataGridView.SelectedRows.Cast<DataGridViewRow>()
Expand Down Expand Up @@ -210,6 +217,7 @@ private void loadSelected_Click(object sender, EventArgs e)
_parent.Invoke(() => _parent.LoadPaths(files, filePaths.ToArray()));
}
}

private async void exportSelected_Click(object sender, EventArgs e)
{
var saveFolderDialog = new OpenFolderDialog();
Expand Down Expand Up @@ -245,6 +253,7 @@ await Task.Run(async () =>
StatusStripUpdate = statusStripUpdate;
}
}

private void BuildAssetData(List<AssetItem> exportableAssets, AssetEntry[] entries)
{
var objectAssetItemDic = new Dictionary<Object, AssetItem>();
Expand Down Expand Up @@ -284,6 +293,7 @@ private void BuildAssetData(List<AssetItem> exportableAssets, AssetEntry[] entri
exportableAssets.Clear();
exportableAssets.AddRange(matches);
}

private void ProcessAssetData(Object asset, List<AssetItem> exportableAssets, Dictionary<Object, AssetItem> objectAssetItemDic, List<(PPtr<Object>, string)> mihoyoBinDataNames, List<(PPtr<Object>, string)> containers)
{
var assetItem = new AssetItem(asset);
Expand Down Expand Up @@ -388,6 +398,7 @@ private void FilterAssetDataGrid()
assetDataGridView.RowCount = _assetEntries.Count;
assetDataGridView.Refresh();
}

private void TryAddFilter(string name, string value)
{
Regex regex;
Expand All @@ -410,41 +421,47 @@ private void TryAddFilter(string name, string value)
_filters[name] = regex;
}
}

private void NameTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (sender is TextBox textBox && e.KeyChar == (char)Keys.Enter)
{
FilterAssetDataGrid();
}
}

private void ContainerTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (sender is TextBox textBox && e.KeyChar == (char)Keys.Enter)
{
FilterAssetDataGrid();
}
}

private void SourceTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (sender is TextBox textBox && e.KeyChar == (char)Keys.Enter)
{
FilterAssetDataGrid();
}
}

private void PathTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (sender is TextBox textBox && e.KeyChar == (char)Keys.Enter)
{
FilterAssetDataGrid();
}
}

private void HashTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (sender is TextBox textBox && e.KeyChar == (char)Keys.Enter)
{
FilterAssetDataGrid();
}
}

private void AssetDataGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
{
if (_assetEntries.Count != 0 && e.RowIndex <= _assetEntries.Count)
Expand All @@ -462,6 +479,7 @@ private void AssetDataGridView_CellValueNeeded(object sender, DataGridViewCellVa
};
}
}

private void AssetListView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.ColumnIndex <= assetDataGridView.Columns.Count)
Expand Down Expand Up @@ -511,15 +529,22 @@ private void AssetListView_ColumnHeaderMouseClick(object sender, DataGridViewCel
assetDataGridView.Refresh();
}
}

private void AssetBrowser_FormClosing(object sender, FormClosingEventArgs e)
{
Clear();
base.OnClosing(e);
}

public void Clear()
{
ResourceMap.Clear();
_assetEntries.Clear();
_backupAssetEntries.Clear();
_firstAssetEntries.Clear();
_secondAssetEntries.Clear();
selectedTypes.Clear();
types.Clear();
assetDataGridView.Rows.Clear();
}

Expand Down Expand Up @@ -699,7 +724,5 @@ private void filterSelectTypesBtn_Click(object sender, EventArgs e)

popup.ShowDialog(this);
}


}
}
33 changes: 31 additions & 2 deletions AnimeStudio.GUI/Components/AssetItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ public class AssetItem : ListViewItem
public long m_PathID;
public long FullSize;
public ClassIDType Type;
public string Hash;
public string InfoText;
public string UniqueID;
public GameObjectTreeNode TreeNode;
private string hash;
private bool subItemsInitialized;

public string Hash => hash ??= Asset.GetHash();

public AssetItem(Object asset)
{
Expand All @@ -25,11 +28,15 @@ public AssetItem(Object asset)
TypeString = Type.ToString();
m_PathID = asset.m_PathID;
FullSize = asset.byteSize;
Hash = asset.GetHash();
}

public void SetSubItems()
{
if (subItemsInitialized)
{
return;
}

SubItems.AddRange(new[]
{
Container, //Container
Expand All @@ -38,6 +45,28 @@ public void SetSubItems()
FullSize.ToString(), //Size
Hash, //Hash
});
subItemsInitialized = true;
}

public string GetColumnText(int column)
{
return column switch
{
0 => Text,
1 => Container,
2 => TypeString,
3 => m_PathID.ToString(),
4 => FullSize.ToString(),
5 => Hash,
_ => string.Empty,
};
}

public bool MatchesListSearch(System.Text.RegularExpressions.Regex regex)
{
return regex.IsMatch(Text)
|| regex.IsMatch(Container)
|| regex.IsMatch(m_PathID.ToString());
}
}
}
Loading