Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Add new naraka format #70

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3b87c1c
Add new naraka format
Rivelia Feb 5, 2024
5597235
- [CLI] allow `--types` to decide class processing behaviour.
Razmoth Feb 6, 2024
61ff13f
- [CLI] Added feature to search prebuild `AssetMap` to loaded filtede…
Razmoth Feb 6, 2024
6b31f63
- [Core] Added `Shader` decompilation/disassembly for `DXCB` program.
Razmoth Feb 6, 2024
3d5a1bc
- [Core] Added hashes to `Shader` output.
Razmoth Feb 6, 2024
14a6115
- [Core] handle `HasMesh` exception.
Razmoth Feb 6, 2024
7e595e2
- [Core] Fix incorrect output location for `GameObject`
Razmoth Feb 10, 2024
5db1b59
- [GUI] Update drag&drop effects.
Razmoth Feb 10, 2024
2e268e6
- [Core] Added shader flags.
Razmoth Feb 10, 2024
e1d7f53
- [Core] Update file foramt.
Razmoth Feb 11, 2024
cf2e750
- [Core] bug fixes #75
Razmoth Feb 18, 2024
90fd2a6
- [CLI] bug fixes
Razmoth Feb 19, 2024
2d1e5a0
- [Core] bug fixes.
Razmoth Feb 19, 2024
b5d54ce
- [Core] bug fixes.
Razmoth Feb 19, 2024
3946c0d
- [Core] bug fixes.
Razmoth Feb 19, 2024
462ac7b
- [Core] fix bug with `AssetMap`
Razmoth Feb 20, 2024
8ba29c2
- [CLI] fix bug with containers.
Razmoth Feb 20, 2024
55fcd60
- [CLI] allow case insensitive flags.
Razmoth Feb 20, 2024
ab73046
- [CLI] allow exported flags to override configs.
Razmoth Feb 20, 2024
63b4464
- [GUI] Highlight nodes that are exportable as fbx.
Razmoth Feb 27, 2024
5664441
- [GUI] change text
Razmoth Feb 27, 2024
d8cad9e
Update ImportHelper.cs
Razmoth Feb 28, 2024
c27ebec
- [Core] Added new entries.
Razmoth Feb 28, 2024
8a3517f
Merge branch 'main' of https://github.com/RazTools/Studio
Razmoth Feb 28, 2024
6c64b41
- [Core] fix parsing issues [ExA]
Razmoth Feb 29, 2024
d135a93
- [Core] bug fixes.
Razmoth Feb 29, 2024
7ed67c3
Support new naraka format
Rivelia Apr 5, 2024
6a1a587
Add new naraka format
Rivelia Feb 5, 2024
669b755
Support new naraka format
Rivelia Apr 5, 2024
37f4efa
Merge branch 'naraka-new-format' of https://github.com/Rivelia/Studio…
Rivelia Apr 5, 2024
0505e0f
support latest naraka patch
Rivelia May 1, 2024
d6014c0
update blocks size for latest naraka version
Rivelia Aug 24, 2024
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
Prev Previous commit
Next Next commit
- [Core] fix bug with AssetMap
  • Loading branch information
Razmoth committed Feb 20, 2024
commit 462ac7b396e3070246b9f8e477838774e1d94fd8
19 changes: 8 additions & 11 deletions AssetStudio.GUI/AssetBrowser.cs
Original file line number Diff line number Diff line change
@@ -126,7 +126,7 @@ private void BuildAssetData(List<AssetItem> exportableAssets, AssetEntry[] entri
{
foreach (var asset in assetsFile.Objects)
{
ProcessAssetData(asset, exportableAssets, entries, objectAssetItemDic, mihoyoBinDataNames, containers);
ProcessAssetData(asset, exportableAssets, objectAssetItemDic, mihoyoBinDataNames, containers);
}
}
foreach ((var pptr, var name) in mihoyoBinDataNames)
@@ -151,16 +151,12 @@ private void BuildAssetData(List<AssetItem> exportableAssets, AssetEntry[] entri
}
}
containers.Clear();
for (int i = exportableAssets.Count - 1; i >= 0; i--)
{
var asset = exportableAssets[i];
if (!entries.Any(x => x.Container == asset.Container && x.Name == asset.Text && x.Type == asset.Type && x.PathID == asset.m_PathID))
{
exportableAssets.Remove(asset);
}
}

