mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 15:14:55 +00:00
Bflyt fixes to UVs.
This commit is contained in:
parent
9180a6cc75
commit
f72b855c1a
6 changed files with 200 additions and 107 deletions
|
@ -76,10 +76,10 @@ namespace LayoutBXLYT
|
|||
if (pic1Pane.TexCoords.Length > 0)
|
||||
{
|
||||
TexCoords = new Vector2[] {
|
||||
pic1Pane.TexCoords[0].TopLeft.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].TopRight.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].BottomRight.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].BottomLeft.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].TopLeft.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].TopRight.ToTKVector2(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -95,10 +95,10 @@ namespace LayoutBXLYT
|
|||
var pic1Pane = pane as BCLYT.PIC1;
|
||||
|
||||
Color[] Colors = new Color[] {
|
||||
pic1Pane.ColorTopLeft.Color,
|
||||
pic1Pane.ColorTopRight.Color,
|
||||
pic1Pane.ColorBottomRight.Color,
|
||||
pic1Pane.ColorBottomLeft.Color,
|
||||
pic1Pane.ColorTopLeft.Color,
|
||||
pic1Pane.ColorTopRight.Color,
|
||||
};
|
||||
|
||||
var mat = pic1Pane.Material;
|
||||
|
@ -114,10 +114,10 @@ namespace LayoutBXLYT
|
|||
if (pic1Pane.TexCoords.Length > 0)
|
||||
{
|
||||
TexCoords = new Vector2[] {
|
||||
pic1Pane.TexCoords[0].TopLeft.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].TopRight.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].BottomRight.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].BottomLeft.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].TopLeft.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].TopRight.ToTKVector2(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -133,10 +133,10 @@ namespace LayoutBXLYT
|
|||
var pic1Pane = pane as BRLYT.PIC1;
|
||||
|
||||
Color[] Colors = new Color[] {
|
||||
pic1Pane.ColorTopLeft.Color,
|
||||
pic1Pane.ColorTopRight.Color,
|
||||
pic1Pane.ColorBottomRight.Color,
|
||||
pic1Pane.ColorBottomLeft.Color,
|
||||
pic1Pane.ColorTopLeft.Color,
|
||||
pic1Pane.ColorTopRight.Color,
|
||||
};
|
||||
|
||||
var mat = pic1Pane.Material;
|
||||
|
@ -152,10 +152,10 @@ namespace LayoutBXLYT
|
|||
if (pic1Pane.TexCoords.Length > 0)
|
||||
{
|
||||
TexCoords = new Vector2[] {
|
||||
pic1Pane.TexCoords[0].TopLeft.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].TopRight.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].BottomRight.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].BottomLeft.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].TopLeft.ToTKVector2(),
|
||||
pic1Pane.TexCoords[0].TopRight.ToTKVector2(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ using System.ComponentModel;
|
|||
|
||||
namespace LayoutBXLYT.Cafe
|
||||
{
|
||||
public class BFLYT : IFileFormat, IEditorForm<LayoutEditor>, IConvertableTextFormat
|
||||
public class BFLYT : IFileFormat, IEditorForm<LayoutEditor>,
|
||||
IEditorFormParameters, IConvertableTextFormat
|
||||
{
|
||||
public FileType FileType { get; set; } = FileType.Layout;
|
||||
|
||||
|
@ -27,6 +28,9 @@ namespace LayoutBXLYT.Cafe
|
|||
public string FilePath { get; set; }
|
||||
public IFileInfo IFileInfo { get; set; }
|
||||
|
||||
public bool KeepOpen { get; } = true;
|
||||
public EventHandler OnSave { get; set; }
|
||||
|
||||
public bool Identify(System.IO.Stream stream)
|
||||
{
|
||||
using (var reader = new Toolbox.Library.IO.FileReader(stream, true))
|
||||
|
@ -105,12 +109,12 @@ namespace LayoutBXLYT.Cafe
|
|||
{
|
||||
LayoutEditor editor = new LayoutEditor();
|
||||
editor.Dock = DockStyle.Fill;
|
||||
editor.LoadBxlyt(header, FileName);
|
||||
editor.LoadBxlyt(header);
|
||||
return editor;
|
||||
}
|
||||
|
||||
public void FillEditor(Form control) {
|
||||
((LayoutEditor)control).LoadBxlyt(header, FileName);
|
||||
((LayoutEditor)control).LoadBxlyt(header);
|
||||
}
|
||||
|
||||
public Header header;
|
||||
|
@ -512,10 +516,9 @@ namespace LayoutBXLYT.Cafe
|
|||
{
|
||||
Version = VersionMajor << 24 | VersionMinor << 16 | VersionMicro << 8 | VersionMicro2;
|
||||
|
||||
writer.SetByteOrder(true);
|
||||
writer.SetByteOrder(IsBigEndian);
|
||||
writer.WriteSignature(Magic);
|
||||
writer.Write(ByteOrderMark);
|
||||
writer.SetByteOrder(IsBigEndian);
|
||||
writer.Write(HeaderSize);
|
||||
writer.Write(Version);
|
||||
writer.Write(uint.MaxValue); //Reserve space for file size later
|
||||
|
@ -564,7 +567,7 @@ namespace LayoutBXLYT.Cafe
|
|||
}
|
||||
}
|
||||
|
||||
private void WritePanes(FileWriter writer, BasePane pane, BxlytHeader header, ref int sectionCount)
|
||||
private void WritePanes(FileWriter writer, BasePane pane, LayoutHeader header, ref int sectionCount)
|
||||
{
|
||||
WriteSection(writer, pane.Signature, pane,() => pane.Write(writer, header));
|
||||
sectionCount++;
|
||||
|
@ -591,7 +594,7 @@ namespace LayoutBXLYT.Cafe
|
|||
}
|
||||
}
|
||||
|
||||
private void WriteGroupPanes(FileWriter writer, BasePane pane, BxlytHeader header, ref int sectionCount)
|
||||
private void WriteGroupPanes(FileWriter writer, BasePane pane, LayoutHeader header, ref int sectionCount)
|
||||
{
|
||||
WriteSection(writer, pane.Signature, pane, () => pane.Write(writer, header));
|
||||
sectionCount++;
|
||||
|
@ -610,23 +613,6 @@ namespace LayoutBXLYT.Cafe
|
|||
WriteSection(writer, "gre1", null);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void WriteSection(FileWriter writer, string magic, SectionCommon section, Action WriteMethod = null)
|
||||
{
|
||||
long startPos = writer.Position;
|
||||
writer.WriteSignature(magic);
|
||||
writer.Write(uint.MaxValue);
|
||||
WriteMethod?.Invoke();
|
||||
writer.Align(4);
|
||||
|
||||
long endPos = writer.Position;
|
||||
|
||||
using (writer.TemporarySeek(startPos + 4, System.IO.SeekOrigin.Begin))
|
||||
{
|
||||
writer.Write((uint)(endPos - startPos));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class CNT1 : SectionCommon
|
||||
|
@ -663,7 +649,7 @@ namespace LayoutBXLYT.Cafe
|
|||
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -809,7 +795,7 @@ namespace LayoutBXLYT.Cafe
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
long pos = writer.Position - 8;
|
||||
|
||||
|
@ -957,7 +943,7 @@ namespace LayoutBXLYT.Cafe
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
long pos = writer.Position - 8;
|
||||
|
||||
|
@ -1094,7 +1080,7 @@ namespace LayoutBXLYT.Cafe
|
|||
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
}
|
||||
|
@ -1158,7 +1144,7 @@ namespace LayoutBXLYT.Cafe
|
|||
Panes.Add(reader.ReadString(24, true));
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
if (header.Version >= 0x05020000)
|
||||
{
|
||||
|
@ -1328,7 +1314,7 @@ namespace LayoutBXLYT.Cafe
|
|||
LayoutFile = reader.ReadZeroTerminatedString();
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
long startPos = writer.Position - 8;
|
||||
base.Write(writer, header);
|
||||
|
@ -1417,7 +1403,7 @@ namespace LayoutBXLYT.Cafe
|
|||
}
|
||||
|
||||
private long _ofsPos;
|
||||
public void Write(FileWriter writer, BxlytHeader header, long startPos)
|
||||
public void Write(FileWriter writer, LayoutHeader header, long startPos)
|
||||
{
|
||||
writer.WriteString(Name, 0x18);
|
||||
writer.Write(UsageFlag);
|
||||
|
@ -1431,7 +1417,7 @@ namespace LayoutBXLYT.Cafe
|
|||
writer.Write(0); //Panel Info Offset
|
||||
}
|
||||
|
||||
public void WriteProperties(FileWriter writer, BxlytHeader header, long startPos)
|
||||
public void WriteProperties(FileWriter writer, LayoutHeader header, long startPos)
|
||||
{
|
||||
if (Property != null)
|
||||
{
|
||||
|
@ -1454,7 +1440,7 @@ namespace LayoutBXLYT.Cafe
|
|||
Entries.Add(new USD1Entry(reader, startPos, header));
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
long startPos = writer.Position - 8;
|
||||
|
||||
|
@ -1530,7 +1516,7 @@ namespace LayoutBXLYT.Cafe
|
|||
reader.SeekBegin(datapos);
|
||||
}
|
||||
|
||||
public void Write(FileWriter writer, BxlytHeader header)
|
||||
public void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
_pos = writer.Position;
|
||||
|
||||
|
@ -1626,7 +1612,7 @@ namespace LayoutBXLYT.Cafe
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
writer.Write(ColorTopLeft);
|
||||
|
@ -1768,7 +1754,7 @@ namespace LayoutBXLYT.Cafe
|
|||
Height = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write(_flags1);
|
||||
writer.Write(origin);
|
||||
|
@ -1826,7 +1812,7 @@ namespace LayoutBXLYT.Cafe
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
long pos = writer.Position - 8;
|
||||
|
||||
|
@ -1977,7 +1963,7 @@ namespace LayoutBXLYT.Cafe
|
|||
FontShadowParameter = new FontShadowParameter(reader, header);
|
||||
}
|
||||
|
||||
public void Write(FileWriter writer, BxlytHeader header)
|
||||
public void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.WriteString(Name, 0x1C);
|
||||
if (header.VersionMajor >= 8)
|
||||
|
@ -2049,7 +2035,7 @@ namespace LayoutBXLYT.Cafe
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write((ushort)Fonts.Count);
|
||||
writer.Write((ushort)0);
|
||||
|
@ -2093,7 +2079,7 @@ namespace LayoutBXLYT.Cafe
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write((ushort)Textures.Count);
|
||||
writer.Write((ushort)0);
|
||||
|
@ -2151,7 +2137,7 @@ namespace LayoutBXLYT.Cafe
|
|||
Name = reader.ReadZeroTerminatedString();
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write(DrawFromCenter);
|
||||
writer.Seek(3);
|
||||
|
|
|
@ -39,6 +39,9 @@ namespace LayoutBXLYT
|
|||
SetColor("blackColor", material.BlackColor.Color);
|
||||
SetInt("debugShading", (int)Runtime.LayoutEditor.Shading);
|
||||
SetInt("numTextureMaps", material.TextureMaps.Length);
|
||||
SetVec2("uvScale0", new Vector2(1, 1));
|
||||
SetFloat("uvRotate0", 0);
|
||||
SetVec2("uvTranslate0", new Vector2(0, 0));
|
||||
|
||||
BindTextureUniforms();
|
||||
|
||||
|
|
|
@ -74,12 +74,12 @@ namespace LayoutBXLYT
|
|||
{
|
||||
LayoutEditor editor = new LayoutEditor();
|
||||
editor.Dock = DockStyle.Fill;
|
||||
editor.LoadBxlyt(header, FileName);
|
||||
editor.LoadBxlyt(header);
|
||||
return editor;
|
||||
}
|
||||
|
||||
public void FillEditor(Form control) {
|
||||
((LayoutEditor)control).LoadBxlyt(header, FileName);
|
||||
((LayoutEditor)control).LoadBxlyt(header);
|
||||
}
|
||||
|
||||
public Header header;
|
||||
|
@ -499,7 +499,7 @@ namespace LayoutBXLYT
|
|||
Text = reader.ReadString(TextLength);
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
long pos = writer.Position;
|
||||
|
||||
|
@ -561,7 +561,7 @@ namespace LayoutBXLYT
|
|||
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
}
|
||||
|
@ -579,7 +579,7 @@ namespace LayoutBXLYT
|
|||
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
}
|
||||
|
@ -604,7 +604,7 @@ namespace LayoutBXLYT
|
|||
Panes.Add(reader.ReadString(0x10, true));
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
if (header.Version >= 0x05020000)
|
||||
{
|
||||
|
@ -635,7 +635,7 @@ namespace LayoutBXLYT
|
|||
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
}
|
||||
|
@ -710,7 +710,7 @@ namespace LayoutBXLYT
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
writer.Write(ColorTopLeft.ToBytes());
|
||||
|
@ -818,7 +818,7 @@ namespace LayoutBXLYT
|
|||
Height = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write(_flags1);
|
||||
writer.Write(Alpha);
|
||||
|
@ -873,7 +873,7 @@ namespace LayoutBXLYT
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write((ushort)Materials.Count);
|
||||
writer.Seek(2);
|
||||
|
@ -912,13 +912,16 @@ namespace LayoutBXLYT
|
|||
TextureMaps = new List<TextureRef>();
|
||||
TextureTransforms = new List<TextureTransform>();
|
||||
|
||||
Name = reader.ReadString(0x14, true);
|
||||
Name = reader.ReadString(20, true);
|
||||
TevColor = reader.ReadColor8RGBA();
|
||||
TevConstantColors = reader.ReadColor8sRGBA(0x6);
|
||||
TevConstantColors = reader.ReadColor8sRGBA(6);
|
||||
flags = reader.ReadUInt32();
|
||||
|
||||
uint texCount = ExtractBits(flags, 2, 0);
|
||||
uint mtxCount = ExtractBits(flags, 2, 2);
|
||||
uint texCount = flags & 3;
|
||||
uint mtxCount = (flags >> 2) & 3;
|
||||
uint texCoordGens = (flags >> 4) & 3;
|
||||
uint tevStages = (flags >> 6) & 7;
|
||||
|
||||
for (int i = 0; i < texCount; i++)
|
||||
TextureMaps.Add(new TextureRef(reader, header));
|
||||
|
||||
|
@ -1034,7 +1037,7 @@ namespace LayoutBXLYT
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write((ushort)Fonts.Count);
|
||||
writer.Seek(2);
|
||||
|
@ -1078,7 +1081,7 @@ namespace LayoutBXLYT
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write((ushort)Textures.Count);
|
||||
writer.Seek(2);
|
||||
|
@ -1118,7 +1121,7 @@ namespace LayoutBXLYT
|
|||
Height = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write(DrawFromCenter);
|
||||
writer.Seek(3);
|
||||
|
|
|
@ -174,8 +174,8 @@ namespace LayoutBXLYT
|
|||
top = Height;
|
||||
else //To center
|
||||
{
|
||||
top = -Height / 2;
|
||||
bottom = Height / 2;
|
||||
top = Height / 2;
|
||||
bottom = -Height / 2;
|
||||
}
|
||||
|
||||
return new Vector4(left, right, top, bottom);
|
||||
|
@ -242,7 +242,7 @@ namespace LayoutBXLYT
|
|||
Entries = new List<UserDataEntry>();
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +298,82 @@ namespace LayoutBXLYT
|
|||
Float,
|
||||
}
|
||||
|
||||
public class BxlytHeader : IDisposable
|
||||
public enum AnimationTarget : byte
|
||||
{
|
||||
Pane = 0,
|
||||
Material = 1
|
||||
}
|
||||
|
||||
public enum KeyType : byte
|
||||
{
|
||||
Uin16 = 1,
|
||||
Float = 2,
|
||||
}
|
||||
|
||||
public enum LPATarget : byte
|
||||
{
|
||||
TranslateX = 0x00,
|
||||
TranslateY = 0x01,
|
||||
TranslateZ = 0x02,
|
||||
RotateX = 0x03,
|
||||
RotateY = 0x04,
|
||||
RotateZ = 0x05,
|
||||
ScaleX = 0x06,
|
||||
ScaleY = 0x07,
|
||||
SizeX = 0x08,
|
||||
SizeZ = 0x09,
|
||||
}
|
||||
|
||||
public enum LTSTarget : byte
|
||||
{
|
||||
TranslateS = 0x00,
|
||||
TranslateT = 0x01,
|
||||
Rotate = 0x02,
|
||||
ScaleS = 0x03,
|
||||
ScaleT = 0x04,
|
||||
}
|
||||
|
||||
public enum LVITarget : byte
|
||||
{
|
||||
Visibility = 0x00,
|
||||
}
|
||||
|
||||
public enum LVCTarget : byte
|
||||
{
|
||||
LeftTopRed = 0x00,
|
||||
LeftTopGreen = 0x01,
|
||||
LeftTopBlue = 0x02,
|
||||
LeftTopAlpha = 0x03,
|
||||
|
||||
RightTopRed = 0x04,
|
||||
RightTopGreen = 0x05,
|
||||
RightTopBlue = 0x06,
|
||||
RightTopAlpha = 0x07,
|
||||
|
||||
LeftBottomRed = 0x08,
|
||||
LeftBottomGreen = 0x09,
|
||||
LeftBottomBlue = 0x0A,
|
||||
LeftBottomAlpha = 0x0B,
|
||||
|
||||
RightBottomRed = 0x0C,
|
||||
RightBottomGreen = 0x0D,
|
||||
RightBottomBlue = 0x0E,
|
||||
RightBottomAlpha = 0x0F,
|
||||
|
||||
PaneAlpha = 0x10,
|
||||
}
|
||||
|
||||
public enum LTPTarget : byte
|
||||
{
|
||||
Image = 0x00,
|
||||
}
|
||||
|
||||
public enum LMCTarget : byte
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class LayoutHeader : IDisposable
|
||||
{
|
||||
[Browsable(false)]
|
||||
public string FileName
|
||||
|
@ -312,21 +387,6 @@ namespace LayoutBXLYT
|
|||
[Browsable(false)]
|
||||
internal IFileFormat FileInfo;
|
||||
|
||||
[Browsable(false)]
|
||||
public BasePane RootPane { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public BasePane RootGroup { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public virtual Dictionary<string, STGenericTexture> GetTextures { get; }
|
||||
|
||||
[Browsable(false)]
|
||||
public virtual List<string> Textures { get; }
|
||||
|
||||
[Browsable(false)]
|
||||
public virtual List<string> Fonts { get; }
|
||||
|
||||
[Browsable(false)]
|
||||
internal uint Version;
|
||||
|
||||
|
@ -339,12 +399,6 @@ namespace LayoutBXLYT
|
|||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public virtual List<BxlytMaterial> GetMaterials()
|
||||
{
|
||||
return new List<BxlytMaterial>();
|
||||
}
|
||||
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
public uint VersionMajor { get; set; }
|
||||
[RefreshProperties(RefreshProperties.All)]
|
||||
|
@ -367,12 +421,57 @@ namespace LayoutBXLYT
|
|||
return VersionMajor << 24 | VersionMinor << 16 | VersionMicro << 8 | VersionMicro2;
|
||||
}
|
||||
|
||||
public static void WriteSection(FileWriter writer, string magic, SectionCommon section, Action WriteMethod = null)
|
||||
{
|
||||
long startPos = writer.Position;
|
||||
writer.WriteSignature(magic);
|
||||
writer.Write(uint.MaxValue);
|
||||
WriteMethod?.Invoke();
|
||||
writer.Align(4);
|
||||
|
||||
long endPos = writer.Position;
|
||||
|
||||
using (writer.TemporarySeek(startPos + 4, System.IO.SeekOrigin.Begin))
|
||||
{
|
||||
writer.Write((uint)(endPos - startPos));
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
FileInfo.Unload();
|
||||
}
|
||||
}
|
||||
|
||||
public class BxlanHeader : LayoutHeader
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class BxlytHeader : LayoutHeader
|
||||
{
|
||||
[Browsable(false)]
|
||||
public BasePane RootPane { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public BasePane RootGroup { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public virtual Dictionary<string, STGenericTexture> GetTextures { get; }
|
||||
|
||||
[Browsable(false)]
|
||||
public virtual List<string> Textures { get; }
|
||||
|
||||
[Browsable(false)]
|
||||
public virtual List<string> Fonts { get; }
|
||||
|
||||
[Browsable(false)]
|
||||
public virtual List<BxlytMaterial> GetMaterials()
|
||||
{
|
||||
return new List<BxlytMaterial>();
|
||||
}
|
||||
}
|
||||
|
||||
public class BxlytMaterial
|
||||
{
|
||||
[DisplayName("Name"), CategoryAttribute("General")]
|
||||
|
@ -401,7 +500,7 @@ namespace LayoutBXLYT
|
|||
Signature = signature;
|
||||
}
|
||||
|
||||
public virtual void Write(FileWriter writer, BxlytHeader header)
|
||||
public virtual void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
if (Data != null)
|
||||
writer.Write(Data);
|
||||
|
@ -434,6 +533,8 @@ namespace LayoutBXLYT
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class LayoutDocked : DockContent
|
||||
{
|
||||
|
||||
|
|
|
@ -74,12 +74,12 @@ namespace LayoutBXLYT
|
|||
{
|
||||
LayoutEditor editor = new LayoutEditor();
|
||||
editor.Dock = DockStyle.Fill;
|
||||
editor.LoadBxlyt(header, FileName);
|
||||
editor.LoadBxlyt(header);
|
||||
return editor;
|
||||
}
|
||||
|
||||
public void FillEditor(Form control) {
|
||||
((LayoutEditor)control).LoadBxlyt(header, FileName);
|
||||
((LayoutEditor)control).LoadBxlyt(header);
|
||||
}
|
||||
|
||||
public Header header;
|
||||
|
@ -502,7 +502,7 @@ namespace LayoutBXLYT
|
|||
Text = reader.ReadString(TextLength);
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
long pos = writer.Position;
|
||||
|
||||
|
@ -564,7 +564,7 @@ namespace LayoutBXLYT
|
|||
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ namespace LayoutBXLYT
|
|||
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ namespace LayoutBXLYT
|
|||
Panes.Add(reader.ReadString(0x10, true));
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.WriteString(Name, 24);
|
||||
writer.Write((ushort)Panes.Count);
|
||||
|
@ -630,7 +630,7 @@ namespace LayoutBXLYT
|
|||
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ namespace LayoutBXLYT
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
writer.Write(ColorTopLeft.ToBytes());
|
||||
|
@ -810,7 +810,7 @@ namespace LayoutBXLYT
|
|||
Height = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write(_flags1);
|
||||
writer.Write(Alpha);
|
||||
|
@ -866,7 +866,7 @@ namespace LayoutBXLYT
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write((ushort)Materials.Count);
|
||||
writer.Seek(2);
|
||||
|
@ -1045,7 +1045,7 @@ namespace LayoutBXLYT
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write((ushort)Fonts.Count);
|
||||
writer.Seek(2);
|
||||
|
@ -1091,7 +1091,7 @@ namespace LayoutBXLYT
|
|||
}
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write((ushort)Textures.Count);
|
||||
writer.Seek(2);
|
||||
|
@ -1131,7 +1131,7 @@ namespace LayoutBXLYT
|
|||
Height = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
writer.Write(DrawFromCenter);
|
||||
writer.Seek(3);
|
||||
|
|
Loading…
Reference in a new issue