Improvements and bug fixes.
This commit is contained in:
@@ -43,7 +43,6 @@ namespace AssetStudio
|
|||||||
public static Game[] GetGames() => Games.Values.ToArray();
|
public static Game[] GetGames() => Games.Values.ToArray();
|
||||||
public static string[] GetGameNames() => Games.Values.Select(x => x.Name).ToArray();
|
public static string[] GetGameNames() => Games.Values.Select(x => x.Name).ToArray();
|
||||||
public static string SupportedGames() => $"Supported Games:\n{string.Join("\n", Games.Values.Select(x => $"{x.Name} ({x.DisplayName})"))}";
|
public static string SupportedGames() => $"Supported Games:\n{string.Join("\n", Games.Values.Select(x => $"{x.Name} ({x.DisplayName})"))}";
|
||||||
public static string ToString() => string.Join("\n", Games.Values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class Game
|
public abstract class Game
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ namespace AssetStudio
|
|||||||
BlockMap = new Dictionary<int, byte>();
|
BlockMap = new Dictionary<int, byte>();
|
||||||
}
|
}
|
||||||
public static void FromFile(string path)
|
public static void FromFile(string path)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
Logger.Info(string.Format("Parsing...."));
|
Logger.Info(string.Format("Parsing...."));
|
||||||
try
|
try
|
||||||
@@ -61,6 +63,7 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
Logger.Info("Loaded !!");
|
Logger.Info("Loaded !!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static void Clear()
|
public static void Clear()
|
||||||
{
|
{
|
||||||
BundleDependencyMap.Clear();
|
BundleDependencyMap.Clear();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Buffers.Binary;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -31,8 +32,6 @@ namespace AssetStudio
|
|||||||
public List<SerializedType> m_RefTypes;
|
public List<SerializedType> m_RefTypes;
|
||||||
public string userInformation;
|
public string userInformation;
|
||||||
|
|
||||||
private static int DecryptClassId(int id) => (id ^ 0x23746FBE) - 3;
|
|
||||||
|
|
||||||
public SerializedFile(FileReader reader, AssetsManager assetsManager, string path = null)
|
public SerializedFile(FileReader reader, AssetsManager assetsManager, string path = null)
|
||||||
{
|
{
|
||||||
this.assetsManager = assetsManager;
|
this.assetsManager = assetsManager;
|
||||||
@@ -238,12 +237,9 @@ namespace AssetStudio
|
|||||||
var type = new SerializedType();
|
var type = new SerializedType();
|
||||||
|
|
||||||
type.classID = reader.ReadInt32();
|
type.classID = reader.ReadInt32();
|
||||||
|
if (BitConverter.ToBoolean(header.m_Reserved, 0))
|
||||||
if ((type.classID > 0xFFFF || type.classID <= 0x0) && !Enum.IsDefined(typeof(ClassIDType), type.classID))
|
|
||||||
{
|
{
|
||||||
byte[] classIdBytes = BitConverter.GetBytes(type.classID);
|
type.classID = DecodeClassID(type.classID);
|
||||||
Array.Reverse(classIdBytes);
|
|
||||||
type.classID = DecryptClassId(BitConverter.ToInt32(classIdBytes, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header.m_Version >= SerializedFileFormatVersion.RefactoredClassId)
|
if (header.m_Version >= SerializedFileFormatVersion.RefactoredClassId)
|
||||||
@@ -385,6 +381,12 @@ namespace AssetStudio
|
|||||||
ObjectsDic.Add(obj.m_PathID, obj);
|
ObjectsDic.Add(obj.m_PathID, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int DecodeClassID(int value)
|
||||||
|
{
|
||||||
|
var bytes = BitConverter.GetBytes(value);
|
||||||
|
value = BinaryPrimitives.ReadInt32BigEndian(bytes);
|
||||||
|
return (value ^ 0x23746FBE) - 3;
|
||||||
|
}
|
||||||
public bool IsVersionStripped => unityVersion == strippedVersion;
|
public bool IsVersionStripped => unityVersion == strippedVersion;
|
||||||
|
|
||||||
private const string strippedVersion = "0.0.0";
|
private const string strippedVersion = "0.0.0";
|
||||||
|
|||||||
@@ -194,9 +194,11 @@ namespace AssetStudio
|
|||||||
value = reader.ReadSByte();
|
value = reader.ReadSByte();
|
||||||
break;
|
break;
|
||||||
case "UInt8":
|
case "UInt8":
|
||||||
case "char":
|
|
||||||
value = reader.ReadByte();
|
value = reader.ReadByte();
|
||||||
break;
|
break;
|
||||||
|
case "char":
|
||||||
|
value = BitConverter.ToChar(reader.ReadBytes(2), 0);
|
||||||
|
break;
|
||||||
case "short":
|
case "short":
|
||||||
case "SInt16":
|
case "SInt16":
|
||||||
value = reader.ReadInt16();
|
value = reader.ReadInt16();
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ namespace AssetStudio
|
|||||||
animationClip.m_ScaleCurves = converter.Scales.Union(animationClip.m_ScaleCurves).ToArray();
|
animationClip.m_ScaleCurves = converter.Scales.Union(animationClip.m_ScaleCurves).ToArray();
|
||||||
animationClip.m_FloatCurves = converter.Floats.Union(animationClip.m_FloatCurves).ToArray();
|
animationClip.m_FloatCurves = converter.Floats.Union(animationClip.m_FloatCurves).ToArray();
|
||||||
animationClip.m_PPtrCurves = converter.PPtrs.Union(animationClip.m_PPtrCurves).ToArray();
|
animationClip.m_PPtrCurves = converter.PPtrs.Union(animationClip.m_PPtrCurves).ToArray();
|
||||||
return ConvertSerializedAnimationClip(animationClip, game);
|
return ConvertSerializedAnimationClip(animationClip);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ConvertSerializedAnimationClip(AnimationClip animationClip, Game game)
|
public static string ConvertSerializedAnimationClip(AnimationClip animationClip)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
using (var stringWriter = new StringWriter(sb))
|
using (var stringWriter = new StringWriter(sb))
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace AssetStudio
|
|||||||
var polygons = triangles.Select(x => new Polygon(new LinearLineSegment(x.Select(y => new PointF(y.X, y.Y)).ToArray()))).ToArray();
|
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);
|
IPathCollection path = new PathCollection(polygons);
|
||||||
var matrix = Matrix3x2.CreateScale(m_Sprite.m_PixelsToUnits);
|
var matrix = Matrix3x2.CreateScale(m_Sprite.m_PixelsToUnits);
|
||||||
matrix *= Matrix3x2.CreateTranslation(textureRect.width * m_Sprite.m_Pivot.X - textureRectOffset.X, textureRect.height * m_Sprite.m_Pivot.Y - textureRectOffset.Y);
|
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);
|
path = path.Transform(matrix);
|
||||||
var graphicsOptions = new GraphicsOptions
|
var graphicsOptions = new GraphicsOptions
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user