1
0
mirror of synced 2024-12-01 02:27:22 +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 namespace FirstPlugin
{ {
public class NUTEXB : STGenericTexture, IFileFormat public class NUTEXB : STGenericTexture, IFileFormat, IContextMenuNode
{ {
public FileType FileType { get; set; } = FileType.Image; public FileType FileType { get; set; } = FileType.Image;
@ -588,10 +588,10 @@ namespace FirstPlugin
return TegraX1Swizzle.GetImageData(this, ImageData, ArrayLevel, MipLevel, 1); return TegraX1Swizzle.GetImageData(this, ImageData, ArrayLevel, MipLevel, 1);
} }
MenuItem save = new MenuItem("Save"); ToolStripMenuItem save = new ToolStripMenuItem("Save");
MenuItem export = new MenuItem("Export"); ToolStripMenuItem export = new ToolStripMenuItem("Export");
MenuItem replace = new MenuItem("Replace"); ToolStripMenuItem replace = new ToolStripMenuItem("Replace");
MenuItem useSizeRestrictions = new MenuItem("UseSizeRestrictions"); ToolStripMenuItem useSizeRestrictions = new ToolStripMenuItem("UseSizeRestrictions");
public void Load(System.IO.Stream stream) public void Load(System.IO.Stream stream)
{ {
@ -605,16 +605,21 @@ namespace FirstPlugin
useSizeRestrictions.Checked = true; 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; save.Click += Save;
replace.Click += Replace; replace.Click += Replace;
export.Click += Export; 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() public void Unload()
{ {

View File

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