1
0
mirror of synced 2024-11-28 09:20:57 +01:00

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 - Exelix for Byaml, Sarc and KCL library
- Syroot for helpful IO extensions and libraries - Syroot for helpful IO extensions and libraries
- GDK Chan for some DDS decode methods - 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. - MelonSpeedruns for logo.
Resources Resources

View File

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