Some more fixes for decoding gx2
This commit is contained in:
parent
fa5fc52258
commit
44dea5fefd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
32
Switch_Toolbox_Library/IO/Extensions/ByteArrayExtensions.cs
Normal file
32
Switch_Toolbox_Library/IO/Extensions/ByteArrayExtensions.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace System
|
||||||
|
{
|
||||||
|
public static class ByteArrayExtensions
|
||||||
|
{
|
||||||
|
public static T[] Slice<T>(this T[] arr, uint indexFrom, uint size)
|
||||||
|
{
|
||||||
|
T[] result = new T[size];
|
||||||
|
Array.Copy(arr, indexFrom, result, 0, size);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T[] SubArrayDeepClone<T>(this T[] data, int index, int length)
|
||||||
|
{
|
||||||
|
T[] arrCopy = new T[length];
|
||||||
|
Array.Copy(data, index, arrCopy, 0, length);
|
||||||
|
using (MemoryStream ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
var bf = new BinaryFormatter();
|
||||||
|
bf.Serialize(ms, arrCopy);
|
||||||
|
ms.Position = 0;
|
||||||
|
return (T[])bf.Deserialize(ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -568,6 +568,7 @@
|
|||||||
<Compile Include="Generics\OpenGLTexture.cs" />
|
<Compile Include="Generics\OpenGLTexture.cs" />
|
||||||
<Compile Include="Interfaces\IDirectoryNode.cs" />
|
<Compile Include="Interfaces\IDirectoryNode.cs" />
|
||||||
<Compile Include="Interfaces\INode.cs" />
|
<Compile Include="Interfaces\INode.cs" />
|
||||||
|
<Compile Include="IO\Extensions\ByteArrayExtensions.cs" />
|
||||||
<Compile Include="Rendering\RenderableTex.cs" />
|
<Compile Include="Rendering\RenderableTex.cs" />
|
||||||
<Compile Include="Generics\STBone.cs" />
|
<Compile Include="Generics\STBone.cs" />
|
||||||
<Compile Include="Generics\STGenericWrapper.cs" />
|
<Compile Include="Generics\STGenericWrapper.cs" />
|
||||||
@ -625,12 +626,12 @@
|
|||||||
<Compile Include="IO\FileWriter.cs" />
|
<Compile Include="IO\FileWriter.cs" />
|
||||||
<Compile Include="IO\SyrootCommon\DWord.cs" />
|
<Compile Include="IO\SyrootCommon\DWord.cs" />
|
||||||
<Compile Include="IO\SyrootCommon\Half.cs" />
|
<Compile Include="IO\SyrootCommon\Half.cs" />
|
||||||
<Compile Include="IO\IOExtensions.cs" />
|
<Compile Include="IO\Extensions\IOExtensions.cs" />
|
||||||
<Compile Include="IO\Matrix4x4.cs" />
|
<Compile Include="IO\Matrix4x4.cs" />
|
||||||
<Compile Include="IO\STFileLoader.cs" />
|
<Compile Include="IO\STFileLoader.cs" />
|
||||||
<Compile Include="IO\STFileSaver.cs" />
|
<Compile Include="IO\STFileSaver.cs" />
|
||||||
<Compile Include="IO\StreamReaderExtensions.cs" />
|
<Compile Include="IO\Extensions\StreamReaderExtensions.cs" />
|
||||||
<Compile Include="IO\StringExtension.cs" />
|
<Compile Include="IO\Extensions\StringExtension.cs" />
|
||||||
<Compile Include="IO\STStream.cs" />
|
<Compile Include="IO\STStream.cs" />
|
||||||
<Compile Include="Maths\Math.cs" />
|
<Compile Include="Maths\Math.cs" />
|
||||||
<Compile Include="Plugin\GenericPluginLoader.cs" />
|
<Compile Include="Plugin\GenericPluginLoader.cs" />
|
||||||
|
@ -658,7 +658,7 @@ namespace Switch_Toolbox.Library
|
|||||||
|
|
||||||
mipOffset = (tex.mipOffset[mipLevel - 1]);
|
mipOffset = (tex.mipOffset[mipLevel - 1]);
|
||||||
if (mipLevel == 1)
|
if (mipLevel == 1)
|
||||||
mipOffset -= (uint)surfInfo.sliceSize;
|
mipOffset -= (uint)surfInfo.surfSize;
|
||||||
|
|
||||||
if (GetLevel)
|
if (GetLevel)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user