Bunch of little improvements

- Fixed NSBMD name problem [Building Editor] The import button now updates the name in real time
- So does the buildings list box [Map editor]
- Updated command database reader
- Improved script reader (commands with relative jumps)
- Added CMDTable repoint patch (not revised yet)
This commit is contained in:
AdAstra-LD 2021-03-16 23:43:36 +01:00
parent 48dac1de88
commit 8556b9fd2d
12 changed files with 428 additions and 364 deletions

View File

@ -110,7 +110,7 @@
this.buildingEditorBldListBox.Name = "buildingEditorBldListBox";
this.buildingEditorBldListBox.Size = new System.Drawing.Size(248, 446);
this.buildingEditorBldListBox.TabIndex = 19;
this.buildingEditorBldListBox.SelectedIndexChanged += new System.EventHandler(this.buildingsListBox_SelectedIndexChanged);
this.buildingEditorBldListBox.SelectedIndexChanged += new System.EventHandler(this.buildingEditorListBox_SelectedIndexChanged);
//
// panel1
//

View File

@ -65,7 +65,8 @@ namespace DSPRE
reader.BaseStream.Position = texturesOffset;
writer.Write((UInt32)0x30585442); // Write magic code BTX0
writer.Write((UInt32)0x0001FEFF); // Sequence needed after BTX0
writer.Write((UInt16)0xFEFF); // Byte order
writer.Write((UInt16)0x0001); // ???
writer.Write((UInt32)texturesSize); // Write size of textures block
writer.Write((UInt32)0x00010010); // Needed sequence
writer.Write((UInt32)0x00000014); // Needed sequence
@ -78,20 +79,15 @@ namespace DSPRE
}
private void FillListBox(bool interior) {
int modelCount = Directory.GetFiles(folder + rom.GetBuildingModelsDirPath(interior)).Length;
for (int i = 0; i < modelCount; i++) {
using (BinaryReader reader = new BinaryReader(File.OpenRead(folder + rom.GetBuildingModelsDirPath(interior) + "\\" + i.ToString("D4"))))
for (int currentIndex = 0; currentIndex < modelCount; currentIndex++) {
using (BinaryReader reader = new BinaryReader(File.OpenRead(folder + rom.GetBuildingModelsDirPath(interior) + "\\" + currentIndex.ToString("D4"))))
{
reader.BaseStream.Position = 0x14;
if (reader.ReadUInt32() == 0x304C444D)
reader.BaseStream.Position = 0x34;
else
reader.BaseStream.Position = 0x38;
string nsbmdName = Encoding.UTF8.GetString(reader.ReadBytes(16));
buildingEditorBldListBox.Items.Add("[" + (i+1).ToString("D2") + "] " + nsbmdName);
string nsbmdName = ReadNSBMDname(reader);
buildingEditorBldListBox.Items.Add("[" + currentIndex.ToString("D3") + "] " + nsbmdName);
}
}
}
private void FillTexturesBox()
{
int texturesCount = Directory.GetFiles(folder + rom.buildingTexturesDirPath).Length;
@ -182,9 +178,9 @@ namespace DSPRE
dist -= (float)e.Delta / 200;
RenderModel();
}
private void buildingsListBox_SelectedIndexChanged(object sender, EventArgs e)
private void buildingEditorListBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (disableHandlers)
if (disableHandlers || buildingEditorBldListBox.SelectedIndex < 0)
return;
LoadBuildingModel(buildingEditorBldListBox.SelectedIndex, interiorCheckBox.Checked);
@ -208,12 +204,16 @@ namespace DSPRE
return;
using (BinaryReader reader = new BinaryReader(new FileStream(im.FileName, FileMode.Open))) {
if (reader.ReadUInt32() != 0x30444D42) {
if (reader.ReadUInt32() != NSBMD.NDS_TYPE_BMD0) {
MessageBox.Show("Please select an NSBMD file.", "Invalid File");
return;
} else {
File.Copy(im.FileName, folder + rom.GetBuildingModelsDirPath(interiorCheckBox.Checked) + "\\" + buildingEditorBldListBox.SelectedIndex.ToString("D4"), true);
buildingsListBox_SelectedIndexChanged(null, null);
int currentIndex = buildingEditorBldListBox.SelectedIndex;
File.Copy(im.FileName, folder + rom.GetBuildingModelsDirPath(interiorCheckBox.Checked) + "\\" + currentIndex.ToString("D4"), true);
string nsbmdName = ReadNSBMDname(reader);
buildingEditorBldListBox.Items[currentIndex] = "[" + currentIndex.ToString("D3") + "] " + nsbmdName;
buildingEditorListBox_SelectedIndexChanged(null, null);
}
}
}
@ -251,5 +251,19 @@ namespace DSPRE
}
RenderModel();
}
#region Utils
private string ReadNSBMDname(BinaryReader reader) {
reader.BaseStream.Position = 0x14;
if (reader.ReadUInt32() == NSBMD.NDS_TYPE_MDL0) { //MDL0
reader.BaseStream.Position = 0x34;
} else {
reader.BaseStream.Position = 0x38;
}
return Encoding.UTF8.GetString(reader.ReadBytes(16));
}
#endregion
}
}

View File

