Beta code v0.4

Worked on UI a bit
Escape sequences work
Item properties editing works
Ready for a beta release
This commit is contained in:
2021-11-29 23:46:47 +01:00
parent b58a289561
commit 9390909b18
9 changed files with 532 additions and 119 deletions

View File

@@ -1164,7 +1164,6 @@ namespace BMGEditor
Entries.Add(txtEntry);
m_File.Stream.Position += 0x01;
}
Console.WriteLine(m_File.Stream.Position);
while (m_File.Reader.ReadByte() != 0x44)
m_File.Stream.Position += 0x01;
@@ -1174,7 +1173,6 @@ namespace BMGEditor
DAT1sectionStart = m_File.Stream.Position;
DAT1sectionMagic = m_File.Reader.ReadInt32();
DAT1sectionSize = m_File.Reader.ReadUInt32();
Console.WriteLine(m_File.Stream.Position);
strPoolStart = m_File.Stream.Position;
if (DAT1sectionMagic != DAT1magic) throw new Exception("BMG exists but isn\'t in the expected format");
@@ -1295,21 +1293,15 @@ namespace BMGEditor
}
public void WriteToFile()
{
//throw new NotImplementedException();
}
public void NukeFile() //Makin' it to WriteToFile() soon !!
{
//File header
m_File.Stream.Position = 0;
m_File.Writer.Write((Int32)m_Signature);
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.Stream.Position = 0;
m_File.Writer.Write((Int32)m_Signature);
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
//INF1 section
Int64 INF1start = m_File.Stream.Position;
@@ -1319,7 +1311,7 @@ namespace BMGEditor
m_File.Writer.Write((UInt16)INF1itemLength);
m_File.Writer.Write((UInt32)0x00);
foreach (TextEntry entry in Entries)
{
{
m_File.Writer.Write((UInt32)0x00);
m_File.Writer.Write((Byte)entry.unk1);
m_File.Writer.Write((Byte)entry.cameraOpt);
@@ -1329,7 +1321,7 @@ namespace BMGEditor
m_File.Writer.Write((Byte)entry.messageLayoutOpt);
m_File.Writer.Write((Byte)entry.messageAreaOpt);
m_File.Writer.Write((Byte)0xFF);
}
}
while (m_File.Stream.Position % 16 != 0x00)
m_File.Writer.Write((Byte)0x00);
@@ -1340,7 +1332,7 @@ namespace BMGEditor
//String pool
List<Int64> strPos = new List<Int64>();
foreach (TextEntry entry in Entries)
{
{
strPos.Add(m_File.Stream.Position - (DAT1start + 0x08));
//Doing this because for some reason there's a random char appearing at the beggining of each str
if (entry.text == "") m_File.Writer.Write((UInt16)0x00);
@@ -1348,13 +1340,12 @@ namespace BMGEditor
{
List<char> strToWrite = new List<char>();
foreach (char c in entry.text)
{
{
strToWrite.Add(c);
}
Console.WriteLine(strToWrite);
}
for (int i = 0; i < strToWrite.Count; i++)
{
for (int i = 0; i < strToWrite.Count; i++)
{
if (strToWrite[i].Equals('*'))
{
EscapeSequence escSeq = new EscapeSequence();
@@ -1362,22 +1353,22 @@ namespace BMGEditor
escSeq.unk1 = Byte.Parse(String.Concat(strToWrite[i + 3], strToWrite[i + 4]), NumberStyles.HexNumber);
i += 0x05;
for (int j = 0; j < escSeq.length * 2 - 8; j += 2)
{
escSeq.binValue.Add(Byte.Parse(String.Concat(strToWrite[i + j], strToWrite[i+j+1]), NumberStyles.HexNumber));
}
{
escSeq.binValue.Add(Byte.Parse(String.Concat(strToWrite[i + j], strToWrite[i + j + 1]), NumberStyles.HexNumber));
}
List<Byte> seqToWrite = BytesFromEscapeSequence(escSeq);
foreach (Byte b in seqToWrite)
{
{
m_File.Writer.Write(b);
}
}
i += escSeq.length * 2 - 8;
}
else
m_File.Writer.Write(strToWrite[i]);
}
}
m_File.Writer.Write((UInt16)0x00);
@@ -1395,16 +1386,16 @@ namespace BMGEditor
m_File.Stream.Position = INF1start;
m_File.Stream.Position += 0x10;
for (int index = 0; index < INF1itemNumber; index++)
{
{
m_File.Writer.Write((UInt32)strPos[index]);
m_File.Stream.Position += 0x08;
}
}
m_File.Stream.Position = DAT1end;
m_File.Writer.Write((Int32)FLW1magic);
m_File.Writer.Write((UInt32)FLW1sectionSize);
m_File.Writer.Write(FLW1sectionContent);
m_File.Writer.Write((Int32)FLI1magic);
m_File.Writer.Write((UInt32)FLI1sectionSize);
m_File.Writer.Write(FLI1sectionContent);
@@ -1415,7 +1406,12 @@ namespace BMGEditor
m_File.Stream.SetLength(newFileSize);
m_File.Flush();
m_File.Flush();
}
public void NukeFile() //Yay, its code has been moved into WriteToFile()!!
{
}

View File

@@ -10,9 +10,9 @@ namespace BMGEditor
public static class Variables
{
public const string softwareName = "Luma";
public const string softwareVersion = "v0.3";
public const string softwareVersion = "v0.4";
public const bool isBeta = true;
public const bool isPrivateBeta = true;
public const bool isPrivateBeta = false;
}
internal static class Program
{

View File

@@ -30,6 +30,7 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BMGEditForm));
this.toolStrip = new System.Windows.Forms.ToolStrip();
this.saveBMGbtn = new System.Windows.Forms.ToolStripButton();
this.openEntryBtn = new System.Windows.Forms.ToolStripButton();
this.deleteEntryBtn = new System.Windows.Forms.ToolStripButton();
this.addEntryBtn = new System.Windows.Forms.ToolStripButton();
@@ -41,6 +42,7 @@
//
this.toolStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saveBMGbtn,
this.openEntryBtn,
this.deleteEntryBtn,
this.addEntryBtn});
@@ -50,6 +52,17 @@
this.toolStrip.TabIndex = 0;
this.toolStrip.Text = "toolStrip";
//
// saveBMGbtn
//
this.saveBMGbtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.saveBMGbtn.Image = ((System.Drawing.Image)(resources.GetObject("saveBMGbtn.Image")));
this.saveBMGbtn.ImageTransparentColor = System.Drawing.Color.Magenta;
this.saveBMGbtn.Name = "saveBMGbtn";
this.saveBMGbtn.Size = new System.Drawing.Size(44, 24);
this.saveBMGbtn.Text = "Save";
this.saveBMGbtn.ToolTipText = "Save";
this.saveBMGbtn.Click += new System.EventHandler(this.saveBMGbtn_Click);
//
// openEntryBtn
//
this.openEntryBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
@@ -82,12 +95,14 @@
//
// entriesListBox
//
this.entriesListBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.entriesListBox.FormattingEnabled = true;
this.entriesListBox.ItemHeight = 20;
this.entriesListBox.Location = new System.Drawing.Point(67, 125);
this.entriesListBox.Location = new System.Drawing.Point(0, 27);
this.entriesListBox.Name = "entriesListBox";
this.entriesListBox.Size = new System.Drawing.Size(554, 284);
this.entriesListBox.Size = new System.Drawing.Size(800, 423);
this.entriesListBox.TabIndex = 1;
this.entriesListBox.DoubleClick += new System.EventHandler(this.entriesListBox_DoubleClick);
//
// BMGEditForm
//
@@ -113,5 +128,6 @@
private System.Windows.Forms.ToolStripButton deleteEntryBtn;
private System.Windows.Forms.ToolStripButton addEntryBtn;
private System.Windows.Forms.ListBox entriesListBox;
private System.Windows.Forms.ToolStripButton saveBMGbtn;
}
}

