Trying to add little endian support

Changed some lines, I expect bugs to happen, if people tested it (w/ SM3DAS files) to report them

Commented some code
This commit is contained in:
Denis
2021-12-25 00:27:41 +01:00
parent 38dc360ce2
commit 8ed1a6aa98
7 changed files with 50 additions and 16 deletions

View File

@@ -245,6 +245,8 @@ namespace BMGEditor
INF1itemNumber++;
Entries.Add(newEntry);
//Code to sort entries by alphabetical order and then reassign an ID
//Works perfectly but is unused right now because it breaks flows
/* Entries.Sort((x, y) =>
{
string entryNameA = x.entryName, entryNameB = y.entryName;
@@ -272,8 +274,8 @@ namespace BMGEditor
m_File.Writer.Write((Int32)m_FileType);
m_File.Writer.Write((UInt32)0x00); //Final fileSize will be written at the end
m_File.Writer.Write((UInt32)0x04); //Number of sections, always 4 in Super Mario Galaxy, this editor isn't meant to be used on anything else anyway.
m_File.Writer.Write((Byte)0x02); //Encoding
while (m_File.Stream.Position != 0x20) m_File.Writer.Write((Byte)0x00); // The 15 bytes of nothing
m_File.Writer.Write((Byte)0x02); //Encoding: UTF-16
while (m_File.Stream.Position != 0x20) m_File.Writer.Write((Byte)0x00); // The 15 bytes of nothing/padding
//INF1 section
Int64 INF1start = m_File.Stream.Position;

View File

@@ -29,13 +29,6 @@ namespace BMGEditor
return (Int32)((val >> 24) | ((val & 0xFF0000) >> 8) | ((val & 0xFF00) << 8) | (val << 24));
}
/*public override long ReadInt64()
{
UInt64 val = base.ReadUInt64();
return (Int64)()
}*/
public override ushort ReadUInt16()
{
UInt16 val = base.ReadUInt16();

View File

@@ -68,8 +68,12 @@ namespace BMGEditor
private void InitRW()
{
Reader = m_BigEndian ? new BinaryReaderBE(m_Stream, m_Encoding) : new BinaryReader(m_Stream, m_Encoding);
Writer = m_BigEndian ? new BinaryWriterBE(m_Stream, m_Encoding) : new BinaryWriter(m_Stream, m_Encoding);
//Original code
//Reader = m_BigEndian ? new BinaryReaderBE(m_Stream, m_Encoding) : new BinaryReader(m_Stream, m_Encoding);
//Writer = m_BigEndian ? new BinaryWriterBE(m_Stream, m_Encoding) : new BinaryWriter(m_Stream, m_Encoding);
Reader = Tests.isBE ? new BinaryReaderBE(m_Stream, m_Encoding) : new BinaryReader(m_Stream, m_Encoding);
Writer = Tests.isBE ? new BinaryWriterBE(m_Stream, m_Encoding) : new BinaryWriter(m_Stream, m_Encoding);
}

View File

@@ -8,10 +8,15 @@ namespace BMGEditor
public static class Variables
{
public const string softwareName = "Luma";
public const string softwareVersion = "v1.0";
public const UInt64 build = 1;
public const bool isBeta = false;
public const bool isBE = true;
public const string softwareVersion = "v1.1";
public const UInt64 build = 2;
public const bool isBeta = true;
}
public static class Tests
{
//Not a good place to put this I know but I'm trying to figure it out
public static bool isBE = true;
}
internal static class Program
{

View File

@@ -43,6 +43,7 @@
this.deleteEntryBtn = new System.Windows.Forms.ToolStripMenuItem();
this.entriesListBox = new System.Windows.Forms.ListBox();
this.openARCDialog = new System.Windows.Forms.OpenFileDialog();
this.toggleBEBtn = new System.Windows.Forms.ToolStripButton();
this.toolStrip.SuspendLayout();
this.SuspendLayout();
//
@@ -52,7 +53,8 @@
this.toolStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileMenu,
this.editBtn});
this.editBtn,
this.toggleBEBtn});
this.toolStrip.Location = new System.Drawing.Point(0, 0);
this.toolStrip.Name = "toolStrip";
this.toolStrip.Size = new System.Drawing.Size(700, 25);
@@ -177,6 +179,16 @@
this.openARCDialog.Filter = "Nintendo ARC Files|*.arc";
this.openARCDialog.Title = "Open ARC";
//
// toggleBEBtn
//
this.toggleBEBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toggleBEBtn.Image = ((System.Drawing.Image)(resources.GetObject("toggleBEBtn.Image")));
this.toggleBEBtn.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toggleBEBtn.Name = "toggleBEBtn";
this.toggleBEBtn.Size = new System.Drawing.Size(158, 22);
this.toggleBEBtn.Text = "toggle BE/LE (BE by default)";
this.toggleBEBtn.Click += new System.EventHandler(this.toggleBEBtn_Click);
//
// BMGEditForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@@ -213,5 +225,6 @@
private System.Windows.Forms.ToolStripMenuItem openBCSVBtn;
private System.Windows.Forms.OpenFileDialog openARCDialog;
private System.Windows.Forms.ToolStripMenuItem openFlowEditorBtn;
private System.Windows.Forms.ToolStripButton toggleBEBtn;
}
}

View File

@@ -133,5 +133,11 @@ namespace BMGEditor
Form bcsvEdit = new BcsvEditorForm(m_ARC);
bcsvEdit.Show();
}
private void toggleBEBtn_Click(object sender, EventArgs e)
{
Tests.isBE = !Tests.isBE;
MessageBox.Show("Switched successfully");
}
}
}

View File

@@ -81,6 +81,17 @@
U87f4aUApcXhnrI9Jzg/laQKFntXlHM+lSQK5psL5fvbp/JvJLGCQqmSWM5JkiCT84igXGtSrruKLQ0T
luAdmZxHBG37FFuWBC/j5XKOmX8WAH7rcI6ZMffPgjQwN2bXJgDo/COBTpjneQ2dML0PY3cISreGe8HM
qgAAAABJRU5ErkJggg==
</value>
</data>
<data name="toggleBEBtn.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEISURBVEhL3ZErDsJAGIR7DlA47oArV8CDR9RiSDAQPBcA
Qx1BgUMQBEk1ooJAKE0I4Wlqf5gmu1n6oqW7hiZfthkx33aqeZ5HKvEFpmmSYRhSQScXINB1XSroDAke
96cUpAmupyPZsx7Z8x4drAnPpQmsgU7LdoHDJNIEYjnAlyBXJ3jPhVyaYLca8nLMhX+CPJXAOT+ouTj5
p5in4asApdWpS8XRwT+zShIFG/fOyxlZJbGC9f5G5bHzUf6LJFJQqTViyxlxEmRiHhLUW10qDbeRpUGC
ErwjE/OQoG9dIsviYGWsXMwxc24BYLcO5pgZc+cWJIG5MbsyAUDnHwlUAkFHJZraR9NeMVq3zi+WF/0A
AAAASUVORK5CYII=
</value>
</data>
<metadata name="openARCDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">