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

Fix context menus for nutexb

This commit is contained in:
KillzXGaming 2019-07-01 17:49:49 -04:00
parent 3a43ea049c
commit f12a85a83a
7 changed files with 17 additions and 12 deletions

Binary file not shown.

View File

@ -14,7 +14,7 @@ using Syroot.NintenTools.NSW.Bntx.GFX;
namespace FirstPlugin
{
public class NUTEXB : STGenericTexture, IFileFormat
public class NUTEXB : STGenericTexture, IFileFormat, IContextMenuNode
{
public FileType FileType { get; set; } = FileType.Image;
@ -588,10 +588,10 @@ namespace FirstPlugin
return TegraX1Swizzle.GetImageData(this, ImageData, ArrayLevel, MipLevel, 1);
}
MenuItem save = new MenuItem("Save");
MenuItem export = new MenuItem("Export");
MenuItem replace = new MenuItem("Replace");
MenuItem useSizeRestrictions = new MenuItem("UseSizeRestrictions");
ToolStripMenuItem save = new ToolStripMenuItem("Save");
ToolStripMenuItem export = new ToolStripMenuItem("Export");
ToolStripMenuItem replace = new ToolStripMenuItem("Replace");
ToolStripMenuItem useSizeRestrictions = new ToolStripMenuItem("UseSizeRestrictions");
public void Load(System.IO.Stream stream)
{
@ -605,16 +605,21 @@ namespace FirstPlugin
useSizeRestrictions.Checked = true;
ContextMenu = new ContextMenu();
ContextMenu.MenuItems.Add(save);
ContextMenu.MenuItems.Add(useSizeRestrictions);
ContextMenu.MenuItems.Add(export);
ContextMenu.MenuItems.Add(replace);
save.Click += Save;
replace.Click += Replace;
export.Click += Export;
}
public ToolStripItem[] GetContextMenuItems()
{
List<ToolStripItem> Items = new List<ToolStripItem>();
Items.Add(save);
Items.Add(useSizeRestrictions);
Items.Add(export);
Items.Add(replace);
return Items.ToArray();
}
public void Unload()
{

View File

@ -632,7 +632,7 @@ namespace Switch_Toolbox.Library
if (tex.mipData != null)
mipdata = new byte[tex.mipData.Length];
uint mipCount = tex.numMips;
if (tex.mipData == null || tex.mipData.Length <= 0)
mipCount = 1;