View File

@@ -26,6 +26,9 @@ namespace BMGEditor
{
entriesListBox.Items.Add(txtEntry.entryName);
}
addEntryBtn.Enabled = false;
deleteEntryBtn.Enabled = false;
}
private BMG m_File = null;
@@ -39,8 +42,8 @@ namespace BMGEditor
private void openEntryBtn_Click(object sender, EventArgs e)
{
Form txtEditForm = new TextEntryEditorForm(m_File.Entries[entriesListBox.SelectedIndex]);
txtEditForm.Show();
if (entriesListBox.SelectedIndex == -1) { }
else openEditor();
}
private void addEntryBtn_Click(object sender, EventArgs e)
@@ -51,7 +54,23 @@ namespace BMGEditor
private void deleteEntryBtn_Click(object sender, EventArgs e)
{
m_File.NukeFile();
throw new NotImplementedException();
}
private void openEditor()
{
Form txtEditForm = new TextEntryEditorForm(m_File.Entries[entriesListBox.SelectedIndex]);
txtEditForm.Show();
}
private void entriesListBox_DoubleClick(object sender, EventArgs e)
{
openEditor();
}
private void saveBMGbtn_Click(object sender, EventArgs e)
{
m_File.WriteToFile();
}
}
}

View File

@@ -61,6 +61,17 @@
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="saveBMGbtn.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAEKSURBVEhL3ZG9DsFQHMXvczDZvIOtXsHObuhqkViI3Quw
6CYmNoMYJJ0NBiFFIoIytOuf0+TeXP3yde+iyS+3OcP53Z4y3/dJJ4HAsiwyTVMp6BQCBIZhKAWdEcHV
vSlBmeB82NFy1KLluEWOPRC5MoHdMWhazwi4RJlALgf4EuT6BI+5kCsTrGddUY658E+QvyXYHq9UnRyC
U87f4aUApcXhnrI9Jzg/laQKFntXlHM+lSQK5psL5fvbp/JvJLGCQqmSWM5JkiCT84igXGtSrruKLQ0T
luAdmZxHBG37FFuWBC/j5XKOmX8WAH7rcI6ZMffPgjQwN2bXJgDo/COBTpjneQ2dML0PY3cISreGe8HM
qgAAAABJRU5ErkJggg==
</value>
</data>
<data name="openEntryBtn.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8

