mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 20:43:09 +00:00
Fix DDS headers in SDF archive
This commit is contained in:
parent
8f849bf260
commit
cee244669e
8 changed files with 21 additions and 4 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Switch_Toolbox;
|
||||
using System.Windows.Forms;
|
||||
|
@ -241,7 +241,17 @@ namespace FirstPlugin
|
|||
|
||||
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++)
|
||||
|
|
Binary file not shown.
|
@ -766,7 +766,7 @@ namespace Switch_Toolbox.Library
|
|||
ArrayCount = DX10header.arrayFlag;
|
||||
}
|
||||
|
||||
public bool SwitchSwizzle = false;
|
||||
public bool SwitchSwizzle = true;
|
||||
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0)
|
||||
{
|
||||
if (SwitchSwizzle)
|
||||
|
|
|
@ -370,7 +370,10 @@ namespace Switch_Toolbox.Library.Forms
|
|||
var image = ActiveTexture.GetBitmap(CurArrayDisplayLevel, CurMipDisplayLevel);
|
||||
|
||||
//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)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,10 @@ namespace Switch_Toolbox.Library
|
|||
{
|
||||
string FilePath = ((ArchiveFileWrapper)file).ArchiveFileInfo.FileName;
|
||||
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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue