Fix DDS headers in SDF archive
This commit is contained in:
parent
8f849bf260
commit
cee244669e
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Switch_Toolbox;
|
using Switch_Toolbox;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
@ -241,7 +241,17 @@ namespace FirstPlugin
|
|||||||
|
|
||||||
if (UseDDS)
|
if (UseDDS)
|
||||||
{
|
{
|
||||||
Data.Add(SDFParent.block2Array[DdsType].Data);
|
bool IsDX10 = false;
|
||||||
|
using (var filereader = new FileReader(SDFParent.block2Array[DdsType].Data))
|
||||||
|
{
|
||||||
|
filereader.Position = 84;
|
||||||
|
IsDX10 = filereader.ReadString(4) == "DX10";
|
||||||
|
|
||||||
|
if (IsDX10)
|
||||||
|
Data.Add(SDFParent.block2Array[DdsType].Data.Take((int)0x94).ToArray());
|
||||||
|
else
|
||||||
|
Data.Add(SDFParent.block2Array[DdsType].Data.Take((int)0x80).ToArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < CompressedSizes.Count; i++)
|
for (var i = 0; i < CompressedSizes.Count; i++)
|
||||||
|
Binary file not shown.
@ -766,7 +766,7 @@ namespace Switch_Toolbox.Library
|
|||||||
ArrayCount = DX10header.arrayFlag;
|
ArrayCount = DX10header.arrayFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SwitchSwizzle = false;
|
public bool SwitchSwizzle = true;
|
||||||
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0)
|
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0)
|
||||||
{
|
{
|
||||||
if (SwitchSwizzle)
|
if (SwitchSwizzle)
|
||||||
|
@ -370,7 +370,10 @@ namespace Switch_Toolbox.Library.Forms
|
|||||||
var image = ActiveTexture.GetBitmap(CurArrayDisplayLevel, CurMipDisplayLevel);
|
var image = ActiveTexture.GetBitmap(CurArrayDisplayLevel, CurMipDisplayLevel);
|
||||||
|
|
||||||
//Keep base image for channel viewer updating/editing
|
//Keep base image for channel viewer updating/editing
|
||||||
BaseImage = new Bitmap(image);
|
if (image != null)
|
||||||
|
BaseImage = new Bitmap(image);
|
||||||
|
else
|
||||||
|
BaseImage = null;
|
||||||
|
|
||||||
if (propertiesEditor.InvokeRequired)
|
if (propertiesEditor.InvokeRequired)
|
||||||
{
|
{
|
||||||
|
@ -33,6 +33,10 @@ namespace Switch_Toolbox.Library
|
|||||||
{
|
{
|
||||||
string FilePath = ((ArchiveFileWrapper)file).ArchiveFileInfo.FileName;
|
string FilePath = ((ArchiveFileWrapper)file).ArchiveFileInfo.FileName;
|
||||||
string FolderPath = Path.GetDirectoryName(FilePath.RemoveIllegaleFolderNameCharacters());
|
string FolderPath = Path.GetDirectoryName(FilePath.RemoveIllegaleFolderNameCharacters());
|
||||||
|
string FolderPathDir = Path.Combine(folderDialog.SelectedPath, FolderPath);
|
||||||
|
|
||||||
|
if (!Directory.Exists(FolderPathDir))
|
||||||
|
Directory.CreateDirectory(FolderPathDir);
|
||||||
|
|
||||||
string FileName = file.Text.RemoveIllegaleFileNameCharacters();
|
string FileName = file.Text.RemoveIllegaleFileNameCharacters();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user