View File

@@ -37,7 +37,7 @@ namespace BMGEditor
this.openTextEditorBtn = new System.Windows.Forms.Button();
this.openBcsvEditorBtn = new System.Windows.Forms.Button();
this.openARCFileDialog = new System.Windows.Forms.OpenFileDialog();
this.button1 = new System.Windows.Forms.Button();
this.aboutBtn = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// openFileBtn
@@ -53,7 +53,7 @@ namespace BMGEditor
// closeFileBtn
//
this.closeFileBtn.Enabled = false;
this.closeFileBtn.Location = new System.Drawing.Point(220, 12);
this.closeFileBtn.Location = new System.Drawing.Point(112, 12);
this.closeFileBtn.Name = "closeFileBtn";
this.closeFileBtn.Size = new System.Drawing.Size(94, 29);
this.closeFileBtn.TabIndex = 1;
@@ -64,7 +64,7 @@ namespace BMGEditor
// openTextEditorBtn
//
this.openTextEditorBtn.Enabled = false;
this.openTextEditorBtn.Location = new System.Drawing.Point(12, 60);
this.openTextEditorBtn.Location = new System.Drawing.Point(12, 112);
this.openTextEditorBtn.Name = "openTextEditorBtn";
this.openTextEditorBtn.Size = new System.Drawing.Size(94, 29);
this.openTextEditorBtn.TabIndex = 2;
@@ -75,11 +75,11 @@ namespace BMGEditor
// openBcsvEditorBtn
//
this.openBcsvEditorBtn.Enabled = false;
this.openBcsvEditorBtn.Location = new System.Drawing.Point(220, 60);
this.openBcsvEditorBtn.Location = new System.Drawing.Point(112, 112);
this.openBcsvEditorBtn.Name = "openBcsvEditorBtn";
this.openBcsvEditorBtn.Size = new System.Drawing.Size(94, 29);
this.openBcsvEditorBtn.Size = new System.Drawing.Size(313, 29);
this.openBcsvEditorBtn.TabIndex = 3;
this.openBcsvEditorBtn.Text = "Entries editor";
this.openBcsvEditorBtn.Text = "BCSV Editor [DEBUG BUILD ONLY]";
this.openBcsvEditorBtn.UseVisualStyleBackColor = true;
this.openBcsvEditorBtn.Click += new System.EventHandler(this.openBcsvEditorBtn_Click);
//
@@ -88,27 +88,30 @@ namespace BMGEditor
this.openARCFileDialog.FileName = "Message.arc";
this.openARCFileDialog.Filter = "Nintendo archive files|*.arc";
//
// button1
// aboutBtn
//
this.button1.Location = new System.Drawing.Point(112, 26);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(102, 50);
this.button1.TabIndex = 4;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
this.aboutBtn.Location = new System.Drawing.Point(323, 12);
this.aboutBtn.Name = "aboutBtn";
this.aboutBtn.Size = new System.Drawing.Size(102, 29);
this.aboutBtn.TabIndex = 4;
this.aboutBtn.Text = "About";
this.aboutBtn.UseVisualStyleBackColor = true;
this.aboutBtn.Click += new System.EventHandler(this.button1_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(326, 101);
this.Controls.Add(this.button1);
this.ClientSize = new System.Drawing.Size(437, 153);
this.Controls.Add(this.aboutBtn);
this.Controls.Add(this.openBcsvEditorBtn);
this.Controls.Add(this.openTextEditorBtn);
this.Controls.Add(this.closeFileBtn);
this.Controls.Add(this.openFileBtn);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "MainForm";
this.ResumeLayout(false);
@@ -121,6 +124,6 @@ namespace BMGEditor
private Button openTextEditorBtn;
private Button openBcsvEditorBtn;
private OpenFileDialog openARCFileDialog;
private Button button1;
private Button aboutBtn;
}
}

