From 446568f64198acc7e9a21364ecbcc5398c05f57a Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Mon, 23 Mar 2020 20:38:39 -0400 Subject: [PATCH] Some more bfxfnt fixes with gx2. Also fix the character selector --- .../FileFormats/Font/BXFNT/Images/Gx2ImageBlock.cs | 14 +++++++++++--- File_Format_Library/GUI/BXFNT/BffntEditor.cs | 8 +++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/File_Format_Library/FileFormats/Font/BXFNT/Images/Gx2ImageBlock.cs b/File_Format_Library/FileFormats/Font/BXFNT/Images/Gx2ImageBlock.cs index 9a29a93a..0893dc49 100644 --- a/File_Format_Library/FileFormats/Font/BXFNT/Images/Gx2ImageBlock.cs +++ b/File_Format_Library/FileFormats/Font/BXFNT/Images/Gx2ImageBlock.cs @@ -27,10 +27,10 @@ namespace FirstPlugin Format = ConvertToGeneric(BFNTFormat); if (Format == TEX_FORMAT.BC4_UNORM) { - RedChannel = STChannelType.One; + /* RedChannel = STChannelType.One; GreenChannel = STChannelType.One; BlueChannel = STChannelType.One; - AlphaChannel = STChannelType.Red; + AlphaChannel = STChannelType.Red;*/ } ImageKey = "Texture"; @@ -78,7 +78,15 @@ namespace FirstPlugin Width = ftex.texture.Width; Height = ftex.texture.Height; - UpdateEditor(); + if (Format == TEX_FORMAT.BC4_UNORM) + { + /* RedChannel = STChannelType.One; + GreenChannel = STChannelType.One; + BlueChannel = STChannelType.One; + AlphaChannel = STChannelType.Red;*/ + } + + // UpdateEditor(); } } diff --git a/File_Format_Library/GUI/BXFNT/BffntEditor.cs b/File_Format_Library/GUI/BXFNT/BffntEditor.cs index 941afb7f..6c844a68 100644 --- a/File_Format_Library/GUI/BXFNT/BffntEditor.cs +++ b/File_Format_Library/GUI/BXFNT/BffntEditor.cs @@ -289,12 +289,13 @@ namespace FirstPlugin.Forms PanelImage = BitmapExtension.Resize(PanelImage, textureGlyph.SheetWidth, textureGlyph.SheetHeight); - int y = 0; for (int c = 0; c < (int)textureGlyph.ColumnCount; c++) { - int x = 0; for (int r = 0; r < (int)textureGlyph.RowCount; r++) { + int x = r * textureGlyph.CellWidth; + int y = c * textureGlyph.CellHeight; + var rect = new Rectangle(x, y, textureGlyph.CellWidth, textureGlyph.CellHeight); Cells.Add(new FontCell() @@ -307,10 +308,7 @@ namespace FirstPlugin.Forms glyphImage.Image.Save($"Glpyh{c} {r}.png"); images.Add(glyphImage);*/ - - x += (int)textureGlyph.CellWidth; } - y += (int)textureGlyph.CellHeight; } GlyphImages = images.ToArray();