Clean up and fix for format 0x35 (with tileMode 16)

Also update README.md
This commit is contained in:
AboodXD 2019-04-11 19:53:55 +04:00
parent f6d8e8196b
commit 8820b01978
2 changed files with 6 additions and 13 deletions

View file

@ -77,7 +77,7 @@ In the event that the tool cannot compile, check references. All the libraries a
- Exelix for Byaml, Sarc and KCL library
- Syroot for helpful IO extensions and libraries
- GDK Chan for some DDS decode methods
- AboodXD for some foundation stuff with exelix's SARC library, GTX and BNTX texture swizzling and documentation
- AboodXD for some foundation stuff with exelix's SARC library, Wii U (GPU7) and Switch (Tegra X1) textures swizzling, and documentation for GTX and BNTX
- MelonSpeedruns for logo.
Resources

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Collections.Generic;
@ -2346,10 +2346,7 @@ namespace Switch_Toolbox.Library
else
blockSize = 4;
width = (uint)(~(blockSize - 1) & ((surfaceWidth >> level) + blockSize - 1));
if (hwFormat == 0x35)
return pSurfOut;
width = (uint)(~(blockSize - 1) & (Math.Max(1, surfaceWidth >> level) + blockSize - 1));
pSurfOut.bpp = formatHwInfo[hwFormat * 4];
pSurfOut.size = 96;
@ -2392,13 +2389,9 @@ namespace Switch_Toolbox.Library
pSurfOut.depth = surfaceDepth;
}
pSurfOut.height = (uint)(~(blockSize - 1) & (pSurfOut.height + blockSize - 1)) / blockSize;
pSurfOut.pixelPitch = (uint)(~(blockSize - 1) & ((surfaceWidth >> level) + blockSize - 1));
pSurfOut.pixelPitch = Math.Max(blockSize, pSurfOut.pixelPitch);
pSurfOut.pixelHeight = (uint)(~(blockSize - 1) & ((surfaceHeight >> level) + blockSize - 1));
pSurfOut.pixelHeight = Math.Max(blockSize, pSurfOut.pixelHeight);
pSurfOut.pitch = Math.Max(1, pSurfOut.pitch);
pSurfOut.height = Math.Max(1, pSurfOut.height);
pSurfOut.pixelPitch = width;
pSurfOut.pixelHeight = (uint)(~(blockSize - 1) & (Math.Max(1, surfaceHeight >> level) + blockSize - 1));
pSurfOut.height = (uint)(pSurfOut.pixelHeight / blockSize);
pSurfOut.surfSize = pSurfOut.bpp * numSamples * pSurfOut.depth * pSurfOut.height * pSurfOut.pitch >> 3;
if (surfaceDim == 2)