View File

@@ -55,7 +55,10 @@ namespace BMGEditor
return;
}
//openBcsvEditorBtn.Enabled = true;
#if DEBUG
openBcsvEditorBtn.Enabled = true;
#else
#endif
openTextEditorBtn.Enabled = true;
closeFileBtn.Enabled = true;
arcOpen = true;

View File

@@ -28,106 +28,359 @@
/// </summary>
private void InitializeComponent()
{
this.tabControl = new System.Windows.Forms.TabControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.entryNoGroup = new System.Windows.Forms.GroupBox();
this.entryNoTextBox = new System.Windows.Forms.TextBox();
this.entryNameGroup = new System.Windows.Forms.GroupBox();
this.entryNameTxtBox = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.sndEffectCombo = new System.Windows.Forms.ComboBox();
this.msgLayoutCombo = new System.Windows.Forms.ComboBox();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.entryTextTxtBox = new System.Windows.Forms.RichTextBox();
this.unk1ValueGroup = new System.Windows.Forms.GroupBox();
this.cameraOptGroup = new System.Windows.Forms.GroupBox();
this.sndEffectOptGroup = new System.Windows.Forms.GroupBox();
this.unk2ValueGroup = new System.Windows.Forms.GroupBox();
this.msgTriggerGroup = new System.Windows.Forms.GroupBox();
this.msgLayoutGroup = new System.Windows.Forms.GroupBox();
this.msgAreaGroup = new System.Windows.Forms.GroupBox();
this.unk1ValueUpDown = new System.Windows.Forms.NumericUpDown();
this.cameraOptUpDown = new System.Windows.Forms.NumericUpDown();
this.sndEffectOptUpDown = new System.Windows.Forms.NumericUpDown();
this.unk2ValueUpDown = new System.Windows.Forms.NumericUpDown();
this.msgTriggerCombo = new System.Windows.Forms.ComboBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.msgLayoutCombo = new System.Windows.Forms.ComboBox();
this.msgAreaCombo = new System.Windows.Forms.ComboBox();
this.tabControl.SuspendLayout();
this.tabPage2.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.entryNoGroup.SuspendLayout();
this.entryNameGroup.SuspendLayout();
this.tabPage1.SuspendLayout();
this.unk1ValueGroup.SuspendLayout();
this.cameraOptGroup.SuspendLayout();
this.sndEffectOptGroup.SuspendLayout();
this.unk2ValueGroup.SuspendLayout();
this.msgTriggerGroup.SuspendLayout();
this.msgLayoutGroup.SuspendLayout();
this.msgAreaGroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.unk1ValueUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.cameraOptUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sndEffectOptUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.unk2ValueUpDown)).BeginInit();
this.SuspendLayout();
//
// tabControl
//
this.tabControl.Controls.Add(this.tabPage1);
this.tabControl.Controls.Add(this.tabPage2);
this.tabControl.Cursor = System.Windows.Forms.Cursors.Default;
this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl.Location = new System.Drawing.Point(0, 0);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
this.tabControl.Size = new System.Drawing.Size(800, 450);
this.tabControl.TabIndex = 1;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.flowLayoutPanel1);
this.tabPage2.Location = new System.Drawing.Point(4, 29);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(792, 417);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Properties";
this.tabPage2.UseVisualStyleBackColor = true;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.entryNameGroup);
this.flowLayoutPanel1.Controls.Add(this.entryNoGroup);
this.flowLayoutPanel1.Controls.Add(this.unk1ValueGroup);
this.flowLayoutPanel1.Controls.Add(this.cameraOptGroup);
this.flowLayoutPanel1.Controls.Add(this.sndEffectOptGroup);
this.flowLayoutPanel1.Controls.Add(this.unk2ValueGroup);
this.flowLayoutPanel1.Controls.Add(this.msgTriggerGroup);
this.flowLayoutPanel1.Controls.Add(this.msgLayoutGroup);
this.flowLayoutPanel1.Controls.Add(this.msgAreaGroup);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(786, 411);
this.flowLayoutPanel1.TabIndex = 0;
//
// entryNoGroup
//
this.entryNoGroup.Controls.Add(this.entryNoTextBox);
this.entryNoGroup.Location = new System.Drawing.Point(196, 3);
this.entryNoGroup.Name = "entryNoGroup";
this.entryNoGroup.Size = new System.Drawing.Size(187, 66);
this.entryNoGroup.TabIndex = 1;
this.entryNoGroup.TabStop = false;
this.entryNoGroup.Text = "Entry number";
//
// entryNoTextBox
//
this.entryNoTextBox.Enabled = false;
this.entryNoTextBox.Location = new System.Drawing.Point(6, 26);
this.entryNoTextBox.Name = "entryNoTextBox";
this.entryNoTextBox.Size = new System.Drawing.Size(167, 27);
this.entryNoTextBox.TabIndex = 0;
//
// entryNameGroup
//
this.entryNameGroup.Controls.Add(this.entryNameTxtBox);
this.entryNameGroup.Location = new System.Drawing.Point(3, 3);
this.entryNameGroup.Name = "entryNameGroup";
this.entryNameGroup.Size = new System.Drawing.Size(187, 66);
this.entryNameGroup.TabIndex = 0;
this.entryNameGroup.TabStop = false;
this.entryNameGroup.Text = "Entry name";
//
// entryNameTxtBox
//
this.entryNameTxtBox.Location = new System.Drawing.Point(538, 327);
this.entryNameTxtBox.Enabled = false;
this.entryNameTxtBox.Location = new System.Drawing.Point(6, 26);
this.entryNameTxtBox.Name = "entryNameTxtBox";
this.entryNameTxtBox.Size = new System.Drawing.Size(125, 27);
this.entryNameTxtBox.Size = new System.Drawing.Size(167, 27);
this.entryNameTxtBox.TabIndex = 0;
//
// textBox2
// tabPage1
//
this.textBox2.Location = new System.Drawing.Point(538, 121);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(125, 27);
this.textBox2.TabIndex = 1;
this.tabPage1.Controls.Add(this.entryTextTxtBox);
this.tabPage1.Location = new System.Drawing.Point(4, 29);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(792, 417);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Text";
this.tabPage1.UseVisualStyleBackColor = true;
//
// textBox3
// entryTextTxtBox
//
this.textBox3.Location = new System.Drawing.Point(538, 71);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(125, 27);
this.textBox3.TabIndex = 2;
this.entryTextTxtBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.entryTextTxtBox.Location = new System.Drawing.Point(3, 3);
this.entryTextTxtBox.Name = "entryTextTxtBox";
this.entryTextTxtBox.Size = new System.Drawing.Size(786, 411);
this.entryTextTxtBox.TabIndex = 7;
this.entryTextTxtBox.Text = "";
//
// textBox4
// unk1ValueGroup
//
this.textBox4.Location = new System.Drawing.Point(538, 24);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(125, 27);
this.textBox4.TabIndex = 3;
this.unk1ValueGroup.Controls.Add(this.unk1ValueUpDown);
this.unk1ValueGroup.Location = new System.Drawing.Point(389, 3);
this.unk1ValueGroup.Name = "unk1ValueGroup";
this.unk1ValueGroup.Size = new System.Drawing.Size(187, 66);
this.unk1ValueGroup.TabIndex = 2;
this.unk1ValueGroup.TabStop = false;
this.unk1ValueGroup.Text = "Unknown value 1";
//
// sndEffectCombo
// cameraOptGroup
//
this.sndEffectCombo.FormattingEnabled = true;
this.sndEffectCombo.Location = new System.Drawing.Point(512, 265);
this.sndEffectCombo.Name = "sndEffectCombo";
this.sndEffectCombo.Size = new System.Drawing.Size(151, 28);
this.sndEffectCombo.TabIndex = 4;
this.cameraOptGroup.Controls.Add(this.cameraOptUpDown);
this.cameraOptGroup.Location = new System.Drawing.Point(582, 3);
this.cameraOptGroup.Name = "cameraOptGroup";
this.cameraOptGroup.Size = new System.Drawing.Size(187, 66);
this.cameraOptGroup.TabIndex = 2;
this.cameraOptGroup.TabStop = false;
this.cameraOptGroup.Text = "Camera";
//
// msgLayoutCombo
// sndEffectOptGroup
//
this.msgLayoutCombo.FormattingEnabled = true;
this.msgLayoutCombo.Location = new System.Drawing.Point(512, 213);
this.msgLayoutCombo.Name = "msgLayoutCombo";
this.msgLayoutCombo.Size = new System.Drawing.Size(151, 28);
this.msgLayoutCombo.TabIndex = 5;
this.sndEffectOptGroup.Controls.Add(this.sndEffectOptUpDown);
this.sndEffectOptGroup.Location = new System.Drawing.Point(3, 75);
this.sndEffectOptGroup.Name = "sndEffectOptGroup";
this.sndEffectOptGroup.Size = new System.Drawing.Size(187, 66);
this.sndEffectOptGroup.TabIndex = 2;
this.sndEffectOptGroup.TabStop = false;
this.sndEffectOptGroup.Text = "Sound effect";
//
// unk2ValueGroup
//
this.unk2ValueGroup.Controls.Add(this.unk2ValueUpDown);
this.unk2ValueGroup.Location = new System.Drawing.Point(196, 75);
this.unk2ValueGroup.Name = "unk2ValueGroup";
this.unk2ValueGroup.Size = new System.Drawing.Size(187, 66);
this.unk2ValueGroup.TabIndex = 3;
this.unk2ValueGroup.TabStop = false;
this.unk2ValueGroup.Text = "Unknown value 2";
//
// msgTriggerGroup
//
this.msgTriggerGroup.Controls.Add(this.msgTriggerCombo);
this.msgTriggerGroup.Location = new System.Drawing.Point(389, 75);
this.msgTriggerGroup.Name = "msgTriggerGroup";
this.msgTriggerGroup.Size = new System.Drawing.Size(187, 66);
this.msgTriggerGroup.TabIndex = 4;
this.msgTriggerGroup.TabStop = false;
this.msgTriggerGroup.Text = "Message trigger";
//
// msgLayoutGroup
//
this.msgLayoutGroup.Controls.Add(this.msgLayoutCombo);
this.msgLayoutGroup.Location = new System.Drawing.Point(582, 75);
this.msgLayoutGroup.Name = "msgLayoutGroup";
this.msgLayoutGroup.Size = new System.Drawing.Size(187, 66);
this.msgLayoutGroup.TabIndex = 5;
this.msgLayoutGroup.TabStop = false;
this.msgLayoutGroup.Text = "Message layout";
//
// msgAreaGroup
//
this.msgAreaGroup.Controls.Add(this.msgAreaCombo);
this.msgAreaGroup.Location = new System.Drawing.Point(3, 147);
this.msgAreaGroup.Name = "msgAreaGroup";
this.msgAreaGroup.Size = new System.Drawing.Size(187, 66);
this.msgAreaGroup.TabIndex = 6;
this.msgAreaGroup.TabStop = false;
this.msgAreaGroup.Text = "Message area";
//
// unk1ValueUpDown
//
this.unk1ValueUpDown.Hexadecimal = true;
this.unk1ValueUpDown.Location = new System.Drawing.Point(6, 27);
this.unk1ValueUpDown.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.unk1ValueUpDown.Name = "unk1ValueUpDown";
this.unk1ValueUpDown.Size = new System.Drawing.Size(167, 27);
this.unk1ValueUpDown.TabIndex = 0;
//
// cameraOptUpDown
//
this.cameraOptUpDown.Hexadecimal = true;
this.cameraOptUpDown.Location = new System.Drawing.Point(6, 26);
this.cameraOptUpDown.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.cameraOptUpDown.Name = "cameraOptUpDown";
this.cameraOptUpDown.Size = new System.Drawing.Size(167, 27);
this.cameraOptUpDown.TabIndex = 1;
//
// sndEffectOptUpDown
//
this.sndEffectOptUpDown.Hexadecimal = true;
this.sndEffectOptUpDown.Location = new System.Drawing.Point(6, 26);
this.sndEffectOptUpDown.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.sndEffectOptUpDown.Name = "sndEffectOptUpDown";
this.sndEffectOptUpDown.Size = new System.Drawing.Size(167, 27);
this.sndEffectOptUpDown.TabIndex = 1;
//
// unk2ValueUpDown
//
this.unk2ValueUpDown.Hexadecimal = true;
this.unk2ValueUpDown.Location = new System.Drawing.Point(6, 26);
this.unk2ValueUpDown.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.unk2ValueUpDown.Name = "unk2ValueUpDown";
this.unk2ValueUpDown.Size = new System.Drawing.Size(167, 27);
this.unk2ValueUpDown.TabIndex = 1;
//
// msgTriggerCombo
//
this.msgTriggerCombo.FormattingEnabled = true;
this.msgTriggerCombo.Location = new System.Drawing.Point(512, 168);
this.msgTriggerCombo.Items.AddRange(new object[] {
"Talk",
"Shout",
"Auto",
"Unknown",
"None"});
this.msgTriggerCombo.Location = new System.Drawing.Point(6, 26);
this.msgTriggerCombo.Name = "msgTriggerCombo";
this.msgTriggerCombo.Size = new System.Drawing.Size(151, 28);
this.msgTriggerCombo.TabIndex = 6;
this.msgTriggerCombo.Size = new System.Drawing.Size(167, 28);
this.msgTriggerCombo.TabIndex = 0;
//
// richTextBox1
// msgLayoutCombo
//
this.richTextBox1.Location = new System.Drawing.Point(12, 28);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(470, 410);
this.richTextBox1.TabIndex = 7;
this.richTextBox1.Text = "";
this.msgLayoutCombo.FormattingEnabled = true;
this.msgLayoutCombo.Items.AddRange(new object[] {
"Default",
"Reading a sign",
"Information"});
this.msgLayoutCombo.Location = new System.Drawing.Point(6, 25);
this.msgLayoutCombo.Name = "msgLayoutCombo";
this.msgLayoutCombo.Size = new System.Drawing.Size(167, 28);
this.msgLayoutCombo.TabIndex = 1;
//
// msgAreaCombo
//
this.msgAreaCombo.FormattingEnabled = true;
this.msgAreaCombo.Items.AddRange(new object[] {
"0x00 (Unknown)",
"0xFF (Unknown)"});
this.msgAreaCombo.Location = new System.Drawing.Point(6, 26);
this.msgAreaCombo.Name = "msgAreaCombo";
this.msgAreaCombo.Size = new System.Drawing.Size(167, 28);
this.msgAreaCombo.TabIndex = 2;
//
// TextEntryEditorForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.msgTriggerCombo);
this.Controls.Add(this.msgLayoutCombo);
this.Controls.Add(this.sndEffectCombo);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.entryNameTxtBox);
this.Controls.Add(this.tabControl);
this.Name = "TextEntryEditorForm";
this.Text = "TextEntryEditorForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TextEntryEditorForm_FormClosing);
this.tabControl.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.flowLayoutPanel1.ResumeLayout(false);
this.entryNoGroup.ResumeLayout(false);
this.entryNoGroup.PerformLayout();
this.entryNameGroup.ResumeLayout(false);
this.entryNameGroup.PerformLayout();
this.tabPage1.ResumeLayout(false);
this.unk1ValueGroup.ResumeLayout(false);
this.cameraOptGroup.ResumeLayout(false);
this.sndEffectOptGroup.ResumeLayout(false);
this.unk2ValueGroup.ResumeLayout(false);
this.msgTriggerGroup.ResumeLayout(false);
this.msgLayoutGroup.ResumeLayout(false);
this.msgAreaGroup.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.unk1ValueUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cameraOptUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.sndEffectOptUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.unk2ValueUpDown)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TabControl tabControl;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.RichTextBox entryTextTxtBox;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.GroupBox entryNameGroup;
private System.Windows.Forms.TextBox entryNameTxtBox;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.ComboBox sndEffectCombo;
private System.Windows.Forms.ComboBox msgLayoutCombo;
private System.Windows.Forms.GroupBox entryNoGroup;
private System.Windows.Forms.TextBox entryNoTextBox;
private System.Windows.Forms.GroupBox unk1ValueGroup;
private System.Windows.Forms.NumericUpDown unk1ValueUpDown;
private System.Windows.Forms.GroupBox cameraOptGroup;
private System.Windows.Forms.NumericUpDown cameraOptUpDown;
private System.Windows.Forms.GroupBox sndEffectOptGroup;
private System.Windows.Forms.NumericUpDown sndEffectOptUpDown;
private System.Windows.Forms.GroupBox unk2ValueGroup;
private System.Windows.Forms.NumericUpDown unk2ValueUpDown;
private System.Windows.Forms.GroupBox msgTriggerGroup;
private System.Windows.Forms.ComboBox msgTriggerCombo;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.GroupBox msgLayoutGroup;
private System.Windows.Forms.ComboBox msgLayoutCombo;
private System.Windows.Forms.GroupBox msgAreaGroup;
private System.Windows.Forms.ComboBox msgAreaCombo;
}
}

