Add option to toggle SRGB for ftex

This commit is contained in:
KillzXGaming 2019-06-13 20:05:05 -04:00
parent add182f902
commit 95d434a058
10 changed files with 43 additions and 2 deletions

Binary file not shown.

View file

@ -57,11 +57,47 @@ namespace Switch_Toolbox.Library.Forms
{
if (GetEditor() == 0)
UpdateHexView();
if (GetEditor() == 1)
UpdateFileEditor();
if (GetEditor() == 2)
UpdateTextView();
}
private void UpdateFileEditor()
{
var File = ArchiveFileInfo.FileFormat;
if (File == null)
File = ArchiveFileInfo.OpenFile();
UserControl control = GetEditorForm(File);
if (control != null)
{
AddControl(control);
// if (CheckActiveType(control.GetType()))
// AddControl(control);
}
}
private bool CheckActiveType(Type type)
{
return stPanel1.Controls.Count > 0 && stPanel1.Controls[0].GetType() != type;
}
public UserControl GetEditorForm(IFileFormat fileFormat)
{
Type objectType = fileFormat.GetType();
foreach (var inter in objectType.GetInterfaces())
{
if (inter.IsGenericType && inter.GetGenericTypeDefinition() == typeof(IEditor<>))
{
System.Reflection.MethodInfo method = objectType.GetMethod("OpenForm");
return (UserControl)method.Invoke(fileFormat, new object[0]);
}
}
return null;
}
private void UpdateTextView()
{
TextEditor editor = (TextEditor)GetActiveEditor(typeof(TextEditor));

View file

@ -530,7 +530,7 @@ namespace Switch_Toolbox.Library
return;
}
private UserControl GetEditorForm(IFileFormat fileFormat)
public UserControl GetEditorForm(IFileFormat fileFormat)
{
Type objectType = fileFormat.GetType();
foreach (var inter in objectType.GetInterfaces())

View file

@ -5580,6 +5580,11 @@
Gets or sets the pixel swizzling stride.
</summary>
</member>
<member name="P:Syroot.NintenTools.Bfres.Texture.UseSRGB">
<summary>
Gets or sets the desired texture data buffer format.
</summary>
</member>
<member name="P:Syroot.NintenTools.Bfres.Texture.Format">
<summary>
Gets or sets the desired texture data buffer format.