Try to fix tex2 swizzle issues
This commit is contained in:
parent
f28b979b33
commit
74bdba4536
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -134,9 +134,10 @@ namespace Bfres.Structs
|
||||
GTXImporterSettings setting = SetImporterSettings(image, FileName);
|
||||
setting.MipSwizzle = Tex2Swizzle;
|
||||
|
||||
GTXTextureImporter importer = new GTXTextureImporter();
|
||||
if (Tex2Swizzle != 0)
|
||||
setting.Swizzle = Tex2SwizzleValue;
|
||||
|
||||
setting.MipSwizzle = Tex2Swizzle;
|
||||
GTXTextureImporter importer = new GTXTextureImporter();
|
||||
importer.LoadSetting(setting);
|
||||
|
||||
if (importer.ShowDialog() == DialogResult.OK)
|
||||
@ -200,6 +201,9 @@ namespace Bfres.Structs
|
||||
importer.ReadOnlySwizzle = IsSwizzleReadOnly;
|
||||
importer.ReadOnlyTileMode = IsSwizzleReadOnly;
|
||||
|
||||
if (Tex2Swizzle != 0)
|
||||
setting.Swizzle = Tex2Swizzle;
|
||||
|
||||
if (MipMapCount != 0)
|
||||
{
|
||||
setting.MipCount = MipMapCount;
|
||||
|
@ -150,7 +150,7 @@ namespace FirstPlugin
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
FTEX ftex = new FTEX();
|
||||
ftex.ReplaceTexture(ofd.FileName, 1, SupportedFormats, true, true);
|
||||
ftex.ReplaceTexture(ofd.FileName, 1, SupportedFormats);
|
||||
if (ftex.texture != null)
|
||||
{
|
||||
image.Swizzle = (byte)ftex.texture.Swizzle;
|
||||
|
@ -20,8 +20,7 @@ namespace FirstPlugin
|
||||
setting.TexHeight,
|
||||
setting.Depth,
|
||||
(uint)setting.Format,
|
||||
setting.SwizzlePattern,
|
||||
setting.MipSwizzle,
|
||||
setting.Swizzle,
|
||||
(uint)setting.SurfaceDim,
|
||||
setting.MipCount);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ namespace FirstPlugin
|
||||
public uint tileMode = 4;
|
||||
|
||||
public uint SwizzlePattern = 0;
|
||||
public uint Swizzle = 0;
|
||||
public uint MipSwizzle = 0;
|
||||
|
||||
public GX2CompSel[] compSel = new GX2CompSel[4];
|
||||
|
@ -205,12 +205,13 @@ namespace FirstPlugin
|
||||
|
||||
MipmapNum.Value = SelectedTexSettings.MipCount;
|
||||
|
||||
SwizzleNum.Value = SelectedTexSettings.SwizzlePattern;
|
||||
SwizzleNum.Value = (SelectedTexSettings.Swizzle >> 8) & 7;
|
||||
}
|
||||
}
|
||||
|
||||
private void SwizzleNum_ValueChanged(object sender, EventArgs e) {
|
||||
SelectedTexSettings.SwizzlePattern = (uint)SwizzleNum.Value;
|
||||
SelectedTexSettings.Swizzle &= GX2.SwizzleMask;
|
||||
SelectedTexSettings.Swizzle |= (uint)SwizzleNum.Value << 8;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Binary file not shown.
Binary file not shown.
@ -432,7 +432,7 @@ namespace Switch_Toolbox.Library
|
||||
static bool DebugSurface = false;
|
||||
|
||||
public static GX2Surface CreateGx2Texture(byte[] imageData, string Name, uint TileMode, uint AAMode,
|
||||
uint Width, uint Height, uint Depth, uint Format, uint swizzle, uint mipSwizzle, uint SurfaceDim, uint MipCount)
|
||||
uint Width, uint Height, uint Depth, uint Format, uint swizzle, uint SurfaceDim, uint MipCount)
|
||||
{
|
||||
var surfOut = getSurfaceInfo((GX2SurfaceFormat)Format, Width, Height, 1, 1, TileMode, 0, 0);
|
||||
uint imageSize = (uint)surfOut.surfSize;
|
||||
@ -474,8 +474,6 @@ namespace Switch_Toolbox.Library
|
||||
|
||||
for (int mipLevel = 0; mipLevel < MipCount; mipLevel++)
|
||||
{
|
||||
uint swizzleValue = s;
|
||||
|
||||
var result = TextureHelper.GetCurrentMipSize(Width, Height, blkWidth, blkHeight, bpp, mipLevel);
|
||||
|
||||
uint offset = result.Item1;
|
||||
@ -489,9 +487,6 @@ namespace Switch_Toolbox.Library
|
||||
|
||||
if (mipLevel != 0)
|
||||
{
|
||||
if (mipSwizzle != 0)
|
||||
swizzleValue = mipSwizzle;
|
||||
|
||||
surfOut = GX2.getSurfaceInfo((GX2SurfaceFormat)Format, Width, Height, 1, 1, TileMode, 0, mipLevel);
|
||||
|
||||
if (mipLevel == 1)
|
||||
@ -506,7 +501,7 @@ namespace Switch_Toolbox.Library
|
||||
if (mipLevel != 0)
|
||||
mipSize += (uint)(surfOut.surfSize + dataAlignBytes.Length);
|
||||
|
||||
byte[] SwizzledData = GX2.swizzle(width_, height_, surfOut.depth, surfOut.height, (uint)Format, surfOut.tileMode, swizzleValue,
|
||||
byte[] SwizzledData = GX2.swizzle(width_, height_, surfOut.depth, surfOut.height, (uint)Format, surfOut.tileMode, s,
|
||||
surfOut.pitch, surfOut.bpp, data_, DepthLevel);
|
||||
|
||||
Swizzled.Add(dataAlignBytes.Concat(SwizzledData).ToArray());
|
||||
|
Loading…
Reference in New Issue
Block a user