View File

@@ -17,13 +17,125 @@ namespace BMGEditor.UI
{
InitializeComponent();
m_Entry = txtEntry;
richTextBox1.Text = m_Entry.text;
Text = $"Editing {m_Entry.entryName} - {Variables.softwareName} {Variables.softwareVersion}";
if (Variables.isBeta) Text += " [BETA]";
//Filling window with entry content
entryTextTxtBox.Text = m_Entry.text;
entryNameTxtBox.Text = m_Entry.entryName;
entryNoTextBox.Text = String.Concat(m_Entry.entryNo);
unk1ValueUpDown.Value = m_Entry.unk1;
cameraOptUpDown.Value = m_Entry.cameraOpt;
sndEffectOptUpDown.Value = m_Entry.sndEffectOpt;
unk2ValueUpDown.Value = m_Entry.unk2;
switch (m_Entry.messageTriggerOpt)
{
case 0x00:
msgTriggerCombo.SelectedIndex = 0x00;
break;
case 0x01:
msgTriggerCombo.SelectedIndex = 0x01;
break;
case 0x02:
msgTriggerCombo.SelectedIndex = 0x02;
break;
case 0x04:
msgTriggerCombo.SelectedIndex = 0x03;
break;
case 0x05:
msgTriggerCombo.SelectedIndex = 0x04;
break;
}
switch (m_Entry.messageLayoutOpt)
{
case 0x00:
msgLayoutCombo.SelectedItem = msgLayoutCombo.Items[0];
break;
case 0x04:
msgLayoutCombo.SelectedItem = msgLayoutCombo.Items[1];
break;
case 0x05:
msgLayoutCombo.SelectedItem = msgLayoutCombo.Items[2];
break;
}
switch (m_Entry.messageAreaOpt)
{
case 0x00:
msgAreaCombo.SelectedItem = msgAreaCombo.Items[0];
break;
case 0xFF:
msgAreaCombo.SelectedItem = msgAreaCombo.Items[1];
break;
}
}
private void TextEntryEditorForm_FormClosing(object sender, FormClosingEventArgs e)
{
m_Entry.text = richTextBox1.Text;
//Saving edited content
m_Entry.text = entryTextTxtBox.Text;
m_Entry.unk1 = (byte)unk1ValueUpDown.Value;
m_Entry.cameraOpt = (byte)cameraOptUpDown.Value;
m_Entry.sndEffectOpt = (byte)sndEffectOptUpDown.Value;
m_Entry.unk2 = (byte)unk2ValueUpDown.Value;
switch (msgTriggerCombo.SelectedIndex)
{
case 0x00:
m_Entry.messageTriggerOpt = 0x00;
break;
case 0x01:
m_Entry.messageTriggerOpt = 0x01;
break;
case 0x02:
m_Entry.messageTriggerOpt = 0x02;
break;
case 0x03:
m_Entry.messageTriggerOpt = 0x04;
break;
case 0x04:
m_Entry.messageTriggerOpt = 0x05;
break;
}
switch (msgLayoutCombo.SelectedIndex)
{
case 0x00:
m_Entry.messageLayoutOpt = 0x00;
break;
case 0x01:
m_Entry.messageLayoutOpt = 0x04;
break;
case 0x02:
m_Entry.messageLayoutOpt = 0x05;
break;
}
switch (msgAreaCombo.SelectedIndex)
{
case 0x00:
m_Entry.messageAreaOpt = 0x00;
break;
case 0x01:
m_Entry.messageAreaOpt = 0xFF;
break;
}
}
}
}