1
0
mirror of synced 2025-02-07 15:11:20 +01:00

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) if (GetEditor() == 0)
UpdateHexView(); UpdateHexView();
if (GetEditor() == 1)
UpdateFileEditor();
if (GetEditor() == 2) if (GetEditor() == 2)
UpdateTextView(); 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() private void UpdateTextView()
{ {
TextEditor editor = (TextEditor)GetActiveEditor(typeof(TextEditor)); TextEditor editor = (TextEditor)GetActiveEditor(typeof(TextEditor));

View File

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

View File

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