1
0
mirror of synced 2024-12-12 15:51:16 +01:00

Try and fix up TXE.cs a bit

This commit is contained in:
JohnFiddleystein 2019-08-04 14:44:05 +01:00
parent dd33b5e6c5
commit 7a4a443b5c
6 changed files with 34 additions and 27 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -385,27 +385,27 @@ namespace FirstPlugin
var data = GenerateMipsAndCompress(bitmap, MipCount, Format); var data = GenerateMipsAndCompress(bitmap, MipCount, Format);
//Swizzle and create surface //Swizzle and create surface
/* var surface = GX2.CreateGx2Texture(data, Text, /* var surface = GX2.CreateGx2Texture(data, Text,
(uint)image.TileMode, (uint)image.TileMode,
(uint)0, (uint)0,
(uint)image.Width, (uint)image.Width,
(uint)image.Height, (uint)image.Height,
(uint)1, (uint)1,
(uint)Gx2Format, (uint)Gx2Format,
(uint)0, (uint)0,
(uint)1, (uint)1,
(uint)MipCount (uint)MipCount
); );
image.Swizzle = (byte)surface.swizzle; image.Swizzle = (byte)surface.swizzle;
image.BCLIMFormat = ConvertFormatGenericToBflim(Format); image.BCLIMFormat = ConvertFormatGenericToBflim(Format);
image.Height = (ushort)surface.height; image.Height = (ushort)surface.height;
image.Width = (ushort)surface.width;*/ image.Width = (ushort)surface.width;*/
Width = image.Width; Width = image.Width;
Height = image.Height; Height = image.Height;
// ImageData = surface.data; // ImageData = surface.data;
IsEdited = true; IsEdited = true;
LoadOpenGLTexture(); LoadOpenGLTexture();

View File

@ -43,16 +43,12 @@ namespace AmbrosiaPikmin1.FileFormats.TXE
stream.Seek((~(offset - 1) & (stream.Position + offset - 1)) - stream.Position); stream.Seek((~(offset - 1) & (stream.Position + offset - 1)) - stream.Position);
} }
public void Load(System.IO.Stream stream) private Texture Read(System.IO.Stream stream)
{ {
//Set this if you want to save the file format
CanSave = true;
//You can add a FileReader with Toolbox.Library.IO namespace //You can add a FileReader with Toolbox.Library.IO namespace
using (var reader = new FileReader(stream)) using (var reader = new FileReader(stream))
{ {
Texture tex = new Texture(); Texture tex = new Texture();
tex.CanEdit = false;
reader.SetByteOrder(true); reader.SetByteOrder(true);
@ -67,17 +63,28 @@ namespace AmbrosiaPikmin1.FileFormats.TXE
tex.PlatformSwizzle = PlatformSwizzle.Platform_Gamecube; tex.PlatformSwizzle = PlatformSwizzle.Platform_Gamecube;
int imageDataSize = reader.ReadInt32(); int imageDataSize = reader.ReadInt32();
SkipPadding(reader, 0x20); SkipPadding(reader, 0x20);
tex.ImageData = reader.ReadBytes(imageDataSize); tex.ImageData = reader.ReadBytes(imageDataSize);
tex.Name = FileName; tex.Name = FileName;
tex.ToolTipText = "Binary Texture Image, used for 2D textures like fonts"; return tex;
_ = Nodes.Add(tex);
} }
} }
public void Load(System.IO.Stream stream)
{
Text = FileName;
//Set this if you want to save the file format
CanSave = false;
Texture tex = Read(stream);
ImageKey = "Texture";
SelectedImageKey = "Texture";
Nodes.Add(tex);
}
public byte[] Save() public byte[] Save()
{ {
return null; return null;
@ -102,8 +109,8 @@ namespace AmbrosiaPikmin1.FileFormats.TXE
{ {
TEX_FORMAT.I4, TEX_FORMAT.I4,
TEX_FORMAT.I8, TEX_FORMAT.I8,
TEX_FORMAT.I4, TEX_FORMAT.IA4,
TEX_FORMAT.I8, TEX_FORMAT.IA8,
TEX_FORMAT.RGB565, TEX_FORMAT.RGB565,
TEX_FORMAT.RGB5A3, TEX_FORMAT.RGB5A3,
TEX_FORMAT.RGBA32, TEX_FORMAT.RGBA32,