Compare commits
4 Commits
Perfare_ma
...
v0.16.8.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
571ea2da4a | ||
|
|
9cbe91decb | ||
|
|
19c6c5fe73 | ||
|
|
792850dbb2 |
57
.github/workflows/build.yml
vendored
57
.github/workflows/build.yml
vendored
@@ -1,57 +0,0 @@
|
||||
name: AssetStudioBuild
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: microsoft/setup-msbuild@v1.1
|
||||
|
||||
- name: Download FBX SDK
|
||||
run: |
|
||||
md fbx
|
||||
cd fbx
|
||||
Invoke-WebRequest "https://damassets.autodesk.net/content/dam/autodesk/www/adn/fbx/2020-2-1/fbx202021_fbxsdk_vs2019_win.exe" -OutFile "fbxsdk.exe"
|
||||
Start-Process -FilePath "fbxsdk.exe" /S -Wait
|
||||
Invoke-WebRequest "https://damassets.autodesk.net/content/dam/autodesk/www/adn/fbx/2020-2-1/fbx202021_fbxsdk_vs2019_pdbs.exe" -OutFile "fbxpdb.exe"
|
||||
Start-Process -FilePath "fbxpdb.exe" /S -Wait
|
||||
cd ..
|
||||
|
||||
- name: Nuget Restore
|
||||
run: nuget restore
|
||||
|
||||
- name: Build .Net472
|
||||
run: msbuild /p:Configuration=Release /p:TargetFramework=net472 /verbosity:minimal
|
||||
|
||||
- name: Build .Net5
|
||||
run: msbuild /t:AssetStudioGUI:publish /p:Configuration=Release /p:TargetFramework=net5.0-windows /p:SelfContained=false /verbosity:minimal
|
||||
|
||||
- name: Build .Net6
|
||||
run: msbuild /t:AssetStudioGUI:publish /p:Configuration=Release /p:TargetFramework=net6.0-windows /p:SelfContained=false /verbosity:minimal
|
||||
|
||||
- name: Upload .Net472 Artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: AssetStudio.net472
|
||||
path: AssetStudioGUI/bin/Release/net472
|
||||
|
||||
- name: Upload .Net5 Artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: AssetStudio.net5
|
||||
path: AssetStudioGUI/bin/Release/net5.0-windows/publish
|
||||
|
||||
- name: Upload .Net6 Artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: AssetStudio.net6
|
||||
path: AssetStudioGUI/bin/Release/net6.0-windows/publish
|
||||
@@ -1,13 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net472;netstandard2.0;net5.0;net6.0</TargetFrameworks>
|
||||
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Version>0.16.0.0</Version>
|
||||
<AssemblyVersion>0.16.0.0</AssemblyVersion>
|
||||
<FileVersion>0.16.0.0</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2020-2022; Copyright © hozuki 2020</Copyright>
|
||||
<DebugType>embedded</DebugType>
|
||||
<Version>0.16.8.1</Version>
|
||||
<AssemblyVersion>0.16.8.1</AssemblyVersion>
|
||||
<FileVersion>0.16.8.1</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2020-2021; Copyright © hozuki 2020</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net472|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,22 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net472;netstandard2.0;net5.0;net6.0</TargetFrameworks>
|
||||
<Version>0.16.0.0</Version>
|
||||
<AssemblyVersion>0.16.0.0</AssemblyVersion>
|
||||
<FileVersion>0.16.0.0</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2018-2022</Copyright>
|
||||
<DebugType>embedded</DebugType>
|
||||
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
|
||||
<Version>0.16.8.1</Version>
|
||||
<AssemblyVersion>0.16.8.1</AssemblyVersion>
|
||||
<FileVersion>0.16.8.1</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2018-2021</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' != 'net472' ">
|
||||
<PackageReference Include="K4os.Compression.LZ4" Version="1.2.16" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
|
||||
<PackageReference Include="System.Memory" Version="4.5.4" />
|
||||
<PackageReference Include="System.IO.Compression" Version="4.0.0" />
|
||||
<PackageReference Include="K4os.Compression.LZ4" Version="1.1.11" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net472|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using static AssetStudio.ImportHelper;
|
||||
@@ -18,12 +17,11 @@ namespace AssetStudio
|
||||
|
||||
private List<string> importFiles = new List<string>();
|
||||
private HashSet<string> importFilesHash = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
private HashSet<string> noexistFiles = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
private HashSet<string> assetsFileListHash = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public void LoadFiles(params string[] files)
|
||||
{
|
||||
var path = Path.GetDirectoryName(Path.GetFullPath(files[0]));
|
||||
var path = Path.GetDirectoryName(files[0]);
|
||||
MergeSplitAssets(path);
|
||||
var toReadFile = ProcessingSplitFiles(files.ToList());
|
||||
Load(toReadFile);
|
||||
@@ -55,7 +53,6 @@ namespace AssetStudio
|
||||
|
||||
importFiles.Clear();
|
||||
importFilesHash.Clear();
|
||||
noexistFiles.Clear();
|
||||
assetsFileListHash.Clear();
|
||||
|
||||
ReadAssets();
|
||||
@@ -87,9 +84,6 @@ namespace AssetStudio
|
||||
case FileType.BrotliFile:
|
||||
LoadFile(DecompressBrotli(reader));
|
||||
break;
|
||||
case FileType.ZipFile:
|
||||
LoadZipFile(reader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +91,7 @@ namespace AssetStudio
|
||||
{
|
||||
if (!assetsFileListHash.Contains(reader.FileName))
|
||||
{
|
||||
Logger.Info($"Loading {reader.FullPath}");
|
||||
Logger.Info($"Loading {reader.FileName}");
|
||||
try
|
||||
{
|
||||
var assetsFile = new SerializedFile(reader, this);
|
||||
@@ -112,38 +106,31 @@ namespace AssetStudio
|
||||
if (!importFilesHash.Contains(sharedFileName))
|
||||
{
|
||||
var sharedFilePath = Path.Combine(Path.GetDirectoryName(reader.FullPath), sharedFileName);
|
||||
if (!noexistFiles.Contains(sharedFilePath))
|
||||
if (!File.Exists(sharedFilePath))
|
||||
{
|
||||
if (!File.Exists(sharedFilePath))
|
||||
var findFiles = Directory.GetFiles(Path.GetDirectoryName(reader.FullPath), sharedFileName, SearchOption.AllDirectories);
|
||||
if (findFiles.Length > 0)
|
||||
{
|
||||
var findFiles = Directory.GetFiles(Path.GetDirectoryName(reader.FullPath), sharedFileName, SearchOption.AllDirectories);
|
||||
if (findFiles.Length > 0)
|
||||
{
|
||||
sharedFilePath = findFiles[0];
|
||||
}
|
||||
}
|
||||
if (File.Exists(sharedFilePath))
|
||||
{
|
||||
importFiles.Add(sharedFilePath);
|
||||
importFilesHash.Add(sharedFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
noexistFiles.Add(sharedFilePath);
|
||||
sharedFilePath = findFiles[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (File.Exists(sharedFilePath))
|
||||
{
|
||||
importFiles.Add(sharedFilePath);
|
||||
importFilesHash.Add(sharedFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Error while reading assets file {reader.FullPath}", e);
|
||||
Logger.Error($"Error while reading assets file {reader.FileName}", e);
|
||||
reader.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info($"Skipping {reader.FullPath}");
|
||||
reader.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -156,7 +143,7 @@ namespace AssetStudio
|
||||
{
|
||||
var assetsFile = new SerializedFile(reader, this);
|
||||
assetsFile.originalPath = originalPath;
|
||||
if (!string.IsNullOrEmpty(unityVersion) && assetsFile.header.m_Version < SerializedFileFormatVersion.Unknown_7)
|
||||
if (!string.IsNullOrEmpty(unityVersion) && assetsFile.header.m_Version < SerializedFileFormatVersion.kUnknown_7)
|
||||
{
|
||||
assetsFile.SetVersion(unityVersion);
|
||||
}
|
||||
@@ -166,17 +153,15 @@ namespace AssetStudio
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Error while reading assets file {reader.FullPath} from {Path.GetFileName(originalPath)}", e);
|
||||
Logger.Error($"Error while reading assets file {reader.FileName} from {Path.GetFileName(originalPath)}", e);
|
||||
resourceFileReaders.Add(reader.FileName, reader);
|
||||
}
|
||||
}
|
||||
else
|
||||
Logger.Info($"Skipping {originalPath} ({reader.FileName})");
|
||||
}
|
||||
|
||||
private void LoadBundleFile(FileReader reader, string originalPath = null)
|
||||
{
|
||||
Logger.Info("Loading " + reader.FullPath);
|
||||
Logger.Info("Loading " + reader.FileName);
|
||||
try
|
||||
{
|
||||
var bundleFile = new BundleFile(reader);
|
||||
@@ -188,15 +173,15 @@ namespace AssetStudio
|
||||
{
|
||||
LoadAssetsFromMemory(subReader, originalPath ?? reader.FullPath, bundleFile.m_Header.unityRevision);
|
||||
}
|
||||
else
|
||||
else if (!resourceFileReaders.ContainsKey(file.fileName))
|
||||
{
|
||||
resourceFileReaders[file.fileName] = subReader; //TODO
|
||||
resourceFileReaders.Add(file.fileName, subReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
var str = $"Error while reading bundle file {reader.FullPath}";
|
||||
var str = $"Error while reading bundle file {reader.FileName}";
|
||||
if (originalPath != null)
|
||||
{
|
||||
str += $" from {Path.GetFileName(originalPath)}";
|
||||
@@ -211,7 +196,7 @@ namespace AssetStudio
|
||||
|
||||
private void LoadWebFile(FileReader reader)
|
||||
{
|
||||
Logger.Info("Loading " + reader.FullPath);
|
||||
Logger.Info("Loading " + reader.FileName);
|
||||
try
|
||||
{
|
||||
var webFile = new WebFile(reader);
|
||||
@@ -238,107 +223,7 @@ namespace AssetStudio
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Error while reading web file {reader.FullPath}", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
reader.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadZipFile(FileReader reader)
|
||||
{
|
||||
Logger.Info("Loading " + reader.FileName);
|
||||
try
|
||||
{
|
||||
using (ZipArchive archive = new ZipArchive(reader.BaseStream, ZipArchiveMode.Read))
|
||||
{
|
||||
List<string> splitFiles = new List<string>();
|
||||
// register all files before parsing the assets so that the external references can be found
|
||||
// and find split files
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
if (entry.Name.Contains(".split"))
|
||||
{
|
||||
string baseName = Path.GetFileNameWithoutExtension(entry.Name);
|
||||
string basePath = Path.Combine(Path.GetDirectoryName(entry.FullName), baseName);
|
||||
if (!splitFiles.Contains(basePath))
|
||||
{
|
||||
splitFiles.Add(basePath);
|
||||
importFilesHash.Add(baseName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
importFilesHash.Add(entry.Name);
|
||||
}
|
||||
}
|
||||
|
||||
// merge split files and load the result
|
||||
foreach (string basePath in splitFiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
Stream splitStream = new MemoryStream();
|
||||
int i = 0;
|
||||
while (true)
|
||||
{
|
||||
string path = $"{basePath}.split{i++}";
|
||||
ZipArchiveEntry entry = archive.GetEntry(path);
|
||||
if (entry == null)
|
||||
break;
|
||||
using (Stream entryStream = entry.Open())
|
||||
{
|
||||
entryStream.CopyTo(splitStream);
|
||||
}
|
||||
}
|
||||
splitStream.Seek(0, SeekOrigin.Begin);
|
||||
FileReader entryReader = new FileReader(basePath, splitStream);
|
||||
LoadFile(entryReader);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Error while reading zip split file {basePath}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// load all entries
|
||||
foreach (ZipArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
try
|
||||
{
|
||||
string dummyPath = Path.Combine(Path.GetDirectoryName(reader.FullPath), reader.FileName, entry.FullName);
|
||||
// create a new stream
|
||||
// - to store the deflated stream in
|
||||
// - to keep the data for later extraction
|
||||
Stream streamReader = new MemoryStream();
|
||||
using (Stream entryStream = entry.Open())
|
||||
{
|
||||
entryStream.CopyTo(streamReader);
|
||||
}
|
||||
streamReader.Position = 0;
|
||||
|
||||
FileReader entryReader = new FileReader(dummyPath, streamReader);
|
||||
LoadFile(entryReader);
|
||||
if (entryReader.FileType == FileType.ResourceFile)
|
||||
{
|
||||
entryReader.Position = 0;
|
||||
if (!resourceFileReaders.ContainsKey(entry.Name))
|
||||
{
|
||||
resourceFileReaders.Add(entry.Name, entryReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Error while reading zip entry {entry.FullName}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error($"Error while reading zip file {reader.FileName}", e);
|
||||
Logger.Error($"Error while reading web file {reader.FileName}", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -488,7 +373,6 @@ namespace AssetStudio
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("Unable to load object")
|
||||
.AppendLine($"Assets {assetsFile.fileName}")
|
||||
.AppendLine($"Path {assetsFile.originalPath}")
|
||||
.AppendLine($"Type {objectReader.type}")
|
||||
.AppendLine($"PathID {objectInfo.m_PathID}")
|
||||
.Append(e);
|
||||
@@ -548,14 +432,6 @@ namespace AssetStudio
|
||||
{
|
||||
m_Sprite.m_SpriteAtlas.Set(m_SpriteAtlas);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Sprite.m_SpriteAtlas.TryGet(out var m_SpriteAtlaOld);
|
||||
if (m_SpriteAtlaOld.m_IsVariant)
|
||||
{
|
||||
m_Sprite.m_SpriteAtlas.Set(m_SpriteAtlas);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -563,4 +439,4 @@ namespace AssetStudio
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Buffers;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public static class BigArrayPool<T>
|
||||
{
|
||||
private static readonly ArrayPool<T> s_shared = ArrayPool<T>.Create(64 * 1024 * 1024, 3);
|
||||
public static ArrayPool<T> Shared => s_shared;
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ namespace AssetStudio
|
||||
public enum BuildTarget
|
||||
{
|
||||
NoTarget = -2,
|
||||
AnyPlayer = -1,
|
||||
ValidPlayer = 1,
|
||||
DashboardWidget = 1,
|
||||
StandaloneOSX = 2,
|
||||
StandaloneOSXPPC = 3,
|
||||
StandaloneOSXIntel = 4,
|
||||
@@ -20,10 +19,8 @@ namespace AssetStudio
|
||||
iOS = 9,
|
||||
PS3,
|
||||
XBOX360,
|
||||
Broadcom = 12,
|
||||
Android = 13,
|
||||
StandaloneGLESEmu = 14,
|
||||
StandaloneGLES20Emu = 15,
|
||||
NaCl = 16,
|
||||
StandaloneLinux = 17,
|
||||
FlashPlayer = 18,
|
||||
@@ -51,8 +48,6 @@ namespace AssetStudio
|
||||
GameCoreXboxSeries,
|
||||
GameCoreXboxOne,
|
||||
PS5,
|
||||
EmbeddedLinux,
|
||||
QNX,
|
||||
UnknownPlatform = 9999
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,11 @@
|
||||
using K4os.Compression.LZ4;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Lz4;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
[Flags]
|
||||
public enum ArchiveFlags
|
||||
{
|
||||
CompressionTypeMask = 0x3f,
|
||||
BlocksAndDirectoryInfoCombined = 0x40,
|
||||
BlocksInfoAtTheEnd = 0x80,
|
||||
OldWebPluginCompatibility = 0x100,
|
||||
BlockInfoNeedPaddingAtStart = 0x200
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum StorageBlockFlags
|
||||
{
|
||||
CompressionTypeMask = 0x3f,
|
||||
Streamed = 0x40
|
||||
}
|
||||
|
||||
public enum CompressionType
|
||||
{
|
||||
None,
|
||||
Lzma,
|
||||
Lz4,
|
||||
Lz4HC,
|
||||
Lzham
|
||||
}
|
||||
|
||||
public class BundleFile
|
||||
{
|
||||
public class Header
|
||||
@@ -42,14 +17,14 @@ namespace AssetStudio
|
||||
public long size;
|
||||
public uint compressedBlocksInfoSize;
|
||||
public uint uncompressedBlocksInfoSize;
|
||||
public ArchiveFlags flags;
|
||||
public uint flags;
|
||||
}
|
||||
|
||||
public class StorageBlock
|
||||
{
|
||||
public uint compressedSize;
|
||||
public uint uncompressedSize;
|
||||
public StorageBlockFlags flags;
|
||||
public ushort flags;
|
||||
}
|
||||
|
||||
public class Node
|
||||
@@ -104,6 +79,7 @@ namespace AssetStudio
|
||||
|
||||
private void ReadHeaderAndBlocksInfo(EndianBinaryReader reader)
|
||||
{
|
||||
var isCompressed = m_Header.signature == "UnityWeb";
|
||||
if (m_Header.version >= 4)
|
||||
{
|
||||
var hash = reader.ReadBytes(16);
|
||||
@@ -120,6 +96,7 @@ namespace AssetStudio
|
||||
{
|
||||
compressedSize = reader.ReadUInt32(),
|
||||
uncompressedSize = reader.ReadUInt32(),
|
||||
flags = (ushort)(isCompressed ? 1 : 0)
|
||||
};
|
||||
if (i == levelCount - 1)
|
||||
{
|
||||
@@ -156,11 +133,10 @@ namespace AssetStudio
|
||||
|
||||
private void ReadBlocksAndDirectory(EndianBinaryReader reader, Stream blocksStream)
|
||||
{
|
||||
var isCompressed = m_Header.signature == "UnityWeb";
|
||||
foreach (var blockInfo in m_BlocksInfo)
|
||||
{
|
||||
var uncompressedBytes = reader.ReadBytes((int)blockInfo.compressedSize);
|
||||
if (isCompressed)
|
||||
if (blockInfo.flags == 1)
|
||||
{
|
||||
using (var memoryStream = new MemoryStream(uncompressedBytes))
|
||||
{
|
||||
@@ -220,7 +196,7 @@ namespace AssetStudio
|
||||
m_Header.size = reader.ReadInt64();
|
||||
m_Header.compressedBlocksInfoSize = reader.ReadUInt32();
|
||||
m_Header.uncompressedBlocksInfoSize = reader.ReadUInt32();
|
||||
m_Header.flags = (ArchiveFlags)reader.ReadUInt32();
|
||||
m_Header.flags = reader.ReadUInt32();
|
||||
if (m_Header.signature != "UnityFS")
|
||||
{
|
||||
reader.ReadByte();
|
||||
@@ -234,51 +210,45 @@ namespace AssetStudio
|
||||
{
|
||||
reader.AlignStream(16);
|
||||
}
|
||||
if ((m_Header.flags & ArchiveFlags.BlocksInfoAtTheEnd) != 0)
|
||||
if ((m_Header.flags & 0x80) != 0) //kArchiveBlocksInfoAtTheEnd
|
||||
{
|
||||
var position = reader.Position;
|
||||
reader.Position = reader.BaseStream.Length - m_Header.compressedBlocksInfoSize;
|
||||
blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
|
||||
reader.Position = position;
|
||||
}
|
||||
else //0x40 BlocksAndDirectoryInfoCombined
|
||||
else //0x40 kArchiveBlocksAndDirectoryInfoCombined
|
||||
{
|
||||
blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize);
|
||||
}
|
||||
var blocksInfoCompressedStream = new MemoryStream(blocksInfoBytes);
|
||||
MemoryStream blocksInfoUncompresseddStream;
|
||||
var uncompressedSize = m_Header.uncompressedBlocksInfoSize;
|
||||
var compressionType = (CompressionType)(m_Header.flags & ArchiveFlags.CompressionTypeMask);
|
||||
switch (compressionType)
|
||||
switch (m_Header.flags & 0x3F) //kArchiveCompressionTypeMask
|
||||
{
|
||||
case CompressionType.None:
|
||||
default: //None
|
||||
{
|
||||
blocksInfoUncompresseddStream = new MemoryStream(blocksInfoBytes);
|
||||
blocksInfoUncompresseddStream = blocksInfoCompressedStream;
|
||||
break;
|
||||
}
|
||||
case CompressionType.Lzma:
|
||||
case 1: //LZMA
|
||||
{
|
||||
blocksInfoUncompresseddStream = new MemoryStream((int)(uncompressedSize));
|
||||
using (var blocksInfoCompressedStream = new MemoryStream(blocksInfoBytes))
|
||||
{
|
||||
SevenZipHelper.StreamDecompress(blocksInfoCompressedStream, blocksInfoUncompresseddStream, m_Header.compressedBlocksInfoSize, m_Header.uncompressedBlocksInfoSize);
|
||||
}
|
||||
blocksInfoUncompresseddStream = new MemoryStream((int)(m_Header.uncompressedBlocksInfoSize));
|
||||
SevenZipHelper.StreamDecompress(blocksInfoCompressedStream, blocksInfoUncompresseddStream, m_Header.compressedBlocksInfoSize, m_Header.uncompressedBlocksInfoSize);
|
||||
blocksInfoUncompresseddStream.Position = 0;
|
||||
blocksInfoCompressedStream.Close();
|
||||
break;
|
||||
}
|
||||
case CompressionType.Lz4:
|
||||
case CompressionType.Lz4HC:
|
||||
case 2: //LZ4
|
||||
case 3: //LZ4HC
|
||||
{
|
||||
var uncompressedBytes = new byte[uncompressedSize];
|
||||
var numWrite = LZ4Codec.Decode(blocksInfoBytes, uncompressedBytes);
|
||||
if (numWrite != uncompressedSize)
|
||||
var uncompressedBytes = new byte[m_Header.uncompressedBlocksInfoSize];
|
||||
using (var decoder = new Lz4DecoderStream(blocksInfoCompressedStream))
|
||||
{
|
||||
throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {uncompressedSize} bytes");
|
||||
decoder.Read(uncompressedBytes, 0, uncompressedBytes.Length);
|
||||
}
|
||||
blocksInfoUncompresseddStream = new MemoryStream(uncompressedBytes);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new IOException($"Unsupported compression type {compressionType}");
|
||||
}
|
||||
using (var blocksInfoReader = new EndianBinaryReader(blocksInfoUncompresseddStream))
|
||||
{
|
||||
@@ -291,7 +261,7 @@ namespace AssetStudio
|
||||
{
|
||||
uncompressedSize = blocksInfoReader.ReadUInt32(),
|
||||
compressedSize = blocksInfoReader.ReadUInt32(),
|
||||
flags = (StorageBlockFlags)blocksInfoReader.ReadUInt16()
|
||||
flags = blocksInfoReader.ReadUInt16()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -308,49 +278,34 @@ namespace AssetStudio
|
||||
};
|
||||
}
|
||||
}
|
||||
if ((m_Header.flags & ArchiveFlags.BlockInfoNeedPaddingAtStart) != 0)
|
||||
{
|
||||
reader.AlignStream(16);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadBlocks(EndianBinaryReader reader, Stream blocksStream)
|
||||
{
|
||||
foreach (var blockInfo in m_BlocksInfo)
|
||||
{
|
||||
var compressionType = (CompressionType)(blockInfo.flags & StorageBlockFlags.CompressionTypeMask);
|
||||
switch (compressionType)
|
||||
switch (blockInfo.flags & 0x3F) //kStorageBlockCompressionTypeMask
|
||||
{
|
||||
case CompressionType.None:
|
||||
default: //None
|
||||
{
|
||||
reader.BaseStream.CopyTo(blocksStream, blockInfo.compressedSize);
|
||||
break;
|
||||
}
|
||||
case CompressionType.Lzma:
|
||||
case 1: //LZMA
|
||||
{
|
||||
SevenZipHelper.StreamDecompress(reader.BaseStream, blocksStream, blockInfo.compressedSize, blockInfo.uncompressedSize);
|
||||
break;
|
||||
}
|
||||
case CompressionType.Lz4:
|
||||
case CompressionType.Lz4HC:
|
||||
case 2: //LZ4
|
||||
case 3: //LZ4HC
|
||||
{
|
||||
var compressedSize = (int)blockInfo.compressedSize;
|
||||
var compressedBytes = BigArrayPool<byte>.Shared.Rent(compressedSize);
|
||||
reader.Read(compressedBytes, 0, compressedSize);
|
||||
var uncompressedSize = (int)blockInfo.uncompressedSize;
|
||||
var uncompressedBytes = BigArrayPool<byte>.Shared.Rent(uncompressedSize);
|
||||
var numWrite = LZ4Codec.Decode(compressedBytes, 0, compressedSize, uncompressedBytes, 0, uncompressedSize);
|
||||
if (numWrite != uncompressedSize)
|
||||
var compressedStream = new MemoryStream(reader.ReadBytes((int)blockInfo.compressedSize));
|
||||
using (var lz4Stream = new Lz4DecoderStream(compressedStream))
|
||||
{
|
||||
throw new IOException($"Lz4 decompression error, write {numWrite} bytes but expected {uncompressedSize} bytes");
|
||||
lz4Stream.CopyTo(blocksStream, blockInfo.uncompressedSize);
|
||||
}
|
||||
blocksStream.Write(uncompressedBytes, 0, uncompressedSize);
|
||||
BigArrayPool<byte>.Shared.Return(compressedBytes);
|
||||
BigArrayPool<byte>.Shared.Return(uncompressedBytes);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new IOException($"Unsupported compression type {compressionType}");
|
||||
}
|
||||
}
|
||||
blocksStream.Position = 0;
|
||||
|
||||
@@ -797,7 +797,6 @@ namespace AssetStudio
|
||||
public ClassIDType typeID;
|
||||
public byte customType;
|
||||
public byte isPPtrCurve;
|
||||
public byte isIntCurve;
|
||||
|
||||
public GenericBinding() { }
|
||||
|
||||
@@ -817,10 +816,6 @@ namespace AssetStudio
|
||||
}
|
||||
customType = reader.ReadByte();
|
||||
isPPtrCurve = reader.ReadByte();
|
||||
if (version[0] > 2022 || (version[0] == 2022 && version[1] >= 1)) //2022.1 and up
|
||||
{
|
||||
isIntCurve = reader.ReadByte();
|
||||
}
|
||||
reader.AlignStream();
|
||||
}
|
||||
}
|
||||
@@ -914,9 +909,9 @@ namespace AssetStudio
|
||||
|
||||
public enum AnimationType
|
||||
{
|
||||
Legacy = 1,
|
||||
Generic = 2,
|
||||
Humanoid = 3
|
||||
kLegacy = 1,
|
||||
kGeneric = 2,
|
||||
kHumanoid = 3
|
||||
};
|
||||
|
||||
public sealed class AnimationClip : NamedObject
|
||||
@@ -950,7 +945,7 @@ namespace AssetStudio
|
||||
else if (version[0] >= 4)//4.0 and up
|
||||
{
|
||||
m_AnimationType = (AnimationType)reader.ReadInt32();
|
||||
if (m_AnimationType == AnimationType.Legacy)
|
||||
if (m_AnimationType == AnimationType.kLegacy)
|
||||
m_Legacy = true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace AssetStudio
|
||||
public sealed class AudioClip : NamedObject
|
||||
{
|
||||
public int m_Format;
|
||||
public FMODSoundType m_Type;
|
||||
public AudioType m_Type;
|
||||
public bool m_3D;
|
||||
public bool m_UseHardware;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace AssetStudio
|
||||
if (version[0] < 5)
|
||||
{
|
||||
m_Format = reader.ReadInt32();
|
||||
m_Type = (FMODSoundType)reader.ReadInt32();
|
||||
m_Type = (AudioType)reader.ReadInt32();
|
||||
m_3D = reader.ReadBoolean();
|
||||
m_UseHardware = reader.ReadBoolean();
|
||||
reader.AlignStream();
|
||||
@@ -92,51 +92,34 @@ namespace AssetStudio
|
||||
}
|
||||
}
|
||||
|
||||
public enum FMODSoundType
|
||||
public enum AudioType
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
ACC = 1,
|
||||
AIFF = 2,
|
||||
ASF = 3,
|
||||
AT3 = 4,
|
||||
CDDA = 5,
|
||||
DLS = 6,
|
||||
FLAC = 7,
|
||||
FSB = 8,
|
||||
GCADPCM = 9,
|
||||
UNKNOWN,
|
||||
ACC,
|
||||
AIFF,
|
||||
IT = 10,
|
||||
MIDI = 11,
|
||||
MOD = 12,
|
||||
MPEG = 13,
|
||||
OGGVORBIS = 14,
|
||||
PLAYLIST = 15,
|
||||
RAW = 16,
|
||||
MPEG,
|
||||
OGGVORBIS,
|
||||
S3M = 17,
|
||||
SF2 = 18,
|
||||
USER = 19,
|
||||
WAV = 20,
|
||||
XM = 21,
|
||||
XMA = 22,
|
||||
VAG = 23,
|
||||
AUDIOQUEUE = 24,
|
||||
XWMA = 25,
|
||||
BCWAV = 26,
|
||||
AT9 = 27,
|
||||
VORBIS = 28,
|
||||
MEDIA_FOUNDATION = 29
|
||||
XM,
|
||||
XMA,
|
||||
VAG,
|
||||
AUDIOQUEUE
|
||||
}
|
||||
|
||||
public enum AudioCompressionFormat
|
||||
{
|
||||
PCM = 0,
|
||||
Vorbis = 1,
|
||||
ADPCM = 2,
|
||||
MP3 = 3,
|
||||
PSMVAG = 4,
|
||||
HEVAG = 5,
|
||||
XMA = 6,
|
||||
AAC = 7,
|
||||
GCADPCM = 8,
|
||||
ATRAC9 = 9
|
||||
PCM,
|
||||
Vorbis,
|
||||
ADPCM,
|
||||
MP3,
|
||||
VAG,
|
||||
HEVAG,
|
||||
XMA,
|
||||
AAC,
|
||||
GCADPCM,
|
||||
ATRAC9
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,18 +74,9 @@ namespace AssetStudio
|
||||
var m_ShaderKeywords = reader.ReadStringArray();
|
||||
}
|
||||
|
||||
if (version[0] > 2021 || (version[0] == 2021 && version[1] >= 3)) //2021.3 and up
|
||||
{
|
||||
var m_ValidKeywords = reader.ReadStringArray();
|
||||
var m_InvalidKeywords = reader.ReadStringArray();
|
||||
}
|
||||
else if (version[0] >= 5) //5.0 ~ 2021.2
|
||||
{
|
||||
var m_ShaderKeywords = reader.ReadAlignedString();
|
||||
}
|
||||
|
||||
if (version[0] >= 5) //5.0 and up
|
||||
{
|
||||
var m_ShaderKeywords = reader.ReadAlignedString();
|
||||
var m_LightmapFlags = reader.ReadUInt32();
|
||||
}
|
||||
|
||||
|
||||
@@ -396,14 +396,14 @@ namespace AssetStudio
|
||||
}
|
||||
}
|
||||
|
||||
public enum GfxPrimitiveType
|
||||
public enum GfxPrimitiveType : int
|
||||
{
|
||||
Triangles = 0,
|
||||
TriangleStrip = 1,
|
||||
Quads = 2,
|
||||
Lines = 3,
|
||||
LineStrip = 4,
|
||||
Points = 5
|
||||
kPrimitiveTriangles = 0,
|
||||
kPrimitiveTriangleStrip = 1,
|
||||
kPrimitiveQuads = 2,
|
||||
kPrimitiveLines = 3,
|
||||
kPrimitiveLineStrip = 4,
|
||||
kPrimitivePoints = 5,
|
||||
};
|
||||
|
||||
public class SubMesh
|
||||
@@ -651,11 +651,6 @@ namespace AssetStudio
|
||||
|
||||
int m_MeshUsageFlags = reader.ReadInt32();
|
||||
|
||||
if (version[0] > 2022 || (version[0] == 2022 && version[1] >= 1)) //2022.1 and up
|
||||
{
|
||||
int m_CookingOptions = reader.ReadInt32();
|
||||
}
|
||||
|
||||
if (version[0] >= 5) //5.0 and up
|
||||
{
|
||||
var m_BakedConvexCollisionMesh = reader.ReadUInt8Array();
|
||||
@@ -734,7 +729,7 @@ namespace AssetStudio
|
||||
}
|
||||
}
|
||||
|
||||
if (reader.Endian == EndianType.BigEndian && componentByteSize > 1) //swap bytes
|
||||
if (reader.endian == EndianType.BigEndian && componentByteSize > 1) //swap bytes
|
||||
{
|
||||
for (var i = 0; i < componentBytes.Length / componentByteSize; i++)
|
||||
{
|
||||
@@ -1065,7 +1060,7 @@ namespace AssetStudio
|
||||
}
|
||||
var indexCount = m_SubMesh.indexCount;
|
||||
var topology = m_SubMesh.topology;
|
||||
if (topology == GfxPrimitiveType.Triangles)
|
||||
if (topology == GfxPrimitiveType.kPrimitiveTriangles)
|
||||
{
|
||||
for (int i = 0; i < indexCount; i += 3)
|
||||
{
|
||||
@@ -1074,7 +1069,7 @@ namespace AssetStudio
|
||||
m_Indices.Add(m_IndexBuffer[firstIndex + i + 2]);
|
||||
}
|
||||
}
|
||||
else if (version[0] < 4 || topology == GfxPrimitiveType.TriangleStrip)
|
||||
else if (version[0] < 4 || topology == GfxPrimitiveType.kPrimitiveTriangleStrip)
|
||||
{
|
||||
// de-stripify :
|
||||
uint triIndex = 0;
|
||||
@@ -1105,7 +1100,7 @@ namespace AssetStudio
|
||||
//fix indexCount
|
||||
m_SubMesh.indexCount = triIndex;
|
||||
}
|
||||
else if (topology == GfxPrimitiveType.Quads)
|
||||
else if (topology == GfxPrimitiveType.kPrimitiveQuads)
|
||||
{
|
||||
for (int q = 0; q < indexCount; q += 4)
|
||||
{
|
||||
@@ -1198,44 +1193,44 @@ namespace AssetStudio
|
||||
{
|
||||
public enum VertexChannelFormat
|
||||
{
|
||||
Float,
|
||||
Float16,
|
||||
Color,
|
||||
Byte,
|
||||
UInt32
|
||||
kChannelFormatFloat,
|
||||
kChannelFormatFloat16,
|
||||
kChannelFormatColor,
|
||||
kChannelFormatByte,
|
||||
kChannelFormatUInt32
|
||||
}
|
||||
|
||||
public enum VertexFormat2017
|
||||
{
|
||||
Float,
|
||||
Float16,
|
||||
Color,
|
||||
UNorm8,
|
||||
SNorm8,
|
||||
UNorm16,
|
||||
SNorm16,
|
||||
UInt8,
|
||||
SInt8,
|
||||
UInt16,
|
||||
SInt16,
|
||||
UInt32,
|
||||
SInt32
|
||||
kVertexFormatFloat,
|
||||
kVertexFormatFloat16,
|
||||
kVertexFormatColor,
|
||||
kVertexFormatUNorm8,
|
||||
kVertexFormatSNorm8,
|
||||
kVertexFormatUNorm16,
|
||||
kVertexFormatSNorm16,
|
||||
kVertexFormatUInt8,
|
||||
kVertexFormatSInt8,
|
||||
kVertexFormatUInt16,
|
||||
kVertexFormatSInt16,
|
||||
kVertexFormatUInt32,
|
||||
kVertexFormatSInt32
|
||||
}
|
||||
|
||||
public enum VertexFormat
|
||||
{
|
||||
Float,
|
||||
Float16,
|
||||
UNorm8,
|
||||
SNorm8,
|
||||
UNorm16,
|
||||
SNorm16,
|
||||
UInt8,
|
||||
SInt8,
|
||||
UInt16,
|
||||
SInt16,
|
||||
UInt32,
|
||||
SInt32
|
||||
kVertexFormatFloat,
|
||||
kVertexFormatFloat16,
|
||||
kVertexFormatUNorm8,
|
||||
kVertexFormatSNorm8,
|
||||
kVertexFormatUNorm16,
|
||||
kVertexFormatSNorm16,
|
||||
kVertexFormatUInt8,
|
||||
kVertexFormatSInt8,
|
||||
kVertexFormatUInt16,
|
||||
kVertexFormatSInt16,
|
||||
kVertexFormatUInt32,
|
||||
kVertexFormatSInt32
|
||||
}
|
||||
|
||||
public static VertexFormat ToVertexFormat(int format, int[] version)
|
||||
@@ -1244,16 +1239,16 @@ namespace AssetStudio
|
||||
{
|
||||
switch ((VertexChannelFormat)format)
|
||||
{
|
||||
case VertexChannelFormat.Float:
|
||||
return VertexFormat.Float;
|
||||
case VertexChannelFormat.Float16:
|
||||
return VertexFormat.Float16;
|
||||
case VertexChannelFormat.Color: //in 4.x is size 4
|
||||
return VertexFormat.UNorm8;
|
||||
case VertexChannelFormat.Byte:
|
||||
return VertexFormat.UInt8;
|
||||
case VertexChannelFormat.UInt32: //in 5.x
|
||||
return VertexFormat.UInt32;
|
||||
case VertexChannelFormat.kChannelFormatFloat:
|
||||
return VertexFormat.kVertexFormatFloat;
|
||||
case VertexChannelFormat.kChannelFormatFloat16:
|
||||
return VertexFormat.kVertexFormatFloat16;
|
||||
case VertexChannelFormat.kChannelFormatColor: //in 4.x is size 4
|
||||
return VertexFormat.kVertexFormatUNorm8;
|
||||
case VertexChannelFormat.kChannelFormatByte:
|
||||
return VertexFormat.kVertexFormatUInt8;
|
||||
case VertexChannelFormat.kChannelFormatUInt32: //in 5.x
|
||||
return VertexFormat.kVertexFormatUInt32;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(format), format, null);
|
||||
}
|
||||
@@ -1262,31 +1257,31 @@ namespace AssetStudio
|
||||
{
|
||||
switch ((VertexFormat2017)format)
|
||||
{
|
||||
case VertexFormat2017.Float:
|
||||
return VertexFormat.Float;
|
||||
case VertexFormat2017.Float16:
|
||||
return VertexFormat.Float16;
|
||||
case VertexFormat2017.Color:
|
||||
case VertexFormat2017.UNorm8:
|
||||
return VertexFormat.UNorm8;
|
||||
case VertexFormat2017.SNorm8:
|
||||
return VertexFormat.SNorm8;
|
||||
case VertexFormat2017.UNorm16:
|
||||
return VertexFormat.UNorm16;
|
||||
case VertexFormat2017.SNorm16:
|
||||
return VertexFormat.SNorm16;
|
||||
case VertexFormat2017.UInt8:
|
||||
return VertexFormat.UInt8;
|
||||
case VertexFormat2017.SInt8:
|
||||
return VertexFormat.SInt8;
|
||||
case VertexFormat2017.UInt16:
|
||||
return VertexFormat.UInt16;
|
||||
case VertexFormat2017.SInt16:
|
||||
return VertexFormat.SInt16;
|
||||
case VertexFormat2017.UInt32:
|
||||
return VertexFormat.UInt32;
|
||||
case VertexFormat2017.SInt32:
|
||||
return VertexFormat.SInt32;
|
||||
case VertexFormat2017.kVertexFormatFloat:
|
||||
return VertexFormat.kVertexFormatFloat;
|
||||
case VertexFormat2017.kVertexFormatFloat16:
|
||||
return VertexFormat.kVertexFormatFloat16;
|
||||
case VertexFormat2017.kVertexFormatColor:
|
||||
case VertexFormat2017.kVertexFormatUNorm8:
|
||||
return VertexFormat.kVertexFormatUNorm8;
|
||||
case VertexFormat2017.kVertexFormatSNorm8:
|
||||
return VertexFormat.kVertexFormatSNorm8;
|
||||
case VertexFormat2017.kVertexFormatUNorm16:
|
||||
return VertexFormat.kVertexFormatUNorm16;
|
||||
case VertexFormat2017.kVertexFormatSNorm16:
|
||||
return VertexFormat.kVertexFormatSNorm16;
|
||||
case VertexFormat2017.kVertexFormatUInt8:
|
||||
return VertexFormat.kVertexFormatUInt8;
|
||||
case VertexFormat2017.kVertexFormatSInt8:
|
||||
return VertexFormat.kVertexFormatSInt8;
|
||||
case VertexFormat2017.kVertexFormatUInt16:
|
||||
return VertexFormat.kVertexFormatUInt16;
|
||||
case VertexFormat2017.kVertexFormatSInt16:
|
||||
return VertexFormat.kVertexFormatSInt16;
|
||||
case VertexFormat2017.kVertexFormatUInt32:
|
||||
return VertexFormat.kVertexFormatUInt32;
|
||||
case VertexFormat2017.kVertexFormatSInt32:
|
||||
return VertexFormat.kVertexFormatSInt32;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(format), format, null);
|
||||
}
|
||||
@@ -1302,20 +1297,20 @@ namespace AssetStudio
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case VertexFormat.Float:
|
||||
case VertexFormat.UInt32:
|
||||
case VertexFormat.SInt32:
|
||||
case VertexFormat.kVertexFormatFloat:
|
||||
case VertexFormat.kVertexFormatUInt32:
|
||||
case VertexFormat.kVertexFormatSInt32:
|
||||
return 4u;
|
||||
case VertexFormat.Float16:
|
||||
case VertexFormat.UNorm16:
|
||||
case VertexFormat.SNorm16:
|
||||
case VertexFormat.UInt16:
|
||||
case VertexFormat.SInt16:
|
||||
case VertexFormat.kVertexFormatFloat16:
|
||||
case VertexFormat.kVertexFormatUNorm16:
|
||||
case VertexFormat.kVertexFormatSNorm16:
|
||||
case VertexFormat.kVertexFormatUInt16:
|
||||
case VertexFormat.kVertexFormatSInt16:
|
||||
return 2u;
|
||||
case VertexFormat.UNorm8:
|
||||
case VertexFormat.SNorm8:
|
||||
case VertexFormat.UInt8:
|
||||
case VertexFormat.SInt8:
|
||||
case VertexFormat.kVertexFormatUNorm8:
|
||||
case VertexFormat.kVertexFormatSNorm8:
|
||||
case VertexFormat.kVertexFormatUInt8:
|
||||
case VertexFormat.kVertexFormatSInt8:
|
||||
return 1u;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(format), format, null);
|
||||
@@ -1324,7 +1319,7 @@ namespace AssetStudio
|
||||
|
||||
public static bool IsIntFormat(VertexFormat format)
|
||||
{
|
||||
return format >= VertexFormat.UInt8;
|
||||
return format >= VertexFormat.kVertexFormatUInt8;
|
||||
}
|
||||
|
||||
public static float[] BytesToFloatArray(byte[] inputBytes, VertexFormat format)
|
||||
@@ -1336,22 +1331,22 @@ namespace AssetStudio
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case VertexFormat.Float:
|
||||
case VertexFormat.kVertexFormatFloat:
|
||||
result[i] = BitConverter.ToSingle(inputBytes, i * 4);
|
||||
break;
|
||||
case VertexFormat.Float16:
|
||||
case VertexFormat.kVertexFormatFloat16:
|
||||
result[i] = Half.ToHalf(inputBytes, i * 2);
|
||||
break;
|
||||
case VertexFormat.UNorm8:
|
||||
case VertexFormat.kVertexFormatUNorm8:
|
||||
result[i] = inputBytes[i] / 255f;
|
||||
break;
|
||||
case VertexFormat.SNorm8:
|
||||
case VertexFormat.kVertexFormatSNorm8:
|
||||
result[i] = Math.Max((sbyte)inputBytes[i] / 127f, -1f);
|
||||
break;
|
||||
case VertexFormat.UNorm16:
|
||||
case VertexFormat.kVertexFormatUNorm16:
|
||||
result[i] = BitConverter.ToUInt16(inputBytes, i * 2) / 65535f;
|
||||
break;
|
||||
case VertexFormat.SNorm16:
|
||||
case VertexFormat.kVertexFormatSNorm16:
|
||||
result[i] = Math.Max(BitConverter.ToInt16(inputBytes, i * 2) / 32767f, -1f);
|
||||
break;
|
||||
}
|
||||
@@ -1368,16 +1363,16 @@ namespace AssetStudio
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case VertexFormat.UInt8:
|
||||
case VertexFormat.SInt8:
|
||||
case VertexFormat.kVertexFormatUInt8:
|
||||
case VertexFormat.kVertexFormatSInt8:
|
||||
result[i] = inputBytes[i];
|
||||
break;
|
||||
case VertexFormat.UInt16:
|
||||
case VertexFormat.SInt16:
|
||||
case VertexFormat.kVertexFormatUInt16:
|
||||
case VertexFormat.kVertexFormatSInt16:
|
||||
result[i] = BitConverter.ToInt16(inputBytes, i * 2);
|
||||
break;
|
||||
case VertexFormat.UInt32:
|
||||
case VertexFormat.SInt32:
|
||||
case VertexFormat.kVertexFormatUInt32:
|
||||
case VertexFormat.kVertexFormatSInt32:
|
||||
result[i] = BitConverter.ToInt32(inputBytes, i * 4);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace AssetStudio
|
||||
public PPtr(ObjectReader reader)
|
||||
{
|
||||
m_FileID = reader.ReadInt32();
|
||||
m_PathID = reader.m_Version < SerializedFileFormatVersion.Unknown_14 ? reader.ReadInt32() : reader.ReadInt64();
|
||||
m_PathID = reader.m_Version < SerializedFileFormatVersion.kUnknown_14 ? reader.ReadInt32() : reader.ReadInt64();
|
||||
assetsFile = reader.assetsFile;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,14 +56,15 @@ namespace AssetStudio
|
||||
}
|
||||
public enum TextureDimension
|
||||
{
|
||||
Unknown = -1,
|
||||
None = 0,
|
||||
Any = 1,
|
||||
Tex2D = 2,
|
||||
Tex3D = 3,
|
||||
Cube = 4,
|
||||
Tex2DArray = 5,
|
||||
CubeArray = 6
|
||||
kTexDimUnknown = -1,
|
||||
kTexDimNone = 0,
|
||||
kTexDimAny = 1,
|
||||
kTexDim2D = 2,
|
||||
kTexDim3D = 3,
|
||||
kTexDimCUBE = 4,
|
||||
kTexDim2DArray = 5,
|
||||
kTexDimCubeArray = 6,
|
||||
kTexDimForce32Bit = 2147483647
|
||||
};
|
||||
|
||||
public class SerializedTextureProperty
|
||||
@@ -80,12 +81,11 @@ namespace AssetStudio
|
||||
|
||||
public enum SerializedPropertyType
|
||||
{
|
||||
Color = 0,
|
||||
Vector = 1,
|
||||
Float = 2,
|
||||
Range = 3,
|
||||
Texture = 4,
|
||||
Int = 5
|
||||
kColor = 0,
|
||||
kVector = 1,
|
||||
kFloat = 2,
|
||||
kRange = 3,
|
||||
kTexture = 4
|
||||
};
|
||||
|
||||
public class SerializedProperty
|
||||
@@ -195,11 +195,11 @@ namespace AssetStudio
|
||||
|
||||
public enum FogMode
|
||||
{
|
||||
Unknown = -1,
|
||||
Disabled = 0,
|
||||
Linear = 1,
|
||||
Exp = 2,
|
||||
Exp2 = 3
|
||||
kFogUnknown = -1,
|
||||
kFogDisabled = 0,
|
||||
kFogLinear = 1,
|
||||
kFogExp = 2,
|
||||
kFogExp2 = 3
|
||||
};
|
||||
|
||||
public class SerializedShaderState
|
||||
@@ -428,7 +428,6 @@ namespace AssetStudio
|
||||
|
||||
if ((version[0] == 2020 && version[1] > 3) ||
|
||||
(version[0] == 2020 && version[1] == 3 && version[2] >= 2) || //2020.3.2f1 and up
|
||||
(version[0] > 2021) ||
|
||||
(version[0] == 2021 && version[1] > 1) ||
|
||||
(version[0] == 2021 && version[1] == 1 && version[2] >= 4)) //2021.1.4f1 and up
|
||||
{
|
||||
@@ -454,39 +453,38 @@ namespace AssetStudio
|
||||
|
||||
public enum ShaderGpuProgramType
|
||||
{
|
||||
Unknown = 0,
|
||||
GLLegacy = 1,
|
||||
GLES31AEP = 2,
|
||||
GLES31 = 3,
|
||||
GLES3 = 4,
|
||||
GLES = 5,
|
||||
GLCore32 = 6,
|
||||
GLCore41 = 7,
|
||||
GLCore43 = 8,
|
||||
DX9VertexSM20 = 9,
|
||||
DX9VertexSM30 = 10,
|
||||
DX9PixelSM20 = 11,
|
||||
DX9PixelSM30 = 12,
|
||||
DX10Level9Vertex = 13,
|
||||
DX10Level9Pixel = 14,
|
||||
DX11VertexSM40 = 15,
|
||||
DX11VertexSM50 = 16,
|
||||
DX11PixelSM40 = 17,
|
||||
DX11PixelSM50 = 18,
|
||||
DX11GeometrySM40 = 19,
|
||||
DX11GeometrySM50 = 20,
|
||||
DX11HullSM50 = 21,
|
||||
DX11DomainSM50 = 22,
|
||||
MetalVS = 23,
|
||||
MetalFS = 24,
|
||||
SPIRV = 25,
|
||||
ConsoleVS = 26,
|
||||
ConsoleFS = 27,
|
||||
ConsoleHS = 28,
|
||||
ConsoleDS = 29,
|
||||
ConsoleGS = 30,
|
||||
RayTracing = 31,
|
||||
PS5NGGC = 32
|
||||
kShaderGpuProgramUnknown = 0,
|
||||
kShaderGpuProgramGLLegacy = 1,
|
||||
kShaderGpuProgramGLES31AEP = 2,
|
||||
kShaderGpuProgramGLES31 = 3,
|
||||
kShaderGpuProgramGLES3 = 4,
|
||||
kShaderGpuProgramGLES = 5,
|
||||
kShaderGpuProgramGLCore32 = 6,
|
||||
kShaderGpuProgramGLCore41 = 7,
|
||||
kShaderGpuProgramGLCore43 = 8,
|
||||
kShaderGpuProgramDX9VertexSM20 = 9,
|
||||
kShaderGpuProgramDX9VertexSM30 = 10,
|
||||
kShaderGpuProgramDX9PixelSM20 = 11,
|
||||
kShaderGpuProgramDX9PixelSM30 = 12,
|
||||
kShaderGpuProgramDX10Level9Vertex = 13,
|
||||
kShaderGpuProgramDX10Level9Pixel = 14,
|
||||
kShaderGpuProgramDX11VertexSM40 = 15,
|
||||
kShaderGpuProgramDX11VertexSM50 = 16,
|
||||
kShaderGpuProgramDX11PixelSM40 = 17,
|
||||
kShaderGpuProgramDX11PixelSM50 = 18,
|
||||
kShaderGpuProgramDX11GeometrySM40 = 19,
|
||||
kShaderGpuProgramDX11GeometrySM50 = 20,
|
||||
kShaderGpuProgramDX11HullSM50 = 21,
|
||||
kShaderGpuProgramDX11DomainSM50 = 22,
|
||||
kShaderGpuProgramMetalVS = 23,
|
||||
kShaderGpuProgramMetalFS = 24,
|
||||
kShaderGpuProgramSPIRV = 25,
|
||||
kShaderGpuProgramConsoleVS = 26,
|
||||
kShaderGpuProgramConsoleFS = 27,
|
||||
kShaderGpuProgramConsoleHS = 28,
|
||||
kShaderGpuProgramConsoleDS = 29,
|
||||
kShaderGpuProgramConsoleGS = 30,
|
||||
kShaderGpuProgramRayTracing = 31,
|
||||
};
|
||||
|
||||
public class SerializedProgramParameters
|
||||
@@ -606,9 +604,8 @@ namespace AssetStudio
|
||||
|
||||
if ((version[0] == 2020 && version[1] > 3) ||
|
||||
(version[0] == 2020 && version[1] == 3 && version[2] >= 2) || //2020.3.2f1 and up
|
||||
(version[0] > 2021) ||
|
||||
(version[0] == 2021 && version[1] > 1) ||
|
||||
(version[0] == 2021 && version[1] == 1 && version[2] >= 1)) //2021.1.1f1 and up
|
||||
(version[0] == 2021 && version[1] == 1 && version[2] >= 4)) //2021.1.4f1 and up
|
||||
{
|
||||
m_Parameters = new SerializedProgramParameters(reader);
|
||||
}
|
||||
@@ -692,7 +689,6 @@ namespace AssetStudio
|
||||
{
|
||||
public SerializedSubProgram[] m_SubPrograms;
|
||||
public SerializedProgramParameters m_CommonParameters;
|
||||
public ushort[] m_SerializedKeywordStateMask;
|
||||
|
||||
public SerializedProgram(ObjectReader reader)
|
||||
{
|
||||
@@ -707,26 +703,19 @@ namespace AssetStudio
|
||||
|
||||
if ((version[0] == 2020 && version[1] > 3) ||
|
||||
(version[0] == 2020 && version[1] == 3 && version[2] >= 2) || //2020.3.2f1 and up
|
||||
(version[0] > 2021) ||
|
||||
(version[0] == 2021 && version[1] > 1) ||
|
||||
(version[0] == 2021 && version[1] == 1 && version[2] >= 1)) //2021.1.1f1 and up
|
||||
(version[0] == 2021 && version[1] == 1 && version[2] >= 4)) //2021.1.4f1 and up
|
||||
{
|
||||
m_CommonParameters = new SerializedProgramParameters(reader);
|
||||
}
|
||||
|
||||
if (version[0] > 2022 || (version[0] == 2022 && version[1] >= 1)) //2022.1 and up
|
||||
{
|
||||
m_SerializedKeywordStateMask = reader.ReadUInt16Array();
|
||||
reader.AlignStream();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum PassType
|
||||
{
|
||||
Normal = 0,
|
||||
Use = 1,
|
||||
Grab = 2
|
||||
kPassTypeNormal = 0,
|
||||
kPassTypeUse = 1,
|
||||
kPassTypeGrab = 2
|
||||
};
|
||||
|
||||
public class SerializedPass
|
||||
@@ -805,7 +794,7 @@ namespace AssetStudio
|
||||
m_Name = reader.ReadAlignedString();
|
||||
m_TextureName = reader.ReadAlignedString();
|
||||
m_Tags = new SerializedTagMap(reader);
|
||||
if (version[0] == 2021 && version[1] >= 2) //2021.2 ~2021.x
|
||||
if (version[0] > 2021 || (version[0] == 2021 && version[1] >= 2)) //2021.2 and up
|
||||
{
|
||||
m_SerializedKeywordStateMask = reader.ReadUInt16Array();
|
||||
reader.AlignStream();
|
||||
@@ -933,32 +922,32 @@ namespace AssetStudio
|
||||
|
||||
public enum ShaderCompilerPlatform
|
||||
{
|
||||
None = -1,
|
||||
GL = 0,
|
||||
D3D9 = 1,
|
||||
Xbox360 = 2,
|
||||
PS3 = 3,
|
||||
D3D11 = 4,
|
||||
GLES20 = 5,
|
||||
NaCl = 6,
|
||||
Flash = 7,
|
||||
D3D11_9x = 8,
|
||||
GLES3Plus = 9,
|
||||
PSP2 = 10,
|
||||
PS4 = 11,
|
||||
XboxOne = 12,
|
||||
PSM = 13,
|
||||
Metal = 14,
|
||||
OpenGLCore = 15,
|
||||
N3DS = 16,
|
||||
WiiU = 17,
|
||||
Vulkan = 18,
|
||||
Switch = 19,
|
||||
XboxOneD3D12 = 20,
|
||||
GameCoreXboxOne = 21,
|
||||
GameCoreScarlett = 22,
|
||||
PS5 = 23,
|
||||
PS5NGGC = 24
|
||||
kShaderCompPlatformNone = -1,
|
||||
kShaderCompPlatformGL = 0,
|
||||
kShaderCompPlatformD3D9 = 1,
|
||||
kShaderCompPlatformXbox360 = 2,
|
||||
kShaderCompPlatformPS3 = 3,
|
||||
kShaderCompPlatformD3D11 = 4,
|
||||
kShaderCompPlatformGLES20 = 5,
|
||||
kShaderCompPlatformNaCl = 6,
|
||||
kShaderCompPlatformFlash = 7,
|
||||
kShaderCompPlatformD3D11_9x = 8,
|
||||
kShaderCompPlatformGLES3Plus = 9,
|
||||
kShaderCompPlatformPSP2 = 10,
|
||||
kShaderCompPlatformPS4 = 11,
|
||||
kShaderCompPlatformXboxOne = 12,
|
||||
kShaderCompPlatformPSM = 13,
|
||||
kShaderCompPlatformMetal = 14,
|
||||
kShaderCompPlatformOpenGLCore = 15,
|
||||
kShaderCompPlatformN3DS = 16,
|
||||
kShaderCompPlatformWiiU = 17,
|
||||
kShaderCompPlatformVulkan = 18,
|
||||
kShaderCompPlatformSwitch = 19,
|
||||
kShaderCompPlatformXboxOneD3D12 = 20,
|
||||
kShaderCompPlatformGameCoreXboxOne = 21,
|
||||
kShaderCompPlatformGameCoreScarlett = 22,
|
||||
kShaderCompPlatformPS5 = 23,
|
||||
kShaderCompPlatformPS5NGGC = 24,
|
||||
};
|
||||
|
||||
public class Shader : NamedObject
|
||||
@@ -970,9 +959,9 @@ namespace AssetStudio
|
||||
//5.5 and up
|
||||
public SerializedShader m_ParsedForm;
|
||||
public ShaderCompilerPlatform[] platforms;
|
||||
public uint[][] offsets;
|
||||
public uint[][] compressedLengths;
|
||||
public uint[][] decompressedLengths;
|
||||
public uint[] offsets;
|
||||
public uint[] compressedLengths;
|
||||
public uint[] decompressedLengths;
|
||||
public byte[] compressedBlob;
|
||||
|
||||
public Shader(ObjectReader reader) : base(reader)
|
||||
@@ -983,15 +972,15 @@ namespace AssetStudio
|
||||
platforms = reader.ReadUInt32Array().Select(x => (ShaderCompilerPlatform)x).ToArray();
|
||||
if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up
|
||||
{
|
||||
offsets = reader.ReadUInt32ArrayArray();
|
||||
compressedLengths = reader.ReadUInt32ArrayArray();
|
||||
decompressedLengths = reader.ReadUInt32ArrayArray();
|
||||
offsets = reader.ReadUInt32ArrayArray().Select(x => x[0]).ToArray();
|
||||
compressedLengths = reader.ReadUInt32ArrayArray().Select(x => x[0]).ToArray();
|
||||
decompressedLengths = reader.ReadUInt32ArrayArray().Select(x => x[0]).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
offsets = reader.ReadUInt32Array().Select(x => new[] { x }).ToArray();
|
||||
compressedLengths = reader.ReadUInt32Array().Select(x => new[] { x }).ToArray();
|
||||
decompressedLengths = reader.ReadUInt32Array().Select(x => new[] { x }).ToArray();
|
||||
offsets = reader.ReadUInt32Array();
|
||||
compressedLengths = reader.ReadUInt32Array();
|
||||
decompressedLengths = reader.ReadUInt32Array();
|
||||
}
|
||||
compressedBlob = reader.ReadUInt8Array();
|
||||
reader.AlignStream();
|
||||
|
||||
@@ -18,23 +18,23 @@ namespace AssetStudio
|
||||
|
||||
public enum SpritePackingRotation
|
||||
{
|
||||
None = 0,
|
||||
FlipHorizontal = 1,
|
||||
FlipVertical = 2,
|
||||
Rotate180 = 3,
|
||||
Rotate90 = 4
|
||||
kSPRNone = 0,
|
||||
kSPRFlipHorizontal = 1,
|
||||
kSPRFlipVertical = 2,
|
||||
kSPRRotate180 = 3,
|
||||
kSPRRotate90 = 4
|
||||
};
|
||||
|
||||
public enum SpritePackingMode
|
||||
{
|
||||
Tight = 0,
|
||||
Rectangle
|
||||
kSPMTight = 0,
|
||||
kSPMRectangle
|
||||
};
|
||||
|
||||
public enum SpriteMeshType
|
||||
{
|
||||
FullRect,
|
||||
Tight
|
||||
kSpriteMeshTypeFullRect,
|
||||
kSpriteMeshTypeTight
|
||||
};
|
||||
|
||||
public class SpriteSettings
|
||||
@@ -197,7 +197,7 @@ namespace AssetStudio
|
||||
public Vector2 m_Offset;
|
||||
public Vector4 m_Border;
|
||||
public float m_PixelsToUnits;
|
||||
public Vector2 m_Pivot = new Vector2(0.5f, 0.5f);
|
||||
public Vector2 m_Pivot;
|
||||
public uint m_Extrude;
|
||||
public bool m_IsPolygon;
|
||||
public KeyValuePair<Guid, long> m_RenderDataKey;
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace AssetStudio
|
||||
{
|
||||
public PPtr<Sprite>[] m_PackedSprites;
|
||||
public Dictionary<KeyValuePair<Guid, long>, SpriteAtlasData> m_RenderDataMap;
|
||||
public bool m_IsVariant;
|
||||
|
||||
public SpriteAtlas(ObjectReader reader) : base(reader)
|
||||
{
|
||||
@@ -68,9 +67,8 @@ namespace AssetStudio
|
||||
var value = new SpriteAtlasData(reader);
|
||||
m_RenderDataMap.Add(new KeyValuePair<Guid, long>(first, second), value);
|
||||
}
|
||||
var m_Tag = reader.ReadAlignedString();
|
||||
m_IsVariant = reader.ReadBoolean();
|
||||
reader.AlignStream();
|
||||
//string m_Tag
|
||||
//bool m_IsVariant
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,13 +151,10 @@ namespace AssetStudio
|
||||
RGB24,
|
||||
RGBA32,
|
||||
ARGB32,
|
||||
ARGBFloat,
|
||||
RGB565,
|
||||
BGR24,
|
||||
R16,
|
||||
RGB565 = 7,
|
||||
R16 = 9,
|
||||
DXT1,
|
||||
DXT3,
|
||||
DXT5,
|
||||
DXT5 = 12,
|
||||
RGBA4444,
|
||||
BGRA32,
|
||||
RHalf,
|
||||
@@ -168,12 +165,11 @@ namespace AssetStudio
|
||||
RGBAFloat,
|
||||
YUY2,
|
||||
RGB9e5Float,
|
||||
RGBFloat,
|
||||
BC6H,
|
||||
BC7,
|
||||
BC4,
|
||||
BC4 = 26,
|
||||
BC5,
|
||||
DXT1Crunched,
|
||||
BC6H = 24,
|
||||
BC7,
|
||||
DXT1Crunched = 28,
|
||||
DXT5Crunched,
|
||||
PVRTC_RGB2,
|
||||
PVRTC_RGBA2,
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
using System;
|
||||
using System.Buffers.Binary;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public enum EndianType
|
||||
{
|
||||
LittleEndian,
|
||||
BigEndian
|
||||
}
|
||||
|
||||
public class EndianBinaryReader : BinaryReader
|
||||
{
|
||||
private readonly byte[] buffer;
|
||||
|
||||
public EndianType Endian;
|
||||
public EndianType endian;
|
||||
|
||||
public EndianBinaryReader(Stream stream, EndianType endian = EndianType.BigEndian) : base(stream)
|
||||
{
|
||||
Endian = endian;
|
||||
buffer = new byte[8];
|
||||
this.endian = endian;
|
||||
}
|
||||
|
||||
public long Position
|
||||
@@ -24,82 +28,88 @@ namespace AssetStudio
|
||||
|
||||
public override short ReadInt16()
|
||||
{
|
||||
if (Endian == EndianType.BigEndian)
|
||||
if (endian == EndianType.BigEndian)
|
||||
{
|
||||
Read(buffer, 0, 2);
|
||||
return BinaryPrimitives.ReadInt16BigEndian(buffer);
|
||||
var buff = ReadBytes(2);
|
||||
Array.Reverse(buff);
|
||||
return BitConverter.ToInt16(buff, 0);
|
||||
}
|
||||
return base.ReadInt16();
|
||||
}
|
||||
|
||||
public override int ReadInt32()
|
||||
{
|
||||
if (Endian == EndianType.BigEndian)
|
||||
if (endian == EndianType.BigEndian)
|
||||
{
|
||||
Read(buffer, 0, 4);
|
||||
return BinaryPrimitives.ReadInt32BigEndian(buffer);
|
||||
var buff = ReadBytes(4);
|
||||
Array.Reverse(buff);
|
||||
return BitConverter.ToInt32(buff, 0);
|
||||
}
|
||||
return base.ReadInt32();
|
||||
}
|
||||
|
||||
public override long ReadInt64()
|
||||
{
|
||||
if (Endian == EndianType.BigEndian)
|
||||
if (endian == EndianType.BigEndian)
|
||||
{
|
||||
Read(buffer, 0, 8);
|
||||
return BinaryPrimitives.ReadInt64BigEndian(buffer);
|
||||
var buff = ReadBytes(8);
|
||||
Array.Reverse(buff);
|
||||
return BitConverter.ToInt64(buff, 0);
|
||||
}
|
||||
return base.ReadInt64();
|
||||
}
|
||||
|
||||
public override ushort ReadUInt16()
|
||||
{
|
||||
if (Endian == EndianType.BigEndian)
|
||||
if (endian == EndianType.BigEndian)
|
||||
{
|
||||
Read(buffer, 0, 2);
|
||||
return BinaryPrimitives.ReadUInt16BigEndian(buffer);
|
||||
var buff = ReadBytes(2);
|
||||
Array.Reverse(buff);
|
||||
return BitConverter.ToUInt16(buff, 0);
|
||||
}
|
||||
return base.ReadUInt16();
|
||||
}
|
||||
|
||||
public override uint ReadUInt32()
|
||||
{
|
||||
if (Endian == EndianType.BigEndian)
|
||||
if (endian == EndianType.BigEndian)
|
||||
{
|
||||
Read(buffer, 0, 4);
|
||||
return BinaryPrimitives.ReadUInt32BigEndian(buffer);
|
||||
var buff = ReadBytes(4);
|
||||
Array.Reverse(buff);
|
||||
return BitConverter.ToUInt32(buff, 0);
|
||||
}
|
||||
return base.ReadUInt32();
|
||||
}
|
||||
|
||||
public override ulong ReadUInt64()
|
||||
{
|
||||
if (Endian == EndianType.BigEndian)
|
||||
if (endian == EndianType.BigEndian)
|
||||
{
|
||||
Read(buffer, 0, 8);
|
||||
return BinaryPrimitives.ReadUInt64BigEndian(buffer);
|
||||
var buff = ReadBytes(8);
|
||||
Array.Reverse(buff);
|
||||
return BitConverter.ToUInt64(buff, 0);
|
||||
}
|
||||
return base.ReadUInt64();
|
||||
}
|
||||
|
||||
public override float ReadSingle()
|
||||
{
|
||||
if (Endian == EndianType.BigEndian)
|
||||
if (endian == EndianType.BigEndian)
|
||||
{
|
||||
Read(buffer, 0, 4);
|
||||
Array.Reverse(buffer, 0, 4);
|
||||
return BitConverter.ToSingle(buffer, 0);
|
||||
var buff = ReadBytes(4);
|
||||
Array.Reverse(buff);
|
||||
return BitConverter.ToSingle(buff, 0);
|
||||
}
|
||||
return base.ReadSingle();
|
||||
}
|
||||
|
||||
public override double ReadDouble()
|
||||
{
|
||||
if (Endian == EndianType.BigEndian)
|
||||
if (endian == EndianType.BigEndian)
|
||||
{
|
||||
Read(buffer, 0, 8);
|
||||
Array.Reverse(buffer);
|
||||
return BitConverter.ToDouble(buffer, 0);
|
||||
var buff = ReadBytes(8);
|
||||
Array.Reverse(buff);
|
||||
return BitConverter.ToUInt64(buff, 0);
|
||||
}
|
||||
return base.ReadDouble();
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public enum EndianType
|
||||
{
|
||||
LittleEndian,
|
||||
BigEndian
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,6 @@ namespace AssetStudio
|
||||
|
||||
private static readonly byte[] gzipMagic = { 0x1f, 0x8b };
|
||||
private static readonly byte[] brotliMagic = { 0x62, 0x72, 0x6F, 0x74, 0x6C, 0x69 };
|
||||
private static readonly byte[] zipMagic = { 0x50, 0x4B, 0x03, 0x04 };
|
||||
private static readonly byte[] zipSpannedMagic = { 0x50, 0x4B, 0x07, 0x08 };
|
||||
|
||||
public FileReader(string path) : this(path, File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { }
|
||||
|
||||
@@ -38,7 +36,7 @@ namespace AssetStudio
|
||||
return FileType.WebFile;
|
||||
default:
|
||||
{
|
||||
byte[] magic = ReadBytes(2);
|
||||
var magic = ReadBytes(2);
|
||||
Position = 0;
|
||||
if (gzipMagic.SequenceEqual(magic))
|
||||
{
|
||||
@@ -55,11 +53,10 @@ namespace AssetStudio
|
||||
{
|
||||
return FileType.AssetsFile;
|
||||
}
|
||||
magic = ReadBytes(4);
|
||||
Position = 0;
|
||||
if (zipMagic.SequenceEqual(magic) || zipSpannedMagic.SequenceEqual(magic))
|
||||
return FileType.ZipFile;
|
||||
return FileType.ResourceFile;
|
||||
else
|
||||
{
|
||||
return FileType.ResourceFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace AssetStudio
|
||||
WebFile,
|
||||
ResourceFile,
|
||||
GZipFile,
|
||||
BrotliFile,
|
||||
ZipFile
|
||||
BrotliFile
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,28 +73,6 @@ namespace AssetStudio
|
||||
return null;
|
||||
}
|
||||
|
||||
public ImportedFrame FindRelativeFrameWithPath(string path)
|
||||
{
|
||||
var subs = path.Split(new[] { '/' }, 2);
|
||||
foreach (var child in children)
|
||||
{
|
||||
if (child.Name == subs[0])
|
||||
{
|
||||
if (subs.Length == 1)
|
||||
{
|
||||
return child;
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = child.FindRelativeFrameWithPath(subs[1]);
|
||||
if (result != null)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ImportedFrame FindFrame(string name)
|
||||
{
|
||||
if (Name == name)
|
||||
|
||||
17
AssetStudio/IProgress.cs
Normal file
17
AssetStudio/IProgress.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public interface IProgress
|
||||
{
|
||||
void Report(int value);
|
||||
}
|
||||
|
||||
public sealed class DummyProgress : IProgress
|
||||
{
|
||||
public void Report(int value) { }
|
||||
}
|
||||
}
|
||||
540
AssetStudio/Lz4DecoderStream.cs
Normal file
540
AssetStudio/Lz4DecoderStream.cs
Normal file
@@ -0,0 +1,540 @@
|
||||
#define CHECK_ARGS
|
||||
#define CHECK_EOF
|
||||
//#define LOCAL_SHADOW
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Lz4
|
||||
{
|
||||
public class Lz4DecoderStream : Stream
|
||||
{
|
||||
public Lz4DecoderStream(Stream input, long inputLength = long.MaxValue)
|
||||
{
|
||||
Reset(input, inputLength);
|
||||
}
|
||||
|
||||
private void Reset(Stream input, long inputLength = long.MaxValue)
|
||||
{
|
||||
this.inputLength = inputLength;
|
||||
this.input = input;
|
||||
|
||||
phase = DecodePhase.ReadToken;
|
||||
|
||||
decodeBufferPos = 0;
|
||||
|
||||
litLen = 0;
|
||||
matLen = 0;
|
||||
matDst = 0;
|
||||
|
||||
inBufPos = DecBufLen;
|
||||
inBufEnd = DecBufLen;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (disposing && input != null)
|
||||
{
|
||||
input.Close();
|
||||
}
|
||||
input = null;
|
||||
decodeBuffer = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
|
||||
private long inputLength;
|
||||
private Stream input;
|
||||
|
||||
//because we might not be able to match back across invocations,
|
||||
//we have to keep the last window's worth of bytes around for reuse
|
||||
//we use a circular buffer for this - every time we write into this
|
||||
//buffer, we also write the same into our output buffer
|
||||
|
||||
private const int DecBufLen = 0x10000;
|
||||
private const int DecBufMask = 0xFFFF;
|
||||
|
||||
private const int InBufLen = 128;
|
||||
|
||||
private byte[] decodeBuffer = new byte[DecBufLen + InBufLen];
|
||||
private int decodeBufferPos, inBufPos, inBufEnd;
|
||||
|
||||
//we keep track of which phase we're in so that we can jump right back
|
||||
//into the correct part of decoding
|
||||
|
||||
private DecodePhase phase;
|
||||
|
||||
private enum DecodePhase
|
||||
{
|
||||
ReadToken,
|
||||
ReadExLiteralLength,
|
||||
CopyLiteral,
|
||||
ReadOffset,
|
||||
ReadExMatchLength,
|
||||
CopyMatch,
|
||||
}
|
||||
|
||||
//state within interruptable phases and across phase boundaries is
|
||||
//kept here - again, so that we can punt out and restart freely
|
||||
|
||||
private int litLen, matLen, matDst;
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
#if CHECK_ARGS
|
||||
if (buffer == null)
|
||||
throw new ArgumentNullException("buffer");
|
||||
if (offset < 0 || count < 0 || buffer.Length - count < offset)
|
||||
throw new ArgumentOutOfRangeException();
|
||||
|
||||
if (input == null)
|
||||
throw new InvalidOperationException();
|
||||
#endif
|
||||
int nRead, nToRead = count;
|
||||
|
||||
var decBuf = decodeBuffer;
|
||||
|
||||
//the stringy gotos are obnoxious, but their purpose is to
|
||||
//make it *blindingly* obvious how the state machine transitions
|
||||
//back and forth as it reads - remember, we can yield out of
|
||||
//this routine in several places, and we must be able to re-enter
|
||||
//and pick up where we left off!
|
||||
|
||||
#if LOCAL_SHADOW
|
||||
var phase = this.phase;
|
||||
var inBufPos = this.inBufPos;
|
||||
var inBufEnd = this.inBufEnd;
|
||||
#endif
|
||||
switch (phase)
|
||||
{
|
||||
case DecodePhase.ReadToken:
|
||||
goto readToken;
|
||||
|
||||
case DecodePhase.ReadExLiteralLength:
|
||||
goto readExLiteralLength;
|
||||
|
||||
case DecodePhase.CopyLiteral:
|
||||
goto copyLiteral;
|
||||
|
||||
case DecodePhase.ReadOffset:
|
||||
goto readOffset;
|
||||
|
||||
case DecodePhase.ReadExMatchLength:
|
||||
goto readExMatchLength;
|
||||
|
||||
case DecodePhase.CopyMatch:
|
||||
goto copyMatch;
|
||||
}
|
||||
|
||||
readToken:
|
||||
int tok;
|
||||
if (inBufPos < inBufEnd)
|
||||
{
|
||||
tok = decBuf[inBufPos++];
|
||||
}
|
||||
else
|
||||
{
|
||||
#if LOCAL_SHADOW
|
||||
this.inBufPos = inBufPos;
|
||||
#endif
|
||||
|
||||
tok = ReadByteCore();
|
||||
#if LOCAL_SHADOW
|
||||
inBufPos = this.inBufPos;
|
||||
inBufEnd = this.inBufEnd;
|
||||
#endif
|
||||
#if CHECK_EOF
|
||||
if (tok == -1)
|
||||
goto finish;
|
||||
#endif
|
||||
}
|
||||
|
||||
litLen = tok >> 4;
|
||||
matLen = (tok & 0xF) + 4;
|
||||
|
||||
switch (litLen)
|
||||
{
|
||||
case 0:
|
||||
phase = DecodePhase.ReadOffset;
|
||||
goto readOffset;
|
||||
|
||||
case 0xF:
|
||||
phase = DecodePhase.ReadExLiteralLength;
|
||||
goto readExLiteralLength;
|
||||
|
||||
default:
|
||||
phase = DecodePhase.CopyLiteral;
|
||||
goto copyLiteral;
|
||||
}
|
||||
|
||||
readExLiteralLength:
|
||||
int exLitLen;
|
||||
if (inBufPos < inBufEnd)
|
||||
{
|
||||
exLitLen = decBuf[inBufPos++];
|
||||
}
|
||||
else
|
||||
{
|
||||
#if LOCAL_SHADOW
|
||||
this.inBufPos = inBufPos;
|
||||
#endif
|
||||
exLitLen = ReadByteCore();
|
||||
#if LOCAL_SHADOW
|
||||
inBufPos = this.inBufPos;
|
||||
inBufEnd = this.inBufEnd;
|
||||
#endif
|
||||
|
||||
#if CHECK_EOF
|
||||
if (exLitLen == -1)
|
||||
goto finish;
|
||||
#endif
|
||||
}
|
||||
|
||||
litLen += exLitLen;
|
||||
if (exLitLen == 255)
|
||||
goto readExLiteralLength;
|
||||
|
||||
phase = DecodePhase.CopyLiteral;
|
||||
goto copyLiteral;
|
||||
|
||||
copyLiteral:
|
||||
int nReadLit = litLen < nToRead ? litLen : nToRead;
|
||||
if (nReadLit != 0)
|
||||
{
|
||||
if (inBufPos + nReadLit <= inBufEnd)
|
||||
{
|
||||
int ofs = offset;
|
||||
|
||||
for (int c = nReadLit; c-- != 0;)
|
||||
buffer[ofs++] = decBuf[inBufPos++];
|
||||
|
||||
nRead = nReadLit;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if LOCAL_SHADOW
|
||||
this.inBufPos = inBufPos;
|
||||
#endif
|
||||
nRead = ReadCore(buffer, offset, nReadLit);
|
||||
#if LOCAL_SHADOW
|
||||
inBufPos = this.inBufPos;
|
||||
inBufEnd = this.inBufEnd;
|
||||
#endif
|
||||
#if CHECK_EOF
|
||||
if (nRead == 0)
|
||||
goto finish;
|
||||
#endif
|
||||
}
|
||||
|
||||
offset += nRead;
|
||||
nToRead -= nRead;
|
||||
|
||||
litLen -= nRead;
|
||||
|
||||
if (litLen != 0)
|
||||
goto copyLiteral;
|
||||
}
|
||||
|
||||
if (nToRead == 0)
|
||||
goto finish;
|
||||
|
||||
phase = DecodePhase.ReadOffset;
|
||||
goto readOffset;
|
||||
|
||||
readOffset:
|
||||
if (inBufPos + 1 < inBufEnd)
|
||||
{
|
||||
matDst = (decBuf[inBufPos + 1] << 8) | decBuf[inBufPos];
|
||||
inBufPos += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if LOCAL_SHADOW
|
||||
this.inBufPos = inBufPos;
|
||||
#endif
|
||||
matDst = ReadOffsetCore();
|
||||
#if LOCAL_SHADOW
|
||||
inBufPos = this.inBufPos;
|
||||
inBufEnd = this.inBufEnd;
|
||||
#endif
|
||||
#if CHECK_EOF
|
||||
if (matDst == -1)
|
||||
goto finish;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (matLen == 15 + 4)
|
||||
{
|
||||
phase = DecodePhase.ReadExMatchLength;
|
||||
goto readExMatchLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
phase = DecodePhase.CopyMatch;
|
||||
goto copyMatch;
|
||||
}
|
||||
|
||||
readExMatchLength:
|
||||
int exMatLen;
|
||||
if (inBufPos < inBufEnd)
|
||||
{
|
||||
exMatLen = decBuf[inBufPos++];
|
||||
}
|
||||
else
|
||||
{
|
||||
#if LOCAL_SHADOW
|
||||
this.inBufPos = inBufPos;
|
||||
#endif
|
||||
exMatLen = ReadByteCore();
|
||||
#if LOCAL_SHADOW
|
||||
inBufPos = this.inBufPos;
|
||||
inBufEnd = this.inBufEnd;
|
||||
#endif
|
||||
#if CHECK_EOF
|
||||
if (exMatLen == -1)
|
||||
goto finish;
|
||||
#endif
|
||||
}
|
||||
|
||||
matLen += exMatLen;
|
||||
if (exMatLen == 255)
|
||||
goto readExMatchLength;
|
||||
|
||||
phase = DecodePhase.CopyMatch;
|
||||
goto copyMatch;
|
||||
|
||||
copyMatch:
|
||||
int nCpyMat = matLen < nToRead ? matLen : nToRead;
|
||||
if (nCpyMat != 0)
|
||||
{
|
||||
nRead = count - nToRead;
|
||||
|
||||
int bufDst = matDst - nRead;
|
||||
if (bufDst > 0)
|
||||
{
|
||||
//offset is fairly far back, we need to pull from the buffer
|
||||
|
||||
int bufSrc = decodeBufferPos - bufDst;
|
||||
if (bufSrc < 0)
|
||||
bufSrc += DecBufLen;
|
||||
int bufCnt = bufDst < nCpyMat ? bufDst : nCpyMat;
|
||||
|
||||
for (int c = bufCnt; c-- != 0;)
|
||||
buffer[offset++] = decBuf[bufSrc++ & DecBufMask];
|
||||
}
|
||||
else
|
||||
{
|
||||
bufDst = 0;
|
||||
}
|
||||
|
||||
int sOfs = offset - matDst;
|
||||
for (int i = bufDst; i < nCpyMat; i++)
|
||||
buffer[offset++] = buffer[sOfs++];
|
||||
|
||||
nToRead -= nCpyMat;
|
||||
matLen -= nCpyMat;
|
||||
}
|
||||
|
||||
if (nToRead == 0)
|
||||
goto finish;
|
||||
|
||||
phase = DecodePhase.ReadToken;
|
||||
goto readToken;
|
||||
|
||||
finish:
|
||||
nRead = count - nToRead;
|
||||
|
||||
int nToBuf = nRead < DecBufLen ? nRead : DecBufLen;
|
||||
int repPos = offset - nToBuf;
|
||||
|
||||
if (nToBuf == DecBufLen)
|
||||
{
|
||||
Buffer.BlockCopy(buffer, repPos, decBuf, 0, DecBufLen);
|
||||
decodeBufferPos = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int decPos = decodeBufferPos;
|
||||
|
||||
while (nToBuf-- != 0)
|
||||
decBuf[decPos++ & DecBufMask] = buffer[repPos++];
|
||||
|
||||
decodeBufferPos = decPos & DecBufMask;
|
||||
}
|
||||
|
||||
#if LOCAL_SHADOW
|
||||
this.phase = phase;
|
||||
this.inBufPos = inBufPos;
|
||||
#endif
|
||||
return nRead;
|
||||
}
|
||||
|
||||
private int ReadByteCore()
|
||||
{
|
||||
var buf = decodeBuffer;
|
||||
|
||||
if (inBufPos == inBufEnd)
|
||||
{
|
||||
int nRead = input.Read(buf, DecBufLen,
|
||||
InBufLen < inputLength ? InBufLen : (int)inputLength);
|
||||
|
||||
#if CHECK_EOF
|
||||
if (nRead == 0)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
inputLength -= nRead;
|
||||
|
||||
inBufPos = DecBufLen;
|
||||
inBufEnd = DecBufLen + nRead;
|
||||
}
|
||||
|
||||
return buf[inBufPos++];
|
||||
}
|
||||
|
||||
private int ReadOffsetCore()
|
||||
{
|
||||
var buf = decodeBuffer;
|
||||
|
||||
if (inBufPos == inBufEnd)
|
||||
{
|
||||
int nRead = input.Read(buf, DecBufLen,
|
||||
InBufLen < inputLength ? InBufLen : (int)inputLength);
|
||||
|
||||
#if CHECK_EOF
|
||||
if (nRead == 0)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
inputLength -= nRead;
|
||||
|
||||
inBufPos = DecBufLen;
|
||||
inBufEnd = DecBufLen + nRead;
|
||||
}
|
||||
|
||||
if (inBufEnd - inBufPos == 1)
|
||||
{
|
||||
buf[DecBufLen] = buf[inBufPos];
|
||||
|
||||
int nRead = input.Read(buf, DecBufLen + 1,
|
||||
InBufLen - 1 < inputLength ? InBufLen - 1 : (int)inputLength);
|
||||
|
||||
#if CHECK_EOF
|
||||
if (nRead == 0)
|
||||
{
|
||||
inBufPos = DecBufLen;
|
||||
inBufEnd = DecBufLen + 1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
inputLength -= nRead;
|
||||
|
||||
inBufPos = DecBufLen;
|
||||
inBufEnd = DecBufLen + nRead + 1;
|
||||
}
|
||||
|
||||
int ret = (buf[inBufPos + 1] << 8) | buf[inBufPos];
|
||||
inBufPos += 2;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private int ReadCore(byte[] buffer, int offset, int count)
|
||||
{
|
||||
int nToRead = count;
|
||||
|
||||
var buf = decodeBuffer;
|
||||
int inBufLen = inBufEnd - inBufPos;
|
||||
|
||||
int fromBuf = nToRead < inBufLen ? nToRead : inBufLen;
|
||||
if (fromBuf != 0)
|
||||
{
|
||||
var bufPos = inBufPos;
|
||||
|
||||
for (int c = fromBuf; c-- != 0;)
|
||||
buffer[offset++] = buf[bufPos++];
|
||||
|
||||
inBufPos = bufPos;
|
||||
nToRead -= fromBuf;
|
||||
}
|
||||
|
||||
if (nToRead != 0)
|
||||
{
|
||||
int nRead;
|
||||
|
||||
if (nToRead >= InBufLen)
|
||||
{
|
||||
nRead = input.Read(buffer, offset,
|
||||
nToRead < inputLength ? nToRead : (int)inputLength);
|
||||
nToRead -= nRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRead = input.Read(buf, DecBufLen,
|
||||
InBufLen < inputLength ? InBufLen : (int)inputLength);
|
||||
|
||||
inBufPos = DecBufLen;
|
||||
inBufEnd = DecBufLen + nRead;
|
||||
|
||||
fromBuf = nToRead < nRead ? nToRead : nRead;
|
||||
|
||||
var bufPos = inBufPos;
|
||||
|
||||
for (int c = fromBuf; c-- != 0;)
|
||||
buffer[offset++] = buf[bufPos++];
|
||||
|
||||
inBufPos = bufPos;
|
||||
nToRead -= fromBuf;
|
||||
}
|
||||
|
||||
inputLength -= nRead;
|
||||
}
|
||||
|
||||
return count - nToRead;
|
||||
}
|
||||
|
||||
#region Stream internals
|
||||
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override bool CanSeek => false;
|
||||
|
||||
public override bool CanWrite => false;
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
public override long Length => throw new NotSupportedException();
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get => throw new NotSupportedException();
|
||||
set => throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace AssetStudio
|
||||
public int[] version => assetsFile.version;
|
||||
public BuildType buildType => assetsFile.buildType;
|
||||
|
||||
public ObjectReader(EndianBinaryReader reader, SerializedFile assetsFile, ObjectInfo objectInfo) : base(reader.BaseStream, reader.Endian)
|
||||
public ObjectReader(EndianBinaryReader reader, SerializedFile assetsFile, ObjectInfo objectInfo) : base(reader.BaseStream, reader.endian)
|
||||
{
|
||||
this.assetsFile = assetsFile;
|
||||
m_PathID = objectInfo.m_PathID;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace AssetStudio
|
||||
namespace AssetStudio
|
||||
{
|
||||
public static class Progress
|
||||
{
|
||||
public static IProgress<int> Default = new Progress<int>();
|
||||
public static IProgress Default = new DummyProgress();
|
||||
private static int preValue;
|
||||
|
||||
public static void Reset()
|
||||
|
||||
@@ -11,8 +11,6 @@ namespace AssetStudio
|
||||
private long size;
|
||||
private BinaryReader reader;
|
||||
|
||||
public int Size { get => (int)size; }
|
||||
|
||||
public ResourceReader(string path, SerializedFile assetsFile, long offset, long size)
|
||||
{
|
||||
needSearch = true;
|
||||
@@ -71,13 +69,6 @@ namespace AssetStudio
|
||||
return binaryReader.ReadBytes((int)size);
|
||||
}
|
||||
|
||||
public void GetData(byte[] buff)
|
||||
{
|
||||
var binaryReader = GetReader();
|
||||
binaryReader.BaseStream.Position = offset;
|
||||
binaryReader.Read(buff, 0, (int)size);
|
||||
}
|
||||
|
||||
public void WriteData(string path)
|
||||
{
|
||||
var binaryReader = GetReader();
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace AssetStudio
|
||||
header.m_Version = (SerializedFileFormatVersion)reader.ReadUInt32();
|
||||
header.m_DataOffset = reader.ReadUInt32();
|
||||
|
||||
if (header.m_Version >= SerializedFileFormatVersion.Unknown_9)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kUnknown_9)
|
||||
{
|
||||
header.m_Endianess = reader.ReadByte();
|
||||
header.m_Reserved = reader.ReadBytes(3);
|
||||
@@ -57,7 +57,7 @@ namespace AssetStudio
|
||||
m_FileEndianess = reader.ReadByte();
|
||||
}
|
||||
|
||||
if (header.m_Version >= SerializedFileFormatVersion.LargeFilesSupport)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kLargeFilesSupport)
|
||||
{
|
||||
header.m_MetadataSize = reader.ReadUInt32();
|
||||
header.m_FileSize = reader.ReadInt64();
|
||||
@@ -68,14 +68,14 @@ namespace AssetStudio
|
||||
// ReadMetadata
|
||||
if (m_FileEndianess == 0)
|
||||
{
|
||||
reader.Endian = EndianType.LittleEndian;
|
||||
reader.endian = EndianType.LittleEndian;
|
||||
}
|
||||
if (header.m_Version >= SerializedFileFormatVersion.Unknown_7)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kUnknown_7)
|
||||
{
|
||||
unityVersion = reader.ReadStringToNull();
|
||||
SetVersion(unityVersion);
|
||||
}
|
||||
if (header.m_Version >= SerializedFileFormatVersion.Unknown_8)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kUnknown_8)
|
||||
{
|
||||
m_TargetPlatform = (BuildTarget)reader.ReadInt32();
|
||||
if (!Enum.IsDefined(typeof(BuildTarget), m_TargetPlatform))
|
||||
@@ -83,7 +83,7 @@ namespace AssetStudio
|
||||
m_TargetPlatform = BuildTarget.UnknownPlatform;
|
||||
}
|
||||
}
|
||||
if (header.m_Version >= SerializedFileFormatVersion.HasTypeTreeHashes)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kHasTypeTreeHashes)
|
||||
{
|
||||
m_EnableTypeTree = reader.ReadBoolean();
|
||||
}
|
||||
@@ -96,7 +96,7 @@ namespace AssetStudio
|
||||
m_Types.Add(ReadSerializedType(false));
|
||||
}
|
||||
|
||||
if (header.m_Version >= SerializedFileFormatVersion.Unknown_7 && header.m_Version < SerializedFileFormatVersion.Unknown_14)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kUnknown_7 && header.m_Version < SerializedFileFormatVersion.kUnknown_14)
|
||||
{
|
||||
bigIDEnabled = reader.ReadInt32();
|
||||
}
|
||||
@@ -113,7 +113,7 @@ namespace AssetStudio
|
||||
{
|
||||
objectInfo.m_PathID = reader.ReadInt64();
|
||||
}
|
||||
else if (header.m_Version < SerializedFileFormatVersion.Unknown_14)
|
||||
else if (header.m_Version < SerializedFileFormatVersion.kUnknown_14)
|
||||
{
|
||||
objectInfo.m_PathID = reader.ReadInt32();
|
||||
}
|
||||
@@ -123,7 +123,7 @@ namespace AssetStudio
|
||||
objectInfo.m_PathID = reader.ReadInt64();
|
||||
}
|
||||
|
||||
if (header.m_Version >= SerializedFileFormatVersion.LargeFilesSupport)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kLargeFilesSupport)
|
||||
objectInfo.byteStart = reader.ReadInt64();
|
||||
else
|
||||
objectInfo.byteStart = reader.ReadUInt32();
|
||||
@@ -131,7 +131,7 @@ namespace AssetStudio
|
||||
objectInfo.byteStart += header.m_DataOffset;
|
||||
objectInfo.byteSize = reader.ReadUInt32();
|
||||
objectInfo.typeID = reader.ReadInt32();
|
||||
if (header.m_Version < SerializedFileFormatVersion.RefactoredClassId)
|
||||
if (header.m_Version < SerializedFileFormatVersion.kRefactoredClassId)
|
||||
{
|
||||
objectInfo.classID = reader.ReadUInt16();
|
||||
objectInfo.serializedType = m_Types.Find(x => x.classID == objectInfo.typeID);
|
||||
@@ -142,24 +142,24 @@ namespace AssetStudio
|
||||
objectInfo.serializedType = type;
|
||||
objectInfo.classID = type.classID;
|
||||
}
|
||||
if (header.m_Version < SerializedFileFormatVersion.HasScriptTypeIndex)
|
||||
if (header.m_Version < SerializedFileFormatVersion.kHasScriptTypeIndex)
|
||||
{
|
||||
objectInfo.isDestroyed = reader.ReadUInt16();
|
||||
}
|
||||
if (header.m_Version >= SerializedFileFormatVersion.HasScriptTypeIndex && header.m_Version < SerializedFileFormatVersion.RefactorTypeData)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kHasScriptTypeIndex && header.m_Version < SerializedFileFormatVersion.kRefactorTypeData)
|
||||
{
|
||||
var m_ScriptTypeIndex = reader.ReadInt16();
|
||||
if (objectInfo.serializedType != null)
|
||||
objectInfo.serializedType.m_ScriptTypeIndex = m_ScriptTypeIndex;
|
||||
}
|
||||
if (header.m_Version == SerializedFileFormatVersion.SupportsStrippedObject || header.m_Version == SerializedFileFormatVersion.RefactoredClassId)
|
||||
if (header.m_Version == SerializedFileFormatVersion.kSupportsStrippedObject || header.m_Version == SerializedFileFormatVersion.kRefactoredClassId)
|
||||
{
|
||||
objectInfo.stripped = reader.ReadByte();
|
||||
}
|
||||
m_Objects.Add(objectInfo);
|
||||
}
|
||||
|
||||
if (header.m_Version >= SerializedFileFormatVersion.HasScriptTypeIndex)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kHasScriptTypeIndex)
|
||||
{
|
||||
int scriptCount = reader.ReadInt32();
|
||||
m_ScriptTypes = new List<LocalSerializedObjectIdentifier>(scriptCount);
|
||||
@@ -167,7 +167,7 @@ namespace AssetStudio
|
||||
{
|
||||
var m_ScriptType = new LocalSerializedObjectIdentifier();
|
||||
m_ScriptType.localSerializedFileIndex = reader.ReadInt32();
|
||||
if (header.m_Version < SerializedFileFormatVersion.Unknown_14)
|
||||
if (header.m_Version < SerializedFileFormatVersion.kUnknown_14)
|
||||
{
|
||||
m_ScriptType.localIdentifierInFile = reader.ReadInt32();
|
||||
}
|
||||
@@ -185,11 +185,11 @@ namespace AssetStudio
|
||||
for (int i = 0; i < externalsCount; i++)
|
||||
{
|
||||
var m_External = new FileIdentifier();
|
||||
if (header.m_Version >= SerializedFileFormatVersion.Unknown_6)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kUnknown_6)
|
||||
{
|
||||
var tempEmpty = reader.ReadStringToNull();
|
||||
}
|
||||
if (header.m_Version >= SerializedFileFormatVersion.Unknown_5)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kUnknown_5)
|
||||
{
|
||||
m_External.guid = new Guid(reader.ReadBytes(16));
|
||||
m_External.type = reader.ReadInt32();
|
||||
@@ -199,7 +199,7 @@ namespace AssetStudio
|
||||
m_Externals.Add(m_External);
|
||||
}
|
||||
|
||||
if (header.m_Version >= SerializedFileFormatVersion.SupportsRefObject)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kSupportsRefObject)
|
||||
{
|
||||
int refTypesCount = reader.ReadInt32();
|
||||
m_RefTypes = new List<SerializedType>(refTypesCount);
|
||||
@@ -209,7 +209,7 @@ namespace AssetStudio
|
||||
}
|
||||
}
|
||||
|
||||
if (header.m_Version >= SerializedFileFormatVersion.Unknown_5)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kUnknown_5)
|
||||
{
|
||||
userInformation = reader.ReadStringToNull();
|
||||
}
|
||||
@@ -235,23 +235,23 @@ namespace AssetStudio
|
||||
|
||||
type.classID = reader.ReadInt32();
|
||||
|
||||
if (header.m_Version >= SerializedFileFormatVersion.RefactoredClassId)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kRefactoredClassId)
|
||||
{
|
||||
type.m_IsStrippedType = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
if (header.m_Version >= SerializedFileFormatVersion.RefactorTypeData)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kRefactorTypeData)
|
||||
{
|
||||
type.m_ScriptTypeIndex = reader.ReadInt16();
|
||||
}
|
||||
|
||||
if (header.m_Version >= SerializedFileFormatVersion.HasTypeTreeHashes)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kHasTypeTreeHashes)
|
||||
{
|
||||
if (isRefType && type.m_ScriptTypeIndex >= 0)
|
||||
{
|
||||
type.m_ScriptID = reader.ReadBytes(16);
|
||||
}
|
||||
else if ((header.m_Version < SerializedFileFormatVersion.RefactoredClassId && type.classID < 0) || (header.m_Version >= SerializedFileFormatVersion.RefactoredClassId && type.classID == 114))
|
||||
else if ((header.m_Version < SerializedFileFormatVersion.kRefactoredClassId && type.classID < 0) || (header.m_Version >= SerializedFileFormatVersion.kRefactoredClassId && type.classID == 114))
|
||||
{
|
||||
type.m_ScriptID = reader.ReadBytes(16);
|
||||
}
|
||||
@@ -262,7 +262,7 @@ namespace AssetStudio
|
||||
{
|
||||
type.m_Type = new TypeTree();
|
||||
type.m_Type.m_Nodes = new List<TypeTreeNode>();
|
||||
if (header.m_Version >= SerializedFileFormatVersion.Unknown_12 || header.m_Version == SerializedFileFormatVersion.Unknown_10)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kUnknown_12 || header.m_Version == SerializedFileFormatVersion.kUnknown_10)
|
||||
{
|
||||
TypeTreeBlobRead(type.m_Type);
|
||||
}
|
||||
@@ -270,7 +270,7 @@ namespace AssetStudio
|
||||
{
|
||||
ReadTypeTree(type.m_Type);
|
||||
}
|
||||
if (header.m_Version >= SerializedFileFormatVersion.StoresTypeDependencies)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kStoresTypeDependencies)
|
||||
{
|
||||
if (isRefType)
|
||||
{
|
||||
@@ -296,17 +296,17 @@ namespace AssetStudio
|
||||
typeTreeNode.m_Type = reader.ReadStringToNull();
|
||||
typeTreeNode.m_Name = reader.ReadStringToNull();
|
||||
typeTreeNode.m_ByteSize = reader.ReadInt32();
|
||||
if (header.m_Version == SerializedFileFormatVersion.Unknown_2)
|
||||
if (header.m_Version == SerializedFileFormatVersion.kUnknown_2)
|
||||
{
|
||||
var variableCount = reader.ReadInt32();
|
||||
}
|
||||
if (header.m_Version != SerializedFileFormatVersion.Unknown_3)
|
||||
if (header.m_Version != SerializedFileFormatVersion.kUnknown_3)
|
||||
{
|
||||
typeTreeNode.m_Index = reader.ReadInt32();
|
||||
}
|
||||
typeTreeNode.m_TypeFlags = reader.ReadInt32();
|
||||
typeTreeNode.m_Version = reader.ReadInt32();
|
||||
if (header.m_Version != SerializedFileFormatVersion.Unknown_3)
|
||||
if (header.m_Version != SerializedFileFormatVersion.kUnknown_3)
|
||||
{
|
||||
typeTreeNode.m_MetaFlag = reader.ReadInt32();
|
||||
}
|
||||
@@ -334,7 +334,7 @@ namespace AssetStudio
|
||||
typeTreeNode.m_ByteSize = reader.ReadInt32();
|
||||
typeTreeNode.m_Index = reader.ReadInt32();
|
||||
typeTreeNode.m_MetaFlag = reader.ReadInt32();
|
||||
if (header.m_Version >= SerializedFileFormatVersion.TypeTreeNodeWithTypeFlags)
|
||||
if (header.m_Version >= SerializedFileFormatVersion.kTypeTreeNodeWithTypeFlags)
|
||||
{
|
||||
typeTreeNode.m_RefTypeHash = reader.ReadUInt64();
|
||||
}
|
||||
|
||||
@@ -8,80 +8,80 @@ namespace AssetStudio
|
||||
{
|
||||
public enum SerializedFileFormatVersion
|
||||
{
|
||||
Unsupported = 1,
|
||||
Unknown_2 = 2,
|
||||
Unknown_3 = 3,
|
||||
kUnsupported = 1,
|
||||
kUnknown_2 = 2,
|
||||
kUnknown_3 = 3,
|
||||
/// <summary>
|
||||
/// 1.2.0 to 2.0.0
|
||||
/// </summary>
|
||||
Unknown_5 = 5,
|
||||
kUnknown_5 = 5,
|
||||
/// <summary>
|
||||
/// 2.1.0 to 2.6.1
|
||||
/// </summary>
|
||||
Unknown_6 = 6,
|
||||
kUnknown_6 = 6,
|
||||
/// <summary>
|
||||
/// 3.0.0b
|
||||
/// </summary>
|
||||
Unknown_7 = 7,
|
||||
kUnknown_7 = 7,
|
||||
/// <summary>
|
||||
/// 3.0.0 to 3.4.2
|
||||
/// </summary>
|
||||
Unknown_8 = 8,
|
||||
kUnknown_8 = 8,
|
||||
/// <summary>
|
||||
/// 3.5.0 to 4.7.2
|
||||
/// </summary>
|
||||
Unknown_9 = 9,
|
||||
kUnknown_9 = 9,
|
||||
/// <summary>
|
||||
/// 5.0.0aunk1
|
||||
/// </summary>
|
||||
Unknown_10 = 10,
|
||||
kUnknown_10 = 10,
|
||||
/// <summary>
|
||||
/// 5.0.0aunk2
|
||||
/// </summary>
|
||||
HasScriptTypeIndex = 11,
|
||||
kHasScriptTypeIndex = 11,
|
||||
/// <summary>
|
||||
/// 5.0.0aunk3
|
||||
/// </summary>
|
||||
Unknown_12 = 12,
|
||||
kUnknown_12 = 12,
|
||||
/// <summary>
|
||||
/// 5.0.0aunk4
|
||||
/// </summary>
|
||||
HasTypeTreeHashes = 13,
|
||||
kHasTypeTreeHashes = 13,
|
||||
/// <summary>
|
||||
/// 5.0.0unk
|
||||
/// </summary>
|
||||
Unknown_14 = 14,
|
||||
kUnknown_14 = 14,
|
||||
/// <summary>
|
||||
/// 5.0.1 to 5.4.0
|
||||
/// </summary>
|
||||
SupportsStrippedObject = 15,
|
||||
kSupportsStrippedObject = 15,
|
||||
/// <summary>
|
||||
/// 5.5.0a
|
||||
/// </summary>
|
||||
RefactoredClassId = 16,
|
||||
kRefactoredClassId = 16,
|
||||
/// <summary>
|
||||
/// 5.5.0unk to 2018.4
|
||||
/// </summary>
|
||||
RefactorTypeData = 17,
|
||||
kRefactorTypeData = 17,
|
||||
/// <summary>
|
||||
/// 2019.1a
|
||||
/// </summary>
|
||||
RefactorShareableTypeTreeData = 18,
|
||||
kRefactorShareableTypeTreeData = 18,
|
||||
/// <summary>
|
||||
/// 2019.1unk
|
||||
/// </summary>
|
||||
TypeTreeNodeWithTypeFlags = 19,
|
||||
kTypeTreeNodeWithTypeFlags = 19,
|
||||
/// <summary>
|
||||
/// 2019.2
|
||||
/// </summary>
|
||||
SupportsRefObject = 20,
|
||||
kSupportsRefObject = 20,
|
||||
/// <summary>
|
||||
/// 2019.3 to 2019.4
|
||||
/// </summary>
|
||||
StoresTypeDependencies = 21,
|
||||
kStoresTypeDependencies = 21,
|
||||
/// <summary>
|
||||
/// 2020.1 to x
|
||||
/// </summary>
|
||||
LargeFilesSupport = 22
|
||||
kLargeFilesSupport = 22
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
@@ -40,10 +39,8 @@ namespace AssetStudio
|
||||
value = reader.ReadSByte();
|
||||
break;
|
||||
case "UInt8":
|
||||
value = reader.ReadByte();
|
||||
break;
|
||||
case "char":
|
||||
value = BitConverter.ToChar(reader.ReadBytes(2), 0);
|
||||
value = reader.ReadByte();
|
||||
break;
|
||||
case "short":
|
||||
case "SInt16":
|
||||
@@ -84,8 +81,7 @@ namespace AssetStudio
|
||||
append = false;
|
||||
var str = reader.ReadAlignedString();
|
||||
sb.AppendFormat("{0}{1} {2} = \"{3}\"\r\n", (new string('\t', level)), varTypeStr, varNameStr, str);
|
||||
var toSkip = GetNodes(m_Nodes, i);
|
||||
i += toSkip.Count - 1;
|
||||
i += 3;
|
||||
break;
|
||||
case "map":
|
||||
{
|
||||
@@ -194,10 +190,8 @@ namespace AssetStudio
|
||||
value = reader.ReadSByte();
|
||||
break;
|
||||
case "UInt8":
|
||||
value = reader.ReadByte();
|
||||
break;
|
||||
case "char":
|
||||
value = BitConverter.ToChar(reader.ReadBytes(2), 0);
|
||||
value = reader.ReadByte();
|
||||
break;
|
||||
case "short":
|
||||
case "SInt16":
|
||||
@@ -236,8 +230,7 @@ namespace AssetStudio
|
||||
break;
|
||||
case "string":
|
||||
value = reader.ReadAlignedString();
|
||||
var toSkip = GetNodes(m_Nodes, i);
|
||||
i += toSkip.Count - 1;
|
||||
i += 3;
|
||||
break;
|
||||
case "map":
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace AssetStudio
|
||||
|
||||
public WebFile(EndianBinaryReader reader)
|
||||
{
|
||||
reader.Endian = EndianType.LittleEndian;
|
||||
reader.endian = EndianType.LittleEndian;
|
||||
var signature = reader.ReadStringToNull();
|
||||
var headLength = reader.ReadInt32();
|
||||
var dataList = new List<WebData>();
|
||||
|
||||
@@ -29,26 +29,26 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@@ -100,14 +100,14 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_AS_DLL;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.0.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libfbxsdk-mt.lib;libxml2-mt.lib;zlib-mt.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\lib\vs2019\x86\debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.0.1\lib\vs2017\x86\debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -119,8 +119,9 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_AS_DLL;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.0.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -128,7 +129,7 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libfbxsdk-mt.lib;libxml2-mt.lib;zlib-mt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\lib\vs2019\x86\release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.0.1\lib\vs2017\x86\release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
@@ -137,14 +138,14 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_AS_DLL;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.0.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libfbxsdk-mt.lib;libxml2-mt.lib;zlib-mt.lib;wininet.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\lib\vs2019\x64\debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.0.1\lib\vs2017\x64\debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -156,8 +157,9 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_AS_DLL;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.0.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -165,7 +167,7 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libfbxsdk-mt.lib;libxml2-mt.lib;zlib-mt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.2.1\lib\vs2019\x64\release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>C:\Program Files\Autodesk\FBX\FBX SDK\2020.0.1\lib\vs2017\x64\release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net472;netstandard2.0;net5.0;net6.0</TargetFrameworks>
|
||||
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Version>0.16.0.0</Version>
|
||||
<AssemblyVersion>0.16.0.0</AssemblyVersion>
|
||||
<FileVersion>0.16.0.0</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2018-2022; Copyright © hozuki 2020</Copyright>
|
||||
<DebugType>embedded</DebugType>
|
||||
<Version>0.16.8.1</Version>
|
||||
<AssemblyVersion>0.16.8.1</AssemblyVersion>
|
||||
<FileVersion>0.16.8.1</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2018-2021; Copyright © hozuki 2020</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net472|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2,14 +2,19 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFrameworks>net472;net5.0-windows;net6.0-windows</TargetFrameworks>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ApplicationIcon>Resources\as.ico</ApplicationIcon>
|
||||
<Version>0.16.0.0</Version>
|
||||
<AssemblyVersion>0.16.0.0</AssemblyVersion>
|
||||
<FileVersion>0.16.0.0</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2018-2022</Copyright>
|
||||
<DebugType>embedded</DebugType>
|
||||
<AssemblyTitle>AssetStudio Mod by VaDiM</AssemblyTitle>
|
||||
<Version>0.16.8.1</Version>
|
||||
<AssemblyVersion>0.16.8.1</AssemblyVersion>
|
||||
<FileVersion>0.16.8.1</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2018-2021</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -52,33 +57,16 @@
|
||||
</ContentWithTargetPath>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' != 'net472' ">
|
||||
<PackageReference Include="OpenTK" Version="4.6.7" />
|
||||
<Reference Include="OpenTK.WinForms">
|
||||
<HintPath>Libraries\OpenTK.WinForms.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="OpenTK" Version="3.1.0" />
|
||||
<PackageReference Include="OpenTK.GLControl" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyExtraFiles" AfterTargets="AfterBuild">
|
||||
<Target Name="CustomAfterBuild" AfterTargets="AfterBuild">
|
||||
<Copy SourceFiles="$(SolutionDir)AssetStudioFBXNative\bin\Win32\$(Configuration)\AssetStudioFBXNative.dll" DestinationFolder="$(TargetDir)x86" ContinueOnError="true" />
|
||||
<Copy SourceFiles="$(SolutionDir)AssetStudioFBXNative\bin\x64\$(Configuration)\AssetStudioFBXNative.dll" DestinationFolder="$(TargetDir)x64" ContinueOnError="true" />
|
||||
<Copy SourceFiles="$(SolutionDir)Texture2DDecoderNative\bin\Win32\$(Configuration)\Texture2DDecoderNative.dll" DestinationFolder="$(TargetDir)x86" ContinueOnError="true" />
|
||||
<Copy SourceFiles="$(SolutionDir)Texture2DDecoderNative\bin\x64\$(Configuration)\Texture2DDecoderNative.dll" DestinationFolder="$(TargetDir)x64" ContinueOnError="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PublishExtraFiles" AfterTargets="Publish">
|
||||
<Copy SourceFiles="$(TargetDir)x86\AssetStudioFBXNative.dll" DestinationFolder="$(PublishDir)x86" ContinueOnError="true" />
|
||||
<Copy SourceFiles="$(TargetDir)x64\AssetStudioFBXNative.dll" DestinationFolder="$(PublishDir)x64" ContinueOnError="true" />
|
||||
<Copy SourceFiles="$(TargetDir)x86\Texture2DDecoderNative.dll" DestinationFolder="$(PublishDir)x86" ContinueOnError="true" />
|
||||
<Copy SourceFiles="$(TargetDir)x64\Texture2DDecoderNative.dll" DestinationFolder="$(PublishDir)x64" ContinueOnError="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
219
AssetStudioGUI/AssetStudioGUIForm.Designer.cs
generated
219
AssetStudioGUI/AssetStudioGUIForm.Designer.cs
generated
@@ -124,6 +124,7 @@
|
||||
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exportSelectedAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exportAnimatorwithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.dumpSelectedAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.goToSceneHierarchyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
@@ -158,7 +159,7 @@
|
||||
this.debugMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(1264, 25);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(1264, 24);
|
||||
this.menuStrip1.TabIndex = 0;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
@@ -171,39 +172,39 @@
|
||||
this.extractFileToolStripMenuItem,
|
||||
this.extractFolderToolStripMenuItem});
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(39, 21);
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "File";
|
||||
//
|
||||
// loadFileToolStripMenuItem
|
||||
//
|
||||
this.loadFileToolStripMenuItem.Name = "loadFileToolStripMenuItem";
|
||||
this.loadFileToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
||||
this.loadFileToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.loadFileToolStripMenuItem.Text = "Load file";
|
||||
this.loadFileToolStripMenuItem.Click += new System.EventHandler(this.loadFile_Click);
|
||||
//
|
||||
// loadFolderToolStripMenuItem
|
||||
//
|
||||
this.loadFolderToolStripMenuItem.Name = "loadFolderToolStripMenuItem";
|
||||
this.loadFolderToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
||||
this.loadFolderToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.loadFolderToolStripMenuItem.Text = "Load folder";
|
||||
this.loadFolderToolStripMenuItem.Click += new System.EventHandler(this.loadFolder_Click);
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(151, 6);
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(141, 6);
|
||||
//
|
||||
// extractFileToolStripMenuItem
|
||||
//
|
||||
this.extractFileToolStripMenuItem.Name = "extractFileToolStripMenuItem";
|
||||
this.extractFileToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
||||
this.extractFileToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.extractFileToolStripMenuItem.Text = "Extract file";
|
||||
this.extractFileToolStripMenuItem.Click += new System.EventHandler(this.extractFileToolStripMenuItem_Click);
|
||||
//
|
||||
// extractFolderToolStripMenuItem
|
||||
//
|
||||
this.extractFolderToolStripMenuItem.Name = "extractFolderToolStripMenuItem";
|
||||
this.extractFolderToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
||||
this.extractFolderToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.extractFolderToolStripMenuItem.Text = "Extract folder";
|
||||
this.extractFolderToolStripMenuItem.Click += new System.EventHandler(this.extractFolderToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -216,14 +217,14 @@
|
||||
this.toolStripMenuItem14,
|
||||
this.showExpOpt});
|
||||
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21);
|
||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||
this.optionsToolStripMenuItem.Text = "Options";
|
||||
//
|
||||
// displayAll
|
||||
//
|
||||
this.displayAll.CheckOnClick = true;
|
||||
this.displayAll.Name = "displayAll";
|
||||
this.displayAll.Size = new System.Drawing.Size(223, 22);
|
||||
this.displayAll.Size = new System.Drawing.Size(207, 22);
|
||||
this.displayAll.Text = "Display all assets";
|
||||
this.displayAll.ToolTipText = "Check this option will display all types assets. Not extractable assets can expor" +
|
||||
"t the RAW file.";
|
||||
@@ -235,7 +236,7 @@
|
||||
this.enablePreview.CheckOnClick = true;
|
||||
this.enablePreview.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.enablePreview.Name = "enablePreview";
|
||||
this.enablePreview.Size = new System.Drawing.Size(223, 22);
|
||||
this.enablePreview.Size = new System.Drawing.Size(207, 22);
|
||||
this.enablePreview.Text = "Enable preview";
|
||||
this.enablePreview.ToolTipText = "Toggle the loading and preview of readable assets, such as images, sounds, text, " +
|
||||
"etc.\r\nDisable preview if you have performance or compatibility issues.";
|
||||
@@ -247,7 +248,7 @@
|
||||
this.displayInfo.CheckOnClick = true;
|
||||
this.displayInfo.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.displayInfo.Name = "displayInfo";
|
||||
this.displayInfo.Size = new System.Drawing.Size(223, 22);
|
||||
this.displayInfo.Size = new System.Drawing.Size(207, 22);
|
||||
this.displayInfo.Text = "Display asset infromation";
|
||||
this.displayInfo.ToolTipText = "Toggle the overlay that shows information about each asset, eg. image size, forma" +
|
||||
"t, audio bitrate, etc.";
|
||||
@@ -258,7 +259,7 @@
|
||||
this.toolStripMenuItem14.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.specifyUnityVersion});
|
||||
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
|
||||
this.toolStripMenuItem14.Size = new System.Drawing.Size(223, 22);
|
||||
this.toolStripMenuItem14.Size = new System.Drawing.Size(207, 22);
|
||||
this.toolStripMenuItem14.Text = "Specify Unity version";
|
||||
//
|
||||
// specifyUnityVersion
|
||||
@@ -270,7 +271,7 @@
|
||||
// showExpOpt
|
||||
//
|
||||
this.showExpOpt.Name = "showExpOpt";
|
||||
this.showExpOpt.Size = new System.Drawing.Size(223, 22);
|
||||
this.showExpOpt.Size = new System.Drawing.Size(207, 22);
|
||||
this.showExpOpt.Text = "Export options";
|
||||
this.showExpOpt.Click += new System.EventHandler(this.showExpOpt_Click);
|
||||
//
|
||||
@@ -284,46 +285,46 @@
|
||||
this.exportSelectedObjectsmergeToolStripMenuItem,
|
||||
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem});
|
||||
this.modelToolStripMenuItem.Name = "modelToolStripMenuItem";
|
||||
this.modelToolStripMenuItem.Size = new System.Drawing.Size(58, 21);
|
||||
this.modelToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
|
||||
this.modelToolStripMenuItem.Text = "Model";
|
||||
//
|
||||
// exportAllObjectssplitToolStripMenuItem1
|
||||
//
|
||||
this.exportAllObjectssplitToolStripMenuItem1.Name = "exportAllObjectssplitToolStripMenuItem1";
|
||||
this.exportAllObjectssplitToolStripMenuItem1.Size = new System.Drawing.Size(417, 22);
|
||||
this.exportAllObjectssplitToolStripMenuItem1.Size = new System.Drawing.Size(382, 22);
|
||||
this.exportAllObjectssplitToolStripMenuItem1.Text = "Export all objects (split)";
|
||||
this.exportAllObjectssplitToolStripMenuItem1.Click += new System.EventHandler(this.exportAllObjectssplitToolStripMenuItem1_Click);
|
||||
//
|
||||
// exportSelectedObjectsToolStripMenuItem
|
||||
//
|
||||
this.exportSelectedObjectsToolStripMenuItem.Name = "exportSelectedObjectsToolStripMenuItem";
|
||||
this.exportSelectedObjectsToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
|
||||
this.exportSelectedObjectsToolStripMenuItem.Size = new System.Drawing.Size(382, 22);
|
||||
this.exportSelectedObjectsToolStripMenuItem.Text = "Export selected objects (split)";
|
||||
this.exportSelectedObjectsToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsToolStripMenuItem_Click);
|
||||
//
|
||||
// exportSelectedObjectsWithAnimationClipToolStripMenuItem
|
||||
//
|
||||
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Name = "exportSelectedObjectsWithAnimationClipToolStripMenuItem";
|
||||
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
|
||||
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(382, 22);
|
||||
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Text = "Export selected objects (split) + selected AnimationClips";
|
||||
this.exportSelectedObjectsWithAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportObjectswithAnimationClipMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(414, 6);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(379, 6);
|
||||
//
|
||||
// exportSelectedObjectsmergeToolStripMenuItem
|
||||
//
|
||||
this.exportSelectedObjectsmergeToolStripMenuItem.Name = "exportSelectedObjectsmergeToolStripMenuItem";
|
||||
this.exportSelectedObjectsmergeToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
|
||||
this.exportSelectedObjectsmergeToolStripMenuItem.Size = new System.Drawing.Size(382, 22);
|
||||
this.exportSelectedObjectsmergeToolStripMenuItem.Text = "Export selected objects (merge)";
|
||||
this.exportSelectedObjectsmergeToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsmergeToolStripMenuItem_Click);
|
||||
//
|
||||
// exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem
|
||||
//
|
||||
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Name = "exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem";
|
||||
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(417, 22);
|
||||
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(382, 22);
|
||||
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Text = "Export selected objects (merge) + selected AnimationClips";
|
||||
this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedObjectsmergeWithAnimationClipToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -341,46 +342,46 @@
|
||||
this.toolStripSeparator2,
|
||||
this.toolStripMenuItem10});
|
||||
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
|
||||
this.exportToolStripMenuItem.Size = new System.Drawing.Size(58, 21);
|
||||
this.exportToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
|
||||
this.exportToolStripMenuItem.Text = "Export";
|
||||
//
|
||||
// exportAllAssetsMenuItem
|
||||
//
|
||||
this.exportAllAssetsMenuItem.Name = "exportAllAssetsMenuItem";
|
||||
this.exportAllAssetsMenuItem.Size = new System.Drawing.Size(284, 22);
|
||||
this.exportAllAssetsMenuItem.Size = new System.Drawing.Size(266, 22);
|
||||
this.exportAllAssetsMenuItem.Text = "All assets";
|
||||
this.exportAllAssetsMenuItem.Click += new System.EventHandler(this.exportAllAssetsMenuItem_Click);
|
||||
//
|
||||
// exportSelectedAssetsMenuItem
|
||||
//
|
||||
this.exportSelectedAssetsMenuItem.Name = "exportSelectedAssetsMenuItem";
|
||||
this.exportSelectedAssetsMenuItem.Size = new System.Drawing.Size(284, 22);
|
||||
this.exportSelectedAssetsMenuItem.Size = new System.Drawing.Size(266, 22);
|
||||
this.exportSelectedAssetsMenuItem.Text = "Selected assets";
|
||||
this.exportSelectedAssetsMenuItem.Click += new System.EventHandler(this.exportSelectedAssetsMenuItem_Click);
|
||||
//
|
||||
// exportFilteredAssetsMenuItem
|
||||
//
|
||||
this.exportFilteredAssetsMenuItem.Name = "exportFilteredAssetsMenuItem";
|
||||
this.exportFilteredAssetsMenuItem.Size = new System.Drawing.Size(284, 22);
|
||||
this.exportFilteredAssetsMenuItem.Size = new System.Drawing.Size(266, 22);
|
||||
this.exportFilteredAssetsMenuItem.Text = "Filtered assets";
|
||||
this.exportFilteredAssetsMenuItem.Click += new System.EventHandler(this.exportFilteredAssetsMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(281, 6);
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(263, 6);
|
||||
//
|
||||
// exportAnimatorWithSelectedAnimationClipToolStripMenuItem
|
||||
//
|
||||
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Name = "exportAnimatorWithSelectedAnimationClipToolStripMenuItem";
|
||||
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(284, 22);
|
||||
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Size = new System.Drawing.Size(266, 22);
|
||||
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Text = "Animator + selected AnimationClips";
|
||||
this.exportAnimatorWithSelectedAnimationClipToolStripMenuItem.Click += new System.EventHandler(this.exportAnimatorwithAnimationClipMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator4
|
||||
//
|
||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(281, 6);
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(263, 6);
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
@@ -389,27 +390,27 @@
|
||||
this.toolStripMenuItem5,
|
||||
this.toolStripMenuItem6});
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(284, 22);
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(266, 22);
|
||||
this.toolStripMenuItem2.Text = "Raw";
|
||||
//
|
||||
// toolStripMenuItem4
|
||||
//
|
||||
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
|
||||
this.toolStripMenuItem4.Size = new System.Drawing.Size(165, 22);
|
||||
this.toolStripMenuItem4.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem4.Text = "All assets";
|
||||
this.toolStripMenuItem4.Click += new System.EventHandler(this.toolStripMenuItem4_Click);
|
||||
//
|
||||
// toolStripMenuItem5
|
||||
//
|
||||
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
|
||||
this.toolStripMenuItem5.Size = new System.Drawing.Size(165, 22);
|
||||
this.toolStripMenuItem5.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem5.Text = "Selected assets";
|
||||
this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click);
|
||||
//
|
||||
// toolStripMenuItem6
|
||||
//
|
||||
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
|
||||
this.toolStripMenuItem6.Size = new System.Drawing.Size(165, 22);
|
||||
this.toolStripMenuItem6.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem6.Text = "Filtered assets";
|
||||
this.toolStripMenuItem6.Click += new System.EventHandler(this.toolStripMenuItem6_Click);
|
||||
//
|
||||
@@ -420,34 +421,34 @@
|
||||
this.toolStripMenuItem8,
|
||||
this.toolStripMenuItem9});
|
||||
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
|
||||
this.toolStripMenuItem3.Size = new System.Drawing.Size(284, 22);
|
||||
this.toolStripMenuItem3.Size = new System.Drawing.Size(266, 22);
|
||||
this.toolStripMenuItem3.Text = "Dump";
|
||||
//
|
||||
// toolStripMenuItem7
|
||||
//
|
||||
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
|
||||
this.toolStripMenuItem7.Size = new System.Drawing.Size(165, 22);
|
||||
this.toolStripMenuItem7.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem7.Text = "All assets";
|
||||
this.toolStripMenuItem7.Click += new System.EventHandler(this.toolStripMenuItem7_Click);
|
||||
//
|
||||
// toolStripMenuItem8
|
||||
//
|
||||
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
|
||||
this.toolStripMenuItem8.Size = new System.Drawing.Size(165, 22);
|
||||
this.toolStripMenuItem8.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem8.Text = "Selected assets";
|
||||
this.toolStripMenuItem8.Click += new System.EventHandler(this.toolStripMenuItem8_Click);
|
||||
//
|
||||
// toolStripMenuItem9
|
||||
//
|
||||
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
|
||||
this.toolStripMenuItem9.Size = new System.Drawing.Size(165, 22);
|
||||
this.toolStripMenuItem9.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem9.Text = "Filtered assets";
|
||||
this.toolStripMenuItem9.Click += new System.EventHandler(this.toolStripMenuItem9_Click);
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(281, 6);
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(263, 6);
|
||||
//
|
||||
// toolStripMenuItem10
|
||||
//
|
||||
@@ -456,27 +457,27 @@
|
||||
this.toolStripMenuItem12,
|
||||
this.toolStripMenuItem13});
|
||||
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
|
||||
this.toolStripMenuItem10.Size = new System.Drawing.Size(284, 22);
|
||||
this.toolStripMenuItem10.Size = new System.Drawing.Size(266, 22);
|
||||
this.toolStripMenuItem10.Text = "Asset list to XML";
|
||||
//
|
||||
// toolStripMenuItem11
|
||||
//
|
||||
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
|
||||
this.toolStripMenuItem11.Size = new System.Drawing.Size(165, 22);
|
||||
this.toolStripMenuItem11.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem11.Text = "All assets";
|
||||
this.toolStripMenuItem11.Click += new System.EventHandler(this.toolStripMenuItem11_Click);
|
||||
//
|
||||
// toolStripMenuItem12
|
||||
//
|
||||
this.toolStripMenuItem12.Name = "toolStripMenuItem12";
|
||||
this.toolStripMenuItem12.Size = new System.Drawing.Size(165, 22);
|
||||
this.toolStripMenuItem12.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem12.Text = "Selected assets";
|
||||
this.toolStripMenuItem12.Click += new System.EventHandler(this.toolStripMenuItem12_Click);
|
||||
//
|
||||
// toolStripMenuItem13
|
||||
//
|
||||
this.toolStripMenuItem13.Name = "toolStripMenuItem13";
|
||||
this.toolStripMenuItem13.Size = new System.Drawing.Size(165, 22);
|
||||
this.toolStripMenuItem13.Size = new System.Drawing.Size(152, 22);
|
||||
this.toolStripMenuItem13.Text = "Filtered assets";
|
||||
this.toolStripMenuItem13.Click += new System.EventHandler(this.toolStripMenuItem13_Click);
|
||||
//
|
||||
@@ -485,7 +486,7 @@
|
||||
this.filterTypeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.allToolStripMenuItem});
|
||||
this.filterTypeToolStripMenuItem.Name = "filterTypeToolStripMenuItem";
|
||||
this.filterTypeToolStripMenuItem.Size = new System.Drawing.Size(80, 21);
|
||||
this.filterTypeToolStripMenuItem.Size = new System.Drawing.Size(72, 20);
|
||||
this.filterTypeToolStripMenuItem.Text = "Filter Type";
|
||||
//
|
||||
// allToolStripMenuItem
|
||||
@@ -494,7 +495,7 @@
|
||||
this.allToolStripMenuItem.CheckOnClick = true;
|
||||
this.allToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.allToolStripMenuItem.Name = "allToolStripMenuItem";
|
||||
this.allToolStripMenuItem.Size = new System.Drawing.Size(90, 22);
|
||||
this.allToolStripMenuItem.Size = new System.Drawing.Size(88, 22);
|
||||
this.allToolStripMenuItem.Text = "All";
|
||||
this.allToolStripMenuItem.Click += new System.EventHandler(this.typeToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -504,23 +505,21 @@
|
||||
this.toolStripMenuItem15,
|
||||
this.exportClassStructuresMenuItem});
|
||||
this.debugMenuItem.Name = "debugMenuItem";
|
||||
this.debugMenuItem.Size = new System.Drawing.Size(59, 21);
|
||||
this.debugMenuItem.Size = new System.Drawing.Size(54, 20);
|
||||
this.debugMenuItem.Text = "Debug";
|
||||
//
|
||||
// toolStripMenuItem15
|
||||
//
|
||||
this.toolStripMenuItem15.Checked = true;
|
||||
this.toolStripMenuItem15.CheckOnClick = true;
|
||||
this.toolStripMenuItem15.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.toolStripMenuItem15.Name = "toolStripMenuItem15";
|
||||
this.toolStripMenuItem15.Size = new System.Drawing.Size(207, 22);
|
||||
this.toolStripMenuItem15.Text = "Show error message";
|
||||
this.toolStripMenuItem15.Size = new System.Drawing.Size(200, 22);
|
||||
this.toolStripMenuItem15.Text = "Show all error messages";
|
||||
this.toolStripMenuItem15.Click += new System.EventHandler(this.toolStripMenuItem15_Click);
|
||||
//
|
||||
// exportClassStructuresMenuItem
|
||||
//
|
||||
this.exportClassStructuresMenuItem.Name = "exportClassStructuresMenuItem";
|
||||
this.exportClassStructuresMenuItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.exportClassStructuresMenuItem.Size = new System.Drawing.Size(200, 22);
|
||||
this.exportClassStructuresMenuItem.Text = "Export class structures";
|
||||
this.exportClassStructuresMenuItem.Click += new System.EventHandler(this.exportClassStructuresMenuItem_Click);
|
||||
//
|
||||
@@ -528,7 +527,7 @@
|
||||
//
|
||||
this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 25);
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 24);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
@@ -542,7 +541,7 @@
|
||||
this.splitContainer1.Panel2.Controls.Add(this.tabControl2);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.statusStrip1);
|
||||
this.splitContainer1.Panel2MinSize = 400;
|
||||
this.splitContainer1.Size = new System.Drawing.Size(1264, 656);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(1264, 657);
|
||||
this.splitContainer1.SplitterDistance = 482;
|
||||
this.splitContainer1.TabIndex = 2;
|
||||
this.splitContainer1.TabStop = false;
|
||||
@@ -557,7 +556,7 @@
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.Padding = new System.Drawing.Point(17, 3);
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(480, 634);
|
||||
this.tabControl1.Size = new System.Drawing.Size(480, 633);
|
||||
this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
|
||||
this.tabControl1.TabIndex = 0;
|
||||
this.tabControl1.Selected += new System.Windows.Forms.TabControlEventHandler(this.tabPageSelected);
|
||||
@@ -568,7 +567,7 @@
|
||||
this.tabPage1.Controls.Add(this.treeSearch);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Size = new System.Drawing.Size(472, 608);
|
||||
this.tabPage1.Size = new System.Drawing.Size(472, 607);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "Scene Hierarchy";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
@@ -578,7 +577,7 @@
|
||||
this.sceneTreeView.CheckBoxes = true;
|
||||
this.sceneTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.sceneTreeView.HideSelection = false;
|
||||
this.sceneTreeView.Location = new System.Drawing.Point(0, 21);
|
||||
this.sceneTreeView.Location = new System.Drawing.Point(0, 20);
|
||||
this.sceneTreeView.Name = "sceneTreeView";
|
||||
this.sceneTreeView.Size = new System.Drawing.Size(472, 587);
|
||||
this.sceneTreeView.TabIndex = 1;
|
||||
@@ -590,7 +589,7 @@
|
||||
this.treeSearch.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.treeSearch.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeSearch.Name = "treeSearch";
|
||||
this.treeSearch.Size = new System.Drawing.Size(472, 21);
|
||||
this.treeSearch.Size = new System.Drawing.Size(472, 20);
|
||||
this.treeSearch.TabIndex = 0;
|
||||
this.treeSearch.Text = " Search ";
|
||||
this.treeSearch.TextChanged += new System.EventHandler(this.treeSearch_TextChanged);
|
||||
@@ -604,7 +603,7 @@
|
||||
this.tabPage2.Controls.Add(this.listSearch);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Size = new System.Drawing.Size(472, 608);
|
||||
this.tabPage2.Size = new System.Drawing.Size(472, 607);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "Asset List";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
@@ -621,7 +620,7 @@
|
||||
this.assetListView.FullRowSelect = true;
|
||||
this.assetListView.GridLines = true;
|
||||
this.assetListView.HideSelection = false;
|
||||
this.assetListView.Location = new System.Drawing.Point(0, 21);
|
||||
this.assetListView.Location = new System.Drawing.Point(0, 20);
|
||||
this.assetListView.Name = "assetListView";
|
||||
this.assetListView.Size = new System.Drawing.Size(472, 587);
|
||||
this.assetListView.TabIndex = 1;
|
||||
@@ -631,6 +630,8 @@
|
||||
this.assetListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.assetListView_ColumnClick);
|
||||
this.assetListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.selectAsset);
|
||||
this.assetListView.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.assetListView_RetrieveVirtualItem);
|
||||
this.assetListView.SelectedIndexChanged += new System.EventHandler(this.assetListView_SelectedIndexChanged);
|
||||
this.assetListView.VirtualItemsSelectionRangeChanged += new System.Windows.Forms.ListViewVirtualItemsSelectionRangeChangedEventHandler(this.assetListView_VirtualItemsSelectionRangeChanged);
|
||||
this.assetListView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.assetListView_MouseClick);
|
||||
//
|
||||
// columnHeaderName
|
||||
@@ -663,7 +664,7 @@
|
||||
this.listSearch.ForeColor = System.Drawing.SystemColors.GrayText;
|
||||
this.listSearch.Location = new System.Drawing.Point(0, 0);
|
||||
this.listSearch.Name = "listSearch";
|
||||
this.listSearch.Size = new System.Drawing.Size(472, 21);
|
||||
this.listSearch.Size = new System.Drawing.Size(472, 20);
|
||||
this.listSearch.TabIndex = 0;
|
||||
this.listSearch.Text = " Filter ";
|
||||
this.listSearch.TextChanged += new System.EventHandler(this.ListSearchTextChanged);
|
||||
@@ -675,7 +676,7 @@
|
||||
this.tabPage3.Controls.Add(this.classesListView);
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.Size = new System.Drawing.Size(472, 608);
|
||||
this.tabPage3.Size = new System.Drawing.Size(472, 607);
|
||||
this.tabPage3.TabIndex = 2;
|
||||
this.tabPage3.Text = "Asset Classes";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
@@ -691,7 +692,7 @@
|
||||
this.classesListView.Location = new System.Drawing.Point(0, 0);
|
||||
this.classesListView.MultiSelect = false;
|
||||
this.classesListView.Name = "classesListView";
|
||||
this.classesListView.Size = new System.Drawing.Size(472, 608);
|
||||
this.classesListView.Size = new System.Drawing.Size(472, 607);
|
||||
this.classesListView.TabIndex = 0;
|
||||
this.classesListView.UseCompatibleStateImageBehavior = false;
|
||||
this.classesListView.View = System.Windows.Forms.View.Details;
|
||||
@@ -713,18 +714,18 @@
|
||||
//
|
||||
this.progressbarPanel.Controls.Add(this.progressBar1);
|
||||
this.progressbarPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.progressbarPanel.Location = new System.Drawing.Point(0, 634);
|
||||
this.progressbarPanel.Location = new System.Drawing.Point(0, 633);
|
||||
this.progressbarPanel.Name = "progressbarPanel";
|
||||
this.progressbarPanel.Padding = new System.Windows.Forms.Padding(1, 3, 1, 1);
|
||||
this.progressbarPanel.Size = new System.Drawing.Size(480, 20);
|
||||
this.progressbarPanel.Size = new System.Drawing.Size(480, 22);
|
||||
this.progressbarPanel.TabIndex = 2;
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
this.progressBar1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.progressBar1.Location = new System.Drawing.Point(1, 2);
|
||||
this.progressBar1.Location = new System.Drawing.Point(1, 3);
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Size = new System.Drawing.Size(478, 17);
|
||||
this.progressBar1.Size = new System.Drawing.Size(478, 18);
|
||||
this.progressBar1.Step = 1;
|
||||
this.progressBar1.TabIndex = 1;
|
||||
//
|
||||
@@ -736,7 +737,7 @@
|
||||
this.tabControl2.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabControl2.Name = "tabControl2";
|
||||
this.tabControl2.SelectedIndex = 0;
|
||||
this.tabControl2.Size = new System.Drawing.Size(776, 632);
|
||||
this.tabControl2.Size = new System.Drawing.Size(776, 633);
|
||||
this.tabControl2.TabIndex = 4;
|
||||
this.tabControl2.SelectedIndexChanged += new System.EventHandler(this.tabControl2_SelectedIndexChanged);
|
||||
//
|
||||
@@ -745,7 +746,7 @@
|
||||
this.tabPage4.Controls.Add(this.previewPanel);
|
||||
this.tabPage4.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage4.Name = "tabPage4";
|
||||
this.tabPage4.Size = new System.Drawing.Size(768, 606);
|
||||
this.tabPage4.Size = new System.Drawing.Size(768, 607);
|
||||
this.tabPage4.TabIndex = 0;
|
||||
this.tabPage4.Text = "Preview";
|
||||
this.tabPage4.UseVisualStyleBackColor = true;
|
||||
@@ -764,7 +765,7 @@
|
||||
this.previewPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.previewPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.previewPanel.Name = "previewPanel";
|
||||
this.previewPanel.Size = new System.Drawing.Size(768, 606);
|
||||
this.previewPanel.Size = new System.Drawing.Size(768, 607);
|
||||
this.previewPanel.TabIndex = 1;
|
||||
this.previewPanel.Resize += new System.EventHandler(this.preview_Resize);
|
||||
//
|
||||
@@ -773,9 +774,9 @@
|
||||
this.assetInfoLabel.AutoSize = true;
|
||||
this.assetInfoLabel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.assetInfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.assetInfoLabel.Location = new System.Drawing.Point(4, 7);
|
||||
this.assetInfoLabel.Location = new System.Drawing.Point(4, 8);
|
||||
this.assetInfoLabel.Name = "assetInfoLabel";
|
||||
this.assetInfoLabel.Size = new System.Drawing.Size(0, 12);
|
||||
this.assetInfoLabel.Size = new System.Drawing.Size(0, 13);
|
||||
this.assetInfoLabel.TabIndex = 0;
|
||||
//
|
||||
// FMODpanel
|
||||
@@ -794,7 +795,7 @@
|
||||
this.FMODpanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.FMODpanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.FMODpanel.Name = "FMODpanel";
|
||||
this.FMODpanel.Size = new System.Drawing.Size(768, 606);
|
||||
this.FMODpanel.Size = new System.Drawing.Size(768, 607);
|
||||
this.FMODpanel.TabIndex = 2;
|
||||
this.FMODpanel.Visible = false;
|
||||
//
|
||||
@@ -802,9 +803,9 @@
|
||||
//
|
||||
this.FMODcopyright.AutoSize = true;
|
||||
this.FMODcopyright.ForeColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.FMODcopyright.Location = new System.Drawing.Point(214, 337);
|
||||
this.FMODcopyright.Location = new System.Drawing.Point(214, 365);
|
||||
this.FMODcopyright.Name = "FMODcopyright";
|
||||
this.FMODcopyright.Size = new System.Drawing.Size(341, 12);
|
||||
this.FMODcopyright.Size = new System.Drawing.Size(283, 13);
|
||||
this.FMODcopyright.TabIndex = 9;
|
||||
this.FMODcopyright.Text = "Audio Engine supplied by FMOD by Firelight Technologies.";
|
||||
//
|
||||
@@ -812,38 +813,37 @@
|
||||
//
|
||||
this.FMODinfoLabel.AutoSize = true;
|
||||
this.FMODinfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.FMODinfoLabel.Location = new System.Drawing.Point(269, 235);
|
||||
this.FMODinfoLabel.Location = new System.Drawing.Point(269, 255);
|
||||
this.FMODinfoLabel.Name = "FMODinfoLabel";
|
||||
this.FMODinfoLabel.Size = new System.Drawing.Size(0, 12);
|
||||
this.FMODinfoLabel.Size = new System.Drawing.Size(0, 13);
|
||||
this.FMODinfoLabel.TabIndex = 8;
|
||||
//
|
||||
// FMODtimerLabel
|
||||
//
|
||||
this.FMODtimerLabel.AutoSize = true;
|
||||
this.FMODtimerLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.FMODtimerLabel.Location = new System.Drawing.Point(460, 235);
|
||||
this.FMODtimerLabel.Location = new System.Drawing.Point(404, 255);
|
||||
this.FMODtimerLabel.Name = "FMODtimerLabel";
|
||||
this.FMODtimerLabel.Size = new System.Drawing.Size(95, 12);
|
||||
this.FMODtimerLabel.Size = new System.Drawing.Size(155, 13);
|
||||
this.FMODtimerLabel.TabIndex = 7;
|
||||
this.FMODtimerLabel.Text = "0:00.0 / 0:00.0";
|
||||
this.FMODtimerLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// FMODstatusLabel
|
||||
//
|
||||
this.FMODstatusLabel.AutoSize = true;
|
||||
this.FMODstatusLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.FMODstatusLabel.Location = new System.Drawing.Point(213, 235);
|
||||
this.FMODstatusLabel.Location = new System.Drawing.Point(213, 255);
|
||||
this.FMODstatusLabel.Name = "FMODstatusLabel";
|
||||
this.FMODstatusLabel.Size = new System.Drawing.Size(47, 12);
|
||||
this.FMODstatusLabel.Size = new System.Drawing.Size(50, 13);
|
||||
this.FMODstatusLabel.TabIndex = 6;
|
||||
this.FMODstatusLabel.Text = "Stopped";
|
||||
//
|
||||
// FMODprogressBar
|
||||
//
|
||||
this.FMODprogressBar.AutoSize = false;
|
||||
this.FMODprogressBar.Location = new System.Drawing.Point(213, 253);
|
||||
this.FMODprogressBar.Location = new System.Drawing.Point(213, 274);
|
||||
this.FMODprogressBar.Maximum = 1000;
|
||||
this.FMODprogressBar.Name = "FMODprogressBar";
|
||||
this.FMODprogressBar.Size = new System.Drawing.Size(350, 22);
|
||||
this.FMODprogressBar.Size = new System.Drawing.Size(350, 24);
|
||||
this.FMODprogressBar.TabIndex = 5;
|
||||
this.FMODprogressBar.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this.FMODprogressBar.Scroll += new System.EventHandler(this.FMODprogressBar_Scroll);
|
||||
@@ -853,7 +853,7 @@
|
||||
// FMODvolumeBar
|
||||
//
|
||||
this.FMODvolumeBar.LargeChange = 2;
|
||||
this.FMODvolumeBar.Location = new System.Drawing.Point(460, 280);
|
||||
this.FMODvolumeBar.Location = new System.Drawing.Point(460, 303);
|
||||
this.FMODvolumeBar.Name = "FMODvolumeBar";
|
||||
this.FMODvolumeBar.Size = new System.Drawing.Size(104, 45);
|
||||
this.FMODvolumeBar.TabIndex = 4;
|
||||
@@ -864,9 +864,9 @@
|
||||
// FMODloopButton
|
||||
//
|
||||
this.FMODloopButton.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.FMODloopButton.Location = new System.Drawing.Point(399, 280);
|
||||
this.FMODloopButton.Location = new System.Drawing.Point(399, 303);
|
||||
this.FMODloopButton.Name = "FMODloopButton";
|
||||
this.FMODloopButton.Size = new System.Drawing.Size(55, 42);
|
||||
this.FMODloopButton.Size = new System.Drawing.Size(55, 46);
|
||||
this.FMODloopButton.TabIndex = 3;
|
||||
this.FMODloopButton.Text = "Loop";
|
||||
this.FMODloopButton.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
@@ -875,9 +875,9 @@
|
||||
//
|
||||
// FMODstopButton
|
||||
//
|
||||
this.FMODstopButton.Location = new System.Drawing.Point(338, 280);
|
||||
this.FMODstopButton.Location = new System.Drawing.Point(338, 303);
|
||||
this.FMODstopButton.Name = "FMODstopButton";
|
||||
this.FMODstopButton.Size = new System.Drawing.Size(55, 42);
|
||||
this.FMODstopButton.Size = new System.Drawing.Size(55, 46);
|
||||
this.FMODstopButton.TabIndex = 2;
|
||||
this.FMODstopButton.Text = "Stop";
|
||||
this.FMODstopButton.UseVisualStyleBackColor = true;
|
||||
@@ -885,9 +885,9 @@
|
||||
//
|
||||
// FMODpauseButton
|
||||
//
|
||||
this.FMODpauseButton.Location = new System.Drawing.Point(277, 280);
|
||||
this.FMODpauseButton.Location = new System.Drawing.Point(277, 303);
|
||||
this.FMODpauseButton.Name = "FMODpauseButton";
|
||||
this.FMODpauseButton.Size = new System.Drawing.Size(55, 42);
|
||||
this.FMODpauseButton.Size = new System.Drawing.Size(55, 46);
|
||||
this.FMODpauseButton.TabIndex = 1;
|
||||
this.FMODpauseButton.Text = "Pause";
|
||||
this.FMODpauseButton.UseVisualStyleBackColor = true;
|
||||
@@ -895,9 +895,9 @@
|
||||
//
|
||||
// FMODplayButton
|
||||
//
|
||||
this.FMODplayButton.Location = new System.Drawing.Point(216, 280);
|
||||
this.FMODplayButton.Location = new System.Drawing.Point(216, 303);
|
||||
this.FMODplayButton.Name = "FMODplayButton";
|
||||
this.FMODplayButton.Size = new System.Drawing.Size(55, 42);
|
||||
this.FMODplayButton.Size = new System.Drawing.Size(55, 46);
|
||||
this.FMODplayButton.TabIndex = 0;
|
||||
this.FMODplayButton.Text = "Play";
|
||||
this.FMODplayButton.UseVisualStyleBackColor = true;
|
||||
@@ -910,7 +910,7 @@
|
||||
this.fontPreviewBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.fontPreviewBox.Name = "fontPreviewBox";
|
||||
this.fontPreviewBox.ReadOnly = true;
|
||||
this.fontPreviewBox.Size = new System.Drawing.Size(768, 606);
|
||||
this.fontPreviewBox.Size = new System.Drawing.Size(768, 607);
|
||||
this.fontPreviewBox.TabIndex = 0;
|
||||
this.fontPreviewBox.Text = resources.GetString("fontPreviewBox.Text");
|
||||
this.fontPreviewBox.Visible = false;
|
||||
@@ -922,7 +922,7 @@
|
||||
this.glControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.glControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.glControl1.Name = "glControl1";
|
||||
this.glControl1.Size = new System.Drawing.Size(768, 606);
|
||||
this.glControl1.Size = new System.Drawing.Size(768, 607);
|
||||
this.glControl1.TabIndex = 4;
|
||||
this.glControl1.Visible = false;
|
||||
this.glControl1.VSync = false;
|
||||
@@ -942,7 +942,7 @@
|
||||
this.textPreviewBox.Name = "textPreviewBox";
|
||||
this.textPreviewBox.ReadOnly = true;
|
||||
this.textPreviewBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textPreviewBox.Size = new System.Drawing.Size(768, 606);
|
||||
this.textPreviewBox.Size = new System.Drawing.Size(768, 607);
|
||||
this.textPreviewBox.TabIndex = 2;
|
||||
this.textPreviewBox.Visible = false;
|
||||
this.textPreviewBox.WordWrap = false;
|
||||
@@ -955,7 +955,7 @@
|
||||
this.classTextBox.Name = "classTextBox";
|
||||
this.classTextBox.ReadOnly = true;
|
||||
this.classTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.classTextBox.Size = new System.Drawing.Size(768, 606);
|
||||
this.classTextBox.Size = new System.Drawing.Size(768, 607);
|
||||
this.classTextBox.TabIndex = 3;
|
||||
this.classTextBox.Visible = false;
|
||||
this.classTextBox.WordWrap = false;
|
||||
@@ -965,7 +965,7 @@
|
||||
this.tabPage5.Controls.Add(this.dumpTextBox);
|
||||
this.tabPage5.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage5.Name = "tabPage5";
|
||||
this.tabPage5.Size = new System.Drawing.Size(768, 606);
|
||||
this.tabPage5.Size = new System.Drawing.Size(768, 607);
|
||||
this.tabPage5.TabIndex = 1;
|
||||
this.tabPage5.Text = "Dump";
|
||||
this.tabPage5.UseVisualStyleBackColor = true;
|
||||
@@ -978,7 +978,7 @@
|
||||
this.dumpTextBox.Name = "dumpTextBox";
|
||||
this.dumpTextBox.ReadOnly = true;
|
||||
this.dumpTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.dumpTextBox.Size = new System.Drawing.Size(768, 606);
|
||||
this.dumpTextBox.Size = new System.Drawing.Size(768, 607);
|
||||
this.dumpTextBox.TabIndex = 0;
|
||||
this.dumpTextBox.WordWrap = false;
|
||||
//
|
||||
@@ -986,7 +986,7 @@
|
||||
//
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripStatusLabel1});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 632);
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 633);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(776, 22);
|
||||
this.statusStrip1.TabIndex = 2;
|
||||
@@ -1020,37 +1020,45 @@
|
||||
this.copyToolStripMenuItem,
|
||||
this.exportSelectedAssetsToolStripMenuItem,
|
||||
this.exportAnimatorwithselectedAnimationClipMenuItem,
|
||||
this.dumpSelectedAssetsToolStripMenuItem,
|
||||
this.goToSceneHierarchyToolStripMenuItem,
|
||||
this.showOriginalFileToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(327, 114);
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(304, 158);
|
||||
//
|
||||
// copyToolStripMenuItem
|
||||
//
|
||||
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(303, 22);
|
||||
this.copyToolStripMenuItem.Text = "Copy text";
|
||||
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
|
||||
//
|
||||
// exportSelectedAssetsToolStripMenuItem
|
||||
//
|
||||
this.exportSelectedAssetsToolStripMenuItem.Name = "exportSelectedAssetsToolStripMenuItem";
|
||||
this.exportSelectedAssetsToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
|
||||
this.exportSelectedAssetsToolStripMenuItem.Size = new System.Drawing.Size(303, 22);
|
||||
this.exportSelectedAssetsToolStripMenuItem.Text = "Export selected assets";
|
||||
this.exportSelectedAssetsToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedAssetsToolStripMenuItem_Click);
|
||||
//
|
||||
// exportAnimatorwithselectedAnimationClipMenuItem
|
||||
//
|
||||
this.exportAnimatorwithselectedAnimationClipMenuItem.Name = "exportAnimatorwithselectedAnimationClipMenuItem";
|
||||
this.exportAnimatorwithselectedAnimationClipMenuItem.Size = new System.Drawing.Size(326, 22);
|
||||
this.exportAnimatorwithselectedAnimationClipMenuItem.Size = new System.Drawing.Size(303, 22);
|
||||
this.exportAnimatorwithselectedAnimationClipMenuItem.Text = "Export Animator + selected AnimationClips";
|
||||
this.exportAnimatorwithselectedAnimationClipMenuItem.Visible = false;
|
||||
this.exportAnimatorwithselectedAnimationClipMenuItem.Click += new System.EventHandler(this.exportAnimatorwithAnimationClipMenuItem_Click);
|
||||
//
|
||||
// dumpSelectedAssetsToolStripMenuItem
|
||||
//
|
||||
this.dumpSelectedAssetsToolStripMenuItem.Name = "dumpSelectedAssetsToolStripMenuItem";
|
||||
this.dumpSelectedAssetsToolStripMenuItem.Size = new System.Drawing.Size(303, 22);
|
||||
this.dumpSelectedAssetsToolStripMenuItem.Text = "Dump selected assets";
|
||||
this.dumpSelectedAssetsToolStripMenuItem.Click += new System.EventHandler(this.dumpSelectedAssetsToolStripMenuItem_Click);
|
||||
//
|
||||
// goToSceneHierarchyToolStripMenuItem
|
||||
//
|
||||
this.goToSceneHierarchyToolStripMenuItem.Name = "goToSceneHierarchyToolStripMenuItem";
|
||||
this.goToSceneHierarchyToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
|
||||
this.goToSceneHierarchyToolStripMenuItem.Size = new System.Drawing.Size(303, 22);
|
||||
this.goToSceneHierarchyToolStripMenuItem.Text = "Go to scene hierarchy";
|
||||
this.goToSceneHierarchyToolStripMenuItem.Visible = false;
|
||||
this.goToSceneHierarchyToolStripMenuItem.Click += new System.EventHandler(this.goToSceneHierarchyToolStripMenuItem_Click);
|
||||
@@ -1058,7 +1066,7 @@
|
||||
// showOriginalFileToolStripMenuItem
|
||||
//
|
||||
this.showOriginalFileToolStripMenuItem.Name = "showOriginalFileToolStripMenuItem";
|
||||
this.showOriginalFileToolStripMenuItem.Size = new System.Drawing.Size(326, 22);
|
||||
this.showOriginalFileToolStripMenuItem.Size = new System.Drawing.Size(303, 22);
|
||||
this.showOriginalFileToolStripMenuItem.Text = "Show original file";
|
||||
this.showOriginalFileToolStripMenuItem.Visible = false;
|
||||
this.showOriginalFileToolStripMenuItem.Click += new System.EventHandler(this.showOriginalFileToolStripMenuItem_Click);
|
||||
@@ -1066,13 +1074,15 @@
|
||||
// AssetStudioGUIForm
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1264, 681);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Icon = global::AssetStudioGUI.Properties.Resources._as;
|
||||
this.KeyPreview = true;
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.MinimumSize = new System.Drawing.Size(620, 372);
|
||||
this.MinimumSize = new System.Drawing.Size(620, 400);
|
||||
this.Name = "AssetStudioGUIForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "AssetStudioGUI";
|
||||
@@ -1209,6 +1219,7 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem14;
|
||||
private System.Windows.Forms.ToolStripTextBox specifyUnityVersion;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem15;
|
||||
private System.Windows.Forms.ToolStripMenuItem dumpSelectedAssetsToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Text;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@@ -18,21 +19,17 @@ using System.Timers;
|
||||
using System.Windows.Forms;
|
||||
using static AssetStudioGUI.Studio;
|
||||
using Font = AssetStudio.Font;
|
||||
#if NET472
|
||||
using ImageFormat = AssetStudio.ImageFormat;
|
||||
using PixelFormat = System.Drawing.Imaging.PixelFormat;
|
||||
using Vector3 = OpenTK.Vector3;
|
||||
using Vector4 = OpenTK.Vector4;
|
||||
#else
|
||||
using Vector3 = OpenTK.Mathematics.Vector3;
|
||||
using Vector4 = OpenTK.Mathematics.Vector4;
|
||||
using Matrix4 = OpenTK.Mathematics.Matrix4;
|
||||
#endif
|
||||
|
||||
namespace AssetStudioGUI
|
||||
{
|
||||
partial class AssetStudioGUIForm : Form
|
||||
{
|
||||
private AssetItem lastSelectedItem;
|
||||
private DirectBitmap imageTexture;
|
||||
private Bitmap imageTexture;
|
||||
private string tempClipboard;
|
||||
|
||||
private FMOD.System system;
|
||||
@@ -76,6 +73,7 @@ namespace AssetStudioGUI
|
||||
//asset list sorting
|
||||
private int sortColumn = -1;
|
||||
private bool reverseSort;
|
||||
private AlphanumComparatorFast alphanumComparator = new AlphanumComparatorFast();
|
||||
|
||||
//asset list filter
|
||||
private System.Timers.Timer delayTimer;
|
||||
@@ -107,7 +105,7 @@ namespace AssetStudioGUI
|
||||
|
||||
logger = new GUILogger(StatusStripUpdate);
|
||||
Logger.Default = logger;
|
||||
Progress.Default = new Progress<int>(SetProgressBarValue);
|
||||
Progress.Default = new GUIProgress(SetProgressBarValue);
|
||||
Studio.StatusStripUpdate = StatusStripUpdate;
|
||||
}
|
||||
|
||||
@@ -141,7 +139,7 @@ namespace AssetStudioGUI
|
||||
private async void loadFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
openFileDialog1.InitialDirectory = openDirectoryBackup;
|
||||
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
ResetForm();
|
||||
openDirectoryBackup = Path.GetDirectoryName(openFileDialog1.FileNames[0]);
|
||||
@@ -167,7 +165,7 @@ namespace AssetStudioGUI
|
||||
|
||||
private async void extractFileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var saveFolderDialog = new OpenFolderDialog();
|
||||
saveFolderDialog.Title = "Select the save folder";
|
||||
@@ -222,6 +220,10 @@ namespace AssetStudioGUI
|
||||
|
||||
sceneTreeView.BeginUpdate();
|
||||
sceneTreeView.Nodes.AddRange(treeNodeCollection.ToArray());
|
||||
foreach (var node in treeNodeCollection)
|
||||
{
|
||||
node.HideCheckBox();
|
||||
}
|
||||
sceneTreeView.EndUpdate();
|
||||
treeNodeCollection.Clear();
|
||||
|
||||
@@ -389,7 +391,7 @@ namespace AssetStudioGUI
|
||||
{
|
||||
if (enablePreview.Checked && imageTexture != null)
|
||||
{
|
||||
previewPanel.BackgroundImage = imageTexture.Bitmap;
|
||||
previewPanel.BackgroundImage = imageTexture;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -457,7 +459,7 @@ namespace AssetStudioGUI
|
||||
private void showExpOpt_Click(object sender, EventArgs e)
|
||||
{
|
||||
var exportOpt = new ExportOptions();
|
||||
exportOpt.ShowDialog(this);
|
||||
exportOpt.ShowDialog();
|
||||
}
|
||||
|
||||
private void assetListView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
|
||||
@@ -620,6 +622,15 @@ namespace AssetStudioGUI
|
||||
return reverseSort ? pathID_Y.CompareTo(pathID_X) : pathID_X.CompareTo(pathID_Y);
|
||||
});
|
||||
}
|
||||
else if (sortColumn == 0) // Name
|
||||
{
|
||||
visibleAssets.Sort((a, b) =>
|
||||
{
|
||||
var at = a.SubItems[sortColumn].Text;
|
||||
var bt = b.SubItems[sortColumn].Text;
|
||||
return reverseSort ? alphanumComparator.Compare(bt, at) : alphanumComparator.Compare(at, bt);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
visibleAssets.Sort((a, b) =>
|
||||
@@ -752,11 +763,9 @@ namespace AssetStudioGUI
|
||||
|
||||
private void PreviewTexture2D(AssetItem assetItem, Texture2D m_Texture2D)
|
||||
{
|
||||
var image = m_Texture2D.ConvertToImage(true);
|
||||
if (image != null)
|
||||
var bitmap = m_Texture2D.ConvertToBitmap(true);
|
||||
if (bitmap != null)
|
||||
{
|
||||
var bitmap = new DirectBitmap(image.ConvertToBytes(), m_Texture2D.m_Width, m_Texture2D.m_Height);
|
||||
image.Dispose();
|
||||
assetItem.InfoText = $"Width: {m_Texture2D.m_Width}\nHeight: {m_Texture2D.m_Height}\nFormat: {m_Texture2D.m_TextureFormat}";
|
||||
switch (m_Texture2D.m_TextureSettings.m_FilterMode)
|
||||
{
|
||||
@@ -784,11 +793,13 @@ namespace AssetStudioGUI
|
||||
assetItem.InfoText += "None";
|
||||
if (validChannel != 4)
|
||||
{
|
||||
var bytes = bitmap.Bits;
|
||||
for (int i = 0; i < bitmap.Height; i++)
|
||||
var bmpData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
|
||||
var bytes = new byte[bitmap.Width * bitmap.Height * 4];
|
||||
Marshal.Copy(bmpData.Scan0, bytes, 0, bytes.Length);
|
||||
for (int i = 0; i < bmpData.Height; i++)
|
||||
{
|
||||
int offset = Math.Abs(bitmap.Stride) * i;
|
||||
for (int j = 0; j < bitmap.Width; j++)
|
||||
int offset = Math.Abs(bmpData.Stride) * i;
|
||||
for (int j = 0; j < bmpData.Width; j++)
|
||||
{
|
||||
bytes[offset] = textureChannels[0] ? bytes[offset] : validChannel == 1 && textureChannels[3] ? byte.MaxValue : byte.MinValue;
|
||||
bytes[offset + 1] = textureChannels[1] ? bytes[offset + 1] : validChannel == 1 && textureChannels[3] ? byte.MaxValue : byte.MinValue;
|
||||
@@ -797,6 +808,8 @@ namespace AssetStudioGUI
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
Marshal.Copy(bytes, 0, bmpData.Scan0, bytes.Length);
|
||||
bitmap.UnlockBits(bmpData);
|
||||
}
|
||||
PreviewTexture(bitmap);
|
||||
|
||||
@@ -816,40 +829,40 @@ namespace AssetStudioGUI
|
||||
{
|
||||
switch (m_AudioClip.m_Type)
|
||||
{
|
||||
case FMODSoundType.ACC:
|
||||
case AudioType.ACC:
|
||||
assetItem.InfoText += "Acc";
|
||||
break;
|
||||
case FMODSoundType.AIFF:
|
||||
case AudioType.AIFF:
|
||||
assetItem.InfoText += "AIFF";
|
||||
break;
|
||||
case FMODSoundType.IT:
|
||||
case AudioType.IT:
|
||||
assetItem.InfoText += "Impulse tracker";
|
||||
break;
|
||||
case FMODSoundType.MOD:
|
||||
case AudioType.MOD:
|
||||
assetItem.InfoText += "Protracker / Fasttracker MOD";
|
||||
break;
|
||||
case FMODSoundType.MPEG:
|
||||
case AudioType.MPEG:
|
||||
assetItem.InfoText += "MP2/MP3 MPEG";
|
||||
break;
|
||||
case FMODSoundType.OGGVORBIS:
|
||||
case AudioType.OGGVORBIS:
|
||||
assetItem.InfoText += "Ogg vorbis";
|
||||
break;
|
||||
case FMODSoundType.S3M:
|
||||
case AudioType.S3M:
|
||||
assetItem.InfoText += "ScreamTracker 3";
|
||||
break;
|
||||
case FMODSoundType.WAV:
|
||||
case AudioType.WAV:
|
||||
assetItem.InfoText += "Microsoft WAV";
|
||||
break;
|
||||
case FMODSoundType.XM:
|
||||
case AudioType.XM:
|
||||
assetItem.InfoText += "FastTracker 2 XM";
|
||||
break;
|
||||
case FMODSoundType.XMA:
|
||||
case AudioType.XMA:
|
||||
assetItem.InfoText += "Xbox360 XMA";
|
||||
break;
|
||||
case FMODSoundType.VAG:
|
||||
case AudioType.VAG:
|
||||
assetItem.InfoText += "PlayStation Portable ADPCM";
|
||||
break;
|
||||
case FMODSoundType.AUDIOQUEUE:
|
||||
case AudioType.AUDIOQUEUE:
|
||||
assetItem.InfoText += "iPhone";
|
||||
break;
|
||||
default:
|
||||
@@ -873,7 +886,7 @@ namespace AssetStudioGUI
|
||||
case AudioCompressionFormat.MP3:
|
||||
assetItem.InfoText += "MP3";
|
||||
break;
|
||||
case AudioCompressionFormat.PSMVAG:
|
||||
case AudioCompressionFormat.VAG:
|
||||
assetItem.InfoText += "PlayStation Portable ADPCM";
|
||||
break;
|
||||
case AudioCompressionFormat.HEVAG:
|
||||
@@ -1160,11 +1173,9 @@ namespace AssetStudioGUI
|
||||
|
||||
private void PreviewSprite(AssetItem assetItem, Sprite m_Sprite)
|
||||
{
|
||||
var image = m_Sprite.GetImage();
|
||||
if (image != null)
|
||||
var bitmap = m_Sprite.GetImage();
|
||||
if (bitmap != null)
|
||||
{
|
||||
var bitmap = new DirectBitmap(image.ConvertToBytes(), image.Width, image.Height);
|
||||
image.Dispose();
|
||||
assetItem.InfoText = $"Width: {bitmap.Width}\nHeight: {bitmap.Height}\n";
|
||||
PreviewTexture(bitmap);
|
||||
}
|
||||
@@ -1174,11 +1185,11 @@ namespace AssetStudioGUI
|
||||
}
|
||||
}
|
||||
|
||||
private void PreviewTexture(DirectBitmap bitmap)
|
||||
private void PreviewTexture(Bitmap bitmap)
|
||||
{
|
||||
imageTexture?.Dispose();
|
||||
imageTexture = bitmap;
|
||||
previewPanel.BackgroundImage = imageTexture.Bitmap;
|
||||
previewPanel.BackgroundImage = imageTexture;
|
||||
if (imageTexture.Width > previewPanel.Width || imageTexture.Height > previewPanel.Height)
|
||||
previewPanel.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
else
|
||||
@@ -1229,7 +1240,6 @@ namespace AssetStudioGUI
|
||||
classesListView.Groups.Clear();
|
||||
previewPanel.BackgroundImage = Properties.Resources.preview;
|
||||
imageTexture?.Dispose();
|
||||
imageTexture = null;
|
||||
previewPanel.BackgroundImageLayout = ImageLayout.Center;
|
||||
assetInfoLabel.Visible = false;
|
||||
assetInfoLabel.Text = null;
|
||||
@@ -1241,6 +1251,8 @@ namespace AssetStudioGUI
|
||||
reverseSort = false;
|
||||
enableFiltering = false;
|
||||
listSearch.Text = " Filter ";
|
||||
if (tabControl1.SelectedIndex == 1)
|
||||
assetListView.Select();
|
||||
|
||||
var count = filterTypeToolStripMenuItem.DropDownItems.Count;
|
||||
for (var i = 1; i < count; i++)
|
||||
@@ -1273,7 +1285,10 @@ namespace AssetStudioGUI
|
||||
}
|
||||
}
|
||||
|
||||
tempClipboard = assetListView.HitTest(new Point(e.X, e.Y)).SubItem.Text;
|
||||
var selectedElement = assetListView.HitTest(new Point(e.X, e.Y));
|
||||
var subItemIndex = selectedElement.Item.SubItems.IndexOf(selectedElement.SubItem);
|
||||
tempClipboard = selectedElement.SubItem.Text;
|
||||
copyToolStripMenuItem.Text = $"Copy {assetListView.Columns[subItemIndex].Text}";
|
||||
contextMenuStrip1.Show(assetListView, e.X, e.Y);
|
||||
}
|
||||
}
|
||||
@@ -1288,6 +1303,11 @@ namespace AssetStudioGUI
|
||||
ExportAssets(ExportFilter.Selected, ExportType.Convert);
|
||||
}
|
||||
|
||||
private void dumpSelectedAssetsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ExportAssets(ExportFilter.Selected, ExportType.Dump);
|
||||
}
|
||||
|
||||
private void showOriginalFileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var selectasset = (AssetItem)assetListView.Items[assetListView.SelectedIndices[0]];
|
||||
@@ -1380,32 +1400,25 @@ namespace AssetStudioGUI
|
||||
{
|
||||
var gameObjects = new List<GameObject>();
|
||||
GetSelectedParentNode(sceneTreeView.Nodes, gameObjects);
|
||||
if (gameObjects.Count > 0)
|
||||
var saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.FileName = gameObjects[0].m_Name + " (merge).fbx";
|
||||
saveFileDialog.AddExtension = false;
|
||||
saveFileDialog.Filter = "Fbx file (*.fbx)|*.fbx";
|
||||
saveFileDialog.InitialDirectory = saveDirectoryBackup;
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.FileName = gameObjects[0].m_Name + " (merge).fbx";
|
||||
saveFileDialog.AddExtension = false;
|
||||
saveFileDialog.Filter = "Fbx file (*.fbx)|*.fbx";
|
||||
saveFileDialog.InitialDirectory = saveDirectoryBackup;
|
||||
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
saveDirectoryBackup = Path.GetDirectoryName(saveFileDialog.FileName);
|
||||
var exportPath = saveFileDialog.FileName;
|
||||
List<AssetItem> animationList = null;
|
||||
if (animation)
|
||||
{
|
||||
saveDirectoryBackup = Path.GetDirectoryName(saveFileDialog.FileName);
|
||||
var exportPath = saveFileDialog.FileName;
|
||||
List<AssetItem> animationList = null;
|
||||
if (animation)
|
||||
animationList = GetSelectedAssets().Where(x => x.Type == ClassIDType.AnimationClip).ToList();
|
||||
if (animationList.Count == 0)
|
||||
{
|
||||
animationList = GetSelectedAssets().Where(x => x.Type == ClassIDType.AnimationClip).ToList();
|
||||
if (animationList.Count == 0)
|
||||
{
|
||||
animationList = null;
|
||||
}
|
||||
animationList = null;
|
||||
}
|
||||
ExportObjectsMergeWithAnimationClip(exportPath, gameObjects, animationList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusStripUpdate("No Object selected for export.");
|
||||
ExportObjectsMergeWithAnimationClip(exportPath, gameObjects, animationList);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1499,6 +1512,18 @@ namespace AssetStudioGUI
|
||||
}
|
||||
}
|
||||
|
||||
private void assetListView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (assetListView.SelectedIndices.Count > 1)
|
||||
StatusStripUpdate($"Selected {assetListView.SelectedIndices.Count} assets.");
|
||||
}
|
||||
|
||||
private void assetListView_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e)
|
||||
{
|
||||
if (assetListView.SelectedIndices.Count > 1)
|
||||
StatusStripUpdate($"Selected {assetListView.SelectedIndices.Count} assets.");
|
||||
}
|
||||
|
||||
private List<AssetItem> GetSelectedAssets()
|
||||
{
|
||||
var selectedAssets = new List<AssetItem>(assetListView.SelectedIndices.Count);
|
||||
|
||||
96
AssetStudioGUI/Components/AlphanumComparatorFast.cs
Normal file
96
AssetStudioGUI/Components/AlphanumComparatorFast.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
// This code developed by Dot Net Perls
|
||||
using System.Collections;
|
||||
|
||||
|
||||
namespace AssetStudioGUI
|
||||
{
|
||||
internal class AlphanumComparatorFast : IComparer
|
||||
{
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
if (!(x is string s1))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (!(y is string s2))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int len1 = s1.Length;
|
||||
int len2 = s2.Length;
|
||||
int marker1 = 0;
|
||||
int marker2 = 0;
|
||||
|
||||
// Walk through two the strings with two markers.
|
||||
while (marker1 < len1 && marker2 < len2)
|
||||
{
|
||||
char ch1 = s1[marker1];
|
||||
char ch2 = s2[marker2];
|
||||
|
||||
// Some buffers we can build up characters in for each chunk.
|
||||
char[] space1 = new char[len1];
|
||||
int loc1 = 0;
|
||||
char[] space2 = new char[len2];
|
||||
int loc2 = 0;
|
||||
|
||||
// Walk through all following characters that are digits or
|
||||
// characters in BOTH strings starting at the appropriate marker.
|
||||
// Collect char arrays.
|
||||
do
|
||||
{
|
||||
space1[loc1++] = ch1;
|
||||
marker1++;
|
||||
|
||||
if (marker1 < len1)
|
||||
{
|
||||
ch1 = s1[marker1];
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (char.IsDigit(ch1) == char.IsDigit(space1[0]));
|
||||
|
||||
do
|
||||
{
|
||||
space2[loc2++] = ch2;
|
||||
marker2++;
|
||||
|
||||
if (marker2 < len2)
|
||||
{
|
||||
ch2 = s2[marker2];
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (char.IsDigit(ch2) == char.IsDigit(space2[0]));
|
||||
|
||||
// If we have collected numbers, compare them numerically.
|
||||
// Otherwise, if we have strings, compare them alphabetically.
|
||||
string str1 = new string(space1);
|
||||
string str2 = new string(space2);
|
||||
|
||||
int result;
|
||||
|
||||
if (char.IsDigit(space1[0]) && char.IsDigit(space2[0]))
|
||||
{
|
||||
int thisNumericChunk = int.Parse(str1);
|
||||
int thatNumericChunk = int.Parse(str2);
|
||||
result = thisNumericChunk.CompareTo(thatNumericChunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = str1.CompareTo(str2);
|
||||
}
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return len1 - len2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,11 @@ namespace AssetStudioGUI
|
||||
{
|
||||
public GameObject gameObject;
|
||||
|
||||
public GameObjectTreeNode(string name)
|
||||
{
|
||||
Text = name;
|
||||
}
|
||||
|
||||
public GameObjectTreeNode(GameObject gameObject)
|
||||
{
|
||||
this.gameObject = gameObject;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
@@ -14,13 +15,12 @@ namespace AssetStudioGUI
|
||||
|
||||
internal DialogResult ShowDialog(IWin32Window owner = null)
|
||||
{
|
||||
//#if NETFRAMEWORK
|
||||
if (Environment.OSVersion.Version.Major >= 6)
|
||||
{
|
||||
return ShowVistaDialog(owner);
|
||||
}
|
||||
//#endif
|
||||
return ShowFolderBrowserDialog(owner);
|
||||
|
||||
return ShowLegacyDialog(owner);
|
||||
}
|
||||
|
||||
private DialogResult ShowVistaDialog(IWin32Window owner)
|
||||
@@ -74,7 +74,7 @@ namespace AssetStudioGUI
|
||||
return DialogResult.Cancel;
|
||||
}
|
||||
|
||||
private DialogResult ShowFolderBrowserDialog(IWin32Window owner)
|
||||
private DialogResult ShowLegacyDialog(IWin32Window owner)
|
||||
{
|
||||
using (var frm = new FolderBrowserDialog())
|
||||
{
|
||||
@@ -82,20 +82,13 @@ namespace AssetStudioGUI
|
||||
{
|
||||
frm.SelectedPath = InitialFolder;
|
||||
}
|
||||
#if !NETFRAMEWORK
|
||||
if (Title != null)
|
||||
if ((owner == null ? frm.ShowDialog() : frm.ShowDialog(owner)) == DialogResult.OK)
|
||||
{
|
||||
frm.Description = Title;
|
||||
frm.UseDescriptionForTitle = true;
|
||||
Folder = Path.GetDirectoryName(frm.SelectedPath);
|
||||
return DialogResult.OK;
|
||||
}
|
||||
#endif
|
||||
var result = owner == null ? frm.ShowDialog() : frm.ShowDialog(owner);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
Folder = frm.SelectedPath;
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
|
||||
return DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
48
AssetStudioGUI/Components/TreeViewExtensions.cs
Normal file
48
AssetStudioGUI/Components/TreeViewExtensions.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AssetStudioGUI
|
||||
{
|
||||
internal static class TreeViewExtensions
|
||||
{
|
||||
private const int TVIF_STATE = 0x8;
|
||||
private const int TVIS_STATEIMAGEMASK = 0xF000;
|
||||
private const int TV_FIRST = 0x1100;
|
||||
private const int TVM_SETITEM = TV_FIRST + 63;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 8, CharSet = CharSet.Auto)]
|
||||
private struct TVITEM
|
||||
{
|
||||
public int mask;
|
||||
public IntPtr hItem;
|
||||
public int state;
|
||||
public int stateMask;
|
||||
[MarshalAs(UnmanagedType.LPTStr)]
|
||||
public string lpszText;
|
||||
public int cchTextMax;
|
||||
public int iImage;
|
||||
public int iSelectedImage;
|
||||
public int cChildren;
|
||||
public IntPtr lParam;
|
||||
}
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||
private static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, ref TVITEM lParam);
|
||||
|
||||
/// <summary>
|
||||
/// Hides the checkbox for the specified node on a TreeView control.
|
||||
/// </summary>
|
||||
public static void HideCheckBox(this TreeNode node)
|
||||
{
|
||||
var tvi = new TVITEM
|
||||
{
|
||||
hItem = node.Handle,
|
||||
mask = TVIF_STATE,
|
||||
stateMask = TVIS_STATEIMAGEMASK,
|
||||
state = TVIS_STATEIMAGEMASK //temp bugfix for an issue with getting stuck during the "Building tree structure" step
|
||||
};
|
||||
SendMessage(node.TreeView.Handle, TVM_SETITEM, IntPtr.Zero, ref tvi);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace AssetStudioGUI
|
||||
{
|
||||
public sealed class DirectBitmap : IDisposable
|
||||
{
|
||||
public DirectBitmap(byte[] buff, int width, int height)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
Bits = buff;
|
||||
m_handle = GCHandle.Alloc(Bits, GCHandleType.Pinned);
|
||||
m_bitmap = new Bitmap(Width, Height, Stride, PixelFormat.Format32bppArgb, m_handle.AddrOfPinnedObject());
|
||||
}
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
m_bitmap.Dispose();
|
||||
m_handle.Free();
|
||||
}
|
||||
m_bitmap = null;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
public int Height { get; }
|
||||
public int Width { get; }
|
||||
public int Stride => Width * 4;
|
||||
public byte[] Bits { get; }
|
||||
public Bitmap Bitmap => m_bitmap;
|
||||
|
||||
private Bitmap m_bitmap;
|
||||
private readonly GCHandle m_handle;
|
||||
}
|
||||
}
|
||||
134
AssetStudioGUI/ExportOptions.Designer.cs
generated
134
AssetStudioGUI/ExportOptions.Designer.cs
generated
@@ -72,9 +72,9 @@
|
||||
//
|
||||
// OKbutton
|
||||
//
|
||||
this.OKbutton.Location = new System.Drawing.Point(318, 351);
|
||||
this.OKbutton.Location = new System.Drawing.Point(318, 380);
|
||||
this.OKbutton.Name = "OKbutton";
|
||||
this.OKbutton.Size = new System.Drawing.Size(75, 21);
|
||||
this.OKbutton.Size = new System.Drawing.Size(75, 23);
|
||||
this.OKbutton.TabIndex = 6;
|
||||
this.OKbutton.Text = "OK";
|
||||
this.OKbutton.UseVisualStyleBackColor = true;
|
||||
@@ -83,9 +83,9 @@
|
||||
// Cancel
|
||||
//
|
||||
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.Cancel.Location = new System.Drawing.Point(399, 351);
|
||||
this.Cancel.Location = new System.Drawing.Point(399, 380);
|
||||
this.Cancel.Name = "Cancel";
|
||||
this.Cancel.Size = new System.Drawing.Size(75, 21);
|
||||
this.Cancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.Cancel.TabIndex = 7;
|
||||
this.Cancel.Text = "Cancel";
|
||||
this.Cancel.UseVisualStyleBackColor = true;
|
||||
@@ -101,9 +101,9 @@
|
||||
this.groupBox1.Controls.Add(this.convertAudio);
|
||||
this.groupBox1.Controls.Add(this.panel1);
|
||||
this.groupBox1.Controls.Add(this.converttexture);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 13);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(232, 334);
|
||||
this.groupBox1.Size = new System.Drawing.Size(232, 362);
|
||||
this.groupBox1.TabIndex = 9;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Export";
|
||||
@@ -113,9 +113,9 @@
|
||||
this.openAfterExport.AutoSize = true;
|
||||
this.openAfterExport.Checked = true;
|
||||
this.openAfterExport.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.openAfterExport.Location = new System.Drawing.Point(6, 160);
|
||||
this.openAfterExport.Location = new System.Drawing.Point(6, 173);
|
||||
this.openAfterExport.Name = "openAfterExport";
|
||||
this.openAfterExport.Size = new System.Drawing.Size(168, 16);
|
||||
this.openAfterExport.Size = new System.Drawing.Size(137, 17);
|
||||
this.openAfterExport.TabIndex = 10;
|
||||
this.openAfterExport.Text = "Open folder after export";
|
||||
this.openAfterExport.UseVisualStyleBackColor = true;
|
||||
@@ -125,9 +125,9 @@
|
||||
this.restoreExtensionName.AutoSize = true;
|
||||
this.restoreExtensionName.Checked = true;
|
||||
this.restoreExtensionName.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.restoreExtensionName.Location = new System.Drawing.Point(6, 58);
|
||||
this.restoreExtensionName.Location = new System.Drawing.Point(6, 63);
|
||||
this.restoreExtensionName.Name = "restoreExtensionName";
|
||||
this.restoreExtensionName.Size = new System.Drawing.Size(216, 16);
|
||||
this.restoreExtensionName.Size = new System.Drawing.Size(190, 17);
|
||||
this.restoreExtensionName.TabIndex = 9;
|
||||
this.restoreExtensionName.Text = "Restore TextAsset extension name";
|
||||
this.restoreExtensionName.UseVisualStyleBackColor = true;
|
||||
@@ -141,17 +141,17 @@
|
||||
"container path",
|
||||
"source file name",
|
||||
"do not group"});
|
||||
this.assetGroupOptions.Location = new System.Drawing.Point(6, 32);
|
||||
this.assetGroupOptions.Location = new System.Drawing.Point(6, 35);
|
||||
this.assetGroupOptions.Name = "assetGroupOptions";
|
||||
this.assetGroupOptions.Size = new System.Drawing.Size(149, 20);
|
||||
this.assetGroupOptions.Size = new System.Drawing.Size(149, 21);
|
||||
this.assetGroupOptions.TabIndex = 8;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(6, 17);
|
||||
this.label6.Location = new System.Drawing.Point(6, 18);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(149, 12);
|
||||
this.label6.Size = new System.Drawing.Size(127, 13);
|
||||
this.label6.TabIndex = 7;
|
||||
this.label6.Text = "Group exported assets by";
|
||||
//
|
||||
@@ -160,9 +160,9 @@
|
||||
this.convertAudio.AutoSize = true;
|
||||
this.convertAudio.Checked = true;
|
||||
this.convertAudio.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.convertAudio.Location = new System.Drawing.Point(6, 138);
|
||||
this.convertAudio.Location = new System.Drawing.Point(6, 150);
|
||||
this.convertAudio.Name = "convertAudio";
|
||||
this.convertAudio.Size = new System.Drawing.Size(198, 16);
|
||||
this.convertAudio.Size = new System.Drawing.Size(179, 17);
|
||||
this.convertAudio.TabIndex = 6;
|
||||
this.convertAudio.Text = "Convert AudioClip to WAV(PCM)";
|
||||
this.convertAudio.UseVisualStyleBackColor = true;
|
||||
@@ -173,17 +173,17 @@
|
||||
this.panel1.Controls.Add(this.tojpg);
|
||||
this.panel1.Controls.Add(this.topng);
|
||||
this.panel1.Controls.Add(this.tobmp);
|
||||
this.panel1.Location = new System.Drawing.Point(20, 102);
|
||||
this.panel1.Location = new System.Drawing.Point(20, 111);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(202, 30);
|
||||
this.panel1.Size = new System.Drawing.Size(202, 33);
|
||||
this.panel1.TabIndex = 5;
|
||||
//
|
||||
// totga
|
||||
//
|
||||
this.totga.AutoSize = true;
|
||||
this.totga.Location = new System.Drawing.Point(150, 6);
|
||||
this.totga.Location = new System.Drawing.Point(150, 7);
|
||||
this.totga.Name = "totga";
|
||||
this.totga.Size = new System.Drawing.Size(41, 16);
|
||||
this.totga.Size = new System.Drawing.Size(44, 17);
|
||||
this.totga.TabIndex = 2;
|
||||
this.totga.Text = "Tga";
|
||||
this.totga.UseVisualStyleBackColor = true;
|
||||
@@ -191,9 +191,9 @@
|
||||
// tojpg
|
||||
//
|
||||
this.tojpg.AutoSize = true;
|
||||
this.tojpg.Location = new System.Drawing.Point(97, 6);
|
||||
this.tojpg.Location = new System.Drawing.Point(97, 7);
|
||||
this.tojpg.Name = "tojpg";
|
||||
this.tojpg.Size = new System.Drawing.Size(47, 16);
|
||||
this.tojpg.Size = new System.Drawing.Size(48, 17);
|
||||
this.tojpg.TabIndex = 4;
|
||||
this.tojpg.Text = "Jpeg";
|
||||
this.tojpg.UseVisualStyleBackColor = true;
|
||||
@@ -202,9 +202,9 @@
|
||||
//
|
||||
this.topng.AutoSize = true;
|
||||
this.topng.Checked = true;
|
||||
this.topng.Location = new System.Drawing.Point(50, 6);
|
||||
this.topng.Location = new System.Drawing.Point(50, 7);
|
||||
this.topng.Name = "topng";
|
||||
this.topng.Size = new System.Drawing.Size(41, 16);
|
||||
this.topng.Size = new System.Drawing.Size(44, 17);
|
||||
this.topng.TabIndex = 3;
|
||||
this.topng.TabStop = true;
|
||||
this.topng.Text = "Png";
|
||||
@@ -213,9 +213,9 @@
|
||||
// tobmp
|
||||
//
|
||||
this.tobmp.AutoSize = true;
|
||||
this.tobmp.Location = new System.Drawing.Point(3, 6);
|
||||
this.tobmp.Location = new System.Drawing.Point(3, 7);
|
||||
this.tobmp.Name = "tobmp";
|
||||
this.tobmp.Size = new System.Drawing.Size(41, 16);
|
||||
this.tobmp.Size = new System.Drawing.Size(46, 17);
|
||||
this.tobmp.TabIndex = 2;
|
||||
this.tobmp.Text = "Bmp";
|
||||
this.tobmp.UseVisualStyleBackColor = true;
|
||||
@@ -225,9 +225,9 @@
|
||||
this.converttexture.AutoSize = true;
|
||||
this.converttexture.Checked = true;
|
||||
this.converttexture.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.converttexture.Location = new System.Drawing.Point(6, 80);
|
||||
this.converttexture.Location = new System.Drawing.Point(6, 87);
|
||||
this.converttexture.Name = "converttexture";
|
||||
this.converttexture.Size = new System.Drawing.Size(126, 16);
|
||||
this.converttexture.Size = new System.Drawing.Size(116, 17);
|
||||
this.converttexture.TabIndex = 1;
|
||||
this.converttexture.Text = "Convert Texture2D";
|
||||
this.converttexture.UseVisualStyleBackColor = true;
|
||||
@@ -252,9 +252,9 @@
|
||||
this.groupBox2.Controls.Add(this.castToBone);
|
||||
this.groupBox2.Controls.Add(this.exportAllNodes);
|
||||
this.groupBox2.Controls.Add(this.eulerFilter);
|
||||
this.groupBox2.Location = new System.Drawing.Point(250, 12);
|
||||
this.groupBox2.Location = new System.Drawing.Point(250, 13);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(224, 334);
|
||||
this.groupBox2.Size = new System.Drawing.Size(224, 362);
|
||||
this.groupBox2.TabIndex = 11;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Fbx";
|
||||
@@ -263,9 +263,9 @@
|
||||
//
|
||||
this.exportAllUvsAsDiffuseMaps.AccessibleDescription = "";
|
||||
this.exportAllUvsAsDiffuseMaps.AutoSize = true;
|
||||
this.exportAllUvsAsDiffuseMaps.Location = new System.Drawing.Point(6, 171);
|
||||
this.exportAllUvsAsDiffuseMaps.Location = new System.Drawing.Point(6, 185);
|
||||
this.exportAllUvsAsDiffuseMaps.Name = "exportAllUvsAsDiffuseMaps";
|
||||
this.exportAllUvsAsDiffuseMaps.Size = new System.Drawing.Size(204, 16);
|
||||
this.exportAllUvsAsDiffuseMaps.Size = new System.Drawing.Size(168, 17);
|
||||
this.exportAllUvsAsDiffuseMaps.TabIndex = 23;
|
||||
this.exportAllUvsAsDiffuseMaps.Text = "Export all UVs as diffuse maps";
|
||||
this.exportUvsTooltip.SetToolTip(this.exportAllUvsAsDiffuseMaps, "Unchecked: UV1 exported as normal map. Check this if your export is missing a UV " +
|
||||
@@ -277,9 +277,9 @@
|
||||
this.exportBlendShape.AutoSize = true;
|
||||
this.exportBlendShape.Checked = true;
|
||||
this.exportBlendShape.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.exportBlendShape.Location = new System.Drawing.Point(6, 127);
|
||||
this.exportBlendShape.Location = new System.Drawing.Point(6, 138);
|
||||
this.exportBlendShape.Name = "exportBlendShape";
|
||||
this.exportBlendShape.Size = new System.Drawing.Size(126, 16);
|
||||
this.exportBlendShape.Size = new System.Drawing.Size(114, 17);
|
||||
this.exportBlendShape.TabIndex = 22;
|
||||
this.exportBlendShape.Text = "Export blendshape";
|
||||
this.exportBlendShape.UseVisualStyleBackColor = true;
|
||||
@@ -289,9 +289,9 @@
|
||||
this.exportAnimations.AutoSize = true;
|
||||
this.exportAnimations.Checked = true;
|
||||
this.exportAnimations.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.exportAnimations.Location = new System.Drawing.Point(6, 105);
|
||||
this.exportAnimations.Location = new System.Drawing.Point(6, 114);
|
||||
this.exportAnimations.Name = "exportAnimations";
|
||||
this.exportAnimations.Size = new System.Drawing.Size(126, 16);
|
||||
this.exportAnimations.Size = new System.Drawing.Size(109, 17);
|
||||
this.exportAnimations.TabIndex = 21;
|
||||
this.exportAnimations.Text = "Export animations";
|
||||
this.exportAnimations.UseVisualStyleBackColor = true;
|
||||
@@ -304,9 +304,9 @@
|
||||
0,
|
||||
0,
|
||||
131072});
|
||||
this.scaleFactor.Location = new System.Drawing.Point(83, 224);
|
||||
this.scaleFactor.Location = new System.Drawing.Point(83, 243);
|
||||
this.scaleFactor.Name = "scaleFactor";
|
||||
this.scaleFactor.Size = new System.Drawing.Size(60, 21);
|
||||
this.scaleFactor.Size = new System.Drawing.Size(60, 20);
|
||||
this.scaleFactor.TabIndex = 20;
|
||||
this.scaleFactor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.scaleFactor.Value = new decimal(new int[] {
|
||||
@@ -318,9 +318,9 @@
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(6, 226);
|
||||
this.label5.Location = new System.Drawing.Point(6, 245);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(71, 12);
|
||||
this.label5.Size = new System.Drawing.Size(64, 13);
|
||||
this.label5.TabIndex = 19;
|
||||
this.label5.Text = "ScaleFactor";
|
||||
//
|
||||
@@ -331,17 +331,17 @@
|
||||
this.fbxFormat.Items.AddRange(new object[] {
|
||||
"Binary",
|
||||
"Ascii"});
|
||||
this.fbxFormat.Location = new System.Drawing.Point(77, 254);
|
||||
this.fbxFormat.Location = new System.Drawing.Point(77, 275);
|
||||
this.fbxFormat.Name = "fbxFormat";
|
||||
this.fbxFormat.Size = new System.Drawing.Size(61, 20);
|
||||
this.fbxFormat.Size = new System.Drawing.Size(61, 21);
|
||||
this.fbxFormat.TabIndex = 18;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(6, 258);
|
||||
this.label4.Location = new System.Drawing.Point(6, 280);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(59, 12);
|
||||
this.label4.Size = new System.Drawing.Size(59, 13);
|
||||
this.label4.TabIndex = 17;
|
||||
this.label4.Text = "FBXFormat";
|
||||
//
|
||||
@@ -356,25 +356,25 @@
|
||||
"7.3",
|
||||
"7.4",
|
||||
"7.5"});
|
||||
this.fbxVersion.Location = new System.Drawing.Point(77, 284);
|
||||
this.fbxVersion.Location = new System.Drawing.Point(77, 308);
|
||||
this.fbxVersion.Name = "fbxVersion";
|
||||
this.fbxVersion.Size = new System.Drawing.Size(47, 20);
|
||||
this.fbxVersion.Size = new System.Drawing.Size(47, 21);
|
||||
this.fbxVersion.TabIndex = 16;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(6, 287);
|
||||
this.label3.Location = new System.Drawing.Point(6, 311);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(65, 12);
|
||||
this.label3.Size = new System.Drawing.Size(62, 13);
|
||||
this.label3.TabIndex = 15;
|
||||
this.label3.Text = "FBXVersion";
|
||||
//
|
||||
// boneSize
|
||||
//
|
||||
this.boneSize.Location = new System.Drawing.Point(65, 197);
|
||||
this.boneSize.Location = new System.Drawing.Point(65, 213);
|
||||
this.boneSize.Name = "boneSize";
|
||||
this.boneSize.Size = new System.Drawing.Size(46, 21);
|
||||
this.boneSize.Size = new System.Drawing.Size(46, 20);
|
||||
this.boneSize.TabIndex = 11;
|
||||
this.boneSize.Value = new decimal(new int[] {
|
||||
10,
|
||||
@@ -385,9 +385,9 @@
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(6, 199);
|
||||
this.label2.Location = new System.Drawing.Point(6, 216);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(53, 12);
|
||||
this.label2.Size = new System.Drawing.Size(52, 13);
|
||||
this.label2.TabIndex = 10;
|
||||
this.label2.Text = "BoneSize";
|
||||
//
|
||||
@@ -396,9 +396,9 @@
|
||||
this.exportSkins.AutoSize = true;
|
||||
this.exportSkins.Checked = true;
|
||||
this.exportSkins.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.exportSkins.Location = new System.Drawing.Point(6, 83);
|
||||
this.exportSkins.Location = new System.Drawing.Point(6, 90);
|
||||
this.exportSkins.Name = "exportSkins";
|
||||
this.exportSkins.Size = new System.Drawing.Size(96, 16);
|
||||
this.exportSkins.Size = new System.Drawing.Size(83, 17);
|
||||
this.exportSkins.TabIndex = 8;
|
||||
this.exportSkins.Text = "Export skins";
|
||||
this.exportSkins.UseVisualStyleBackColor = true;
|
||||
@@ -406,9 +406,9 @@
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(26, 39);
|
||||
this.label1.Location = new System.Drawing.Point(26, 42);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(95, 12);
|
||||
this.label1.Size = new System.Drawing.Size(72, 13);
|
||||
this.label1.TabIndex = 7;
|
||||
this.label1.Text = "FilterPrecision";
|
||||
//
|
||||
@@ -420,9 +420,9 @@
|
||||
0,
|
||||
0,
|
||||
131072});
|
||||
this.filterPrecision.Location = new System.Drawing.Point(127, 37);
|
||||
this.filterPrecision.Location = new System.Drawing.Point(127, 40);
|
||||
this.filterPrecision.Name = "filterPrecision";
|
||||
this.filterPrecision.Size = new System.Drawing.Size(51, 21);
|
||||
this.filterPrecision.Size = new System.Drawing.Size(51, 20);
|
||||
this.filterPrecision.TabIndex = 6;
|
||||
this.filterPrecision.Value = new decimal(new int[] {
|
||||
25,
|
||||
@@ -433,9 +433,9 @@
|
||||
// castToBone
|
||||
//
|
||||
this.castToBone.AutoSize = true;
|
||||
this.castToBone.Location = new System.Drawing.Point(6, 149);
|
||||
this.castToBone.Location = new System.Drawing.Point(6, 161);
|
||||
this.castToBone.Name = "castToBone";
|
||||
this.castToBone.Size = new System.Drawing.Size(156, 16);
|
||||
this.castToBone.Size = new System.Drawing.Size(131, 17);
|
||||
this.castToBone.TabIndex = 5;
|
||||
this.castToBone.Text = "All nodes cast to bone";
|
||||
this.castToBone.UseVisualStyleBackColor = true;
|
||||
@@ -445,9 +445,9 @@
|
||||
this.exportAllNodes.AutoSize = true;
|
||||
this.exportAllNodes.Checked = true;
|
||||
this.exportAllNodes.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.exportAllNodes.Location = new System.Drawing.Point(6, 61);
|
||||
this.exportAllNodes.Location = new System.Drawing.Point(6, 66);
|
||||
this.exportAllNodes.Name = "exportAllNodes";
|
||||
this.exportAllNodes.Size = new System.Drawing.Size(120, 16);
|
||||
this.exportAllNodes.Size = new System.Drawing.Size(101, 17);
|
||||
this.exportAllNodes.TabIndex = 4;
|
||||
this.exportAllNodes.Text = "Export all nodes";
|
||||
this.exportAllNodes.UseVisualStyleBackColor = true;
|
||||
@@ -457,9 +457,9 @@
|
||||
this.eulerFilter.AutoSize = true;
|
||||
this.eulerFilter.Checked = true;
|
||||
this.eulerFilter.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.eulerFilter.Location = new System.Drawing.Point(6, 20);
|
||||
this.eulerFilter.Location = new System.Drawing.Point(6, 22);
|
||||
this.eulerFilter.Name = "eulerFilter";
|
||||
this.eulerFilter.Size = new System.Drawing.Size(90, 16);
|
||||
this.eulerFilter.Size = new System.Drawing.Size(72, 17);
|
||||
this.eulerFilter.TabIndex = 3;
|
||||
this.eulerFilter.Text = "EulerFilter";
|
||||
this.eulerFilter.UseVisualStyleBackColor = true;
|
||||
@@ -467,19 +467,19 @@
|
||||
// ExportOptions
|
||||
//
|
||||
this.AcceptButton = this.OKbutton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.Cancel;
|
||||
this.ClientSize = new System.Drawing.Size(486, 384);
|
||||
this.ClientSize = new System.Drawing.Size(486, 416);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.Cancel);
|
||||
this.Controls.Add(this.OKbutton);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ExportOptions";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Export options";
|
||||
this.TopMost = true;
|
||||
|
||||
@@ -120,4 +120,7 @@
|
||||
<metadata name="exportUvsTooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="exportUvsTooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -17,15 +17,12 @@ namespace AssetStudioGUI
|
||||
var type = Properties.Settings.Default.convertType;
|
||||
if (!TryExportFile(exportPath, item, "." + type.ToString().ToLower(), out var exportFullPath))
|
||||
return false;
|
||||
var image = m_Texture2D.ConvertToImage(true);
|
||||
if (image == null)
|
||||
var stream = m_Texture2D.ConvertToStream(type, true);
|
||||
if (stream == null)
|
||||
return false;
|
||||
using (image)
|
||||
using (stream)
|
||||
{
|
||||
using (var file = File.OpenWrite(exportFullPath))
|
||||
{
|
||||
image.WriteToStream(file, type);
|
||||
}
|
||||
File.WriteAllBytes(exportFullPath, stream.ToArray());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -152,7 +149,6 @@ namespace AssetStudioGUI
|
||||
#region UV
|
||||
if (m_Mesh.m_UV0?.Length > 0)
|
||||
{
|
||||
c = 4;
|
||||
if (m_Mesh.m_UV0.Length == m_Mesh.m_VertexCount * 2)
|
||||
{
|
||||
c = 2;
|
||||
@@ -233,15 +229,12 @@ namespace AssetStudioGUI
|
||||
var type = Properties.Settings.Default.convertType;
|
||||
if (!TryExportFile(exportPath, item, "." + type.ToString().ToLower(), out var exportFullPath))
|
||||
return false;
|
||||
var image = ((Sprite)item.Asset).GetImage();
|
||||
if (image != null)
|
||||
var stream = ((Sprite)item.Asset).GetImage(type);
|
||||
if (stream != null)
|
||||
{
|
||||
using (image)
|
||||
using (stream)
|
||||
{
|
||||
using (var file = File.OpenWrite(exportFullPath))
|
||||
{
|
||||
image.WriteToStream(file, type);
|
||||
}
|
||||
File.WriteAllBytes(exportFullPath, stream.ToArray());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace AssetStudioGUI
|
||||
{
|
||||
class GUILogger : ILogger
|
||||
{
|
||||
public bool ShowErrorMessage = true;
|
||||
public bool ShowErrorMessage = false;
|
||||
private Action<string> action;
|
||||
|
||||
public GUILogger(Action<string> action)
|
||||
|
||||
23
AssetStudioGUI/GUIProgress.cs
Normal file
23
AssetStudioGUI/GUIProgress.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AssetStudio;
|
||||
|
||||
namespace AssetStudioGUI
|
||||
{
|
||||
class GUIProgress : IProgress
|
||||
{
|
||||
private Action<int> action;
|
||||
|
||||
public GUIProgress(Action<int> action)
|
||||
{
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public void Report(int value)
|
||||
{
|
||||
action(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -265,7 +265,7 @@ namespace AssetStudioGUI
|
||||
Progress.Reset();
|
||||
foreach (var assetsFile in assetsManager.assetsFileList)
|
||||
{
|
||||
var fileNode = new TreeNode(assetsFile.fileName); //RootNode
|
||||
var fileNode = new GameObjectTreeNode(assetsFile.fileName); //RootNode
|
||||
|
||||
foreach (var obj in assetsFile.Objects)
|
||||
{
|
||||
@@ -307,12 +307,11 @@ namespace AssetStudioGUI
|
||||
{
|
||||
if (m_Father.m_GameObject.TryGet(out var parentGameObject))
|
||||
{
|
||||
if (!treeNodeDictionary.TryGetValue(parentGameObject, out var parentGameObjectNode))
|
||||
if (!treeNodeDictionary.TryGetValue(parentGameObject, out parentNode))
|
||||
{
|
||||
parentGameObjectNode = new GameObjectTreeNode(parentGameObject);
|
||||
treeNodeDictionary.Add(parentGameObject, parentGameObjectNode);
|
||||
parentNode = new GameObjectTreeNode(parentGameObject);
|
||||
treeNodeDictionary.Add(parentGameObject, parentNode);
|
||||
}
|
||||
parentNode = parentGameObjectNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -458,7 +457,7 @@ namespace AssetStudioGUI
|
||||
|
||||
if (Properties.Settings.Default.openAfterExport && exportedCount > 0)
|
||||
{
|
||||
OpenFolderInExplorer(savePath);
|
||||
Process.Start(savePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -503,7 +502,7 @@ namespace AssetStudioGUI
|
||||
|
||||
if (Properties.Settings.Default.openAfterExport && toExportAssets.Count() > 0)
|
||||
{
|
||||
OpenFolderInExplorer(savePath);
|
||||
Process.Start(savePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -515,7 +514,7 @@ namespace AssetStudioGUI
|
||||
var count = nodes.Cast<TreeNode>().Sum(x => x.Nodes.Count);
|
||||
int k = 0;
|
||||
Progress.Reset();
|
||||
foreach (TreeNode node in nodes)
|
||||
foreach (GameObjectTreeNode node in nodes)
|
||||
{
|
||||
//遍历一级子节点
|
||||
foreach (GameObjectTreeNode j in node.Nodes)
|
||||
@@ -563,7 +562,7 @@ namespace AssetStudioGUI
|
||||
}
|
||||
if (Properties.Settings.Default.openAfterExport)
|
||||
{
|
||||
OpenFolderInExplorer(savePath);
|
||||
Process.Start(savePath);
|
||||
}
|
||||
StatusStripUpdate("Finished");
|
||||
});
|
||||
@@ -589,7 +588,7 @@ namespace AssetStudioGUI
|
||||
ExportAnimator(animator, exportPath, animationList);
|
||||
if (Properties.Settings.Default.openAfterExport)
|
||||
{
|
||||
OpenFolderInExplorer(exportPath);
|
||||
Process.Start(exportPath);
|
||||
}
|
||||
Progress.Report(1, 1);
|
||||
StatusStripUpdate($"Finished exporting {animator.Text}");
|
||||
@@ -631,12 +630,12 @@ namespace AssetStudioGUI
|
||||
}
|
||||
if (Properties.Settings.Default.openAfterExport)
|
||||
{
|
||||
OpenFolderInExplorer(exportPath);
|
||||
Process.Start(exportPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusStripUpdate("No Object selected for export.");
|
||||
StatusStripUpdate("No Object can be exported.");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -661,18 +660,18 @@ namespace AssetStudioGUI
|
||||
}
|
||||
if (Properties.Settings.Default.openAfterExport)
|
||||
{
|
||||
OpenFolderInExplorer(Path.GetDirectoryName(exportPath));
|
||||
Process.Start(Path.GetDirectoryName(exportPath));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void GetSelectedParentNode(TreeNodeCollection nodes, List<GameObject> gameObjects)
|
||||
{
|
||||
foreach (TreeNode i in nodes)
|
||||
foreach (GameObjectTreeNode i in nodes)
|
||||
{
|
||||
if (i is GameObjectTreeNode gameObjectTreeNode && i.Checked)
|
||||
if (i.Checked)
|
||||
{
|
||||
gameObjects.Add(gameObjectTreeNode.gameObject);
|
||||
gameObjects.Add(i.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -709,12 +708,5 @@ namespace AssetStudioGUI
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static void OpenFolderInExplorer(string path)
|
||||
{
|
||||
var info = new ProcessStartInfo(path);
|
||||
info.UseShellExecute = true;
|
||||
Process.Start(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net472;netstandard2.0;net5.0;net6.0</TargetFrameworks>
|
||||
<Version>0.16.0.0</Version>
|
||||
<AssemblyVersion>0.16.0.0</AssemblyVersion>
|
||||
<FileVersion>0.16.0.0</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2018-2022</Copyright>
|
||||
<DebugType>embedded</DebugType>
|
||||
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
|
||||
<Version>0.16.8.1</Version>
|
||||
<AssemblyVersion>0.16.8.1</AssemblyVersion>
|
||||
<FileVersion>0.16.8.1</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2018-2021</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net472|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Mono.Cecil" Version="0.11.3" />
|
||||
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta13" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -94,29 +94,29 @@ namespace AssetStudio
|
||||
{
|
||||
switch (m_AudioClip.m_Type)
|
||||
{
|
||||
case FMODSoundType.ACC:
|
||||
case AudioType.ACC:
|
||||
return ".m4a";
|
||||
case FMODSoundType.AIFF:
|
||||
case AudioType.AIFF:
|
||||
return ".aif";
|
||||
case FMODSoundType.IT:
|
||||
case AudioType.IT:
|
||||
return ".it";
|
||||
case FMODSoundType.MOD:
|
||||
case AudioType.MOD:
|
||||
return ".mod";
|
||||
case FMODSoundType.MPEG:
|
||||
case AudioType.MPEG:
|
||||
return ".mp3";
|
||||
case FMODSoundType.OGGVORBIS:
|
||||
case AudioType.OGGVORBIS:
|
||||
return ".ogg";
|
||||
case FMODSoundType.S3M:
|
||||
case AudioType.S3M:
|
||||
return ".s3m";
|
||||
case FMODSoundType.WAV:
|
||||
case AudioType.WAV:
|
||||
return ".wav";
|
||||
case FMODSoundType.XM:
|
||||
case AudioType.XM:
|
||||
return ".xm";
|
||||
case FMODSoundType.XMA:
|
||||
case AudioType.XMA:
|
||||
return ".wav";
|
||||
case FMODSoundType.VAG:
|
||||
case AudioType.VAG:
|
||||
return ".vag";
|
||||
case FMODSoundType.AUDIOQUEUE:
|
||||
case AudioType.AUDIOQUEUE:
|
||||
return ".fsb";
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace AssetStudio
|
||||
return ".fsb";
|
||||
case AudioCompressionFormat.MP3:
|
||||
return ".fsb";
|
||||
case AudioCompressionFormat.PSMVAG:
|
||||
case AudioCompressionFormat.VAG:
|
||||
return ".fsb";
|
||||
case AudioCompressionFormat.HEVAG:
|
||||
return ".fsb";
|
||||
@@ -159,13 +159,13 @@ namespace AssetStudio
|
||||
{
|
||||
switch (m_AudioClip.m_Type)
|
||||
{
|
||||
case FMODSoundType.AIFF:
|
||||
case FMODSoundType.IT:
|
||||
case FMODSoundType.MOD:
|
||||
case FMODSoundType.S3M:
|
||||
case FMODSoundType.XM:
|
||||
case FMODSoundType.XMA:
|
||||
case FMODSoundType.AUDIOQUEUE:
|
||||
case AudioType.AIFF:
|
||||
case AudioType.IT:
|
||||
case AudioType.MOD:
|
||||
case AudioType.S3M:
|
||||
case AudioType.XM:
|
||||
case AudioType.XMA:
|
||||
case AudioType.AUDIOQUEUE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -1,55 +1,32 @@
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Formats.Bmp;
|
||||
using SixLabors.ImageSharp.Formats.Tga;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using TGASharpLib;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public static class ImageExtensions
|
||||
{
|
||||
public static void WriteToStream(this Image image, Stream stream, ImageFormat imageFormat)
|
||||
public static MemoryStream ConvertToStream(this Bitmap image, ImageFormat imageFormat)
|
||||
{
|
||||
var outputStream = new MemoryStream();
|
||||
switch (imageFormat)
|
||||
{
|
||||
case ImageFormat.Jpeg:
|
||||
image.SaveAsJpeg(stream);
|
||||
image.Save(outputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
break;
|
||||
case ImageFormat.Png:
|
||||
image.SaveAsPng(stream);
|
||||
image.Save(outputStream, System.Drawing.Imaging.ImageFormat.Png);
|
||||
break;
|
||||
case ImageFormat.Bmp:
|
||||
image.Save(stream, new BmpEncoder
|
||||
{
|
||||
BitsPerPixel = BmpBitsPerPixel.Pixel32,
|
||||
SupportTransparency = true
|
||||
});
|
||||
image.Save(outputStream, System.Drawing.Imaging.ImageFormat.Bmp);
|
||||
break;
|
||||
case ImageFormat.Tga:
|
||||
image.Save(stream, new TgaEncoder
|
||||
{
|
||||
BitsPerPixel = TgaBitsPerPixel.Pixel32,
|
||||
Compression = TgaCompression.None
|
||||
});
|
||||
var tga = new TGA(image);
|
||||
tga.Save(outputStream);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static MemoryStream ConvertToStream(this Image image, ImageFormat imageFormat)
|
||||
{
|
||||
var stream = new MemoryStream();
|
||||
image.WriteToStream(stream, imageFormat);
|
||||
return stream;
|
||||
}
|
||||
|
||||
public static byte[] ConvertToBytes<TPixel>(this Image<TPixel> image) where TPixel : unmanaged, IPixel<TPixel>
|
||||
{
|
||||
if (image.TryGetSinglePixelSpan(out var pixelSpan))
|
||||
{
|
||||
return MemoryMarshal.AsBytes(pixelSpan).ToArray();
|
||||
}
|
||||
return null;
|
||||
image.Dispose();
|
||||
return outputStream;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1063,21 +1063,26 @@ namespace AssetStudio
|
||||
else
|
||||
{
|
||||
transformName = strs.Last();
|
||||
var parentFramePath = path.Substring(0, path.LastIndexOf('/'));
|
||||
parentFrame = RootFrame.FindRelativeFrameWithPath(parentFramePath);
|
||||
var parentFrameName = strs[strs.Length - 2];
|
||||
parentFrame = RootFrame.FindChild(parentFrameName);
|
||||
//var parentFramePath = path.Substring(0, path.LastIndexOf('/'));
|
||||
//parentFrame = RootFrame.FindFrameByPath(parentFramePath);
|
||||
}
|
||||
|
||||
var skeletonPose = avatar.m_Avatar.m_DefaultPose;
|
||||
var xform = skeletonPose.m_X[i];
|
||||
|
||||
var frame = RootFrame.FindChild(transformName);
|
||||
if (frame != null)
|
||||
{
|
||||
SetFrame(frame, xform.t, xform.q, xform.s);
|
||||
parentFrame.AddChild(frame);
|
||||
}
|
||||
else
|
||||
{
|
||||
frame = CreateFrame(transformName, xform.t, xform.q, xform.s);
|
||||
parentFrame.AddChild(frame);
|
||||
}
|
||||
parentFrame.AddChild(frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using K4os.Compression.LZ4;
|
||||
using System;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Lz4;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
@@ -15,11 +15,13 @@ namespace AssetStudio
|
||||
if (shader.m_SubProgramBlob != null) //5.3 - 5.4
|
||||
{
|
||||
var decompressedBytes = new byte[shader.decompressedSize];
|
||||
LZ4Codec.Decode(shader.m_SubProgramBlob, decompressedBytes);
|
||||
using (var decoder = new Lz4DecoderStream(new MemoryStream(shader.m_SubProgramBlob)))
|
||||
{
|
||||
decoder.Read(decompressedBytes, 0, (int)shader.decompressedSize);
|
||||
}
|
||||
using (var blobReader = new BinaryReader(new MemoryStream(decompressedBytes)))
|
||||
{
|
||||
var program = new ShaderProgram(blobReader, shader.version);
|
||||
program.Read(blobReader, 0);
|
||||
return header + program.Export(Encoding.UTF8.GetString(shader.m_Script));
|
||||
}
|
||||
}
|
||||
@@ -34,25 +36,19 @@ namespace AssetStudio
|
||||
|
||||
private static string ConvertSerializedShader(Shader shader)
|
||||
{
|
||||
var length = shader.platforms.Length;
|
||||
var shaderPrograms = new ShaderProgram[length];
|
||||
for (var i = 0; i < length; i++)
|
||||
var shaderPrograms = new ShaderProgram[shader.platforms.Length];
|
||||
for (var i = 0; i < shader.platforms.Length; i++)
|
||||
{
|
||||
for (var j = 0; j < shader.offsets[i].Length; j++)
|
||||
var compressedBytes = new byte[shader.compressedLengths[i]];
|
||||
Buffer.BlockCopy(shader.compressedBlob, (int)shader.offsets[i], compressedBytes, 0, (int)shader.compressedLengths[i]);
|
||||
var decompressedBytes = new byte[shader.decompressedLengths[i]];
|
||||
using (var decoder = new Lz4DecoderStream(new MemoryStream(compressedBytes)))
|
||||
{
|
||||
var offset = shader.offsets[i][j];
|
||||
var compressedLength = shader.compressedLengths[i][j];
|
||||
var decompressedLength = shader.decompressedLengths[i][j];
|
||||
var decompressedBytes = new byte[decompressedLength];
|
||||
LZ4Codec.Decode(shader.compressedBlob, (int)offset, (int)compressedLength, decompressedBytes, 0, (int)decompressedLength);
|
||||
using (var blobReader = new BinaryReader(new MemoryStream(decompressedBytes)))
|
||||
{
|
||||
if (j == 0)
|
||||
{
|
||||
shaderPrograms[i] = new ShaderProgram(blobReader, shader.version);
|
||||
}
|
||||
shaderPrograms[i].Read(blobReader, j);
|
||||
}
|
||||
decoder.Read(decompressedBytes, 0, (int)shader.decompressedLengths[i]);
|
||||
}
|
||||
using (var blobReader = new BinaryReader(new MemoryStream(decompressedBytes)))
|
||||
{
|
||||
shaderPrograms[i] = new ShaderProgram(blobReader, shader.version);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,17 +105,17 @@ namespace AssetStudio
|
||||
var sb = new StringBuilder();
|
||||
switch (m_Passe.m_Type)
|
||||
{
|
||||
case PassType.Normal:
|
||||
case PassType.kPassTypeNormal:
|
||||
sb.Append(" Pass ");
|
||||
break;
|
||||
case PassType.Use:
|
||||
case PassType.kPassTypeUse:
|
||||
sb.Append(" UsePass ");
|
||||
break;
|
||||
case PassType.Grab:
|
||||
case PassType.kPassTypeGrab:
|
||||
sb.Append(" GrabPass ");
|
||||
break;
|
||||
}
|
||||
if (m_Passe.m_Type == PassType.Use)
|
||||
if (m_Passe.m_Type == PassType.kPassTypeUse)
|
||||
{
|
||||
sb.Append($"\"{m_Passe.m_UseName}\"\n");
|
||||
}
|
||||
@@ -127,7 +123,7 @@ namespace AssetStudio
|
||||
{
|
||||
sb.Append("{\n");
|
||||
|
||||
if (m_Passe.m_Type == PassType.Grab)
|
||||
if (m_Passe.m_Type == PassType.kPassTypeGrab)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(m_Passe.m_TextureName))
|
||||
{
|
||||
@@ -358,7 +354,7 @@ namespace AssetStudio
|
||||
sb.Append(" }\n");
|
||||
}
|
||||
|
||||
if (m_State.fogMode != FogMode.Unknown ||
|
||||
if (m_State.fogMode != FogMode.kFogUnknown ||
|
||||
m_State.fogColor.x.val != 0f ||
|
||||
m_State.fogColor.y.val != 0f ||
|
||||
m_State.fogColor.z.val != 0f ||
|
||||
@@ -368,21 +364,21 @@ namespace AssetStudio
|
||||
m_State.fogEnd.val != 0f)
|
||||
{
|
||||
sb.Append(" Fog {\n");
|
||||
if (m_State.fogMode != FogMode.Unknown)
|
||||
if (m_State.fogMode != FogMode.kFogUnknown)
|
||||
{
|
||||
sb.Append(" Mode ");
|
||||
switch (m_State.fogMode)
|
||||
{
|
||||
case FogMode.Disabled:
|
||||
case FogMode.kFogDisabled:
|
||||
sb.Append("Off");
|
||||
break;
|
||||
case FogMode.Linear:
|
||||
case FogMode.kFogLinear:
|
||||
sb.Append("Linear");
|
||||
break;
|
||||
case FogMode.Exp:
|
||||
case FogMode.kFogExp:
|
||||
sb.Append("Exp");
|
||||
break;
|
||||
case FogMode.Exp2:
|
||||
case FogMode.kFogExp2:
|
||||
sb.Append("Exp2");
|
||||
break;
|
||||
}
|
||||
@@ -674,37 +670,37 @@ namespace AssetStudio
|
||||
sb.Append($"{m_Prop.m_Name} (\"{m_Prop.m_Description}\", ");
|
||||
switch (m_Prop.m_Type)
|
||||
{
|
||||
case SerializedPropertyType.Color:
|
||||
case SerializedPropertyType.kColor:
|
||||
sb.Append("Color");
|
||||
break;
|
||||
case SerializedPropertyType.Vector:
|
||||
case SerializedPropertyType.kVector:
|
||||
sb.Append("Vector");
|
||||
break;
|
||||
case SerializedPropertyType.Float:
|
||||
case SerializedPropertyType.kFloat:
|
||||
sb.Append("Float");
|
||||
break;
|
||||
case SerializedPropertyType.Range:
|
||||
case SerializedPropertyType.kRange:
|
||||
sb.Append($"Range({m_Prop.m_DefValue[1]}, {m_Prop.m_DefValue[2]})");
|
||||
break;
|
||||
case SerializedPropertyType.Texture:
|
||||
case SerializedPropertyType.kTexture:
|
||||
switch (m_Prop.m_DefTexture.m_TexDim)
|
||||
{
|
||||
case TextureDimension.Any:
|
||||
case TextureDimension.kTexDimAny:
|
||||
sb.Append("any");
|
||||
break;
|
||||
case TextureDimension.Tex2D:
|
||||
case TextureDimension.kTexDim2D:
|
||||
sb.Append("2D");
|
||||
break;
|
||||
case TextureDimension.Tex3D:
|
||||
case TextureDimension.kTexDim3D:
|
||||
sb.Append("3D");
|
||||
break;
|
||||
case TextureDimension.Cube:
|
||||
case TextureDimension.kTexDimCUBE:
|
||||
sb.Append("Cube");
|
||||
break;
|
||||
case TextureDimension.Tex2DArray:
|
||||
case TextureDimension.kTexDim2DArray:
|
||||
sb.Append("2DArray");
|
||||
break;
|
||||
case TextureDimension.CubeArray:
|
||||
case TextureDimension.kTexDimCubeArray:
|
||||
sb.Append("CubeArray");
|
||||
break;
|
||||
}
|
||||
@@ -713,15 +709,15 @@ namespace AssetStudio
|
||||
sb.Append(") = ");
|
||||
switch (m_Prop.m_Type)
|
||||
{
|
||||
case SerializedPropertyType.Color:
|
||||
case SerializedPropertyType.Vector:
|
||||
case SerializedPropertyType.kColor:
|
||||
case SerializedPropertyType.kVector:
|
||||
sb.Append($"({m_Prop.m_DefValue[0]},{m_Prop.m_DefValue[1]},{m_Prop.m_DefValue[2]},{m_Prop.m_DefValue[3]})");
|
||||
break;
|
||||
case SerializedPropertyType.Float:
|
||||
case SerializedPropertyType.Range:
|
||||
case SerializedPropertyType.kFloat:
|
||||
case SerializedPropertyType.kRange:
|
||||
sb.Append(m_Prop.m_DefValue[0]);
|
||||
break;
|
||||
case SerializedPropertyType.Texture:
|
||||
case SerializedPropertyType.kTexture:
|
||||
sb.Append($"\"{m_Prop.m_DefTexture.m_DefaultName}\" {{ }}");
|
||||
break;
|
||||
default:
|
||||
@@ -735,65 +731,64 @@ namespace AssetStudio
|
||||
{
|
||||
switch (platform)
|
||||
{
|
||||
case ShaderCompilerPlatform.GL:
|
||||
return programType == ShaderGpuProgramType.GLLegacy;
|
||||
case ShaderCompilerPlatform.D3D9:
|
||||
return programType == ShaderGpuProgramType.DX9VertexSM20
|
||||
|| programType == ShaderGpuProgramType.DX9VertexSM30
|
||||
|| programType == ShaderGpuProgramType.DX9PixelSM20
|
||||
|| programType == ShaderGpuProgramType.DX9PixelSM30;
|
||||
case ShaderCompilerPlatform.Xbox360:
|
||||
case ShaderCompilerPlatform.PS3:
|
||||
case ShaderCompilerPlatform.PSP2:
|
||||
case ShaderCompilerPlatform.PS4:
|
||||
case ShaderCompilerPlatform.XboxOne:
|
||||
case ShaderCompilerPlatform.N3DS:
|
||||
case ShaderCompilerPlatform.WiiU:
|
||||
case ShaderCompilerPlatform.Switch:
|
||||
case ShaderCompilerPlatform.XboxOneD3D12:
|
||||
case ShaderCompilerPlatform.GameCoreXboxOne:
|
||||
case ShaderCompilerPlatform.GameCoreScarlett:
|
||||
case ShaderCompilerPlatform.PS5:
|
||||
return programType == ShaderGpuProgramType.ConsoleVS
|
||||
|| programType == ShaderGpuProgramType.ConsoleFS
|
||||
|| programType == ShaderGpuProgramType.ConsoleHS
|
||||
|| programType == ShaderGpuProgramType.ConsoleDS
|
||||
|| programType == ShaderGpuProgramType.ConsoleGS;
|
||||
case ShaderCompilerPlatform.PS5NGGC:
|
||||
return programType == ShaderGpuProgramType.PS5NGGC;
|
||||
case ShaderCompilerPlatform.D3D11:
|
||||
return programType == ShaderGpuProgramType.DX11VertexSM40
|
||||
|| programType == ShaderGpuProgramType.DX11VertexSM50
|
||||
|| programType == ShaderGpuProgramType.DX11PixelSM40
|
||||
|| programType == ShaderGpuProgramType.DX11PixelSM50
|
||||
|| programType == ShaderGpuProgramType.DX11GeometrySM40
|
||||
|| programType == ShaderGpuProgramType.DX11GeometrySM50
|
||||
|| programType == ShaderGpuProgramType.DX11HullSM50
|
||||
|| programType == ShaderGpuProgramType.DX11DomainSM50;
|
||||
case ShaderCompilerPlatform.GLES20:
|
||||
return programType == ShaderGpuProgramType.GLES;
|
||||
case ShaderCompilerPlatform.NaCl: //Obsolete
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformGL:
|
||||
return programType == ShaderGpuProgramType.kShaderGpuProgramGLLegacy;
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformD3D9:
|
||||
return programType == ShaderGpuProgramType.kShaderGpuProgramDX9VertexSM20
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX9VertexSM30
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX9PixelSM20
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX9PixelSM30;
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformXbox360:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPS3:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPSP2:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPS4:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformXboxOne:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformN3DS:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformWiiU:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformSwitch:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformXboxOneD3D12:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformGameCoreXboxOne:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformGameCoreScarlett:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPS5:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPS5NGGC:
|
||||
return programType == ShaderGpuProgramType.kShaderGpuProgramConsoleVS
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramConsoleFS
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramConsoleHS
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramConsoleDS
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramConsoleGS;
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformD3D11:
|
||||
return programType == ShaderGpuProgramType.kShaderGpuProgramDX11VertexSM40
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX11VertexSM50
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX11PixelSM40
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX11PixelSM50
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX11GeometrySM40
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX11GeometrySM50
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX11HullSM50
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX11DomainSM50;
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformGLES20:
|
||||
return programType == ShaderGpuProgramType.kShaderGpuProgramGLES;
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformNaCl: //Obsolete
|
||||
throw new NotSupportedException();
|
||||
case ShaderCompilerPlatform.Flash: //Obsolete
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformFlash: //Obsolete
|
||||
throw new NotSupportedException();
|
||||
case ShaderCompilerPlatform.D3D11_9x:
|
||||
return programType == ShaderGpuProgramType.DX10Level9Vertex
|
||||
|| programType == ShaderGpuProgramType.DX10Level9Pixel;
|
||||
case ShaderCompilerPlatform.GLES3Plus:
|
||||
return programType == ShaderGpuProgramType.GLES31AEP
|
||||
|| programType == ShaderGpuProgramType.GLES31
|
||||
|| programType == ShaderGpuProgramType.GLES3;
|
||||
case ShaderCompilerPlatform.PSM: //Unknown
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformD3D11_9x:
|
||||
return programType == ShaderGpuProgramType.kShaderGpuProgramDX10Level9Vertex
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramDX10Level9Pixel;
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformGLES3Plus:
|
||||
return programType == ShaderGpuProgramType.kShaderGpuProgramGLES31AEP
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramGLES31
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramGLES3;
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPSM: //Unknown
|
||||
throw new NotSupportedException();
|
||||
case ShaderCompilerPlatform.Metal:
|
||||
return programType == ShaderGpuProgramType.MetalVS
|
||||
|| programType == ShaderGpuProgramType.MetalFS;
|
||||
case ShaderCompilerPlatform.OpenGLCore:
|
||||
return programType == ShaderGpuProgramType.GLCore32
|
||||
|| programType == ShaderGpuProgramType.GLCore41
|
||||
|| programType == ShaderGpuProgramType.GLCore43;
|
||||
case ShaderCompilerPlatform.Vulkan:
|
||||
return programType == ShaderGpuProgramType.SPIRV;
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformMetal:
|
||||
return programType == ShaderGpuProgramType.kShaderGpuProgramMetalVS
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramMetalFS;
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformOpenGLCore:
|
||||
return programType == ShaderGpuProgramType.kShaderGpuProgramGLCore32
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramGLCore41
|
||||
|| programType == ShaderGpuProgramType.kShaderGpuProgramGLCore43;
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformVulkan:
|
||||
return programType == ShaderGpuProgramType.kShaderGpuProgramSPIRV;
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
@@ -803,55 +798,55 @@ namespace AssetStudio
|
||||
{
|
||||
switch (platform)
|
||||
{
|
||||
case ShaderCompilerPlatform.GL:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformGL:
|
||||
return "openGL";
|
||||
case ShaderCompilerPlatform.D3D9:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformD3D9:
|
||||
return "d3d9";
|
||||
case ShaderCompilerPlatform.Xbox360:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformXbox360:
|
||||
return "xbox360";
|
||||
case ShaderCompilerPlatform.PS3:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPS3:
|
||||
return "ps3";
|
||||
case ShaderCompilerPlatform.D3D11:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformD3D11:
|
||||
return "d3d11";
|
||||
case ShaderCompilerPlatform.GLES20:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformGLES20:
|
||||
return "gles";
|
||||
case ShaderCompilerPlatform.NaCl:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformNaCl:
|
||||
return "glesdesktop";
|
||||
case ShaderCompilerPlatform.Flash:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformFlash:
|
||||
return "flash";
|
||||
case ShaderCompilerPlatform.D3D11_9x:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformD3D11_9x:
|
||||
return "d3d11_9x";
|
||||
case ShaderCompilerPlatform.GLES3Plus:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformGLES3Plus:
|
||||
return "gles3";
|
||||
case ShaderCompilerPlatform.PSP2:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPSP2:
|
||||
return "psp2";
|
||||
case ShaderCompilerPlatform.PS4:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPS4:
|
||||
return "ps4";
|
||||
case ShaderCompilerPlatform.XboxOne:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformXboxOne:
|
||||
return "xboxone";
|
||||
case ShaderCompilerPlatform.PSM:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPSM:
|
||||
return "psm";
|
||||
case ShaderCompilerPlatform.Metal:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformMetal:
|
||||
return "metal";
|
||||
case ShaderCompilerPlatform.OpenGLCore:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformOpenGLCore:
|
||||
return "glcore";
|
||||
case ShaderCompilerPlatform.N3DS:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformN3DS:
|
||||
return "n3ds";
|
||||
case ShaderCompilerPlatform.WiiU:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformWiiU:
|
||||
return "wiiu";
|
||||
case ShaderCompilerPlatform.Vulkan:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformVulkan:
|
||||
return "vulkan";
|
||||
case ShaderCompilerPlatform.Switch:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformSwitch:
|
||||
return "switch";
|
||||
case ShaderCompilerPlatform.XboxOneD3D12:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformXboxOneD3D12:
|
||||
return "xboxone_d3d12";
|
||||
case ShaderCompilerPlatform.GameCoreXboxOne:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformGameCoreXboxOne:
|
||||
return "xboxone";
|
||||
case ShaderCompilerPlatform.GameCoreScarlett:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformGameCoreScarlett:
|
||||
return "xbox_scarlett";
|
||||
case ShaderCompilerPlatform.PS5:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPS5:
|
||||
return "ps5";
|
||||
case ShaderCompilerPlatform.PS5NGGC:
|
||||
case ShaderCompilerPlatform.kShaderCompPlatformPS5NGGC:
|
||||
return "ps5_nggc";
|
||||
default:
|
||||
return "unknown";
|
||||
@@ -865,49 +860,29 @@ namespace AssetStudio
|
||||
"///////////////////////////////////////////\n";
|
||||
}
|
||||
|
||||
public class ShaderSubProgramEntry
|
||||
{
|
||||
public int Offset;
|
||||
public int Length;
|
||||
public int Segment;
|
||||
|
||||
public ShaderSubProgramEntry(BinaryReader reader, int[] version)
|
||||
{
|
||||
Offset = reader.ReadInt32();
|
||||
Length = reader.ReadInt32();
|
||||
if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up
|
||||
{
|
||||
Segment = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ShaderProgram
|
||||
{
|
||||
public ShaderSubProgramEntry[] entries;
|
||||
public ShaderSubProgram[] m_SubPrograms;
|
||||
|
||||
public ShaderProgram(BinaryReader reader, int[] version)
|
||||
{
|
||||
var subProgramsCapacity = reader.ReadInt32();
|
||||
entries = new ShaderSubProgramEntry[subProgramsCapacity];
|
||||
m_SubPrograms = new ShaderSubProgram[subProgramsCapacity];
|
||||
int entrySize;
|
||||
if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up
|
||||
{
|
||||
entrySize = 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
entrySize = 8;
|
||||
}
|
||||
for (int i = 0; i < subProgramsCapacity; i++)
|
||||
{
|
||||
entries[i] = new ShaderSubProgramEntry(reader, version);
|
||||
}
|
||||
m_SubPrograms = new ShaderSubProgram[subProgramsCapacity];
|
||||
}
|
||||
|
||||
public void Read(BinaryReader reader, int segment)
|
||||
{
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
if (entry.Segment == segment)
|
||||
{
|
||||
reader.BaseStream.Position = entry.Offset;
|
||||
m_SubPrograms[i] = new ShaderSubProgram(reader);
|
||||
}
|
||||
reader.BaseStream.Position = 4 + i * entrySize;
|
||||
var offset = reader.ReadInt32();
|
||||
reader.BaseStream.Position = offset;
|
||||
m_SubPrograms[i] = new ShaderSubProgram(reader);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -997,36 +972,36 @@ namespace AssetStudio
|
||||
{
|
||||
switch (m_ProgramType)
|
||||
{
|
||||
case ShaderGpuProgramType.GLLegacy:
|
||||
case ShaderGpuProgramType.GLES31AEP:
|
||||
case ShaderGpuProgramType.GLES31:
|
||||
case ShaderGpuProgramType.GLES3:
|
||||
case ShaderGpuProgramType.GLES:
|
||||
case ShaderGpuProgramType.GLCore32:
|
||||
case ShaderGpuProgramType.GLCore41:
|
||||
case ShaderGpuProgramType.GLCore43:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramGLLegacy:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramGLES31AEP:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramGLES31:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramGLES3:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramGLES:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramGLCore32:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramGLCore41:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramGLCore43:
|
||||
sb.Append(Encoding.UTF8.GetString(m_ProgramCode));
|
||||
break;
|
||||
case ShaderGpuProgramType.DX9VertexSM20:
|
||||
case ShaderGpuProgramType.DX9VertexSM30:
|
||||
case ShaderGpuProgramType.DX9PixelSM20:
|
||||
case ShaderGpuProgramType.DX9PixelSM30:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX9VertexSM20:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX9VertexSM30:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX9PixelSM20:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX9PixelSM30:
|
||||
{
|
||||
/*var shaderBytecode = new ShaderBytecode(m_ProgramCode);
|
||||
sb.Append(shaderBytecode.Disassemble());*/
|
||||
sb.Append("// shader disassembly not supported on DXBC");
|
||||
break;
|
||||
}
|
||||
case ShaderGpuProgramType.DX10Level9Vertex:
|
||||
case ShaderGpuProgramType.DX10Level9Pixel:
|
||||
case ShaderGpuProgramType.DX11VertexSM40:
|
||||
case ShaderGpuProgramType.DX11VertexSM50:
|
||||
case ShaderGpuProgramType.DX11PixelSM40:
|
||||
case ShaderGpuProgramType.DX11PixelSM50:
|
||||
case ShaderGpuProgramType.DX11GeometrySM40:
|
||||
case ShaderGpuProgramType.DX11GeometrySM50:
|
||||
case ShaderGpuProgramType.DX11HullSM50:
|
||||
case ShaderGpuProgramType.DX11DomainSM50:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX10Level9Vertex:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX10Level9Pixel:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX11VertexSM40:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX11VertexSM50:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX11PixelSM40:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX11PixelSM50:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX11GeometrySM40:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX11GeometrySM50:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX11HullSM50:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramDX11DomainSM50:
|
||||
{
|
||||
/*int start = 6;
|
||||
if (m_Version == 201509030) // 5.3
|
||||
@@ -1040,8 +1015,8 @@ namespace AssetStudio
|
||||
sb.Append("// shader disassembly not supported on DXBC");
|
||||
break;
|
||||
}
|
||||
case ShaderGpuProgramType.MetalVS:
|
||||
case ShaderGpuProgramType.MetalFS:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramMetalVS:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramMetalFS:
|
||||
using (var reader = new BinaryReader(new MemoryStream(m_ProgramCode)))
|
||||
{
|
||||
var fourCC = reader.ReadUInt32();
|
||||
@@ -1055,7 +1030,7 @@ namespace AssetStudio
|
||||
sb.Append(Encoding.UTF8.GetString(buff));
|
||||
}
|
||||
break;
|
||||
case ShaderGpuProgramType.SPIRV:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramSPIRV:
|
||||
try
|
||||
{
|
||||
sb.Append(SpirVShaderConverter.Convert(m_ProgramCode));
|
||||
@@ -1065,11 +1040,11 @@ namespace AssetStudio
|
||||
sb.Append($"// disassembly error {e.Message}\n");
|
||||
}
|
||||
break;
|
||||
case ShaderGpuProgramType.ConsoleVS:
|
||||
case ShaderGpuProgramType.ConsoleFS:
|
||||
case ShaderGpuProgramType.ConsoleHS:
|
||||
case ShaderGpuProgramType.ConsoleDS:
|
||||
case ShaderGpuProgramType.ConsoleGS:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramConsoleVS:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramConsoleFS:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramConsoleHS:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramConsoleDS:
|
||||
case ShaderGpuProgramType.kShaderGpuProgramConsoleGS:
|
||||
sb.Append(Encoding.UTF8.GetString(m_ProgramCode));
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -1,105 +1,128 @@
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Drawing;
|
||||
using SixLabors.ImageSharp.Drawing.Processing;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public static class SpriteHelper
|
||||
{
|
||||
public static Image<Bgra32> GetImage(this Sprite m_Sprite)
|
||||
public static MemoryStream GetImage(this Sprite m_Sprite, ImageFormat imageFormat)
|
||||
{
|
||||
var image = GetImage(m_Sprite);
|
||||
if (image != null)
|
||||
{
|
||||
using (image)
|
||||
{
|
||||
return image.ConvertToStream(imageFormat);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Bitmap GetImage(this Sprite m_Sprite)
|
||||
{
|
||||
if (m_Sprite.m_SpriteAtlas != null && m_Sprite.m_SpriteAtlas.TryGet(out var m_SpriteAtlas))
|
||||
{
|
||||
if (m_SpriteAtlas.m_RenderDataMap.TryGetValue(m_Sprite.m_RenderDataKey, out var spriteAtlasData) && spriteAtlasData.texture.TryGet(out var m_Texture2D))
|
||||
{
|
||||
return CutImage(m_Sprite, m_Texture2D, spriteAtlasData.textureRect, spriteAtlasData.textureRectOffset, spriteAtlasData.downscaleMultiplier, spriteAtlasData.settingsRaw);
|
||||
return CutImage(m_Texture2D, m_Sprite, spriteAtlasData.textureRect, spriteAtlasData.textureRectOffset, spriteAtlasData.settingsRaw);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Sprite.m_RD.texture.TryGet(out var m_Texture2D))
|
||||
{
|
||||
return CutImage(m_Sprite, m_Texture2D, m_Sprite.m_RD.textureRect, m_Sprite.m_RD.textureRectOffset, m_Sprite.m_RD.downscaleMultiplier, m_Sprite.m_RD.settingsRaw);
|
||||
return CutImage(m_Texture2D, m_Sprite, m_Sprite.m_RD.textureRect, m_Sprite.m_RD.textureRectOffset, m_Sprite.m_RD.settingsRaw);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Image<Bgra32> CutImage(Sprite m_Sprite, Texture2D m_Texture2D, Rectf textureRect, Vector2 textureRectOffset, float downscaleMultiplier, SpriteSettings settingsRaw)
|
||||
private static Bitmap CutImage(Texture2D m_Texture2D, Sprite m_Sprite, Rectf textureRect, Vector2 textureRectOffset, SpriteSettings settingsRaw)
|
||||
{
|
||||
var originalImage = m_Texture2D.ConvertToImage(false);
|
||||
var originalImage = m_Texture2D.ConvertToBitmap(false);
|
||||
if (originalImage != null)
|
||||
{
|
||||
using (originalImage)
|
||||
{
|
||||
if (downscaleMultiplier > 0f && downscaleMultiplier != 1f)
|
||||
{
|
||||
var width = (int)(m_Texture2D.m_Width / downscaleMultiplier);
|
||||
var height = (int)(m_Texture2D.m_Height / downscaleMultiplier);
|
||||
originalImage.Mutate(x => x.Resize(width, height));
|
||||
}
|
||||
var rectX = (int)Math.Floor(textureRect.x);
|
||||
var rectY = (int)Math.Floor(textureRect.y);
|
||||
var rectRight = (int)Math.Ceiling(textureRect.x + textureRect.width);
|
||||
var rectBottom = (int)Math.Ceiling(textureRect.y + textureRect.height);
|
||||
rectRight = Math.Min(rectRight, originalImage.Width);
|
||||
rectBottom = Math.Min(rectBottom, originalImage.Height);
|
||||
rectRight = Math.Min(rectRight, m_Texture2D.m_Width);
|
||||
rectBottom = Math.Min(rectBottom, m_Texture2D.m_Height);
|
||||
var rect = new Rectangle(rectX, rectY, rectRight - rectX, rectBottom - rectY);
|
||||
var spriteImage = originalImage.Clone(x => x.Crop(rect));
|
||||
|
||||
var spriteImage = new Bitmap(rect.Width, rect.Height, PixelFormat.Format32bppArgb);
|
||||
var destRect = new Rectangle(0, 0, rect.Width, rect.Height);
|
||||
using (var graphic = Graphics.FromImage(spriteImage))
|
||||
{
|
||||
graphic.DrawImage(originalImage, destRect, rect, GraphicsUnit.Pixel);
|
||||
}
|
||||
if (settingsRaw.packed == 1)
|
||||
{
|
||||
//RotateAndFlip
|
||||
switch (settingsRaw.packingRotation)
|
||||
{
|
||||
case SpritePackingRotation.FlipHorizontal:
|
||||
spriteImage.Mutate(x => x.Flip(FlipMode.Horizontal));
|
||||
case SpritePackingRotation.kSPRFlipHorizontal:
|
||||
spriteImage.RotateFlip(RotateFlipType.RotateNoneFlipX);
|
||||
break;
|
||||
case SpritePackingRotation.FlipVertical:
|
||||
spriteImage.Mutate(x => x.Flip(FlipMode.Vertical));
|
||||
case SpritePackingRotation.kSPRFlipVertical:
|
||||
spriteImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
break;
|
||||
case SpritePackingRotation.Rotate180:
|
||||
spriteImage.Mutate(x => x.Rotate(180));
|
||||
case SpritePackingRotation.kSPRRotate180:
|
||||
spriteImage.RotateFlip(RotateFlipType.Rotate180FlipNone);
|
||||
break;
|
||||
case SpritePackingRotation.Rotate90:
|
||||
spriteImage.Mutate(x => x.Rotate(270));
|
||||
case SpritePackingRotation.kSPRRotate90:
|
||||
spriteImage.RotateFlip(RotateFlipType.Rotate270FlipNone);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Tight
|
||||
if (settingsRaw.packingMode == SpritePackingMode.Tight)
|
||||
if (settingsRaw.packingMode == SpritePackingMode.kSPMTight)
|
||||
{
|
||||
try
|
||||
{
|
||||
var triangles = GetTriangles(m_Sprite.m_RD);
|
||||
var polygons = triangles.Select(x => new Polygon(new LinearLineSegment(x.Select(y => new PointF(y.X, y.Y)).ToArray()))).ToArray();
|
||||
IPathCollection path = new PathCollection(polygons);
|
||||
var matrix = Matrix3x2.CreateScale(m_Sprite.m_PixelsToUnits);
|
||||
matrix *= Matrix3x2.CreateTranslation(m_Sprite.m_Rect.width * m_Sprite.m_Pivot.X - textureRectOffset.X, m_Sprite.m_Rect.height * m_Sprite.m_Pivot.Y - textureRectOffset.Y);
|
||||
path = path.Transform(matrix);
|
||||
var graphicsOptions = new GraphicsOptions
|
||||
var points = triangles.Select(x => x.Select(y => new PointF(y.X, y.Y)).ToArray());
|
||||
using (var path = new GraphicsPath())
|
||||
{
|
||||
Antialias = false,
|
||||
AlphaCompositionMode = PixelAlphaCompositionMode.DestOut
|
||||
};
|
||||
var options = new DrawingOptions
|
||||
{
|
||||
GraphicsOptions = graphicsOptions
|
||||
};
|
||||
using (var mask = new Image<Bgra32>(rect.Width, rect.Height, SixLabors.ImageSharp.Color.Black))
|
||||
{
|
||||
mask.Mutate(x => x.Fill(options, SixLabors.ImageSharp.Color.Red, path));
|
||||
var bursh = new ImageBrush(mask);
|
||||
spriteImage.Mutate(x => x.Fill(graphicsOptions, bursh));
|
||||
spriteImage.Mutate(x => x.Flip(FlipMode.Vertical));
|
||||
return spriteImage;
|
||||
foreach (var p in points)
|
||||
{
|
||||
path.AddPolygon(p);
|
||||
}
|
||||
using (var matr = new Matrix())
|
||||
{
|
||||
var version = m_Sprite.version;
|
||||
if (version[0] < 5
|
||||
|| (version[0] == 5 && version[1] < 4)
|
||||
|| (version[0] == 5 && version[1] == 4 && version[2] <= 1)) //5.4.1p3 down
|
||||
{
|
||||
matr.Translate(m_Sprite.m_Rect.width * 0.5f - textureRectOffset.X, m_Sprite.m_Rect.height * 0.5f - textureRectOffset.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
matr.Translate(m_Sprite.m_Rect.width * m_Sprite.m_Pivot.X - textureRectOffset.X, m_Sprite.m_Rect.height * m_Sprite.m_Pivot.Y - textureRectOffset.Y);
|
||||
}
|
||||
matr.Scale(m_Sprite.m_PixelsToUnits, m_Sprite.m_PixelsToUnits);
|
||||
path.Transform(matr);
|
||||
var bitmap = new Bitmap(rect.Width, rect.Height);
|
||||
using (var graphic = Graphics.FromImage(bitmap))
|
||||
{
|
||||
using (var brush = new TextureBrush(spriteImage))
|
||||
{
|
||||
graphic.FillPath(brush, path);
|
||||
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
spriteImage.Dispose();
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -109,7 +132,7 @@ namespace AssetStudio
|
||||
}
|
||||
|
||||
//Rectangle
|
||||
spriteImage.Mutate(x => x.Flip(FlipMode.Vertical));
|
||||
spriteImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
return spriteImage;
|
||||
}
|
||||
}
|
||||
|
||||
5963
AssetStudioUtility/TGASharpLib.cs
Normal file
5963
AssetStudioUtility/TGASharpLib.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,223 +1,217 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Linq;
|
||||
using Texture2DDecoder;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public class Texture2DConverter
|
||||
{
|
||||
private ResourceReader reader;
|
||||
private int m_Width;
|
||||
private int m_Height;
|
||||
private TextureFormat m_TextureFormat;
|
||||
private int image_data_size;
|
||||
private byte[] image_data;
|
||||
private int[] version;
|
||||
private BuildTarget platform;
|
||||
private int outPutSize;
|
||||
|
||||
public Texture2DConverter(Texture2D m_Texture2D)
|
||||
{
|
||||
reader = m_Texture2D.image_data;
|
||||
image_data = m_Texture2D.image_data.GetData();
|
||||
image_data_size = image_data.Length;
|
||||
m_Width = m_Texture2D.m_Width;
|
||||
m_Height = m_Texture2D.m_Height;
|
||||
m_TextureFormat = m_Texture2D.m_TextureFormat;
|
||||
version = m_Texture2D.version;
|
||||
platform = m_Texture2D.platform;
|
||||
outPutSize = m_Width * m_Height * 4;
|
||||
}
|
||||
|
||||
public bool DecodeTexture2D(byte[] bytes)
|
||||
public byte[] DecodeTexture2D()
|
||||
{
|
||||
if (reader.Size == 0 || m_Width == 0 || m_Height == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var flag = false;
|
||||
var buff = BigArrayPool<byte>.Shared.Rent(reader.Size);
|
||||
reader.GetData(buff);
|
||||
byte[] bytes = null;
|
||||
switch (m_TextureFormat)
|
||||
{
|
||||
case TextureFormat.Alpha8: //test pass
|
||||
flag = DecodeAlpha8(buff, bytes);
|
||||
bytes = DecodeAlpha8();
|
||||
break;
|
||||
case TextureFormat.ARGB4444: //test pass
|
||||
SwapBytesForXbox(buff);
|
||||
flag = DecodeARGB4444(buff, bytes);
|
||||
SwapBytesForXbox();
|
||||
bytes = DecodeARGB4444();
|
||||
break;
|
||||
case TextureFormat.RGB24: //test pass
|
||||
flag = DecodeRGB24(buff, bytes);
|
||||
bytes = DecodeRGB24();
|
||||
break;
|
||||
case TextureFormat.RGBA32: //test pass
|
||||
flag = DecodeRGBA32(buff, bytes);
|
||||
bytes = DecodeRGBA32();
|
||||
break;
|
||||
case TextureFormat.ARGB32: //test pass
|
||||
flag = DecodeARGB32(buff, bytes);
|
||||
bytes = DecodeARGB32();
|
||||
break;
|
||||
case TextureFormat.RGB565: //test pass
|
||||
SwapBytesForXbox(buff);
|
||||
flag = DecodeRGB565(buff, bytes);
|
||||
SwapBytesForXbox();
|
||||
bytes = DecodeRGB565();
|
||||
break;
|
||||
case TextureFormat.R16: //test pass
|
||||
flag = DecodeR16(buff, bytes);
|
||||
bytes = DecodeR16();
|
||||
break;
|
||||
case TextureFormat.DXT1: //test pass
|
||||
SwapBytesForXbox(buff);
|
||||
flag = DecodeDXT1(buff, bytes);
|
||||
break;
|
||||
case TextureFormat.DXT3:
|
||||
SwapBytesForXbox();
|
||||
bytes = DecodeDXT1();
|
||||
break;
|
||||
case TextureFormat.DXT5: //test pass
|
||||
SwapBytesForXbox(buff);
|
||||
flag = DecodeDXT5(buff, bytes);
|
||||
SwapBytesForXbox();
|
||||
bytes = DecodeDXT5();
|
||||
break;
|
||||
case TextureFormat.RGBA4444: //test pass
|
||||
flag = DecodeRGBA4444(buff, bytes);
|
||||
bytes = DecodeRGBA4444();
|
||||
break;
|
||||
case TextureFormat.BGRA32: //test pass
|
||||
flag = DecodeBGRA32(buff, bytes);
|
||||
bytes = DecodeBGRA32();
|
||||
break;
|
||||
case TextureFormat.RHalf:
|
||||
flag = DecodeRHalf(buff, bytes);
|
||||
bytes = DecodeRHalf();
|
||||
break;
|
||||
case TextureFormat.RGHalf:
|
||||
flag = DecodeRGHalf(buff, bytes);
|
||||
bytes = DecodeRGHalf();
|
||||
break;
|
||||
case TextureFormat.RGBAHalf: //test pass
|
||||
flag = DecodeRGBAHalf(buff, bytes);
|
||||
bytes = DecodeRGBAHalf();
|
||||
break;
|
||||
case TextureFormat.RFloat:
|
||||
flag = DecodeRFloat(buff, bytes);
|
||||
bytes = DecodeRFloat();
|
||||
break;
|
||||
case TextureFormat.RGFloat:
|
||||
flag = DecodeRGFloat(buff, bytes);
|
||||
bytes = DecodeRGFloat();
|
||||
break;
|
||||
case TextureFormat.RGBAFloat:
|
||||
flag = DecodeRGBAFloat(buff, bytes);
|
||||
bytes = DecodeRGBAFloat();
|
||||
break;
|
||||
case TextureFormat.YUY2: //test pass
|
||||
flag = DecodeYUY2(buff, bytes);
|
||||
bytes = DecodeYUY2();
|
||||
break;
|
||||
case TextureFormat.RGB9e5Float: //test pass
|
||||
flag = DecodeRGB9e5Float(buff, bytes);
|
||||
break;
|
||||
case TextureFormat.BC6H: //test pass
|
||||
flag = DecodeBC6H(buff, bytes);
|
||||
break;
|
||||
case TextureFormat.BC7: //test pass
|
||||
flag = DecodeBC7(buff, bytes);
|
||||
bytes = DecodeRGB9e5Float();
|
||||
break;
|
||||
case TextureFormat.BC4: //test pass
|
||||
flag = DecodeBC4(buff, bytes);
|
||||
bytes = DecodeBC4();
|
||||
break;
|
||||
case TextureFormat.BC5: //test pass
|
||||
flag = DecodeBC5(buff, bytes);
|
||||
bytes = DecodeBC5();
|
||||
break;
|
||||
case TextureFormat.BC6H: //test pass
|
||||
bytes = DecodeBC6H();
|
||||
break;
|
||||
case TextureFormat.BC7: //test pass
|
||||
bytes = DecodeBC7();
|
||||
break;
|
||||
case TextureFormat.DXT1Crunched: //test pass
|
||||
flag = DecodeDXT1Crunched(buff, bytes);
|
||||
if (UnpackCrunch())
|
||||
{
|
||||
bytes = DecodeDXT1();
|
||||
}
|
||||
break;
|
||||
case TextureFormat.DXT5Crunched: //test pass
|
||||
flag = DecodeDXT5Crunched(buff, bytes);
|
||||
if (UnpackCrunch())
|
||||
{
|
||||
bytes = DecodeDXT5();
|
||||
}
|
||||
break;
|
||||
case TextureFormat.PVRTC_RGB2: //test pass
|
||||
case TextureFormat.PVRTC_RGBA2: //test pass
|
||||
flag = DecodePVRTC(buff, bytes, true);
|
||||
bytes = DecodePVRTC(true);
|
||||
break;
|
||||
case TextureFormat.PVRTC_RGB4: //test pass
|
||||
case TextureFormat.PVRTC_RGBA4: //test pass
|
||||
flag = DecodePVRTC(buff, bytes, false);
|
||||
bytes = DecodePVRTC(false);
|
||||
break;
|
||||
case TextureFormat.ETC_RGB4: //test pass
|
||||
case TextureFormat.ETC_RGB4_3DS:
|
||||
flag = DecodeETC1(buff, bytes);
|
||||
bytes = DecodeETC1();
|
||||
break;
|
||||
case TextureFormat.ATC_RGB4: //test pass
|
||||
flag = DecodeATCRGB4(buff, bytes);
|
||||
bytes = DecodeATCRGB4();
|
||||
break;
|
||||
case TextureFormat.ATC_RGBA8: //test pass
|
||||
flag = DecodeATCRGBA8(buff, bytes);
|
||||
bytes = DecodeATCRGBA8();
|
||||
break;
|
||||
case TextureFormat.EAC_R: //test pass
|
||||
flag = DecodeEACR(buff, bytes);
|
||||
bytes = DecodeEACR();
|
||||
break;
|
||||
case TextureFormat.EAC_R_SIGNED:
|
||||
flag = DecodeEACRSigned(buff, bytes);
|
||||
bytes = DecodeEACRSigned();
|
||||
break;
|
||||
case TextureFormat.EAC_RG: //test pass
|
||||
flag = DecodeEACRG(buff, bytes);
|
||||
bytes = DecodeEACRG();
|
||||
break;
|
||||
case TextureFormat.EAC_RG_SIGNED:
|
||||
flag = DecodeEACRGSigned(buff, bytes);
|
||||
bytes = DecodeEACRGSigned();
|
||||
break;
|
||||
case TextureFormat.ETC2_RGB: //test pass
|
||||
flag = DecodeETC2(buff, bytes);
|
||||
bytes = DecodeETC2();
|
||||
break;
|
||||
case TextureFormat.ETC2_RGBA1: //test pass
|
||||
flag = DecodeETC2A1(buff, bytes);
|
||||
bytes = DecodeETC2A1();
|
||||
break;
|
||||
case TextureFormat.ETC2_RGBA8: //test pass
|
||||
case TextureFormat.ETC_RGBA8_3DS:
|
||||
flag = DecodeETC2A8(buff, bytes);
|
||||
bytes = DecodeETC2A8();
|
||||
break;
|
||||
case TextureFormat.ASTC_RGB_4x4: //test pass
|
||||
case TextureFormat.ASTC_RGBA_4x4: //test pass
|
||||
case TextureFormat.ASTC_HDR_4x4: //test pass
|
||||
flag = DecodeASTC(buff, bytes, 4);
|
||||
bytes = DecodeASTC(4);
|
||||
break;
|
||||
case TextureFormat.ASTC_RGB_5x5: //test pass
|
||||
case TextureFormat.ASTC_RGBA_5x5: //test pass
|
||||
case TextureFormat.ASTC_HDR_5x5: //test pass
|
||||
flag = DecodeASTC(buff, bytes, 5);
|
||||
bytes = DecodeASTC(5);
|
||||
break;
|
||||
case TextureFormat.ASTC_RGB_6x6: //test pass
|
||||
case TextureFormat.ASTC_RGBA_6x6: //test pass
|
||||
case TextureFormat.ASTC_HDR_6x6: //test pass
|
||||
flag = DecodeASTC(buff, bytes, 6);
|
||||
bytes = DecodeASTC(6);
|
||||
break;
|
||||
case TextureFormat.ASTC_RGB_8x8: //test pass
|
||||
case TextureFormat.ASTC_RGBA_8x8: //test pass
|
||||
case TextureFormat.ASTC_HDR_8x8: //test pass
|
||||
flag = DecodeASTC(buff, bytes, 8);
|
||||
bytes = DecodeASTC(8);
|
||||
break;
|
||||
case TextureFormat.ASTC_RGB_10x10: //test pass
|
||||
case TextureFormat.ASTC_RGBA_10x10: //test pass
|
||||
case TextureFormat.ASTC_HDR_10x10: //test pass
|
||||
flag = DecodeASTC(buff, bytes, 10);
|
||||
bytes = DecodeASTC(10);
|
||||
break;
|
||||
case TextureFormat.ASTC_RGB_12x12: //test pass
|
||||
case TextureFormat.ASTC_RGBA_12x12: //test pass
|
||||
case TextureFormat.ASTC_HDR_12x12: //test pass
|
||||
flag = DecodeASTC(buff, bytes, 12);
|
||||
bytes = DecodeASTC(12);
|
||||
break;
|
||||
case TextureFormat.RG16: //test pass
|
||||
flag = DecodeRG16(buff, bytes);
|
||||
bytes = DecodeRG16();
|
||||
break;
|
||||
case TextureFormat.R8: //test pass
|
||||
flag = DecodeR8(buff, bytes);
|
||||
bytes = DecodeR8();
|
||||
break;
|
||||
case TextureFormat.ETC_RGB4Crunched: //test pass
|
||||
flag = DecodeETC1Crunched(buff, bytes);
|
||||
if (UnpackCrunch())
|
||||
{
|
||||
bytes = DecodeETC1();
|
||||
}
|
||||
break;
|
||||
case TextureFormat.ETC2_RGBA8Crunched: //test pass
|
||||
flag = DecodeETC2A8Crunched(buff, bytes);
|
||||
break;
|
||||
case TextureFormat.RG32: //test pass
|
||||
flag = DecodeRG32(buff, bytes);
|
||||
break;
|
||||
case TextureFormat.RGB48: //test pass
|
||||
flag = DecodeRGB48(buff, bytes);
|
||||
break;
|
||||
case TextureFormat.RGBA64: //test pass
|
||||
flag = DecodeRGBA64(buff, bytes);
|
||||
if (UnpackCrunch())
|
||||
{
|
||||
bytes = DecodeETC2A8();
|
||||
}
|
||||
break;
|
||||
}
|
||||
BigArrayPool<byte>.Shared.Return(buff);
|
||||
return flag;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private void SwapBytesForXbox(byte[] image_data)
|
||||
private void SwapBytesForXbox()
|
||||
{
|
||||
if (platform == BuildTarget.XBOX360)
|
||||
{
|
||||
for (var i = 0; i < reader.Size / 2; i++)
|
||||
for (var i = 0; i < image_data_size / 2; i++)
|
||||
{
|
||||
var b = image_data[i * 2];
|
||||
image_data[i * 2] = image_data[i * 2 + 1];
|
||||
@@ -226,24 +220,22 @@ namespace AssetStudio
|
||||
}
|
||||
}
|
||||
|
||||
private bool DecodeAlpha8(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeAlpha8()
|
||||
{
|
||||
var size = m_Width * m_Height;
|
||||
var span = new Span<byte>(buff);
|
||||
span.Fill(0xFF);
|
||||
for (var i = 0; i < size; i++)
|
||||
var buff = Enumerable.Repeat<byte>(0xFF, m_Width * m_Height * 4).ToArray();
|
||||
for (var i = 0; i < m_Width * m_Height; i++)
|
||||
{
|
||||
buff[i * 4 + 3] = image_data[i];
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeARGB4444(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeARGB4444()
|
||||
{
|
||||
var size = m_Width * m_Height;
|
||||
var pixelNew = new byte[4];
|
||||
for (var i = 0; i < size; i++)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < m_Width * m_Height; i++)
|
||||
{
|
||||
var pixelNew = new byte[4];
|
||||
var pixelOldShort = BitConverter.ToUInt16(image_data, i * 2);
|
||||
pixelNew[0] = (byte)(pixelOldShort & 0x000f);
|
||||
pixelNew[1] = (byte)((pixelOldShort & 0x00f0) >> 4);
|
||||
@@ -253,50 +245,52 @@ namespace AssetStudio
|
||||
pixelNew[j] = (byte)((pixelNew[j] << 4) | pixelNew[j]);
|
||||
pixelNew.CopyTo(buff, i * 4);
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeRGB24(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeRGB24()
|
||||
{
|
||||
var size = m_Width * m_Height;
|
||||
for (var i = 0; i < size; i++)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < m_Width * m_Height; i++)
|
||||
{
|
||||
buff[i * 4] = image_data[i * 3 + 2];
|
||||
buff[i * 4 + 1] = image_data[i * 3 + 1];
|
||||
buff[i * 4 + 2] = image_data[i * 3 + 0];
|
||||
buff[i * 4 + 3] = 255;
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeRGBA32(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeRGBA32()
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < buff.Length; i += 4)
|
||||
{
|
||||
buff[i] = image_data[i + 2];
|
||||
buff[i + 1] = image_data[i + 1];
|
||||
buff[i + 2] = image_data[i + 0];
|
||||
buff[i + 3] = image_data[i + 3];
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeARGB32(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeARGB32()
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < buff.Length; i += 4)
|
||||
{
|
||||
buff[i] = image_data[i + 3];
|
||||
buff[i + 1] = image_data[i + 2];
|
||||
buff[i + 2] = image_data[i + 1];
|
||||
buff[i + 3] = image_data[i + 0];
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeRGB565(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeRGB565()
|
||||
{
|
||||
var size = m_Width * m_Height;
|
||||
for (var i = 0; i < size; i++)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < m_Width * m_Height; i++)
|
||||
{
|
||||
var p = BitConverter.ToUInt16(image_data, i * 2);
|
||||
buff[i * 4] = (byte)((p << 3) | (p >> 2 & 7));
|
||||
@@ -304,38 +298,46 @@ namespace AssetStudio
|
||||
buff[i * 4 + 2] = (byte)((p >> 8 & 0xf8) | (p >> 13));
|
||||
buff[i * 4 + 3] = 255;
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeR16(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeR16()
|
||||
{
|
||||
var size = m_Width * m_Height;
|
||||
for (var i = 0; i < size; i++)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < m_Width * m_Height; i++)
|
||||
{
|
||||
buff[i * 4] = 0; //b
|
||||
buff[i * 4 + 1] = 0; //g
|
||||
buff[i * 4 + 2] = DownScaleFrom16BitTo8Bit(BitConverter.ToUInt16(image_data, i * 2)); //r
|
||||
buff[i * 4 + 2] = image_data[i * 2 + 1]; //r
|
||||
buff[i * 4 + 3] = 255; //a
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeDXT1(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeDXT1()
|
||||
{
|
||||
return TextureDecoder.DecodeDXT1(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeDXT5(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeDXT5(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeRGBA4444(byte[] image_data, byte[] buff)
|
||||
{
|
||||
var size = m_Width * m_Height;
|
||||
var pixelNew = new byte[4];
|
||||
for (var i = 0; i < size; i++)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeDXT1(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeDXT5()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeDXT5(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeRGBA4444()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < m_Width * m_Height; i++)
|
||||
{
|
||||
var pixelNew = new byte[4];
|
||||
var pixelOldShort = BitConverter.ToUInt16(image_data, i * 2);
|
||||
pixelNew[0] = (byte)((pixelOldShort & 0x00f0) >> 4);
|
||||
pixelNew[1] = (byte)((pixelOldShort & 0x0f00) >> 8);
|
||||
@@ -345,101 +347,108 @@ namespace AssetStudio
|
||||
pixelNew[j] = (byte)((pixelNew[j] << 4) | pixelNew[j]);
|
||||
pixelNew.CopyTo(buff, i * 4);
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeBGRA32(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeBGRA32()
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < buff.Length; i += 4)
|
||||
{
|
||||
buff[i] = image_data[i];
|
||||
buff[i + 1] = image_data[i + 1];
|
||||
buff[i + 2] = image_data[i + 2];
|
||||
buff[i + 3] = image_data[i + 3];
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeRHalf(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeRHalf()
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < buff.Length; i += 4)
|
||||
{
|
||||
buff[i] = 0;
|
||||
buff[i + 1] = 0;
|
||||
buff[i + 2] = (byte)Math.Round(Half.ToHalf(image_data, i / 2) * 255f);
|
||||
buff[i + 3] = 255;
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeRGHalf(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeRGHalf()
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < buff.Length; i += 4)
|
||||
{
|
||||
buff[i] = 0;
|
||||
buff[i + 1] = (byte)Math.Round(Half.ToHalf(image_data, i + 2) * 255f);
|
||||
buff[i + 2] = (byte)Math.Round(Half.ToHalf(image_data, i) * 255f);
|
||||
buff[i + 3] = 255;
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeRGBAHalf(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeRGBAHalf()
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < buff.Length; i += 4)
|
||||
{
|
||||
buff[i] = (byte)Math.Round(Half.ToHalf(image_data, i * 2 + 4) * 255f);
|
||||
buff[i + 1] = (byte)Math.Round(Half.ToHalf(image_data, i * 2 + 2) * 255f);
|
||||
buff[i + 2] = (byte)Math.Round(Half.ToHalf(image_data, i * 2) * 255f);
|
||||
buff[i + 3] = (byte)Math.Round(Half.ToHalf(image_data, i * 2 + 6) * 255f);
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeRFloat(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeRFloat()
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < buff.Length; i += 4)
|
||||
{
|
||||
buff[i] = 0;
|
||||
buff[i + 1] = 0;
|
||||
buff[i + 2] = (byte)Math.Round(BitConverter.ToSingle(image_data, i) * 255f);
|
||||
buff[i + 3] = 255;
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeRGFloat(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeRGFloat()
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < buff.Length; i += 4)
|
||||
{
|
||||
buff[i] = 0;
|
||||
buff[i + 1] = (byte)Math.Round(BitConverter.ToSingle(image_data, i * 2 + 4) * 255f);
|
||||
buff[i + 2] = (byte)Math.Round(BitConverter.ToSingle(image_data, i * 2) * 255f);
|
||||
buff[i + 3] = 255;
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeRGBAFloat(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeRGBAFloat()
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < buff.Length; i += 4)
|
||||
{
|
||||
buff[i] = (byte)Math.Round(BitConverter.ToSingle(image_data, i * 4 + 8) * 255f);
|
||||
buff[i + 1] = (byte)Math.Round(BitConverter.ToSingle(image_data, i * 4 + 4) * 255f);
|
||||
buff[i + 2] = (byte)Math.Round(BitConverter.ToSingle(image_data, i * 4) * 255f);
|
||||
buff[i + 3] = (byte)Math.Round(BitConverter.ToSingle(image_data, i * 4 + 12) * 255f);
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static byte ClampByte(int x)
|
||||
{
|
||||
return (byte)(byte.MaxValue < x ? byte.MaxValue : (x > byte.MinValue ? x : byte.MinValue));
|
||||
}
|
||||
|
||||
private bool DecodeYUY2(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeYUY2()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
int p = 0;
|
||||
int o = 0;
|
||||
int halfWidth = m_Width / 2;
|
||||
@@ -465,12 +474,13 @@ namespace AssetStudio
|
||||
buff[o++] = 255;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeRGB9e5Float(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeRGB9e5Float()
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < buff.Length; i += 4)
|
||||
{
|
||||
var n = BitConverter.ToInt32(image_data, i);
|
||||
var scale = n >> 27 & 0x1f;
|
||||
@@ -483,208 +493,195 @@ namespace AssetStudio
|
||||
buff[i + 2] = (byte)Math.Round(r * scalef * 255f);
|
||||
buff[i + 3] = 255;
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeBC4(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeBC4()
|
||||
{
|
||||
return TextureDecoder.DecodeBC4(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeBC5(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeBC5(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeBC6H(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeBC6(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeBC7(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeBC7(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeDXT1Crunched(byte[] image_data, byte[] buff)
|
||||
{
|
||||
if (UnpackCrunch(image_data, out var result))
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeBC4(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
if (DecodeDXT1(result, buff))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return false;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeDXT5Crunched(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeBC5()
|
||||
{
|
||||
if (UnpackCrunch(image_data, out var result))
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeBC5(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
if (DecodeDXT5(result, buff))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return false;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodePVRTC(byte[] image_data, byte[] buff, bool is2bpp)
|
||||
private byte[] DecodeBC6H()
|
||||
{
|
||||
return TextureDecoder.DecodePVRTC(image_data, m_Width, m_Height, buff, is2bpp);
|
||||
}
|
||||
|
||||
private bool DecodeETC1(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeETC1(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeATCRGB4(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeATCRGB4(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeATCRGBA8(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeATCRGBA8(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeEACR(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeEACR(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeEACRSigned(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeEACRSigned(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeEACRG(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeEACRG(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeEACRGSigned(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeEACRGSigned(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeETC2(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeETC2(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeETC2A1(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeETC2A1(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeETC2A8(byte[] image_data, byte[] buff)
|
||||
{
|
||||
return TextureDecoder.DecodeETC2A8(image_data, m_Width, m_Height, buff);
|
||||
}
|
||||
|
||||
private bool DecodeASTC(byte[] image_data, byte[] buff, int blocksize)
|
||||
{
|
||||
return TextureDecoder.DecodeASTC(image_data, m_Width, m_Height, blocksize, blocksize, buff);
|
||||
}
|
||||
|
||||
private bool DecodeRG16(byte[] image_data, byte[] buff)
|
||||
{
|
||||
var size = m_Width * m_Height;
|
||||
for (var i = 0; i < size; i++)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeBC6(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
buff[i * 4] = 0; //B
|
||||
buff[i * 4 + 1] = image_data[i * 2 + 1];//G
|
||||
buff[i * 4 + 2] = image_data[i * 2];//R
|
||||
buff[i * 4 + 3] = 255;//A
|
||||
return null;
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeR8(byte[] image_data, byte[] buff)
|
||||
private byte[] DecodeBC7()
|
||||
{
|
||||
var size = m_Width * m_Height;
|
||||
for (var i = 0; i < size; i++)
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeBC7(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodePVRTC(bool is2bpp)
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodePVRTC(image_data, m_Width, m_Height, buff, is2bpp))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeETC1()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeETC1(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeATCRGB4()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeATCRGB4(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeATCRGBA8()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeATCRGBA8(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeEACR()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeEACR(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeEACRSigned()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeEACRSigned(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeEACRG()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeEACRG(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeEACRGSigned()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeEACRGSigned(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeETC2()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeETC2(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeETC2A1()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeETC2A1(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeETC2A8()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeETC2A8(image_data, m_Width, m_Height, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeASTC(int blocksize)
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
if (!TextureDecoder.DecodeASTC(image_data, m_Width, m_Height, blocksize, blocksize, buff))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeRG16()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < m_Width * m_Height; i += 2)
|
||||
{
|
||||
buff[i * 2 + 1] = image_data[i + 1];//G
|
||||
buff[i * 2 + 2] = image_data[i];//R
|
||||
buff[i * 2 + 3] = 255;//A
|
||||
}
|
||||
return buff;
|
||||
}
|
||||
|
||||
private byte[] DecodeR8()
|
||||
{
|
||||
var buff = new byte[m_Width * m_Height * 4];
|
||||
for (var i = 0; i < m_Width * m_Height; i++)
|
||||
{
|
||||
buff[i * 4] = 0; //B
|
||||
buff[i * 4 + 1] = 0; //G
|
||||
buff[i * 4 + 2] = image_data[i];//R
|
||||
buff[i * 4 + 3] = 255;//A
|
||||
}
|
||||
return true;
|
||||
return buff;
|
||||
}
|
||||
|
||||
private bool DecodeETC1Crunched(byte[] image_data, byte[] buff)
|
||||
{
|
||||
if (UnpackCrunch(image_data, out var result))
|
||||
{
|
||||
if (DecodeETC1(result, buff))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool DecodeETC2A8Crunched(byte[] image_data, byte[] buff)
|
||||
{
|
||||
if (UnpackCrunch(image_data, out var result))
|
||||
{
|
||||
if (DecodeETC2A8(result, buff))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static byte DownScaleFrom16BitTo8Bit(ushort component)
|
||||
{
|
||||
return (byte)(((component * 255) + 32895) >> 16);
|
||||
}
|
||||
|
||||
private bool DecodeRG32(byte[] image_data, byte[] buff)
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
{
|
||||
buff[i] = 0; //b
|
||||
buff[i + 1] = DownScaleFrom16BitTo8Bit(BitConverter.ToUInt16(image_data, i + 2)); //g
|
||||
buff[i + 2] = DownScaleFrom16BitTo8Bit(BitConverter.ToUInt16(image_data, i)); //r
|
||||
buff[i + 3] = byte.MaxValue; //a
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool DecodeRGB48(byte[] image_data, byte[] buff)
|
||||
{
|
||||
var size = m_Width * m_Height;
|
||||
for (var i = 0; i < size; i++)
|
||||
{
|
||||
buff[i * 4] = DownScaleFrom16BitTo8Bit(BitConverter.ToUInt16(image_data, i * 6 + 4)); //b
|
||||
buff[i * 4 + 1] = DownScaleFrom16BitTo8Bit(BitConverter.ToUInt16(image_data, i * 6 + 2)); //g
|
||||
buff[i * 4 + 2] = DownScaleFrom16BitTo8Bit(BitConverter.ToUInt16(image_data, i * 6)); //r
|
||||
buff[i * 4 + 3] = byte.MaxValue; //a
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool DecodeRGBA64(byte[] image_data, byte[] buff)
|
||||
{
|
||||
for (var i = 0; i < outPutSize; i += 4)
|
||||
{
|
||||
buff[i] = DownScaleFrom16BitTo8Bit(BitConverter.ToUInt16(image_data, i * 2 + 4)); //b
|
||||
buff[i + 1] = DownScaleFrom16BitTo8Bit(BitConverter.ToUInt16(image_data, i * 2 + 2)); //g
|
||||
buff[i + 2] = DownScaleFrom16BitTo8Bit(BitConverter.ToUInt16(image_data, i * 2)); //r
|
||||
buff[i + 3] = DownScaleFrom16BitTo8Bit(BitConverter.ToUInt16(image_data, i * 2 + 6)); //a
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool UnpackCrunch(byte[] image_data, out byte[] result)
|
||||
private bool UnpackCrunch()
|
||||
{
|
||||
byte[] result;
|
||||
if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 3) //2017.3 and up
|
||||
|| m_TextureFormat == TextureFormat.ETC_RGB4Crunched
|
||||
|| m_TextureFormat == TextureFormat.ETC2_RGBA8Crunched)
|
||||
@@ -697,6 +694,8 @@ namespace AssetStudio
|
||||
}
|
||||
if (result != null)
|
||||
{
|
||||
image_data = result;
|
||||
image_data_size = result.Length;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,38 +1,34 @@
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public static class Texture2DExtensions
|
||||
{
|
||||
public static Image<Bgra32> ConvertToImage(this Texture2D m_Texture2D, bool flip)
|
||||
public static Bitmap ConvertToBitmap(this Texture2D m_Texture2D, bool flip)
|
||||
{
|
||||
var converter = new Texture2DConverter(m_Texture2D);
|
||||
var buff = BigArrayPool<byte>.Shared.Rent(m_Texture2D.m_Width * m_Texture2D.m_Height * 4);
|
||||
try
|
||||
var bytes = converter.DecodeTexture2D();
|
||||
if (bytes != null && bytes.Length > 0)
|
||||
{
|
||||
if (converter.DecodeTexture2D(buff))
|
||||
var bitmap = new Bitmap(m_Texture2D.m_Width, m_Texture2D.m_Height, PixelFormat.Format32bppArgb);
|
||||
var bmpData = bitmap.LockBits(new Rectangle(0, 0, m_Texture2D.m_Width, m_Texture2D.m_Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
|
||||
Marshal.Copy(bytes, 0, bmpData.Scan0, bytes.Length);
|
||||
bitmap.UnlockBits(bmpData);
|
||||
if (flip)
|
||||
{
|
||||
var image = Image.LoadPixelData<Bgra32>(buff, m_Texture2D.m_Width, m_Texture2D.m_Height);
|
||||
if (flip)
|
||||
{
|
||||
image.Mutate(x => x.Flip(FlipMode.Vertical));
|
||||
}
|
||||
return image;
|
||||
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
BigArrayPool<byte>.Shared.Return(buff);
|
||||
return bitmap;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MemoryStream ConvertToStream(this Texture2D m_Texture2D, ImageFormat imageFormat, bool flip)
|
||||
{
|
||||
var image = ConvertToImage(m_Texture2D, flip);
|
||||
var image = ConvertToBitmap(m_Texture2D, flip);
|
||||
if (image != null)
|
||||
{
|
||||
using (image)
|
||||
|
||||
@@ -253,28 +253,28 @@ namespace AssetStudio
|
||||
switch (typeRef.FullName)
|
||||
{
|
||||
case "UnityEngine.AnimationCurve":
|
||||
Helper.AddAnimationCurve(nodes, name, indent);
|
||||
Helper.AddAnimationCurve(nodes, name, indent + 1);
|
||||
break;
|
||||
case "UnityEngine.Gradient":
|
||||
Helper.AddGradient(nodes, name, indent);
|
||||
Helper.AddGradient(nodes, name, indent + 1);
|
||||
break;
|
||||
case "UnityEngine.GUIStyle":
|
||||
Helper.AddGUIStyle(nodes, name, indent);
|
||||
Helper.AddGUIStyle(nodes, name, indent + 1);
|
||||
break;
|
||||
case "UnityEngine.RectOffset":
|
||||
Helper.AddRectOffset(nodes, name, indent);
|
||||
Helper.AddRectOffset(nodes, name, indent + 1);
|
||||
break;
|
||||
case "UnityEngine.Color32":
|
||||
Helper.AddColor32(nodes, name, indent);
|
||||
Helper.AddColor32(nodes, name, indent + 1);
|
||||
break;
|
||||
case "UnityEngine.Matrix4x4":
|
||||
Helper.AddMatrix4x4(nodes, name, indent);
|
||||
Helper.AddMatrix4x4(nodes, name, indent + 1);
|
||||
break;
|
||||
case "UnityEngine.Rendering.SphericalHarmonicsL2":
|
||||
Helper.AddSphericalHarmonicsL2(nodes, name, indent);
|
||||
Helper.AddSphericalHarmonicsL2(nodes, name, indent + 1);
|
||||
break;
|
||||
case "UnityEngine.PropertyName":
|
||||
Helper.AddPropertyName(nodes, name, indent);
|
||||
Helper.AddPropertyName(nodes, name, indent + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
14
README.md
14
README.md
@@ -7,7 +7,7 @@ AssetStudio is a tool for exploring, extracting and exporting assets and assetbu
|
||||
|
||||
## Features
|
||||
* Support version:
|
||||
* 3.4 - 2022.1
|
||||
* 3.4 - 2021.2
|
||||
* Support asset types:
|
||||
* **Texture2D** : convert to png, tga, jpeg, bmp
|
||||
* **Sprite** : crop Texture2D to png, tga, jpeg, bmp
|
||||
@@ -23,13 +23,7 @@ AssetStudio is a tool for exploring, extracting and exporting assets and assetbu
|
||||
|
||||
## Requirements
|
||||
|
||||
- AssetStudio.net472
|
||||
- [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472)
|
||||
- AssetStudio.net5
|
||||
- [.NET Desktop Runtime 5.0](https://dotnet.microsoft.com/download/dotnet/5.0)
|
||||
- AssetStudio.net6
|
||||
- [.NET Desktop Runtime 6.0](https://dotnet.microsoft.com/download/dotnet/6.0)
|
||||
|
||||
- [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472)
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -69,8 +63,8 @@ First, use my another program [Il2CppDumper](https://github.com/Perfare/Il2CppDu
|
||||
|
||||
## Build
|
||||
|
||||
* Visual Studio 2022 or newer
|
||||
* **AssetStudioFBXNative** uses [FBX SDK 2020.2.1](https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2020-2-1), before building, you need to install the FBX SDK and modify the project file, change include directory and library directory to point to the FBX SDK directory
|
||||
* Visual Studio 2019 or newer
|
||||
* **AssetStudioFBXNative** uses FBX SDK 2020.0.1 VS2017, before building, you need to install the FBX SDK and modify the project file, change include directory and library directory to point to the FBX SDK directory
|
||||
|
||||
## Open source libraries used
|
||||
|
||||
|
||||
@@ -67,26 +67,26 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@@ -154,6 +154,7 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@@ -189,6 +190,7 @@
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net472;netstandard2.0;net5.0;net6.0</TargetFrameworks>
|
||||
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Version>0.16.0.0</Version>
|
||||
<AssemblyVersion>0.16.0.0</AssemblyVersion>
|
||||
<FileVersion>0.16.0.0</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2020-2022; Copyright © hozuki 2020</Copyright>
|
||||
<DebugType>embedded</DebugType>
|
||||
<Version>0.16.8.1</Version>
|
||||
<AssemblyVersion>0.16.8.1</AssemblyVersion>
|
||||
<FileVersion>0.16.8.1</FileVersion>
|
||||
<Copyright>Copyright © Perfare 2020-2021; Copyright © hozuki 2020</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net472|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user