KillzXGaming / Switch-Toolbox

A tool to edit many video game file formats
GNU General Public License v3.0
946 stars 151 forks source link

Issues with BNTX with more than one array level #43

Open masagrator opened 5 years ago

masagrator commented 5 years ago

It looks like this tool has some issues if BNTX/BFTEX contains more than one array layer. It can't export properly to DDS (exported file shows nothing, importing it crashes app)

Importing different file than bftex changes structure of file. F.e. before importing image

After Replace with png, the same format, Image Dimension Dim2D or Dim2DArray (doesn't matter) image But textures datas in hex are the good (tested on Dim2DArray)

And it deletes other array layers except this imported one and can't export anything more than first array layer to image format.

Extract BNTX in tools does nothing.

Sheet0.zip

KillzXGaming commented 5 years ago

Only 2D surfaces work but i'll be adding in multiple types soon. For now on the latest build you can "Image -Edit in external program" (Or click on the blue image icon next to the save one) which will open the image in whatever program opens DDS (ideally something that supports BC4) and edit in that. It'll save back when you save the file. I

KillzXGaming commented 5 years ago

Another update with this. DDS now supports array textures (export and import). A custom UI to add array textures and replacing specific arrays/mip maps with png,jpg,tiff, etc is planned atm.

SilentStorm-1986 commented 2 years ago

I can't find any way to import texture arrays into a Wii U/Switch game. I tried creating a DDS texture array and matched all the parameters to the original file. Only the first texture gets imported and the rest of the array is erased.

When replacing a file in the array manually (Edit in External Program) I receive the error "Failed to Compress and Swizzle the Image" System.Exception: Unsupported Depth (length of the array)! at Toolbox.Library.GX2.CreateGx2Texture(Byte[] imageData, String Name, UInt32 TileMode, UInt32 AAMode, UInt32 Width, UInt32 Height, UInt32 Depth, UInt32 Format, UInt32 swizzle, UInt32 SurfaceDim, UInt32 MipCount) at Bfres.Structs.FTEX.SetImageData(Bitmap bitmap, Int32 ArrayLevel) in C:\projects\switch-toolbox-fkj3m\File_Format_Library\FileFormats\BFRES\Bfres Structs\SubFiles\FTEX.cs:line 492

Hats off to you for your hard work!

DragarX commented 1 year ago

Any more updates on image arrays? Pokemon scarlet and violet use arrays for their terrain textures and currently you can edit the textures and replace them, when you export it currently corrupts all the textures aside from the first. It also crashes when you try to resize any images in an array