mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2025-02-16 22:08:26 +00:00
Some swizzle pattern fixes (Also fixes bflim issues)
This commit is contained in:
parent
a5da5c8609
commit
cea6f264cd
5 changed files with 20 additions and 13 deletions
|
@ -193,10 +193,10 @@ namespace Bfres.Structs
|
|||
if (texture != null && texture.MipCount == 1)
|
||||
ReplaceTexture(FileName, Format, texture.MipCount);
|
||||
else
|
||||
ReplaceTexture(FileName, Format, 0, null, false, false, false);
|
||||
ReplaceTexture(FileName, Format, 0,0, null, false, false, false);
|
||||
}
|
||||
|
||||
public void ReplaceTexture(string FileName, TEX_FORMAT DefaultFormat = TEX_FORMAT.UNKNOWN, uint MipMapCount = 0, TEX_FORMAT[] SupportedFormats = null,
|
||||
public void ReplaceTexture(string FileName, TEX_FORMAT DefaultFormat = TEX_FORMAT.UNKNOWN, uint MipMapCount = 0, uint swizzlePattern = 0, TEX_FORMAT[] SupportedFormats = null,
|
||||
bool IsSwizzleReadOnly = false, bool IsTileModeReadOnly = false, bool IsFormatReadOnly = false)
|
||||
{
|
||||
string ext = System.IO.Path.GetExtension(FileName);
|
||||
|
@ -216,6 +216,7 @@ namespace Bfres.Structs
|
|||
|
||||
GTXImporterSettings setting = SetImporterSettings(FileName, DefaultFormat);
|
||||
setting.MipSwizzle = Tex2Swizzle;
|
||||
setting.SwizzlePattern = swizzlePattern;
|
||||
|
||||
GTXTextureImporter importer = new GTXTextureImporter();
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ namespace FirstPlugin
|
|||
if (ofd.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
FTEX ftex = new FTEX();
|
||||
ftex.ReplaceTexture(ofd.FileName, TEX_FORMAT.BC3_UNORM_SRGB, 1, bflim.SupportedFormats, true, true, false);
|
||||
ftex.ReplaceTexture(ofd.FileName, TEX_FORMAT.BC3_UNORM_SRGB, 1, 0, bflim.SupportedFormats, false, true, false);
|
||||
if (ftex.texture != null)
|
||||
{
|
||||
bflim.Text = ftex.texture.Name;
|
||||
|
@ -310,11 +310,13 @@ namespace FirstPlugin
|
|||
|
||||
public override void Replace(string FileName)
|
||||
{
|
||||
uint swizzle = (image.Swizzle >> 8) & 7;
|
||||
|
||||
FTEX ftex = new FTEX();
|
||||
ftex.ReplaceTexture(FileName, Format, 1, SupportedFormats, true, true, false);
|
||||
ftex.ReplaceTexture(FileName, Format, 1, swizzle, SupportedFormats, true, true, false);
|
||||
if (ftex.texture != null)
|
||||
{
|
||||
image.Swizzle = (byte)ftex.texture.Swizzle;
|
||||
image.Swizzle = ftex.texture.Swizzle;
|
||||
image.BflimFormat = FormatsWiiU.FirstOrDefault(x => x.Value == ftex.Format).Key;
|
||||
image.Height = (ushort)ftex.texture.Height;
|
||||
image.Width = (ushort)ftex.texture.Width;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace FirstPlugin
|
|||
setting.TexHeight,
|
||||
setting.Depth,
|
||||
(uint)setting.Format,
|
||||
setting.Swizzle,
|
||||
setting.SwizzlePattern,
|
||||
(uint)setting.SurfaceDim,
|
||||
setting.MipCount);
|
||||
}
|
||||
|
|
|
@ -279,9 +279,7 @@ namespace FirstPlugin
|
|||
}
|
||||
|
||||
private void SwizzleNum_ValueChanged(object sender, EventArgs e) {
|
||||
// SelectedTexSettings.Swizzle &= GX2.SwizzleMask;
|
||||
// SelectedTexSettings.Swizzle |= (uint)SwizzleNum.Value << 8;
|
||||
SelectedTexSettings.Swizzle = (uint)SwizzleNum.Value;
|
||||
SelectedTexSettings.SwizzlePattern = (uint)SwizzleNum.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -459,6 +459,10 @@ namespace Toolbox.Library
|
|||
else
|
||||
s = 0xd0000 | swizzle << 8;
|
||||
|
||||
s = 0xd0000 | swizzle << 8;
|
||||
|
||||
Console.WriteLine("swizzle " + s);
|
||||
|
||||
uint blkWidth, blkHeight;
|
||||
if (GX2.IsFormatBCN((GX2SurfaceFormat)Format))
|
||||
{
|
||||
|
@ -537,10 +541,12 @@ namespace Toolbox.Library
|
|||
tiling1dLevel += 1;
|
||||
}
|
||||
|
||||
// if (tiling1dLevelSet)
|
||||
// s |= (uint)(tiling1dLevel << 16);
|
||||
// else
|
||||
// s |= (uint)(13 << 16);
|
||||
if (tiling1dLevelSet)
|
||||
s |= (uint)(tiling1dLevel << 16);
|
||||
else
|
||||
s |= (uint)(13 << 16);
|
||||
|
||||
Console.WriteLine("swizzle " + s);
|
||||
|
||||
GX2.GX2Surface surf = new GX2.GX2Surface();
|
||||
surf.depth = Depth;
|
||||
|
|
Loading…
Add table
Reference in a new issue