var matches = exportableAssets.Where(asset => entries.Any(x => x.Container == asset.Container && x.Name == asset.Text && x.Type == asset.Type && x.PathID == asset.m_PathID)).ToArray();
exportableAssets.Clear();
exportableAssets.AddRange(matches);
}
private void ProcessAssetData(Object asset, List<AssetItem> exportableAssets, AssetEntry[] entries, Dictionary<Object, AssetItem> objectAssetItemDic, List<(PPtr<Object>, string)> mihoyoBinDataNames, List<(PPtr<Object>, string)> containers)
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);
objectAssetItemDic.Add(asset, assetItem);
@@ -231,12 +227,13 @@ private void ProcessAssetData(Object asset, List<AssetItem> exportableAssets, As
exportable = true;
break;
}

if (assetItem.Text == "")
{
assetItem.Text = assetItem.TypeString + assetItem.UniqueID;
}

if (entries.Any(x => x.Name == assetItem.Text && x.Type == assetItem.Type) && exportable)
if (exportable)
{
exportableAssets.Add(assetItem);
}
39 changes: 15 additions & 24 deletions AssetStudio/AssetsHelper.cs
Original file line number Diff line number Diff line change
@@ -339,6 +339,7 @@ public static async Task BuildAssetMap(string[] files, string mapName, Game game

private static void BuildAssetMap(string file, List<AssetEntry> assets, ClassIDType[] typeFilters = null, Regex[] nameFilters = null, Regex[] containerFilters = null)
{
var matches = new List<AssetEntry>();
var containers = new List<(PPtr<Object>, string)>();
var mihoyoBinDataNames = new List<(PPtr<Object>, string)>();
var objectAssetItemDic = new Dictionary<Object, AssetEntry>();
@@ -457,25 +458,18 @@ private static void BuildAssetMap(string file, List<AssetEntry> assets, ClassIDT
objectAssetItemDic.Add(obj, asset);
assetsFile.AddObject(obj);
}
var isMatchRegex = nameFilters.IsNullOrEmpty() || nameFilters.Any(x => x.IsMatch(asset.Name) || asset.Type == ClassIDType.Animator);
var isFilteredType = typeFilters.IsNullOrEmpty() || typeFilters.Contains(asset.Type) || asset.Type == ClassIDType.Animator;
if (isMatchRegex && isFilteredType && exportable)
if (exportable)
{
assets.Add(asset);
matches.Add(asset);
}
}
}
foreach ((var pptr, var asset) in animators)
{
if (pptr.TryGet<GameObject>(out var gameObject) && (nameFilters.IsNullOrEmpty() || nameFilters.Any(x => x.IsMatch(gameObject.m_Name))) && (typeFilters.IsNullOrEmpty() || typeFilters.Contains(asset.Type)))
if (pptr.TryGet<GameObject>(out var gameObject))
{
asset.Name = gameObject.m_Name;
}
else
{
assets.Remove(asset);
}

}
foreach ((var pptr, var name) in mihoyoBinDataNames)
{
@@ -490,24 +484,21 @@ private static void BuildAssetMap(string file, List<AssetEntry> assets, ClassIDT
else asset.Name = $"BinFile #{asset.PathID}";
}
}
if (!containerFilters.IsNullOrEmpty())
foreach ((var pptr, var container) in containers)
{
foreach ((var pptr, var container) in containers)
if (pptr.TryGet(out var obj))
{
if (pptr.TryGet(out var obj))
{
var item = objectAssetItemDic[obj];
if (containerFilters.Any(x => x.IsMatch(container)))
{
item.Container = container;
}
else
{
assets.Remove(item);
}
}
objectAssetItemDic[obj].Container = container;
}
}

assets.AddRange(matches.Where(x =>
{
var isMatchRegex = nameFilters.IsNullOrEmpty() || nameFilters.Any(y => y.IsMatch(x.Name));
var isFilteredType = typeFilters.IsNullOrEmpty() || typeFilters.Contains(x.Type);
var isContainerMatch = containerFilters.IsNullOrEmpty() || containerFilters.Any(y => y.IsMatch(x.Container));
return isMatchRegex && isFilteredType && isContainerMatch;
}));
}

public static string[] ParseAssetMap(string mapName, ExportListType mapType, ClassIDType[] typeFilter, Regex[] nameFilter, Regex[] containerFilter)
Loading