@ -176,11 +176,8 @@
this.matrixNameLabel = new System.Windows.Forms.Label();
this.matrixTabControl = new System.Windows.Forms.TabControl();
this.headersTabPage = new System.Windows.Forms.TabPage();
this.headersGridView = new DSPRE.DataGridViewDoubleBuffered();
this.heightsTabPage = new System.Windows.Forms.TabPage();
this.heightsGridView = new DSPRE.DataGridViewDoubleBuffered();
this.mapFilesTabPage = new System.Windows.Forms.TabPage();
this.mapFilesGridView = new DSPRE.DataGridViewDoubleBuffered();
this.matrixNameTextBox = new System.Windows.Forms.TextBox();
this.heightUpDown = new System.Windows.Forms.NumericUpDown();
this.widthUpDown = new System.Windows.Forms.NumericUpDown();
@ -614,6 +611,9 @@
this.spawnEditorToolStripButton = new System.Windows.Forms.ToolStripButton();
this.versionLabel = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.headersGridView = new DSPRE.DataGridViewDoubleBuffered();
this.heightsGridView = new DSPRE.DataGridViewDoubleBuffered();
this.mapFilesGridView = new DSPRE.DataGridViewDoubleBuffered();
this.mainTabControl.SuspendLayout();
this.headerEditorTabPage.SuspendLayout();
this.worldmapCoordsGroupBox.SuspendLayout();
@ -644,11 +644,8 @@
this.matrixEditorTabPage.SuspendLayout();
this.matrixTabControl.SuspendLayout();
this.headersTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.headersGridView)).BeginInit();
this.heightsTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.heightsGridView)).BeginInit();
this.mapFilesTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.mapFilesGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.heightUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.widthUpDown)).BeginInit();
this.mapEditorTabPage.SuspendLayout();
@ -772,6 +769,9 @@
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.mainToolStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.headersGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.heightsGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.mapFilesGridView)).BeginInit();
this.SuspendLayout();
//
// mainTabControl
@ -2322,63 +2322,6 @@
this.headersTabPage.Text = "Map Headers";
this.headersTabPage.UseVisualStyleBackColor = true;
//
// headersGridView
//
this.headersGridView.AllowUserToAddRows = false;
this.headersGridView.AllowUserToDeleteRows = false;
this.headersGridView.AllowUserToResizeColumns = false;
this.headersGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.headersGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.headersGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.headersGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.headersGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.headersGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle3.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle3.Format = "D4";
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.headersGridView.DefaultCellStyle = dataGridViewCellStyle3;
this.headersGridView.Location = new System.Drawing.Point(0, 0);
this.headersGridView.MultiSelect = false;
this.headersGridView.Name = "headersGridView";
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.headersGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.headersGridView.RowHeadersWidth = 50;
this.headersGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle5.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.headersGridView.RowsDefaultCellStyle = dataGridViewCellStyle5;
this.headersGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.headersGridView.RowTemplate.Height = 18;
this.headersGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.headersGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.headersGridView.ShowCellErrors = false;
this.headersGridView.Size = new System.Drawing.Size(1032, 597);
this.headersGridView.TabIndex = 1;
this.headersGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.headersGridView_CellFormatting);
this.headersGridView.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.headersGridView_CellMouseDoubleClick);
this.headersGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.headersGridView_CellValueChanged);
//
// heightsTabPage
//
this.heightsTabPage.Controls.Add(this.heightsGridView);
@ -2389,61 +2332,6 @@
this.heightsTabPage.Text = "Map Heights";
this.heightsTabPage.UseVisualStyleBackColor = true;
//
// heightsGridView
//
this.heightsGridView.AllowUserToAddRows = false;
this.heightsGridView.AllowUserToDeleteRows = false;
this.heightsGridView.AllowUserToResizeColumns = false;
this.heightsGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.heightsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
this.heightsGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.heightsGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.heightsGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
this.heightsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle8.Font = new System.Drawing.Font("Tahoma", 8.25F);
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle8.Format = "D2";
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.heightsGridView.DefaultCellStyle = dataGridViewCellStyle8;
this.heightsGridView.Location = new System.Drawing.Point(0, 0);
this.heightsGridView.MultiSelect = false;
this.heightsGridView.Name = "heightsGridView";
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.heightsGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle9;
this.heightsGridView.RowHeadersWidth = 50;
this.heightsGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle10.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.heightsGridView.RowsDefaultCellStyle = dataGridViewCellStyle10;
this.heightsGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.heightsGridView.RowTemplate.Height = 18;
this.heightsGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.heightsGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.heightsGridView.Size = new System.Drawing.Size(1032, 576);
this.heightsGridView.TabIndex = 2;
this.heightsGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.heightsGridView_CellFormatting);
this.heightsGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.heightsGridView_CellValueChanged);
//
// mapFilesTabPage
//
this.mapFilesTabPage.Controls.Add(this.mapFilesGridView);
@ -2454,62 +2342,6 @@
this.mapFilesTabPage.Text = "Map Files";
this.mapFilesTabPage.UseVisualStyleBackColor = true;
//
// mapFilesGridView
//
this.mapFilesGridView.AllowUserToAddRows = false;
this.mapFilesGridView.AllowUserToDeleteRows = false;
this.mapFilesGridView.AllowUserToResizeColumns = false;
this.mapFilesGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.mapFilesGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
this.mapFilesGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.mapFilesGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle12.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.mapFilesGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
this.mapFilesGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle13.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle13.Format = "D4";
dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.mapFilesGridView.DefaultCellStyle = dataGridViewCellStyle13;
this.mapFilesGridView.Location = new System.Drawing.Point(0, 0);
this.mapFilesGridView.MultiSelect = false;
this.mapFilesGridView.Name = "mapFilesGridView";
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle14.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.mapFilesGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle14;
this.mapFilesGridView.RowHeadersWidth = 50;
this.mapFilesGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle15.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.mapFilesGridView.RowsDefaultCellStyle = dataGridViewCellStyle15;
this.mapFilesGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.mapFilesGridView.RowTemplate.Height = 18;
this.mapFilesGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.mapFilesGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.mapFilesGridView.Size = new System.Drawing.Size(1032, 576);
this.mapFilesGridView.TabIndex = 2;
this.mapFilesGridView.CellContentDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.mapFilesGridView_CellMouseDoubleClick);
this.mapFilesGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.mapFilesGridView_CellFormatting);
this.mapFilesGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.mapFilesGridView_CellValueChanged);
//
// matrixNameTextBox
//
this.matrixNameTextBox.Location = new System.Drawing.Point(13, 73);
@ -6252,7 +6084,7 @@
this.scriptTextBox.BackColor = System.Drawing.SystemColors.Menu;
this.scriptTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.scriptTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.scriptTextBox.Font = new System.Drawing.Font("Bahnschrift Light", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.scriptTextBox.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.scriptTextBox.Location = new System.Drawing.Point(13, 3);
this.scriptTextBox.MaxLength = 1000000;
this.scriptTextBox.Name = "scriptTextBox";
@ -6270,7 +6102,7 @@
this.LineNumberTextBoxScript.Cursor = System.Windows.Forms.Cursors.PanNE;
this.LineNumberTextBoxScript.Dock = System.Windows.Forms.DockStyle.Left;
this.LineNumberTextBoxScript.Enabled = false;
this.LineNumberTextBoxScript.Font = new System.Drawing.Font("Bahnschrift Light", 9.75F);
this.LineNumberTextBoxScript.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.LineNumberTextBoxScript.ForeColor = System.Drawing.SystemColors.HotTrack;
this.LineNumberTextBoxScript.Location = new System.Drawing.Point(3, 3);
this.LineNumberTextBoxScript.MaxLength = 65535;
@ -6301,7 +6133,7 @@
this.functionTextBox.BackColor = System.Drawing.SystemColors.Menu;
this.functionTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.functionTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.functionTextBox.Font = new System.Drawing.Font("Bahnschrift Light", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.functionTextBox.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.functionTextBox.Location = new System.Drawing.Point(13, 3);
this.functionTextBox.MaxLength = 1000000;
this.functionTextBox.Name = "functionTextBox";
@ -6319,7 +6151,7 @@
this.LineNumberTextBoxFunc.Cursor = System.Windows.Forms.Cursors.PanNE;
this.LineNumberTextBoxFunc.Dock = System.Windows.Forms.DockStyle.Left;
this.LineNumberTextBoxFunc.Enabled = false;
this.LineNumberTextBoxFunc.Font = new System.Drawing.Font("Bahnschrift Light", 9.75F);
this.LineNumberTextBoxFunc.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.LineNumberTextBoxFunc.ForeColor = System.Drawing.SystemColors.HotTrack;
this.LineNumberTextBoxFunc.Location = new System.Drawing.Point(3, 3);
this.LineNumberTextBoxFunc.Name = "LineNumberTextBoxFunc";
@ -6347,7 +6179,7 @@
this.movementTextBox.BackColor = System.Drawing.SystemColors.Menu;
this.movementTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.movementTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.movementTextBox.Font = new System.Drawing.Font("Bahnschrift Light", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.movementTextBox.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.movementTextBox.Location = new System.Drawing.Point(13, 3);
this.movementTextBox.MaxLength = 1000000;
this.movementTextBox.Name = "movementTextBox";
@ -6365,7 +6197,7 @@
this.LineNumberTextBoxMov.Cursor = System.Windows.Forms.Cursors.PanNE;
this.LineNumberTextBoxMov.Dock = System.Windows.Forms.DockStyle.Left;
this.LineNumberTextBoxMov.Enabled = false;
this.LineNumberTextBoxMov.Font = new System.Drawing.Font("Bahnschrift Light", 9.75F);
this.LineNumberTextBoxMov.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.LineNumberTextBoxMov.ForeColor = System.Drawing.SystemColors.HotTrack;
this.LineNumberTextBoxMov.Location = new System.Drawing.Point(3, 3);
this.LineNumberTextBoxMov.Name = "LineNumberTextBoxMov";
@ -7845,6 +7677,174 @@
this.versionLabel.TabIndex = 9;
this.versionLabel.Text = "ROM:";
//
// headersGridView
//
this.headersGridView.AllowUserToAddRows = false;
this.headersGridView.AllowUserToDeleteRows = false;
this.headersGridView.AllowUserToResizeColumns = false;
this.headersGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.headersGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.headersGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.headersGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.headersGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.headersGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle3.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle3.Format = "D4";
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.headersGridView.DefaultCellStyle = dataGridViewCellStyle3;
this.headersGridView.Location = new System.Drawing.Point(0, 0);
this.headersGridView.MultiSelect = false;
this.headersGridView.Name = "headersGridView";
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.headersGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.headersGridView.RowHeadersWidth = 50;
this.headersGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle5.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.headersGridView.RowsDefaultCellStyle = dataGridViewCellStyle5;
this.headersGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.headersGridView.RowTemplate.Height = 18;
this.headersGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.headersGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.headersGridView.ShowCellErrors = false;
this.headersGridView.Size = new System.Drawing.Size(1032, 597);
this.headersGridView.TabIndex = 1;
this.headersGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.headersGridView_CellFormatting);
this.headersGridView.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.headersGridView_CellMouseDoubleClick);
this.headersGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.headersGridView_CellValueChanged);
//
// heightsGridView
//
this.heightsGridView.AllowUserToAddRows = false;
this.heightsGridView.AllowUserToDeleteRows = false;
this.heightsGridView.AllowUserToResizeColumns = false;
this.heightsGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.heightsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
this.heightsGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.heightsGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.heightsGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
this.heightsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle8.Font = new System.Drawing.Font("Tahoma", 8.25F);
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle8.Format = "D2";
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.heightsGridView.DefaultCellStyle = dataGridViewCellStyle8;
this.heightsGridView.Location = new System.Drawing.Point(0, 0);
this.heightsGridView.MultiSelect = false;
this.heightsGridView.Name = "heightsGridView";
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.heightsGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle9;
this.heightsGridView.RowHeadersWidth = 50;
this.heightsGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle10.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.heightsGridView.RowsDefaultCellStyle = dataGridViewCellStyle10;
this.heightsGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.heightsGridView.RowTemplate.Height = 18;
this.heightsGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.heightsGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.heightsGridView.Size = new System.Drawing.Size(1032, 576);
this.heightsGridView.TabIndex = 2;
this.heightsGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.heightsGridView_CellFormatting);
this.heightsGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.heightsGridView_CellValueChanged);
//
// mapFilesGridView
//
this.mapFilesGridView.AllowUserToAddRows = false;
this.mapFilesGridView.AllowUserToDeleteRows = false;
this.mapFilesGridView.AllowUserToResizeColumns = false;
this.mapFilesGridView.AllowUserToResizeRows = false;
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.mapFilesGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
this.mapFilesGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.mapFilesGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle12.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.mapFilesGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
this.mapFilesGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle13.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle13.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle13.Format = "D4";
dataGridViewCellStyle13.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle13.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.mapFilesGridView.DefaultCellStyle = dataGridViewCellStyle13;
this.mapFilesGridView.Location = new System.Drawing.Point(0, 0);
this.mapFilesGridView.MultiSelect = false;
this.mapFilesGridView.Name = "mapFilesGridView";
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle14.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F);
dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.mapFilesGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle14;
this.mapFilesGridView.RowHeadersWidth = 50;
this.mapFilesGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle15.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.mapFilesGridView.RowsDefaultCellStyle = dataGridViewCellStyle15;
this.mapFilesGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.mapFilesGridView.RowTemplate.Height = 18;
this.mapFilesGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.mapFilesGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.mapFilesGridView.Size = new System.Drawing.Size(1032, 576);
this.mapFilesGridView.TabIndex = 2;
this.mapFilesGridView.CellContentDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.mapFilesGridView_CellMouseDoubleClick);
this.mapFilesGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.mapFilesGridView_CellFormatting);
this.mapFilesGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.mapFilesGridView_CellValueChanged);
//
// MainProgram
//
this.AllowDrop = true;
@ -7906,11 +7906,8 @@
this.matrixEditorTabPage.PerformLayout();
this.matrixTabControl.ResumeLayout(false);
this.headersTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.headersGridView)).EndInit();
this.heightsTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.heightsGridView)).EndInit();
this.mapFilesTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.mapFilesGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.heightUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.widthUpDown)).EndInit();
this.mapEditorTabPage.ResumeLayout(false);
@ -8072,6 +8069,9 @@
this.statusStrip1.PerformLayout();
this.mainToolStrip.ResumeLayout(false);
this.mainToolStrip.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.headersGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.heightsGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.mapFilesGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -660,9 +660,9 @@ namespace DSPRE {
}
}
private void scriptCommandsDatabaseToolStripButton_Click(object sender, EventArgs e) {
openCommandsDatabase(RomInfo.ScriptCommandNamesDict, RomInfo.CommandParametersDict);
OpenCommandsDatabase(RomInfo.ScriptCommandNamesDict, RomInfo.CommandParametersDict);
}
private void openCommandsDatabase(Dictionary<ushort, string> namesDict, Dictionary<ushort, byte[]> paramsDict) {
private void OpenCommandsDatabase(Dictionary<ushort, string> namesDict, Dictionary<ushort, byte[]> paramsDict) {
statusLabel.Text = "Setting up Commands Database. Please wait...";
Update();
CommandsDatabase form = new CommandsDatabase(namesDict, paramsDict);
@ -910,6 +910,7 @@ namespace DSPRE {
MessageBox.Show("Operation completed.", "Success",
MessageBoxButtons.OK, MessageBoxIcon.Information);
statusLabel.Text = "Ready";
toolStripProgressBar.Value = 0;
toolStripProgressBar.Visible = false;
@ -920,6 +921,9 @@ namespace DSPRE {
textEditorIsReady = false;
tilesetEditorIsReady = false;
if (mapEditorIsReady) {
updateBuildingListComboBox(interiorbldRadioButton.Checked);
}
Update();
}
}
@ -936,17 +940,21 @@ namespace DSPRE {
MessageBox.Show("Operation completed.", "Success",
MessageBoxButtons.OK, MessageBoxIcon.Information);
statusLabel.Text = "Ready";
if (mapEditorIsReady) {
updateBuildingListComboBox(interiorbldRadioButton.Checked);
}
Update();
}
}
private void diamondAndPearlToolStripMenuItem_Click(object sender, EventArgs e) {
openCommandsDatabase(RomInfo.BuildCommandNamesDatabase("D"), RomInfo.BuildCommandParametersDatabase("D"));
OpenCommandsDatabase(RomInfo.BuildCommandNamesDatabase("D"), RomInfo.BuildCommandParametersDatabase("D"));
}
private void platinumToolStripMenuItem_Click(object sender, EventArgs e) {
openCommandsDatabase(RomInfo.BuildCommandNamesDatabase("Plat"), RomInfo.BuildCommandParametersDatabase("Plat"));
OpenCommandsDatabase(RomInfo.BuildCommandNamesDatabase("Plat"), RomInfo.BuildCommandParametersDatabase("Plat"));
}
private void heartGoldAndSoulSilverToolStripMenuItem_Click(object sender, EventArgs e) {
openCommandsDatabase(RomInfo.BuildCommandNamesDatabase("HG"), RomInfo.BuildCommandParametersDatabase("HG"));
OpenCommandsDatabase(RomInfo.BuildCommandNamesDatabase("HG"), RomInfo.BuildCommandParametersDatabase("HG"));
}
private void mainTabControl_SelectedIndexChanged(object sender, EventArgs e) {
if (mainTabControl.SelectedTab == headerEditorTabPage) {
@ -5995,10 +6003,11 @@ namespace DSPRE {
texturePacksListBox.Items.Clear();
int tilesetFileCount;
if (mapTilesetRadioButton.Checked)
if (mapTilesetRadioButton.Checked) {
tilesetFileCount = romInfo.GetMapTexturesCount();
else
} else {
tilesetFileCount = romInfo.GetBuildingTexturesCount();
}
for (int i = 0; i < tilesetFileCount; i++)
texturePacksListBox.Items.Add("Texture Pack " + i);
@ -6047,11 +6056,16 @@ namespace DSPRE {
}
private void mapTilesetRadioButton_CheckedChanged(object sender, EventArgs e) {
FillTilesetBox();
texturePacksListBox.SelectedIndex = (int)areaDataMapTilesetUpDown.Value;
if (texturesListBox.Items.Count > 0)
texturesListBox.SelectedIndex = 0;
if (palettesListBox.Items.Count > 0)
palettesListBox.SelectedIndex = 0;
try {
if (mapTilesetRadioButton.Checked) {
texturePacksListBox.SelectedIndex = (int)areaDataMapTilesetUpDown.Value;
} else if (buildingsTilesetRadioButton.Checked) {
texturePacksListBox.SelectedIndex = (int)areaDataBuildingTilesetUpDown.Value;
}
} catch (ArgumentOutOfRangeException) {
texturePacksListBox.SelectedIndex = 0;
}
}
private void palettesListBox_SelectedIndexChanged(object sender, EventArgs e) {
if (disableHandlers)

View File

@ -1152,7 +1152,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACA
DwAAAk1TRnQBSQFMAgEBBwEAAdQBDgHUAQ4BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
DwAAAk1TRnQBSQFMAgEBBwEAAfwBDgH8AQ4BEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -51,10 +51,11 @@ namespace DSPRE.ROMFiles {
case 0x17: // JumpIfObjID
case 0x18: // JumpIfBgID
case 0x19: // JumpIfPlayerDir
name += " " + BitConverter.ToInt32(commandParameters[0], 0).ToString("D") + " " + "Function_#" + BitConverter.ToInt32(commandParameters[1], 0).ToString("D");
byte param = commandParameters[0][0];
name += " " + param.ToString("X") + " " + "Function_#" + BitConverter.ToInt32(commandParameters[1], 0).ToString("D");
break;
case 0x1C: // CompareLastResultJump
case 0x1D: // CompareLastResultCall
case 0x1C: // Jump-If
case 0x1D: // Call-If
byte opcode = commandParameters[0][0];
name += " " + PokeDatabase.ScriptEditor.comparisonOperatorsDict[opcode] + " " + "Function_#" + BitConverter.ToInt32(commandParameters[1], 0).ToString("D");
break;
@ -93,9 +94,9 @@ namespace DSPRE.ROMFiles {
try {
id = RomInfo.ScriptCommandNamesDict.First(x => x.Value.Equals(nameParts[0], StringComparison.InvariantCultureIgnoreCase)).Key;
} catch (InvalidOperationException) {
try {
id = UInt16.Parse(nameParts[0], NumberStyles.HexNumber, CultureInfo.InvariantCulture);
} catch (FormatException) {
id = UInt16.MaxValue;
if (!UInt16.TryParse(nameParts[0], NumberStyles.HexNumber, CultureInfo.InvariantCulture, out id)) {
string details;
if (wholeLine.Contains('@') && wholeLine.Contains('#')) {
details = "This probably means you forgot to \"End\" the Script or Function above it.";
@ -104,9 +105,8 @@ namespace DSPRE.ROMFiles {
details = "Are you sure it's a proper Script Command?";
}
MessageBox.Show("This Script file could not be saved." +
Environment.NewLine + "Parser failed to interpret line " + lineNumber + ": \"" + wholeLine + "\"." +
Environment.NewLine + "Parser failed to interpret line " + lineNumber + ": \"" + wholeLine + "\"." +
Environment.NewLine + "\n" + details, "Parser error", MessageBoxButtons.OK, MessageBoxIcon.Error);
id = UInt16.MaxValue;
return;
}
}
@ -156,7 +156,7 @@ namespace DSPRE.ROMFiles {
cmdParams.Add(BitConverter.GetBytes((ushort)241));
break;
default:
cmdParams.Add(BitConverter.GetBytes(Int16.Parse(nameParts[i + 1].Substring(indexOfSpecialCharacter + 1), style)));
cmdParams.Add(BitConverter.GetBytes(UInt16.Parse(nameParts[i + 1].Substring(indexOfSpecialCharacter + 1), style)));
break;
}
break;

View File

@ -150,15 +150,15 @@ namespace DSPRE.ROMFiles {
(source, x) => source[x].TrimEnd().Equals(RomInfo.ScriptCommandNamesDict[0x0002], StringComparison.InvariantCultureIgnoreCase) //End
|| source[x].IndexOf(RomInfo.ScriptCommandNamesDict[0x0016] + " Function") >= 0; //Jump Function_#
allScripts = readCommandsFromLines(scriptLines, containerTypes.SCRIPT, scriptEndCondition); //Jump + whitespace
allScripts = ReadCommandsFromLines(scriptLines, containerTypes.SCRIPT, scriptEndCondition); //Jump + whitespace
if (allScripts == null || allScripts.Count <= 0)
return;
allFunctions = readCommandsFromLines(functionLines, containerTypes.FUNCTION, functionEndCondition); //Jump + whitespace
allFunctions = ReadCommandsFromLines(functionLines, containerTypes.FUNCTION, functionEndCondition); //Jump + whitespace
if (allFunctions == null)
return;
allActions = readActionsFromLines(actionLines);
allActions = ReadActionsFromLines(actionLines);
if (allActions == null)
return;
@ -179,59 +179,24 @@ namespace DSPRE.ROMFiles {
switch (id) {
case 0x16: //Jump
case 0x1A: //Call
{
int relativeOffset = dataReader.ReadInt32();
int offsetFromScriptFileStart = (int)(relativeOffset + dataReader.BaseStream.Position);
if (!functionOffsets.Contains(offsetFromScriptFileStart))
functionOffsets.Add(offsetFromScriptFileStart);
int functionNumber = functionOffsets.IndexOf(offsetFromScriptFileStart);
if (functionNumber < 0)
throw new InvalidOperationException();
parameterList.Add(BitConverter.GetBytes(functionNumber + 1));
break;
}
case 0x1C: //CompareLastResultJump
case 0x1D: //CompareLastResultCall
{
byte comparisonOperator = dataReader.ReadByte();
int relativeOffset = dataReader.ReadInt32();
int offsetFromScriptFileStart = (int)(relativeOffset + dataReader.BaseStream.Position);
if (!functionOffsets.Contains(offsetFromScriptFileStart))
functionOffsets.Add(offsetFromScriptFileStart);
parameterList.Add(new byte[] { comparisonOperator });
int functionNumber = functionOffsets.IndexOf(offsetFromScriptFileStart);
if (functionNumber < 0)
throw new InvalidOperationException();
parameterList.Add(BitConverter.GetBytes(functionNumber + 1));
break;
}
case 0x5E: // ApplyMovement
case 0x2A1: // ApplyMovement2
{
ushort overworld = dataReader.ReadUInt16();
int relativeOffset = dataReader.ReadInt32();
int offsetFromScriptFileStart = (int)(relativeOffset + dataReader.BaseStream.Position);
if (!actionOffsets.Contains(offsetFromScriptFileStart))
actionOffsets.Add(offsetFromScriptFileStart);
parameterList.Add(BitConverter.GetBytes(overworld));
int actionNumber = actionOffsets.IndexOf(offsetFromScriptFileStart);
if (actionNumber < 0)
throw new InvalidOperationException();
parameterList.Add(BitConverter.GetBytes(actionNumber + 1));
}
ProcessRelativeJump(dataReader, ref parameterList, ref functionOffsets);
break;
case 0x17: //JumpIfObjID
case 0x18: //JumpIfBgID
case 0x19: //JumpIfPlayerDir
case 0x1C: //Jump-If
case 0x1D: //Call-If
//in the case of Jump-If and Call-If, the first param is a comparisonOperator
//for JumpIfPlayerDir it's a directionID
//for JumpIfObjID, it's an EventID
parameterList.Add(new byte[] { dataReader.ReadByte() });
ProcessRelativeJump(dataReader, ref parameterList, ref functionOffsets);
break;
case 0x5E: // Movement
case 0x2A1: // Movement2
//in the case of Movement, the first param is an overworld ID
parameterList.Add(BitConverter.GetBytes(dataReader.ReadUInt16()));
ProcessRelativeJump(dataReader, ref parameterList, ref actionOffsets);
break;
case 0x1CF:
case 0x1D0:
@ -354,58 +319,19 @@ namespace DSPRE.ROMFiles {
switch (id) {
case 0x16: //Jump
case 0x1A: //Call
{
int relativeOffset = dataReader.ReadInt32();
int offsetFromScriptFileStart = (int)(relativeOffset + dataReader.BaseStream.Position);
if (!functionOffsets.Contains(offsetFromScriptFileStart))
functionOffsets.Add(offsetFromScriptFileStart);
int functionNumber = functionOffsets.IndexOf(offsetFromScriptFileStart);
if (functionNumber < 0)
throw new InvalidOperationException();
parameterList.Add(BitConverter.GetBytes(functionNumber+1));
break;
}
case 0x1C: //CompareLastResultJump
case 0x1D: //CompareLastResultCall
{
byte comparisonOperator = dataReader.ReadByte();
int relativeOffset = dataReader.ReadInt32();
int offsetFromScriptFileStart = (int)(relativeOffset + dataReader.BaseStream.Position);
if (!functionOffsets.Contains(offsetFromScriptFileStart))
functionOffsets.Add(offsetFromScriptFileStart);
parameterList.Add(new byte[] { comparisonOperator });
int functionNumber = functionOffsets.IndexOf(offsetFromScriptFileStart);
if (functionNumber < 0)
throw new InvalidOperationException();
parameterList.Add(BitConverter.GetBytes(functionNumber + 1));
break;
}
case 0x5E: // ApplyMovement
{
ushort overworld = dataReader.ReadUInt16();
int relativeOffset = dataReader.ReadInt32();
int offsetFromScriptFileStart = (int)(relativeOffset + dataReader.BaseStream.Position);
if (!actionOffsets.Contains(offsetFromScriptFileStart))
actionOffsets.Add(offsetFromScriptFileStart);
parameterList.Add(BitConverter.GetBytes(overworld));
int actionNumber = actionOffsets.IndexOf(offsetFromScriptFileStart);
if (actionNumber < 0)
throw new InvalidOperationException();
parameterList.Add(BitConverter.GetBytes(actionNumber + 1));
}
ProcessRelativeJump(dataReader, ref parameterList, ref functionOffsets);
break;
case 0x17: //JumpIfObjID
case 0x18: //JumpIfBgID
case 0x19: //JumpIfPlayerDir
case 0x1C: //Jump-If
case 0x1D: //Call-If
parameterList.Add(new byte[] { dataReader.ReadByte() }); //in the case of Jump-If and Call-If, the first param is a comparisonOperator
ProcessRelativeJump(dataReader, ref parameterList, ref functionOffsets);
break;
case 0x5E: // Movement
parameterList.Add(BitConverter.GetBytes(dataReader.ReadUInt16())); //in the case of Movement, the first param is an overworld ID
ProcessRelativeJump(dataReader, ref parameterList, ref actionOffsets);
break;
case 0x190:
case 0x191:
@ -415,7 +341,6 @@ namespace DSPRE.ROMFiles {
parameterList.Add(new byte[] { parameter1 });
if (parameter1 == 0x2)
parameterList.Add(dataReader.ReadBytes(2));
}
break;
case 0x1D1: // Number of parameters differ depending on the first parameter value
@ -479,6 +404,21 @@ namespace DSPRE.ROMFiles {
}
return new ScriptCommand(id, parameterList);
}
private void ProcessRelativeJump(BinaryReader dataReader, ref List<byte[]> parameterList, ref List<int> offsetsList) {
int relativeOffset = dataReader.ReadInt32();
int offsetFromScriptFileStart = (int)(relativeOffset + dataReader.BaseStream.Position);
if (!offsetsList.Contains(offsetFromScriptFileStart))
offsetsList.Add(offsetFromScriptFileStart);
int functionNumber = offsetsList.IndexOf(offsetFromScriptFileStart);
if (functionNumber < 0)
throw new InvalidOperationException();
parameterList.Add(BitConverter.GetBytes(functionNumber + 1));
}
private void addParametersToList(ref List<byte[]> parameterList, ushort id, BinaryReader dataReader) {
Console.WriteLine("Loaded command id: " + id.ToString("X4"));
try {
@ -496,6 +436,7 @@ namespace DSPRE.ROMFiles {
return;
}
}
public byte[] ToByteArray() {
MemoryStream newData = new MemoryStream();
using (BinaryWriter writer = new BinaryWriter(newData)) {
@ -711,7 +652,7 @@ namespace DSPRE.ROMFiles {
this.SaveToFile(sf.FileName);
}
}
private List<CommandContainer> readCommandsFromLines(string[] lineSource, containerTypes containerType, Func<string[], int, bool> endConditions) {
private List<CommandContainer> ReadCommandsFromLines(string[] lineSource, containerTypes containerType, Func<string[], int, bool> endConditions) {
List<CommandContainer> ls = new List<CommandContainer>();
try {
@ -747,7 +688,7 @@ namespace DSPRE.ROMFiles {
} catch (IndexOutOfRangeException) { }
return ls;
}
private List<ActionContainer> readActionsFromLines(string[] lineSource) {
private List<ActionContainer> ReadActionsFromLines(string[] lineSource) {
List<ActionContainer> ls = new List<ActionContainer>();
try {

View File

@ -53,12 +53,18 @@
this.matrixExpansionTextLBL = new System.Windows.Forms.Label();
this.matrixExpansionLBL = new System.Windows.Forms.Label();
this.expandMatrixButton = new System.Windows.Forms.Button();
this.repointScrcmdCB = new System.Windows.Forms.PictureBox();
this.repointScrcmdTextLBL = new System.Windows.Forms.Label();
this.repointScrcmdLBL = new System.Windows.Forms.Label();
this.repointScrcmdButton = new System.Windows.Forms.Button();
this.scrcmdARM9requiredLBL = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.arm9patchCB)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.overlay1CB)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.BDHCamCB)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sentenceCaseCB)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.itemNumbersCB)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.expandedMatrixCB)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.repointScrcmdCB)).BeginInit();
this.SuspendLayout();
//
// applyItemStandardizeButton
@ -314,12 +320,69 @@
this.expandMatrixButton.UseVisualStyleBackColor = true;
this.expandMatrixButton.Click += new System.EventHandler(this.expandMatrixButton_Click);
//
// repointScrcmdCB
//
this.repointScrcmdCB.Image = ((System.Drawing.Image)(resources.GetObject("repointScrcmdCB.Image")));
this.repointScrcmdCB.Location = new System.Drawing.Point(803, 49);
this.repointScrcmdCB.Name = "repointScrcmdCB";
this.repointScrcmdCB.Size = new System.Drawing.Size(20, 20);
this.repointScrcmdCB.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.repointScrcmdCB.TabIndex = 28;
this.repointScrcmdCB.TabStop = false;
this.repointScrcmdCB.Visible = false;
//
// repointScrcmdTextLBL
//
this.repointScrcmdTextLBL.Location = new System.Drawing.Point(509, 48);
this.repointScrcmdTextLBL.Name = "repointScrcmdTextLBL";
this.repointScrcmdTextLBL.Size = new System.Drawing.Size(288, 37);
this.repointScrcmdTextLBL.TabIndex = 27;
this.repointScrcmdTextLBL.Text = "Moves the Script Commands Table to a new location in the Synthetic Overlay and re" +
"assigns the pointer accordingly.";
this.repointScrcmdTextLBL.UseMnemonic = false;
//
// repointScrcmdLBL
//
this.repointScrcmdLBL.AutoSize = true;
this.repointScrcmdLBL.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.repointScrcmdLBL.Location = new System.Drawing.Point(509, 31);
this.repointScrcmdLBL.Name = "repointScrcmdLBL";
this.repointScrcmdLBL.Size = new System.Drawing.Size(157, 13);
this.repointScrcmdLBL.TabIndex = 26;
this.repointScrcmdLBL.Text = "Move ScrCommands Table";
//
// repointScrcmdButton
//
this.repointScrcmdButton.Location = new System.Drawing.Point(829, 33);
this.repointScrcmdButton.Name = "repointScrcmdButton";
this.repointScrcmdButton.Size = new System.Drawing.Size(100, 50);
this.repointScrcmdButton.TabIndex = 25;
this.repointScrcmdButton.Text = "Expand ARM9";
this.repointScrcmdButton.UseVisualStyleBackColor = true;
this.repointScrcmdButton.Click += new System.EventHandler(this.repointScrcmdButton_Click);
//
// scrcmdARM9requiredLBL
//
this.scrcmdARM9requiredLBL.AutoSize = true;
this.scrcmdARM9requiredLBL.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.scrcmdARM9requiredLBL.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
this.scrcmdARM9requiredLBL.Location = new System.Drawing.Point(663, 30);
this.scrcmdARM9requiredLBL.Name = "scrcmdARM9requiredLBL";
this.scrcmdARM9requiredLBL.Size = new System.Drawing.Size(165, 13);
this.scrcmdARM9requiredLBL.TabIndex = 29;
this.scrcmdARM9requiredLBL.Text = "(Requires ARM9 Expansion)";
//
// ROMToolboxDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(448, 508);
this.ClientSize = new System.Drawing.Size(950, 513);
this.Controls.Add(this.scrcmdARM9requiredLBL);
this.Controls.Add(this.repointScrcmdCB);
this.Controls.Add(this.repointScrcmdTextLBL);
this.Controls.Add(this.repointScrcmdLBL);
this.Controls.Add(this.repointScrcmdButton);
this.Controls.Add(this.expandedMatrixCB);
this.Controls.Add(this.matrixExpansionTextLBL);
this.Controls.Add(this.matrixExpansionLBL);
@ -356,6 +419,7 @@
((System.ComponentModel.ISupportInitialize)(this.sentenceCaseCB)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.itemNumbersCB)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.expandedMatrixCB)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.repointScrcmdCB)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -388,5 +452,10 @@
private System.Windows.Forms.Label matrixExpansionTextLBL;
private System.Windows.Forms.Label matrixExpansionLBL;
private System.Windows.Forms.Button expandMatrixButton;
private System.Windows.Forms.PictureBox repointScrcmdCB;
private System.Windows.Forms.Label repointScrcmdTextLBL;
private System.Windows.Forms.Label repointScrcmdLBL;
private System.Windows.Forms.Button repointScrcmdButton;
private System.Windows.Forms.Label scrcmdARM9requiredLBL;
}
}

View File

@ -100,6 +100,7 @@ namespace DSPRE {
} else {
DisableARM9patch("Unsupported\nlanguage");
DisableBDHCamPatch("Unsupported\nlanguage");
DisableScrcmdRepointPatch("Unsupported\nlanguage");
}
switch (RomInfo.gameVersion) {
@ -107,10 +108,12 @@ namespace DSPRE {
case "P":
DisableOverlay1patch("Unsupported");
DisableMatrixExpansionPatch("Unsupported");
DisableScrcmdRepointPatch("Unsupported");
break;
case "Plat":
DisableOverlay1patch("Unsupported");
DisableMatrixExpansionPatch("Unsupported");
DisableScrcmdRepointPatch("Unsupported");
CheckFilesBDHCamPatchApplied();
break;
case "HG":
@ -119,12 +122,15 @@ namespace DSPRE {
DisableOverlay1patch("Already applied");
overlay1CB.Visible = true;
}
CheckFilesBDHCamPatchApplied();
if (RomInfo.gameLanguage == "ENG" || RomInfo.gameLanguage == "ESP") {
CheckMatrixPatchApplied();
CheckScrcmdRepointPatchApplied();
} else {
DisableMatrixExpansionPatch("Unsupported\nlanguage");
DisableScrcmdRepointPatch("Unsupported\nlanguage");
}
break;
}
@ -162,6 +168,13 @@ namespace DSPRE {
standardizePatchTextLBL.Enabled = false;
applyItemStandardizeButton.Text = reason;
}
private void DisableScrcmdRepointPatch(string reason) {
repointScrcmdButton.Enabled = false;
repointScrcmdLBL.Enabled = false;
repointScrcmdTextLBL.Enabled = false;
scrcmdARM9requiredLBL.Enabled = false;
repointScrcmdButton.Text = reason;
}
#endregion
#endregion
@ -296,6 +309,10 @@ namespace DSPRE {
expandedMatrixCB.Visible = true;
return 1; //arm9 Expansion has already been applied
}
private void CheckScrcmdRepointPatchApplied() {
throw new NotImplementedException();
}
#endregion
#region Button Actions
@ -487,10 +504,11 @@ namespace DSPRE {
case "Plat":
case "HG":
case "SS":
BDHCamARM9requiredLBL.Visible = false;
BDHCamPatchButton.Text = "Apply Patch";
BDHCamPatchButton.Enabled = true;
BDHCamPatchLBL.Enabled = true;
BDHCamPatchTextLBL.Enabled = true;
BDHCamARM9requiredLBL.Visible = false;
break;
}
@ -551,21 +569,6 @@ namespace DSPRE {
}
#region Mikelan's custom commands
private void applyCustomCommands(object sender, EventArgs e) {
if (new FileInfo(RomInfo.syntheticOverlayPath + "\\0000").Length < 0x16000) {// ARM9 expansion hasn't been done in this ROM
MessageBox.Show("The ARM9 Expansion patch must be applied before using this feature", "ARM9 expansion needed", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (RomInfo.gameVersion == "D" || RomInfo.gameVersion == "P" || RomInfo.gameVersion == "Plat") {
UnsupportedROM();
return;
}
if (RomInfo.gameLanguage != "ENG" && RomInfo.gameLanguage != "ESP") {
UnsupportedROMLanguage();
return;
}
int expTableOffset = GetCommandTableOffset();
if (expTableOffset < 0) {
@ -589,7 +592,6 @@ namespace DSPRE {
}
private int GetCommandTableOffset() { // Checks if command table is repointed IN THE EXPANDED ARM9 FILE, returns pointer inside this file
ResourceManager customcmdDB = new ResourceManager("DSPRE.Resources.ROMToolboxDB.CustomScrCmdDB", Assembly.GetExecutingAssembly());
int pointerOffset = int.Parse(customcmdDB.GetString("pointerOffset" + "_" + RomInfo.gameVersion + "_" + RomInfo.gameLanguage));
using (BinaryReader arm9Reader = new BinaryReader(new FileStream(RomInfo.arm9Path, FileMode.Open))) {
@ -745,5 +747,9 @@ namespace DSPRE {
MessageBox.Show("This patch has already been applied.", "Can't reapply patch", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
#endregion
private void repointScrcmdButton_Click(object sender, EventArgs e) {
}
}
}

View File

@ -179,6 +179,16 @@ edit 'Items' in Event Editor.
Ya0APVi4NR/xFCZ481LLhbWHF4ToxecZ2UAmD/Y4kQ+Ag3hrB7VdSjZ6dEJpvENrBrAEguIBIb4J0FIw
upmAncykgSX9hgfNYHyTqg2kaiXFN87xo5nSrQ+kXic1kuVygUkD6d58CYZ1nPWgzlMB3EvmcL1i+AEb
Ho2MhU9VbQAAAABJRU5ErkJggg==
</value>
</data>
<data name="repointScrcmdCB.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wQAADsEBuJFr7QAAAOFJREFUOE+tj8ERgkAMRddx0Js90ItFeJS7B3vxTDO04FiCdaxJ2ISwmywjcPiT
bPLz+IQY464yh1s0Ne9LXK3rERAGkPt/hLDwPAt0WiTg7MtLYhgL3xaQZzUVsC1AD0Y7baK6AKzBaD8z
Ya0APVi4NR/xFCZ481LLhbWHF4ToxecZ2UAmD/Y4kQ+Ag3hrB7VdSjZ6dEJpvENrBrAEguIBIb4J0FIw
upmAncykgSX9hgfNYHyTqg2kaiXFN87xo5nSrQ+kXic1kuVygUkD6d58CYZ1nPWgzlMB3EvmcL1i+AEb
Ho2MhU9VbQAAAABJRU5ErkJggg==
</value>
</data>
</root>

View File

@ -21,33 +21,39 @@ namespace DSPRE.Resources {
for (int i = 0; i < paramsDict.Count - 1; i++)
scriptcmdDataGridView.Rows.Add();
foreach (DataGridViewRow r in scriptcmdDataGridView.Rows) { //loop through
ushort u = (ushort)r.Index;
var paramDictKeys = paramsDict.Keys;
var paramDictValues = paramsDict.Values;
var namesDictValues = namesDict.Values;
r.Cells[0].Value = u.ToString("X4");
System.Collections.IList list = scriptcmdDataGridView.Rows;
for (int i = 0; i < list.Count; i++) { //loop through
DataGridViewRow r = (DataGridViewRow)list[i];
ushort currentID = paramDictKeys.ElementAt(i);
r.Cells[0].Value = currentID.ToString("X4");
string commandName;
if (namesDict.TryGetValue(currentID, out commandName))
r.Cells[1].Value = commandName;
try {
r.Cells[1].Value = namesDict[u];
} catch { }
try {
if (paramsDict[u][0] == 0) {
if (paramDictValues.ElementAt(i)[0] == 0) {
r.Cells[2].Value = 0;
} else {
r.Cells[2].Value = paramsDict[u].Length;//.ToString();
r.Cells[2].Value = paramDictValues.ElementAt(i).Length;//.ToString();
}
} catch { }
string paramSize = "";
try {
foreach (byte size in paramsDict[u]) {
foreach (byte size in paramDictValues.ElementAt(i)) {
if (size != 0) {
paramSize += size + "B; ";
}
}
} catch { }
scriptcmdDataGridView.Rows[u].Cells[3].Value = paramSize;
scriptcmdDataGridView.Rows[i].Cells[3].Value = paramSize;
}
}

View File

@ -440,7 +440,9 @@ namespace DSPRE {
specificDictionaryNames = PokeDatabase.ScriptEditor.PlatScrCmdNames;
return commonDictionaryNames.Concat(specificDictionaryNames).ToLookup(x => x.Key, x => x.Value).ToDictionary(x => x.Key, g => g.First());
default:
return PokeDatabase.ScriptEditor.HGSSScrCmdNames;
commonDictionaryNames = PokeDatabase.ScriptEditor.HGSSScrCmdNames;
var customDictionaryNames = PokeDatabase.ScriptEditor.CustomScrCmdNames;
return commonDictionaryNames.Concat(customDictionaryNames).ToLookup(x => x.Key, x => x.Value).ToDictionary(x => x.Key, g => g.First());
}
}
public static Dictionary<ushort, byte[]> BuildCommandParametersDatabase(string gameVer) {
@ -455,7 +457,9 @@ namespace DSPRE {
specificDictionaryParams = PokeDatabase.ScriptEditor.PlatScrCmdParameters;
return commonDictionaryParams.Concat(specificDictionaryParams).ToLookup(x => x.Key, x => x.Value).ToDictionary(x => x.Key, g => g.First());
default:
return PokeDatabase.ScriptEditor.HGSSScrCmdParameters;
commonDictionaryParams = PokeDatabase.ScriptEditor.HGSSScrCmdParameters;
var customDictionaryParams = PokeDatabase.ScriptEditor.CustomScrCmdParameters;
return commonDictionaryParams.Concat(customDictionaryParams).ToLookup(x => x.Key, x => x.Value).ToDictionary(x => x.Key, g => g.First());
}
}
public void LoadGameVersion() {