This commit is contained in:
2021-11-29 17:21:39 +01:00
parent 4c33901c1f
commit 151fc22069
4 changed files with 90 additions and 85 deletions

View File

@@ -1388,51 +1388,7 @@ namespace BMGEditor
{
if (strToWrite[i].Equals('*'))
{
//if (i + 2 > strToWrite.Count)
//break;
//else
{
EscapeSequence escSeq = new EscapeSequence();
string strEscSeqLen = String.Concat(strToWrite[i+1], strToWrite[i+2]);
escSeq.length = Byte.Parse(strEscSeqLen, NumberStyles.HexNumber);
escSeq.unk1 = Byte.Parse(String.Concat(strToWrite[i + 3], strToWrite[i + 4]), NumberStyles.HexNumber);
switch (escSeq.length)
{
case 0x06:
escSeq.binValue1 = UInt16.Parse(String.Concat(strToWrite[i + 5], strToWrite[i + 6], strToWrite[i + 7], strToWrite[i + 8]), NumberStyles.HexNumber);
break;
case 0x08:
escSeq.binValue1 = UInt16.Parse(String.Concat(strToWrite[i + 5], strToWrite[i + 6], strToWrite[i + 7], strToWrite[i + 8]), NumberStyles.HexNumber);
escSeq.binValue2 = UInt16.Parse(String.Concat(strToWrite[i + 9], strToWrite[i + 10], strToWrite[i + 11], strToWrite[i + 12]), NumberStyles.HexNumber);
break;
case 0x0E:
escSeq.binValue1 = UInt16.Parse(String.Concat(strToWrite[i + 5], strToWrite[i + 6], strToWrite[i + 7], strToWrite[i + 8]), NumberStyles.HexNumber);
escSeq.binValue2 = UInt16.Parse(String.Concat(strToWrite[i + 9], strToWrite[i + 10], strToWrite[i + 11], strToWrite[i + 12]), NumberStyles.HexNumber);
escSeq.binValue3 = UInt16.Parse(String.Concat(strToWrite[i + 13], strToWrite[i + 14], strToWrite[i + 15], strToWrite[i + 16]), NumberStyles.HexNumber);
escSeq.binValue4 = UInt16.Parse(String.Concat(strToWrite[i + 17], strToWrite[i + 18], strToWrite[i + 19], strToWrite[i + 20]), NumberStyles.HexNumber);
escSeq.binValue5 = UInt16.Parse(String.Concat(strToWrite[i + 21], strToWrite[i + 22], strToWrite[i + 23], strToWrite[i + 24]), NumberStyles.HexNumber);
break;
case 0x36:
//escSeq.bigBinValue =
break;
default:
System.Windows.Forms.MessageBox.Show($"Error, please report this issue to Bussun#0586 on Discord. What went wrong: Unknown escape sequence\nMessage name: {entry.entryName} {entry.entryNo}");
break;
}
List<Byte> escSeqToWrite = BytesFromEscapeSequence(escSeq);
foreach (Byte b in escSeqToWrite)
{
m_File.Writer.Write(b);
}
i += escSeq.length * 2 - 3;
}
//TODO: Rewrite escape sequence parser
}
else
m_File.Writer.Write(strToWrite[i]);

View File

@@ -0,0 +1,48 @@
/*if (i + 2 > strToWrite.Count)
break;
else
{
EscapeSequence escSeq = new EscapeSequence();
string strEscSeqLen = String.Concat(strToWrite[i + 1], strToWrite[i + 2]);
escSeq.length = Byte.Parse(strEscSeqLen, NumberStyles.HexNumber);
escSeq.unk1 = Byte.Parse(String.Concat(strToWrite[i + 3], strToWrite[i + 4]), NumberStyles.HexNumber);
switch (escSeq.length)
{
case 0x06:
escSeq.binValue1 = UInt16.Parse(String.Concat(strToWrite[i + 5], strToWrite[i + 6], strToWrite[i + 7], strToWrite[i + 8]), NumberStyles.HexNumber);
break;
case 0x08:
escSeq.binValue1 = UInt16.Parse(String.Concat(strToWrite[i + 5], strToWrite[i + 6], strToWrite[i + 7], strToWrite[i + 8]), NumberStyles.HexNumber);
escSeq.binValue2 = UInt16.Parse(String.Concat(strToWrite[i + 9], strToWrite[i + 10], strToWrite[i + 11], strToWrite[i + 12]), NumberStyles.HexNumber);
break;
case 0x0E:
escSeq.binValue1 = UInt16.Parse(String.Concat(strToWrite[i + 5], strToWrite[i + 6], strToWrite[i + 7], strToWrite[i + 8]), NumberStyles.HexNumber);
escSeq.binValue2 = UInt16.Parse(String.Concat(strToWrite[i + 9], strToWrite[i + 10], strToWrite[i + 11], strToWrite[i + 12]), NumberStyles.HexNumber);
escSeq.binValue3 = UInt16.Parse(String.Concat(strToWrite[i + 13], strToWrite[i + 14], strToWrite[i + 15], strToWrite[i + 16]), NumberStyles.HexNumber);
escSeq.binValue4 = UInt16.Parse(String.Concat(strToWrite[i + 17], strToWrite[i + 18], strToWrite[i + 19], strToWrite[i + 20]), NumberStyles.HexNumber);
escSeq.binValue5 = UInt16.Parse(String.Concat(strToWrite[i + 21], strToWrite[i + 22], strToWrite[i + 23], strToWrite[i + 24]), NumberStyles.HexNumber);
break;
case 0x36:
for (int j = 0; j < escSeq.length)
{
escSeq.bigBinValue += Byte.Parse(strToWrite)
}
break;
default:
System.Windows.Forms.MessageBox.Show($"Error, please report this issue to Bussun#0586 on Discord. What went wrong: Unknown escape sequence\nMessage name: {entry.entryName} {entry.entryNo}");
break;
}
List<Byte> escSeqToWrite = BytesFromEscapeSequence(escSeq);
foreach (Byte b in escSeqToWrite)
{
m_File.Writer.Write(b);
}
i += escSeq.length * 2 - 3;
}*/

View File

@@ -28,73 +28,73 @@
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
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.comboBox1 = new System.Windows.Forms.ComboBox();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.comboBox3 = new System.Windows.Forms.ComboBox();
this.sndEffectCombo = new System.Windows.Forms.ComboBox();
this.msgLayoutCombo = new System.Windows.Forms.ComboBox();
this.msgTriggerCombo = new System.Windows.Forms.ComboBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// textBox1
// entryNameTxtBox
//
this.textBox1.Location = new System.Drawing.Point(176, 35);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(125, 27);
this.textBox1.TabIndex = 0;
this.entryNameTxtBox.Location = new System.Drawing.Point(538, 327);
this.entryNameTxtBox.Name = "entryNameTxtBox";
this.entryNameTxtBox.Size = new System.Drawing.Size(125, 27);
this.entryNameTxtBox.TabIndex = 0;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(569, 35);
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;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(438, 35);
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;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(307, 35);
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;
//
// comboBox1
// sndEffectCombo
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(198, 123);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(151, 28);
this.comboBox1.TabIndex = 4;
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;
//
// comboBox2
// msgLayoutCombo
//
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(512, 123);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(151, 28);
this.comboBox2.TabIndex = 5;
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;
//
// comboBox3
// msgTriggerCombo
//
this.comboBox3.FormattingEnabled = true;
this.comboBox3.Location = new System.Drawing.Point(355, 123);
this.comboBox3.Name = "comboBox3";
this.comboBox3.Size = new System.Drawing.Size(151, 28);
this.comboBox3.TabIndex = 6;
this.msgTriggerCombo.FormattingEnabled = true;
this.msgTriggerCombo.Location = new System.Drawing.Point(512, 168);
this.msgTriggerCombo.Name = "msgTriggerCombo";
this.msgTriggerCombo.Size = new System.Drawing.Size(151, 28);
this.msgTriggerCombo.TabIndex = 6;
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(130, 234);
this.richTextBox1.Location = new System.Drawing.Point(12, 28);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(230, 120);
this.richTextBox1.Size = new System.Drawing.Size(470, 410);
this.richTextBox1.TabIndex = 7;
this.richTextBox1.Text = "";
//
@@ -104,13 +104,13 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.comboBox3);
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.comboBox1);
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.textBox1);
this.Controls.Add(this.entryNameTxtBox);
this.Name = "TextEntryEditorForm";
this.Text = "TextEntryEditorForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TextEntryEditorForm_FormClosing);
@@ -121,13 +121,13 @@
#endregion
private System.Windows.Forms.TextBox textBox1;
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 comboBox1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.ComboBox comboBox3;
private System.Windows.Forms.ComboBox sndEffectCombo;
private System.Windows.Forms.ComboBox msgLayoutCombo;
private System.Windows.Forms.ComboBox msgTriggerCombo;
private System.Windows.Forms.RichTextBox richTextBox1;
}
}

View File

@@ -18,6 +18,7 @@ namespace BMGEditor.UI
InitializeComponent();
m_Entry = txtEntry;
richTextBox1.Text = m_Entry.text;
entryNameTxtBox.Text = m_Entry.entryName;
}
private void TextEntryEditorForm_FormClosing(object sender, FormClosingEventArgs e)