mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2025-02-16 13:58:26 +00:00
More fixes to UI and file saving. Also add in bflim editing.
Fixed the shader param editor not adjusting the height for float4 types. Fixed the shape editor not adjusting some lists properly. Fixed hash based sarcs not saving right (menu.szs for example). Fixed bflim sarc alignment from being corrupted. Add alignment for effect file formats in sarc. Add bflim to the texture loader in sarc for batch previewing/edits
This commit is contained in:
parent
e4ccae2c93
commit
d5f50d91b8
30 changed files with 268 additions and 35 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -48,7 +48,7 @@ namespace FirstPlugin
|
|||
|
||||
var SzsFiles = SARCExt.SARC.UnpackRamN(stream);
|
||||
sarcData = new SarcData();
|
||||
sarcData.HashOnly = false;
|
||||
sarcData.HashOnly = SzsFiles.HashOnly;
|
||||
sarcData.Files = SzsFiles.Files;
|
||||
sarcData.endianness = GetByteOrder(stream);
|
||||
SarcHash = Utils.GenerateUniqueHashID();
|
||||
|
@ -241,15 +241,12 @@ namespace FirstPlugin
|
|||
try
|
||||
{
|
||||
CallRecursive(TreeView);
|
||||
CallRecursive(TreeView);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
PreviewEditor editor = new PreviewEditor();
|
||||
editor.Show();
|
||||
|
||||
|
@ -324,7 +321,7 @@ namespace FirstPlugin
|
|||
{
|
||||
IFileFormat file = STFileLoader.OpenFileFormat(FullName, Data,false, true, this);
|
||||
|
||||
if (file != null && file is TreeNode)
|
||||
if (file != null && file is TreeNodeFile)
|
||||
{
|
||||
sarc.OpenedFiles.Add(FullPath, Data);
|
||||
ReplaceNode(this.Parent, this, (TreeNode)file);
|
||||
|
|
|
@ -169,7 +169,11 @@ namespace Bfres.Structs
|
|||
UpdateEditor();
|
||||
}
|
||||
|
||||
public override void Replace(string FileName)
|
||||
public override void Replace(string FileName) {
|
||||
ReplaceTexture(FileName);
|
||||
}
|
||||
|
||||
public void ReplaceTexture(string FileName, uint MipMapCount = 0, TEX_FORMAT[] SupportedFormats = null)
|
||||
{
|
||||
string ext = System.IO.Path.GetExtension(FileName);
|
||||
ext = ext.ToLower();
|
||||
|
@ -189,8 +193,17 @@ namespace Bfres.Structs
|
|||
GTXImporterSettings setting = SetImporterSettings(FileName);
|
||||
GTXTextureImporter importer = new GTXTextureImporter();
|
||||
|
||||
setting.swizzle = 0;
|
||||
|
||||
if (Tex2Swizzle != 0)
|
||||
setting.swizzle = Tex2Swizzle;
|
||||
if (MipMapCount != 0)
|
||||
{
|
||||
setting.MipCount = MipMapCount;
|
||||
importer.OverrideMipCounter = true;
|
||||
}
|
||||
if (SupportedFormats != null)
|
||||
importer.LoadSupportedFormats(SupportedFormats);
|
||||
|
||||
importer.LoadSetting(setting);
|
||||
|
||||
|
@ -241,6 +254,9 @@ namespace Bfres.Structs
|
|||
|
||||
public void UpdateTex(Texture tex)
|
||||
{
|
||||
if (texture == null)
|
||||
texture = new Texture();
|
||||
|
||||
texture.Name = tex.Name;
|
||||
texture.Data = tex.Data;
|
||||
texture.MipData = tex.MipData;
|
||||
|
@ -436,6 +452,7 @@ namespace Bfres.Structs
|
|||
case TEX_FORMAT.R32_FLOAT: return GX2SurfaceFormat.TCD_R32_Float;
|
||||
case TEX_FORMAT.R8G8_UNORM: return GX2SurfaceFormat.TC_R8_G8_UNorm;
|
||||
case TEX_FORMAT.R8_UNORM: return GX2SurfaceFormat.TC_R8_UNorm;
|
||||
case TEX_FORMAT.A8_UNORM: return GX2SurfaceFormat.TC_R8_UNorm;
|
||||
default:
|
||||
throw new Exception($"Cannot convert format {texFormat}");
|
||||
}
|
||||
|
|
|
@ -36,6 +36,31 @@ namespace FirstPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public BFLIMFormat ConvertFormatGenericToBflim(TEX_FORMAT Format)
|
||||
{
|
||||
switch (Format)
|
||||
{
|
||||
case TEX_FORMAT.A8_UNORM: return BFLIMFormat.L8_UNORM;
|
||||
case TEX_FORMAT.R8G8_UNORM: return BFLIMFormat.LA8;
|
||||
case TEX_FORMAT.B5G6R5_UNORM: return BFLIMFormat.RGB565;
|
||||
case TEX_FORMAT.R8G8B8A8_UNORM: return BFLIMFormat.RGBA8;
|
||||
case TEX_FORMAT.R8G8B8A8_UNORM_SRGB: return BFLIMFormat.RGBA8_SRGB;
|
||||
case TEX_FORMAT.R10G10B10A2_UNORM: return BFLIMFormat.RGB10A2_UNORM;
|
||||
case TEX_FORMAT.B4G4R4A4_UNORM: return BFLIMFormat.RGBA4;
|
||||
case TEX_FORMAT.BC1_UNORM: return BFLIMFormat.BC1_UNORM;
|
||||
case TEX_FORMAT.BC1_UNORM_SRGB: return BFLIMFormat.BC1_SRGB;
|
||||
case TEX_FORMAT.BC2_UNORM: return BFLIMFormat.BC2_UNORM;
|
||||
case TEX_FORMAT.BC2_UNORM_SRGB: return BFLIMFormat.BC2_SRGB;
|
||||
case TEX_FORMAT.BC3_UNORM: return BFLIMFormat.BC3_UNORM;
|
||||
case TEX_FORMAT.BC3_UNORM_SRGB: return BFLIMFormat.BC3_SRGB;
|
||||
case TEX_FORMAT.BC4_UNORM: return BFLIMFormat.BC4A_UNORM;
|
||||
case TEX_FORMAT.BC4_SNORM: return BFLIMFormat.BC4L_UNORM;
|
||||
case TEX_FORMAT.BC5_UNORM: return BFLIMFormat.BC5_UNORM;
|
||||
default:
|
||||
throw new Exception("Unsupported format " + Format);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanEdit { get; set; } = false;
|
||||
|
||||
public bool CanSave { get; set; }
|
||||
|
@ -63,8 +88,11 @@ namespace FirstPlugin
|
|||
}
|
||||
}
|
||||
|
||||
ImageEditorForm form;
|
||||
public ImageEditorForm OpenForm()
|
||||
{
|
||||
bool IsDialog = IFileInfo != null && IFileInfo.InArchive;
|
||||
|
||||
Properties prop = new Properties();
|
||||
prop.Width = Width;
|
||||
prop.Height = Height;
|
||||
|
@ -74,7 +102,7 @@ namespace FirstPlugin
|
|||
prop.ImageSize = (uint)ImageData.Length;
|
||||
prop.Format = Format;
|
||||
|
||||
ImageEditorForm form = new ImageEditorForm();
|
||||
form = new ImageEditorForm(IsDialog);
|
||||
form.editorBase.Text = Text;
|
||||
form.editorBase.Dock = DockStyle.Fill;
|
||||
form.editorBase.AddFileContextEvent("Save", Save);
|
||||
|
@ -85,6 +113,24 @@ namespace FirstPlugin
|
|||
return form;
|
||||
}
|
||||
|
||||
private void UpdateForm()
|
||||
{
|
||||
if (form != null)
|
||||
{
|
||||
Properties prop = new Properties();
|
||||
prop.Width = Width;
|
||||
prop.Height = Height;
|
||||
prop.Depth = Depth;
|
||||
prop.MipCount = MipCount;
|
||||
prop.ArrayCount = ArrayCount;
|
||||
prop.ImageSize = (uint)ImageData.Length;
|
||||
prop.Format = Format;
|
||||
|
||||
form.editorBase.LoadProperties(prop);
|
||||
form.editorBase.LoadImage(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void Replace(object sender, EventArgs args)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
|
@ -100,8 +146,22 @@ namespace FirstPlugin
|
|||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
FTEX ftex = new FTEX();
|
||||
ftex.Replace(ofd.FileName);
|
||||
|
||||
ftex.ReplaceTexture(ofd.FileName, 1, SupportedFormats);
|
||||
if (ftex.texture != null)
|
||||
{
|
||||
image.Swizzle = (byte)ftex.texture.Swizzle;
|
||||
image.BflimFormat = ConvertFormatGenericToBflim(ftex.Format);
|
||||
image.Height = (ushort)ftex.texture.Height;
|
||||
image.Width = (ushort)ftex.texture.Width;
|
||||
|
||||
Format = GetFormat(image.BflimFormat);
|
||||
Width = image.Width;
|
||||
Height = image.Height;
|
||||
|
||||
ImageData = ftex.texture.Data;
|
||||
|
||||
UpdateForm();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,9 +256,12 @@ namespace FirstPlugin
|
|||
reader.Position = 0;
|
||||
ImageData = reader.ReadBytes((int)ImageSize);
|
||||
|
||||
if (!PluginRuntime.bflimTextures.ContainsKey(Text))
|
||||
PluginRuntime.bflimTextures.Add(Text, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private TEX_FORMAT GetFormat(BFLIMFormat format)
|
||||
{
|
||||
switch (format)
|
||||
|
|
|
@ -573,6 +573,7 @@ namespace FirstPlugin
|
|||
writer.Write(ImageData.Length);
|
||||
writer.WriteSignature(" XET");
|
||||
writer.Write(131073);
|
||||
|
||||
writer.Close();
|
||||
writer.Dispose();
|
||||
}
|
||||
|
|
|
@ -69,6 +69,21 @@ namespace FirstPlugin
|
|||
temp.Dispose();
|
||||
}
|
||||
}
|
||||
foreach (BFLIM tex in PluginRuntime.bflimTextures.Values)
|
||||
{
|
||||
Bitmap temp = tex.GetBitmap();
|
||||
|
||||
if (textureListView.InvokeRequired)
|
||||
{
|
||||
textureListView.Invoke((MethodInvoker)delegate {
|
||||
textureListView.Items.Add(tex.Text, imageIndex++);
|
||||
// Running on the UI thread
|
||||
textureImageList.Images.Add(temp);
|
||||
var dummy = textureImageList.Handle;
|
||||
});
|
||||
}
|
||||
temp.Dispose();
|
||||
}
|
||||
}));
|
||||
Thread.Start();
|
||||
|
||||
|
@ -85,6 +100,24 @@ namespace FirstPlugin
|
|||
|
||||
private void textureListView_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (PluginRuntime.bflimTextures.Count > 0)
|
||||
{
|
||||
if (PluginRuntime.bflimTextures.ContainsKey(textureListView.SelectedItems[0].Text))
|
||||
{
|
||||
var tex = PluginRuntime.bflimTextures[textureListView.SelectedItems[0].Text];
|
||||
if (imageEditorForm == null || imageEditorForm.IsDisposed)
|
||||
{
|
||||
imageEditorForm = new ImageEditorForm(false);
|
||||
imageEditorForm.Show(this);
|
||||
}
|
||||
|
||||
imageEditorForm.editorBase.Text = Text;
|
||||
imageEditorForm.editorBase.Dock = DockStyle.Fill;
|
||||
imageEditorForm.editorBase.LoadProperties(tex.GenericProperties);
|
||||
imageEditorForm.editorBase.LoadImage(tex);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (BNTX bntx in PluginRuntime.bntxContainers)
|
||||
{
|
||||
if (bntx.Textures.ContainsKey(textureListView.SelectedItems[0].Text))
|
||||
|
@ -93,7 +126,7 @@ namespace FirstPlugin
|
|||
|
||||
if (imageEditorForm == null || imageEditorForm.IsDisposed)
|
||||
{
|
||||
imageEditorForm = new ImageEditorForm();
|
||||
imageEditorForm = new ImageEditorForm(false);
|
||||
imageEditorForm.Show(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Drawing;
|
||||
using Switch_Toolbox.Library;
|
||||
using Syroot.NintenTools.NSW.Bfres;
|
||||
|
@ -9,7 +11,24 @@ namespace FirstPlugin.Forms
|
|||
{
|
||||
public partial class vector4SliderPanel : ParamValueEditorBase
|
||||
{
|
||||
public bool IsColor { get; set; }
|
||||
public List<string> ColorUniforms = new List<string>()
|
||||
{
|
||||
"Color", "color",
|
||||
"konst0", "konst1", "konst2", "konst3",
|
||||
};
|
||||
|
||||
public bool IsColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (activeParam != null)
|
||||
{
|
||||
return ColorUniforms.Any(activeParam.Name.Contains);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Color GetColor()
|
||||
{
|
||||
|
@ -47,6 +66,8 @@ namespace FirstPlugin.Forms
|
|||
barSlider4.Value = values[3];
|
||||
|
||||
SetColor(UniformName, values);
|
||||
|
||||
AdjustPanelHeight();
|
||||
}
|
||||
|
||||
public vector4SliderPanel(string UniformName, uint[] values, BfresShaderParam param)
|
||||
|
@ -64,6 +85,8 @@ namespace FirstPlugin.Forms
|
|||
barSlider2.Value = values[1];
|
||||
barSlider3.Value = values[2];
|
||||
barSlider4.Value = values[3];
|
||||
|
||||
AdjustPanelHeight();
|
||||
}
|
||||
|
||||
public vector4SliderPanel(string UniformName, int[] values, BfresShaderParam param)
|
||||
|
@ -81,18 +104,18 @@ namespace FirstPlugin.Forms
|
|||
barSlider2.Value = values[1];
|
||||
barSlider3.Value = values[2];
|
||||
barSlider4.Value = values[3];
|
||||
|
||||
AdjustPanelHeight();
|
||||
}
|
||||
|
||||
private void AdjustPanelHeight()
|
||||
{
|
||||
if (!IsColor)
|
||||
Height -= (colorPB.Height + 6);
|
||||
}
|
||||
|
||||
public void SetColor(string UniformName, float[] values)
|
||||
{
|
||||
|
||||
IsColor = UniformName.Contains("Color") ||
|
||||
UniformName.Contains("color") ||
|
||||
UniformName.Contains("konst0") ||
|
||||
UniformName.Contains("konst1") ||
|
||||
UniformName.Contains("konst2") ||
|
||||
UniformName.Contains("konst3");
|
||||
|
||||
if (IsColor)
|
||||
{
|
||||
colorPB.BackColor = Color.FromArgb(
|
||||
|
@ -113,8 +136,6 @@ namespace FirstPlugin.Forms
|
|||
{
|
||||
colorPB.Visible = false;
|
||||
alphaPB.Visible = false;
|
||||
|
||||
Height -= 18;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1006,7 +1006,7 @@
|
|||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.vertexBufferList1.Location = new System.Drawing.Point(6, 50);
|
||||
this.vertexBufferList1.Name = "vertexBufferList1";
|
||||
this.vertexBufferList1.Size = new System.Drawing.Size(398, 178);
|
||||
this.vertexBufferList1.Size = new System.Drawing.Size(585, 181);
|
||||
this.vertexBufferList1.TabIndex = 1;
|
||||
//
|
||||
// vertexBufferSkinCountUD
|
||||
|
@ -1123,6 +1123,8 @@
|
|||
//
|
||||
// stPanel9
|
||||
//
|
||||
this.stPanel9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.stPanel9.Controls.Add(this.stLabel20);
|
||||
this.stPanel9.Controls.Add(this.subMeshesViewBtn);
|
||||
this.stPanel9.Controls.Add(this.stLabel21);
|
||||
|
@ -1284,6 +1286,8 @@
|
|||
//
|
||||
// lodListView
|
||||
//
|
||||
this.lodListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lodListView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.lodListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1,
|
||||
|
|
|
@ -58,6 +58,9 @@
|
|||
//
|
||||
// keyShapeListView
|
||||
//
|
||||
this.keyShapeListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.keyShapeListView.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.keyShapeListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1});
|
||||
|
@ -76,6 +79,7 @@
|
|||
//
|
||||
// btnMoveKeyShapeDown
|
||||
//
|
||||
this.btnMoveKeyShapeDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnMoveKeyShapeDown.Enabled = false;
|
||||
this.btnMoveKeyShapeDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnMoveKeyShapeDown.Location = new System.Drawing.Point(360, 62);
|
||||
|
@ -87,6 +91,7 @@
|
|||
//
|
||||
// btnMoveKeyShapeUp
|
||||
//
|
||||
this.btnMoveKeyShapeUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnMoveKeyShapeUp.Enabled = false;
|
||||
this.btnMoveKeyShapeUp.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnMoveKeyShapeUp.Location = new System.Drawing.Point(360, 32);
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
//
|
||||
// btnScrolDown
|
||||
//
|
||||
this.btnScrolDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnScrolDown.Enabled = false;
|
||||
this.btnScrolDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnScrolDown.Location = new System.Drawing.Point(360, 62);
|
||||
|
@ -74,6 +75,7 @@
|
|||
//
|
||||
// btnScrollUp
|
||||
//
|
||||
this.btnScrollUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnScrollUp.Enabled = false;
|
||||
this.btnScrollUp.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnScrollUp.Location = new System.Drawing.Point(360, 32);
|
||||
|
@ -85,6 +87,9 @@
|
|||
//
|
||||
// attributeListView
|
||||
//
|
||||
this.attributeListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.attributeListView.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.attributeListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader2,
|
||||
|
|
|
@ -248,7 +248,7 @@ namespace FirstPlugin.Forms
|
|||
{
|
||||
if (imageEditorForm == null || imageEditorForm.IsDisposed)
|
||||
{
|
||||
imageEditorForm = new ImageEditorForm();
|
||||
imageEditorForm = new ImageEditorForm(false);
|
||||
imageEditorForm.Show(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ namespace FirstPlugin
|
|||
{
|
||||
public partial class GTXTextureImporter : Form
|
||||
{
|
||||
public bool OverrideMipCounter = false;
|
||||
|
||||
public GTXTextureImporter()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -69,6 +71,22 @@ namespace FirstPlugin
|
|||
tileModeCB.SelectedItem = GTX.GX2TileMode.MODE_2D_TILED_THIN1;
|
||||
formatComboBox.SelectedItem = GTX.GX2SurfaceFormat.T_BC1_SRGB;
|
||||
}
|
||||
|
||||
public void LoadSupportedFormats(TEX_FORMAT[] Formats)
|
||||
{
|
||||
formatComboBox.Items.Clear();
|
||||
foreach (TEX_FORMAT format in Formats)
|
||||
{
|
||||
var Gx2Format = (GTX.GX2SurfaceFormat)FTEX.ConvertToGx2Format(format);
|
||||
formatComboBox.Items.Add(Gx2Format);
|
||||
}
|
||||
|
||||
var Gx2DefaultFormat = (GTX.GX2SurfaceFormat)FTEX.ConvertToGx2Format(Runtime.PreferredTexFormat);
|
||||
|
||||
if (formatComboBox.Items.Contains(Gx2DefaultFormat))
|
||||
formatComboBox.SelectedItem = Gx2DefaultFormat;
|
||||
}
|
||||
|
||||
GTXImporterSettings SelectedTexSettings;
|
||||
|
||||
List<GTXImporterSettings> settings = new List<GTXImporterSettings>();
|
||||
|
@ -98,7 +116,6 @@ namespace FirstPlugin
|
|||
if (SelectedTexSettings.Format == GTX.GX2SurfaceFormat.INVALID)
|
||||
return;
|
||||
|
||||
|
||||
if (Thread != null && Thread.IsAlive)
|
||||
Thread.Abort();
|
||||
|
||||
|
@ -151,6 +168,15 @@ namespace FirstPlugin
|
|||
SetupSettings();
|
||||
|
||||
MipmapNum.Maximum = SelectedTexSettings.GetTotalMipCount() + 1;
|
||||
|
||||
//Force the mip counter to be the selected mip counter
|
||||
//Some textures like bflim (used for UI) only have 1
|
||||
if (OverrideMipCounter)
|
||||
{
|
||||
MipmapNum.Maximum = SelectedTexSettings.MipCount;
|
||||
MipmapNum.Minimum = SelectedTexSettings.MipCount;
|
||||
}
|
||||
|
||||
MipmapNum.Value = SelectedTexSettings.MipCount;
|
||||
|
||||
SwizzleNum.Value = SelectedTexSettings.swizzle;
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace FirstPlugin
|
|||
{
|
||||
public class PluginRuntime
|
||||
{
|
||||
public static Dictionary<string, BFLIM> bflimTextures = new Dictionary<string, BFLIM>();
|
||||
public static List<BNTX> bntxContainers = new List<BNTX>();
|
||||
public static List<BFRESGroupNode> ftexContainers = new List<BFRESGroupNode>();
|
||||
public static string ExternalFMATPath = "";
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -78,7 +78,9 @@ namespace Switch_Toolbox.Library
|
|||
|
||||
public ImageEditorForm OpenForm()
|
||||
{
|
||||
ImageEditorForm form = new ImageEditorForm();
|
||||
bool IsDialog = IFileInfo != null && IFileInfo.InArchive;
|
||||
|
||||
ImageEditorForm form = new ImageEditorForm(IsDialog);
|
||||
form.editorBase.Text = Text;
|
||||
form.editorBase.Dock = DockStyle.Fill;
|
||||
form.editorBase.LoadImage(this);
|
||||
|
|
|
@ -431,7 +431,9 @@ namespace Switch_Toolbox.Library
|
|||
|
||||
public ImageEditorForm OpenForm()
|
||||
{
|
||||
ImageEditorForm form = new ImageEditorForm();
|
||||
bool IsDialog = IFileInfo != null && IFileInfo.InArchive;
|
||||
|
||||
ImageEditorForm form = new ImageEditorForm(IsDialog);
|
||||
form.editorBase.Text = Text;
|
||||
form.editorBase.Dock = DockStyle.Fill;
|
||||
form.editorBase.LoadImage(this);
|
||||
|
|
|
@ -29,31 +29,76 @@
|
|||
private void InitializeComponent()
|
||||
{
|
||||
this.editorBase = new Switch_Toolbox.Library.Forms.ImageEditorBase();
|
||||
this.btnCancel = new Switch_Toolbox.Library.Forms.STButton();
|
||||
this.btnSave = new Switch_Toolbox.Library.Forms.STButton();
|
||||
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
|
||||
this.contentContainer.SuspendLayout();
|
||||
this.stPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// contentContainer
|
||||
//
|
||||
this.contentContainer.Controls.Add(this.editorBase);
|
||||
this.contentContainer.Controls.SetChildIndex(this.editorBase, 0);
|
||||
this.contentContainer.Controls.Add(this.stPanel1);
|
||||
this.contentContainer.Controls.Add(this.btnSave);
|
||||
this.contentContainer.Controls.Add(this.btnCancel);
|
||||
this.contentContainer.Size = new System.Drawing.Size(543, 403);
|
||||
this.contentContainer.Controls.SetChildIndex(this.btnCancel, 0);
|
||||
this.contentContainer.Controls.SetChildIndex(this.btnSave, 0);
|
||||
this.contentContainer.Controls.SetChildIndex(this.stPanel1, 0);
|
||||
//
|
||||
// editorBase
|
||||
//
|
||||
this.editorBase.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.editorBase.HasBeenEdited = false;
|
||||
this.editorBase.Location = new System.Drawing.Point(0, 25);
|
||||
this.editorBase.Location = new System.Drawing.Point(0, 0);
|
||||
this.editorBase.Name = "editorBase";
|
||||
this.editorBase.Size = new System.Drawing.Size(543, 368);
|
||||
this.editorBase.Size = new System.Drawing.Size(543, 334);
|
||||
this.editorBase.TabIndex = 11;
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnCancel.Location = new System.Drawing.Point(459, 371);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancel.TabIndex = 12;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnSave.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnSave.Location = new System.Drawing.Point(378, 371);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnSave.TabIndex = 13;
|
||||
this.btnSave.Text = "Save";
|
||||
this.btnSave.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// stPanel1
|
||||
//
|
||||
this.stPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.stPanel1.Controls.Add(this.editorBase);
|
||||
this.stPanel1.Location = new System.Drawing.Point(0, 31);
|
||||
this.stPanel1.Name = "stPanel1";
|
||||
this.stPanel1.Size = new System.Drawing.Size(543, 334);
|
||||
this.stPanel1.TabIndex = 14;
|
||||
//
|
||||
// ImageEditorForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(549, 398);
|
||||
this.ClientSize = new System.Drawing.Size(549, 408);
|
||||
this.Name = "ImageEditorForm";
|
||||
this.Text = "ImageEditorForm";
|
||||
this.contentContainer.ResumeLayout(false);
|
||||
this.stPanel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -61,5 +106,8 @@
|
|||
#endregion
|
||||
|
||||
public ImageEditorBase editorBase;
|
||||
private STButton btnSave;
|
||||
private STButton btnCancel;
|
||||
private STPanel stPanel1;
|
||||
}
|
||||
}
|
|
@ -12,9 +12,16 @@ namespace Switch_Toolbox.Library.Forms
|
|||
{
|
||||
public partial class ImageEditorForm : STForm
|
||||
{
|
||||
public ImageEditorForm()
|
||||
public ImageEditorForm(bool UseDialog)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (!UseDialog)
|
||||
{
|
||||
btnSave.Visible = false;
|
||||
btnCancel.Visible = false;
|
||||
stPanel1.Dock = DockStyle.Fill;
|
||||
}
|
||||
}
|
||||
|
||||
public IFileFormat GetActiveFile()
|
||||
|
|
|
@ -192,6 +192,7 @@ namespace Switch_Toolbox.Library
|
|||
{ TEX_FORMAT.R16_SNORM, new FormatInfo(2, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.R16_UINT, new FormatInfo(2, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.R16_UNORM, new FormatInfo(2, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.A8_UNORM, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.R8_SINT, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.R8_SNORM, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.R8_UINT, new FormatInfo(1, 1, 1, 1, TargetBuffer.Color) },
|
||||
|
@ -408,9 +409,9 @@ namespace Switch_Toolbox.Library
|
|||
else
|
||||
{
|
||||
//If blue channel becomes first, do not swap them!
|
||||
if (Format.ToString().StartsWith("B") || Format == TEX_FORMAT.B5G6R5_UNORM)
|
||||
return DDSCompressor.DecodePixelBlock(data, (int)Width, (int)Height, (DDS.DXGI_FORMAT)Format);
|
||||
else if (IsAtscFormat(Format))
|
||||
// if (Format.ToString().StartsWith("B") || Format == TEX_FORMAT.B5G6R5_UNORM)
|
||||
// return DDSCompressor.DecodePixelBlock(data, (int)Width, (int)Height, (DDS.DXGI_FORMAT)Format);
|
||||
if (IsAtscFormat(Format))
|
||||
return ConvertBgraToRgba(ASTCDecoder.DecodeToRGBA8888(data, (int)GetBlockWidth(Format), (int)GetBlockHeight(Format), 1, (int)Width, (int)Height, 1));
|
||||
else
|
||||
return ConvertBgraToRgba(DDSCompressor.DecodePixelBlock(data, (int)Width, (int)Height, (DDS.DXGI_FORMAT)Format));
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue