diff --git a/BMGEditor/BMG.cs b/BMGEditor/BMG.cs
new file mode 100644
index 0000000..3b392e4
--- /dev/null
+++ b/BMGEditor/BMG.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BMGEditor
+{
+ public class BMG
+ {
+ private FileBase m_File;
+ private Int32 m_Signature = 0x4D455347;
+ private Int32 m_FileType = 0x626D6731;
+ private Byte m_ExpectedEncoding = 0x02;
+
+ public BMG(FileBase file)
+ {
+ m_File = file;
+ m_File.BigEndian = true;
+ m_File.Stream.Position = 0;
+
+ Int32 headermagic1 = m_File.Reader.ReadInt32();
+ Int32 headermagic2 = m_File.Reader.ReadInt32();
+ if (headermagic1 == m_Signature && headermagic2 == m_FileType) { Console.WriteLine("Nice"); } else { Console.WriteLine("not nice");}
+
+ UInt32 fileSize = m_File.Reader.ReadUInt32();
+ UInt32 numberOfSections = m_File.Reader.ReadUInt32();
+ Byte fileEncoding = m_File.Reader.ReadByte();
+ Console.WriteLine("File size: " + fileSize);
+ Console.WriteLine("File sections: " + numberOfSections);
+
+
+
+ }
+
+ public void Close()
+ {
+ m_File.Close();
+ }
+ }
+
+ /*public class BMGSection
+ {
+ Int32 sectionMagic;
+ public BMGSection()
+ {
+
+ }
+ }
+
+ public class INF1Section : BMGSection
+ {
+ public INF1Section()
+ {
+
+ }
+ }*/
+}
diff --git a/BMGEditor/BMGEditForm.Designer.cs b/BMGEditor/BMGEditForm.Designer.cs
new file mode 100644
index 0000000..84021fc
--- /dev/null
+++ b/BMGEditor/BMGEditForm.Designer.cs
@@ -0,0 +1,39 @@
+namespace BMGEditor
+{
+ partial class BMGEditForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "BMGEditForm";
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/BMGEditor/BMGEditForm.cs b/BMGEditor/BMGEditForm.cs
new file mode 100644
index 0000000..e7dae08
--- /dev/null
+++ b/BMGEditor/BMGEditForm.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace BMGEditor
+{
+ public partial class BMGEditForm : Form
+ {
+ public BMGEditForm(RarcFilesystem arcFs)
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BMGEditor/BMGEditForm.resx b/BMGEditor/BMGEditForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/BMGEditor/BMGEditForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/BMGEditor/BMGEditor.csproj b/BMGEditor/BMGEditor.csproj
index 78ecb4d..346646f 100644
--- a/BMGEditor/BMGEditor.csproj
+++ b/BMGEditor/BMGEditor.csproj
@@ -1,12 +1,13 @@
- WinExe
+ Exe
net6.0-windows
enable
true
disable
AnyCPU;x64
+ x64
\ No newline at end of file
diff --git a/BMGEditor/Bcsv.cs b/BMGEditor/Bcsv.cs
index 4395b43..87f5832 100644
--- a/BMGEditor/Bcsv.cs
+++ b/BMGEditor/Bcsv.cs
@@ -12,7 +12,7 @@ namespace BMGEditor
{
m_File = file;
m_File.BigEndian = true;
- m_File.Encoding = Encoding.GetEncoding("shift-jis");
+ m_File.Encoding = Encoding.GetEncoding(20127);
Fields = new Dictionary();
Entries = new List();
@@ -37,7 +37,6 @@ namespace BMGEditor
field.Type = m_File.Reader.ReadByte();
string fieldname = Bcsv.HashToFieldName(field.NameHash);
- field.Name = fieldname;
Fields.Add(field.NameHash, field);
}
@@ -344,17 +343,7 @@ namespace BMGEditor
public static void PopulateHashtable()
{
m_HashTable = new Dictionary();
-
- string[] lines = new string[1];
- foreach (string _line in lines)
- {
- string line = _line.Trim();
-
- if (line.Length == 0) continue;
- if (line[0] == '#') continue;
-
- AddHash(line);
- }
+ AddHash("wowHowDidYouFindThis");
}
public static Dictionary m_HashTable;
diff --git a/BMGEditor/BcsvEditorForm.Designer.cs b/BMGEditor/BcsvEditorForm.Designer.cs
new file mode 100644
index 0000000..5370bc1
--- /dev/null
+++ b/BMGEditor/BcsvEditorForm.Designer.cs
@@ -0,0 +1,99 @@
+namespace BMGEditor
+{
+ partial class BcsvEditorForm
+ {
+ ///
+ /// Variable nécessaire au concepteur.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Nettoyage des ressources utilisées.
+ ///
+ /// true si les ressources managées doivent être supprimées ; sinon, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Code généré par le Concepteur Windows Form
+
+ ///
+ /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
+ /// le contenu de cette méthode avec l'éditeur de code.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BcsvEditorForm));
+ this.tsToolbar = new System.Windows.Forms.ToolStrip();
+ this.btnSave = new System.Windows.Forms.ToolStripButton();
+ this.dgvBcsv = new System.Windows.Forms.DataGridView();
+ this.tsToolbar.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dgvBcsv)).BeginInit();
+ this.SuspendLayout();
+ //
+ // tsToolbar
+ //
+ this.tsToolbar.ImageScalingSize = new System.Drawing.Size(20, 20);
+ this.tsToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.btnSave});
+ this.tsToolbar.Location = new System.Drawing.Point(0, 0);
+ this.tsToolbar.Name = "tsToolbar";
+ this.tsToolbar.Size = new System.Drawing.Size(1039, 27);
+ this.tsToolbar.TabIndex = 0;
+ this.tsToolbar.Text = "toolStrip1";
+ //
+ // btnSave
+ //
+ this.btnSave.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.btnSave.Enabled = false;
+ this.btnSave.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.Image")));
+ this.btnSave.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btnSave.Name = "btnSave";
+ this.btnSave.Size = new System.Drawing.Size(44, 24);
+ this.btnSave.Text = "Save";
+ this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
+ //
+ // dgvBcsv
+ //
+ this.dgvBcsv.AllowUserToResizeRows = false;
+ this.dgvBcsv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dgvBcsv.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dgvBcsv.Location = new System.Drawing.Point(0, 27);
+ this.dgvBcsv.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.dgvBcsv.MultiSelect = false;
+ this.dgvBcsv.Name = "dgvBcsv";
+ this.dgvBcsv.RowHeadersWidth = 51;
+ this.dgvBcsv.Size = new System.Drawing.Size(1039, 731);
+ this.dgvBcsv.TabIndex = 1;
+ //
+ // BcsvEditorForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1039, 758);
+ this.Controls.Add(this.dgvBcsv);
+ this.Controls.Add(this.tsToolbar);
+ this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.Name = "BcsvEditorForm";
+ this.Text = "[DEBUG] BCSV editor";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BcsvEditorForm_FormClosing);
+ this.tsToolbar.ResumeLayout(false);
+ this.tsToolbar.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dgvBcsv)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ToolStrip tsToolbar;
+ private System.Windows.Forms.DataGridView dgvBcsv;
+ private System.Windows.Forms.ToolStripButton btnSave;
+ }
+}
\ No newline at end of file
diff --git a/BMGEditor/BcsvEditorForm.cs b/BMGEditor/BcsvEditorForm.cs
new file mode 100644
index 0000000..571340d
--- /dev/null
+++ b/BMGEditor/BcsvEditorForm.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace BMGEditor
+{
+ public partial class BcsvEditorForm : Form
+ {
+ public BcsvEditorForm(RarcFilesystem arcFs)
+ {
+ InitializeComponent();
+ m_File = new Bcsv(arcFs.OpenFile($"{arcFs.rootName}/messageid.tbl"));
+
+ dgvBcsv.Rows.Clear();
+ dgvBcsv.Columns.Clear();
+
+ foreach (Bcsv.Field field in m_File.Fields.Values)
+ {
+ dgvBcsv.Columns.Add(field.NameHash.ToString("X8"), field.Name);
+ }
+
+ foreach (Bcsv.Entry entry in m_File.Entries)
+ {
+ object[] row = new object[entry.Count];
+ int i = 0;
+
+ foreach (KeyValuePair _val in entry)
+ {
+ object val = _val.Value;
+ row[i++] = val;
+ }
+
+ dgvBcsv.Rows.Add(row);
+ }
+
+ btnSave.Enabled = true;
+ }
+
+ private Bcsv m_File = null;
+
+
+ private void btnSave_Click(object sender, EventArgs e)
+ {
+ m_File.Entries.Clear();
+
+ foreach (DataGridViewRow row in dgvBcsv.Rows)
+ {
+ if (row.IsNewRow) continue;
+
+ Bcsv.Entry entry = new Bcsv.Entry();
+ m_File.Entries.Add(entry);
+
+ foreach (Bcsv.Field field in m_File.Fields.Values)
+ {
+ uint hash = field.NameHash;
+ string valstring = row.Cells[hash.ToString("X8")].FormattedValue.ToString();
+
+ try
+ {
+ switch (field.Type)
+ {
+ case 0:
+ case 3: entry.Add(hash, uint.Parse(valstring)); break;
+ case 4: entry.Add(hash, ushort.Parse(valstring)); break;
+ case 5: entry.Add(hash, byte.Parse(valstring)); break;
+ case 2: entry.Add(hash, float.Parse(valstring)); break;
+ case 6: entry.Add(hash, valstring); break;
+ }
+ }
+ catch
+ {
+ switch (field.Type)
+ {
+ case 0:
+ case 3: entry.Add(hash, (uint)0); break;
+ case 4: entry.Add(hash, (ushort)0); break;
+ case 5: entry.Add(hash, (byte)0); break;
+ case 2: entry.Add(hash, 0f); break;
+ case 6: entry.Add(hash, ""); break;
+ }
+ }
+ }
+ }
+
+ m_File.Flush();
+ }
+
+ private void BcsvEditorForm_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ m_File.Close();
+ }
+ }
+}
diff --git a/BMGEditor/BcsvEditorForm.resx b/BMGEditor/BcsvEditorForm.resx
new file mode 100644
index 0000000..3a841c2
--- /dev/null
+++ b/BMGEditor/BcsvEditorForm.resx
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+
+
+
\ No newline at end of file
diff --git a/BMGEditor/BigEndian.cs b/BMGEditor/BigEndian.cs
index ca1569f..6d909d3 100644
--- a/BMGEditor/BigEndian.cs
+++ b/BMGEditor/BigEndian.cs
@@ -29,6 +29,12 @@ 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()
{
diff --git a/BMGEditor/ExternalFilesystem.cs b/BMGEditor/ExternalFilesystem.cs
new file mode 100644
index 0000000..ac89403
--- /dev/null
+++ b/BMGEditor/ExternalFilesystem.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+
+namespace BMGEditor
+{
+ public class ExternalFilesystem : FilesystemBase
+ {
+ public ExternalFilesystem(string basedir)
+ {
+ if (basedir.EndsWith("/") || basedir.EndsWith("\\"))
+ basedir = basedir.Substring(0, basedir.Length - 1);
+
+ m_BaseDirectory = basedir;
+ if (!Directory.Exists(basedir)) throw new Exception("Directory '" + basedir + "' doesn't exist");
+ }
+
+
+ public override string[] GetDirectories(string directory)
+ {
+ string[] ret = Directory.GetDirectories(m_BaseDirectory + directory);
+
+ for (int i = 0; i < ret.Length; i++)
+ {
+ ret[i] = ret[i].Substring(ret[i].LastIndexOfAny(new char[] { '/', '\\' }) + 1);
+ }
+
+ return ret;
+ }
+
+ public override bool DirectoryExists(string directory)
+ {
+ return Directory.Exists(m_BaseDirectory + directory);
+ }
+
+
+ public override string[] GetFiles(string directory)
+ {
+ string[] ret = Directory.GetFiles(m_BaseDirectory + directory);
+
+ for (int i = 0; i < ret.Length; i++)
+ {
+ ret[i] = ret[i].Substring(ret[i].LastIndexOfAny(new char[] { '/', '\\' }) + 1);
+ }
+
+ return ret;
+ }
+
+ public override bool FileExists(string filename)
+ {
+ return File.Exists(m_BaseDirectory + filename);
+ }
+
+ public override FileBase OpenFile(string filename)
+ {
+ return new ExternalFile(m_BaseDirectory + filename, false);
+ }
+
+
+ private string m_BaseDirectory;
+ }
+
+
+ public class ExternalFile : FileBase
+ {
+ public ExternalFile(string filename, bool create)
+ {
+ Stream = File.Open(filename, create ? FileMode.Create : FileMode.Open, FileAccess.ReadWrite, FileShare.Read);
+ }
+ }
+}
diff --git a/BMGEditor/MainForm.Designer.cs b/BMGEditor/MainForm.Designer.cs
index 592fd0d..ae7aaeb 100644
--- a/BMGEditor/MainForm.Designer.cs
+++ b/BMGEditor/MainForm.Designer.cs
@@ -32,12 +32,95 @@ namespace BMGEditor
///
private void InitializeComponent()
{
- this.components = new System.ComponentModel.Container();
+ this.openFileBtn = new System.Windows.Forms.Button();
+ this.closeFileBtn = new System.Windows.Forms.Button();
+ 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.SuspendLayout();
+ //
+ // openFileBtn
+ //
+ this.openFileBtn.Location = new System.Drawing.Point(12, 12);
+ this.openFileBtn.Name = "openFileBtn";
+ this.openFileBtn.Size = new System.Drawing.Size(94, 29);
+ this.openFileBtn.TabIndex = 0;
+ this.openFileBtn.Text = "Open file";
+ this.openFileBtn.UseVisualStyleBackColor = true;
+ this.openFileBtn.Click += new System.EventHandler(this.openFileBtn_Click);
+ //
+ // closeFileBtn
+ //
+ this.closeFileBtn.Enabled = false;
+ this.closeFileBtn.Location = new System.Drawing.Point(220, 12);
+ this.closeFileBtn.Name = "closeFileBtn";
+ this.closeFileBtn.Size = new System.Drawing.Size(94, 29);
+ this.closeFileBtn.TabIndex = 1;
+ this.closeFileBtn.Text = "Close file";
+ this.closeFileBtn.UseVisualStyleBackColor = true;
+ this.closeFileBtn.Click += new System.EventHandler(this.closeFileBtn_Click);
+ //
+ // openTextEditorBtn
+ //
+ this.openTextEditorBtn.Enabled = false;
+ this.openTextEditorBtn.Location = new System.Drawing.Point(12, 60);
+ this.openTextEditorBtn.Name = "openTextEditorBtn";
+ this.openTextEditorBtn.Size = new System.Drawing.Size(94, 29);
+ this.openTextEditorBtn.TabIndex = 2;
+ this.openTextEditorBtn.Text = "Text edit";
+ this.openTextEditorBtn.UseVisualStyleBackColor = true;
+ this.openTextEditorBtn.Click += new System.EventHandler(this.openTextEditorBtn_Click);
+ //
+ // openBcsvEditorBtn
+ //
+ this.openBcsvEditorBtn.Enabled = false;
+ this.openBcsvEditorBtn.Location = new System.Drawing.Point(220, 60);
+ this.openBcsvEditorBtn.Name = "openBcsvEditorBtn";
+ this.openBcsvEditorBtn.Size = new System.Drawing.Size(94, 29);
+ this.openBcsvEditorBtn.TabIndex = 3;
+ this.openBcsvEditorBtn.Text = "Entries editor";
+ this.openBcsvEditorBtn.UseVisualStyleBackColor = true;
+ this.openBcsvEditorBtn.Click += new System.EventHandler(this.openBcsvEditorBtn_Click);
+ //
+ // openARCFileDialog
+ //
+ this.openARCFileDialog.FileName = "Message.arc";
+ this.openARCFileDialog.Filter = "Nintendo archive files|*.arc";
+ //
+ // button1
+ //
+ 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);
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
+ this.ClientSize = new System.Drawing.Size(326, 101);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.openBcsvEditorBtn);
+ this.Controls.Add(this.openTextEditorBtn);
+ this.Controls.Add(this.closeFileBtn);
+ this.Controls.Add(this.openFileBtn);
+ this.Name = "MainForm";
this.Text = "MainForm";
+ this.ResumeLayout(false);
+
}
#endregion
+
+ private Button openFileBtn;
+ private Button closeFileBtn;
+ private Button openTextEditorBtn;
+ private Button openBcsvEditorBtn;
+ private OpenFileDialog openARCFileDialog;
+ private Button button1;
}
}
\ No newline at end of file
diff --git a/BMGEditor/MainForm.cs b/BMGEditor/MainForm.cs
index fdf4b2f..89f33cf 100644
--- a/BMGEditor/MainForm.cs
+++ b/BMGEditor/MainForm.cs
@@ -12,9 +12,72 @@ namespace BMGEditor
{
public partial class MainForm : Form
{
+ RarcFilesystem arc;
+ bool arcOpen = false;
+
public MainForm()
{
InitializeComponent();
}
+
+ private void openBcsvEditorBtn_Click(object sender, EventArgs e)
+ {
+ Form bcsvEdit = new BcsvEditorForm(arc);
+ bcsvEdit.Show();
+ }
+
+ private void openFileBtn_Click(object sender, EventArgs e)
+ {
+ if (arcOpen) {
+ MessageBox.Show("Please close the current file first.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+
+ string fileName;
+ if (openARCFileDialog.ShowDialog() == DialogResult.OK)
+ {
+ fileName = openARCFileDialog.FileName;
+ arc = new RarcFilesystem(new ExternalFile(fileName, false));
+ if (arc.FileExists($"{arc.rootName}/message.bmg") && arc.FileExists($"{arc.rootName}/messageid.tbl"))
+ {
+
+ }
+ else
+ {
+ MessageBox.Show(
+ "Selected archive doesn\'t contain all the required files. Please check your file.",
+ "Error while loading file",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+
+ openBcsvEditorBtn.Enabled = true;
+ openTextEditorBtn.Enabled = true;
+ closeFileBtn.Enabled = true;
+ arcOpen = true;
+ }
+ else
+ return;
+ }
+
+ private void closeFileBtn_Click(object sender, EventArgs e)
+ {
+ arc.Close();
+ arcOpen = false;
+ openBcsvEditorBtn.Enabled = false;
+ openTextEditorBtn.Enabled = false;
+ closeFileBtn.Enabled = false;
+ }
+
+ private void openTextEditorBtn_Click(object sender, EventArgs e)
+ {
+ Form bmgEdit = new BMGEditForm(arc);
+ bmgEdit.Show();
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ MessageBox.Show("BMG Editor by Bussun", "About", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
}
}
diff --git a/BMGEditor/MainForm.resx b/BMGEditor/MainForm.resx
index 1af7de1..81c2352 100644
--- a/BMGEditor/MainForm.resx
+++ b/BMGEditor/MainForm.resx
@@ -1,64 +1,4 @@
-
-
-
+
@@ -117,4 +57,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file
diff --git a/BMGEditor/Program.cs b/BMGEditor/Program.cs
index 4fded10..2ddd1b1 100644
--- a/BMGEditor/Program.cs
+++ b/BMGEditor/Program.cs
@@ -14,6 +14,7 @@ namespace BMGEditor
static void Main()
{
ApplicationConfiguration.Initialize();
+ Bcsv.PopulateHashtable();
Application.Run(new MainForm());
}
}
diff --git a/BMGEditor/RarcFilesystem.cs b/BMGEditor/RarcFilesystem.cs
index 78edd52..88b6235 100644
--- a/BMGEditor/RarcFilesystem.cs
+++ b/BMGEditor/RarcFilesystem.cs
@@ -41,7 +41,7 @@ namespace BMGEditor
m_File.Stream.Position = m_StringTableOffset + rnoffset;
root.Name = m_File.ReadString();
root.FullName = "/" + root.Name;
-
+ rootName = root.FullName;
m_DirEntries.Add(0, root);
for (uint i = 0; i < m_NumDirNodes; i++)
@@ -237,6 +237,7 @@ namespace BMGEditor
private uint m_DirNodesOffset;
private uint m_FileEntriesOffset;
private uint m_StringTableOffset;
+ public string rootName;
private Dictionary m_FileEntries;
private Dictionary m_DirEntries;