diff --git a/DS_Map/BuildingEditor.Designer.cs b/DS_Map/BuildingEditor.Designer.cs index daf9e8b..0fc496e 100644 --- a/DS_Map/BuildingEditor.Designer.cs +++ b/DS_Map/BuildingEditor.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.textureComboBox = new System.Windows.Forms.ComboBox(); this.importButton = new System.Windows.Forms.Button(); this.exportButton = new System.Windows.Forms.Button(); @@ -35,7 +36,9 @@ this.interiorCheckBox = new System.Windows.Forms.CheckBox(); this.buildingsListBox = new System.Windows.Forms.ListBox(); this.panel1 = new System.Windows.Forms.Panel(); + this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit(); this.SuspendLayout(); // // textureComboBox @@ -131,6 +134,7 @@ this.Name = "BuildingEditor"; this.Text = "Building Editor"; this.panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -145,5 +149,6 @@ private System.Windows.Forms.CheckBox interiorCheckBox; private System.Windows.Forms.ListBox buildingsListBox; private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.BindingSource bindingSource1; } } \ No newline at end of file diff --git a/DS_Map/BuildingEditor.resx b/DS_Map/BuildingEditor.resx index 1af7de1..76cdda2 100644 --- a/DS_Map/BuildingEditor.resx +++ b/DS_Map/BuildingEditor.resx @@ -117,4 +117,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/DS_Map/CameraView.Designer.cs b/DS_Map/CameraView.Designer.cs new file mode 100644 index 0000000..52a7b5d --- /dev/null +++ b/DS_Map/CameraView.Designer.cs @@ -0,0 +1,79 @@ +namespace DS_Map +{ + partial class CameraView + { + /// + /// 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.panel1 = new System.Windows.Forms.Panel(); + this.cameraOpenGLControl = new Tao.Platform.Windows.SimpleOpenGlControl(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Controls.Add(this.cameraOpenGLControl); + this.panel1.Location = new System.Drawing.Point(387, 12); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(401, 426); + this.panel1.TabIndex = 27; + // + // cameraOpenGLControl + // + this.cameraOpenGLControl.AccumBits = ((byte)(0)); + this.cameraOpenGLControl.AutoCheckErrors = false; + this.cameraOpenGLControl.AutoFinish = false; + this.cameraOpenGLControl.AutoMakeCurrent = true; + this.cameraOpenGLControl.AutoSwapBuffers = true; + this.cameraOpenGLControl.BackColor = System.Drawing.Color.Black; + this.cameraOpenGLControl.ColorBits = ((byte)(32)); + this.cameraOpenGLControl.DepthBits = ((byte)(24)); + this.cameraOpenGLControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.cameraOpenGLControl.Location = new System.Drawing.Point(0, 0); + this.cameraOpenGLControl.Name = "cameraOpenGLControl"; + this.cameraOpenGLControl.Size = new System.Drawing.Size(401, 426); + this.cameraOpenGLControl.StencilBits = ((byte)(0)); + this.cameraOpenGLControl.TabIndex = 21; + // + // CameraView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.panel1); + this.Name = "CameraView"; + this.Text = "Camera View"; + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private Tao.Platform.Windows.SimpleOpenGlControl cameraOpenGLControl; + } +} \ No newline at end of file diff --git a/DS_Map/CameraView.cs b/DS_Map/CameraView.cs new file mode 100644 index 0000000..acf5002 --- /dev/null +++ b/DS_Map/CameraView.cs @@ -0,0 +1,44 @@ +using LibNDSFormats.NSBMD; +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; +using Tao.OpenGl; + +namespace DS_Map +{ + public partial class CameraView : Form + { + #region Variables + string folder; + bool disableHandlers = new bool(); + RomInfo info; + NSBMD currentNSBMD; + NSBMDGlRenderer renderer = new NSBMDGlRenderer(); + + public static float ang = 0.0f; + public static float dist = 12.8f; + public static float elev = 50.0f; + public static float tempAng = 0.0f; + public static float tempDist = 0.0f; + public static float tempElev = 0.0f; + public float perspective = 45f; + #endregion + + public CameraView(RomInfo romInfo) + { + InitializeComponent(); + info = romInfo; + + cameraOpenGLControl.InitializeContexts(); + cameraOpenGLControl.MakeCurrent(); + Gl.glEnable(Gl.GL_TEXTURE_2D); + + } + } +} diff --git a/DS_Map/CameraView.resx b/DS_Map/CameraView.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DS_Map/CameraView.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/DS_Map/DS Map.csproj b/DS_Map/DS Map.csproj index ef687ed..6aa8f26 100644 --- a/DS_Map/DS Map.csproj +++ b/DS_Map/DS Map.csproj @@ -100,6 +100,12 @@ BuildingEditor.cs + + Form + + + CameraView.cs + Form @@ -228,6 +234,9 @@ BuildingEditor.cs + + CameraView.cs + WildEditorHGSS.cs diff --git a/DS_Map/Main Window.Designer.cs b/DS_Map/Main Window.Designer.cs index b7c5e32..71d2c76 100644 --- a/DS_Map/Main Window.Designer.cs +++ b/DS_Map/Main Window.Designer.cs @@ -29,6 +29,7 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); @@ -44,7 +45,6 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.headerListBox = new System.Windows.Forms.ListBox(); this.mainTabControl = new System.Windows.Forms.TabControl(); this.headerEditorTabPage = new System.Windows.Forms.TabPage(); @@ -119,11 +119,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 DS_Map.DataGridViewDoubleBuffered(); this.heightsTabPage = new System.Windows.Forms.TabPage(); - this.heightsGridView = new DS_Map.DataGridViewDoubleBuffered(); this.mapFilesTabPage = new System.Windows.Forms.TabPage(); - this.mapFilesGridView = new DS_Map.DataGridViewDoubleBuffered(); this.matrixNameTextBox = new System.Windows.Forms.TextBox(); this.heightUpDown = new System.Windows.Forms.NumericUpDown(); this.widthUpDown = new System.Windows.Forms.NumericUpDown(); @@ -429,6 +426,7 @@ this.searchMessageResultTextBox = new System.Windows.Forms.TextBox(); this.searchMessageTextBox = new System.Windows.Forms.TextBox(); this.searchMessageButton = new System.Windows.Forms.Button(); + this.replaceMessageButton = new System.Windows.Forms.Button(); this.removeStringButton = new System.Windows.Forms.Button(); this.addStringButton = new System.Windows.Forms.Button(); this.textEditorDataGridView = new System.Windows.Forms.DataGridView(); @@ -488,6 +486,14 @@ this.wildEditorButton = new System.Windows.Forms.ToolStripButton(); this.buildingEditorButton = new System.Windows.Forms.ToolStripButton(); this.versionLabel = new System.Windows.Forms.Label(); + this.replaceMessageTextBox = new System.Windows.Forms.TextBox(); + this.replaceTextLabel = new System.Windows.Forms.Label(); + this.LineNumberTextBoxScript = new System.Windows.Forms.RichTextBox(); + this.LineNumberTextBoxFunc = new System.Windows.Forms.RichTextBox(); + this.LineNumberTextBoxMov = new System.Windows.Forms.RichTextBox(); + this.headersGridView = new DS_Map.DataGridViewDoubleBuffered(); + this.heightsGridView = new DS_Map.DataGridViewDoubleBuffered(); + this.mapFilesGridView = new DS_Map.DataGridViewDoubleBuffered(); this.mainTabControl.SuspendLayout(); this.headerEditorTabPage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.areaIconPictureBox)).BeginInit(); @@ -508,11 +514,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(); @@ -620,6 +623,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(); // // headerListBox @@ -1466,62 +1472,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.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(878, 566); - 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); @@ -1532,60 +1482,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.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(878, 566); - 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); @@ -1596,61 +1492,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.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(878, 566); - 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(15, 211); @@ -4425,6 +4266,7 @@ // scriptsTabPage // this.scriptsTabPage.Controls.Add(this.scriptTextBox); + this.scriptsTabPage.Controls.Add(this.LineNumberTextBoxScript); this.scriptsTabPage.Location = new System.Drawing.Point(4, 22); this.scriptsTabPage.Name = "scriptsTabPage"; this.scriptsTabPage.Padding = new System.Windows.Forms.Padding(3); @@ -4437,18 +4279,22 @@ // 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.Location = new System.Drawing.Point(7, 6); + this.scriptTextBox.Location = new System.Drawing.Point(13, 3); this.scriptTextBox.MaxLength = 1000000; this.scriptTextBox.Name = "scriptTextBox"; this.scriptTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; - this.scriptTextBox.Size = new System.Drawing.Size(583, 556); + this.scriptTextBox.Size = new System.Drawing.Size(581, 562); this.scriptTextBox.TabIndex = 7; this.scriptTextBox.Text = ""; + this.scriptTextBox.VScroll += new System.EventHandler(this.scriptTextBox_VScroll); + this.scriptTextBox.TextChanged += new System.EventHandler(this.scriptTextBox_TextChanged); // // functionTabPage // this.functionTabPage.Controls.Add(this.functionTextBox); + this.functionTabPage.Controls.Add(this.LineNumberTextBoxFunc); this.functionTabPage.Location = new System.Drawing.Point(4, 22); this.functionTabPage.Name = "functionTabPage"; this.functionTabPage.Padding = new System.Windows.Forms.Padding(3); @@ -4461,18 +4307,22 @@ // 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.Location = new System.Drawing.Point(7, 6); + this.functionTextBox.Location = new System.Drawing.Point(13, 3); this.functionTextBox.MaxLength = 1000000; this.functionTextBox.Name = "functionTextBox"; this.functionTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; - this.functionTextBox.Size = new System.Drawing.Size(583, 556); + this.functionTextBox.Size = new System.Drawing.Size(581, 562); this.functionTextBox.TabIndex = 14; this.functionTextBox.Text = ""; + this.functionTextBox.VScroll += new System.EventHandler(this.functionTextBox_VScroll); + this.functionTextBox.TextChanged += new System.EventHandler(this.functionTextBox_SelectionChanged); // // movementTabPage // this.movementTabPage.Controls.Add(this.movementTextBox); + this.movementTabPage.Controls.Add(this.LineNumberTextBoxMov); this.movementTabPage.Location = new System.Drawing.Point(4, 22); this.movementTabPage.Name = "movementTabPage"; this.movementTabPage.Padding = new System.Windows.Forms.Padding(3); @@ -4485,14 +4335,17 @@ // 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.Location = new System.Drawing.Point(7, 6); + this.movementTextBox.Location = new System.Drawing.Point(13, 3); this.movementTextBox.MaxLength = 1000000; this.movementTextBox.Name = "movementTextBox"; this.movementTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; - this.movementTextBox.Size = new System.Drawing.Size(583, 556); + this.movementTextBox.Size = new System.Drawing.Size(581, 562); this.movementTextBox.TabIndex = 17; this.movementTextBox.Text = ""; + this.movementTextBox.VScroll += new System.EventHandler(this.movementTextBox_VScroll); + this.movementTextBox.TextChanged += new System.EventHandler(this.movementTextBox_TextChanged); // // scriptCommandsTabControl // @@ -5197,6 +5050,8 @@ // // groupBox13 // + this.groupBox13.Controls.Add(this.replaceTextLabel); + this.groupBox13.Controls.Add(this.replaceMessageTextBox); this.groupBox13.Controls.Add(this.label8); this.groupBox13.Controls.Add(this.textSearchProgressBar); this.groupBox13.Controls.Add(this.checkBox1); @@ -5204,9 +5059,10 @@ this.groupBox13.Controls.Add(this.searchMessageResultTextBox); this.groupBox13.Controls.Add(this.searchMessageTextBox); this.groupBox13.Controls.Add(this.searchMessageButton); + this.groupBox13.Controls.Add(this.replaceMessageButton); this.groupBox13.Location = new System.Drawing.Point(800, 71); this.groupBox13.Name = "groupBox13"; - this.groupBox13.Size = new System.Drawing.Size(244, 270); + this.groupBox13.Size = new System.Drawing.Size(244, 411); this.groupBox13.TabIndex = 31; this.groupBox13.TabStop = false; this.groupBox13.Text = "Search for messages containing text"; @@ -5214,7 +5070,7 @@ // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(6, 220); + this.label8.Location = new System.Drawing.Point(0, 362); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(48, 13); this.label8.TabIndex = 35; @@ -5222,7 +5078,7 @@ // // textSearchProgressBar // - this.textSearchProgressBar.Location = new System.Drawing.Point(8, 236); + this.textSearchProgressBar.Location = new System.Drawing.Point(8, 378); this.textSearchProgressBar.Name = "textSearchProgressBar"; this.textSearchProgressBar.Size = new System.Drawing.Size(227, 27); this.textSearchProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; @@ -5241,7 +5097,7 @@ // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(6, 71); + this.label7.Location = new System.Drawing.Point(5, 174); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(42, 13); this.label7.TabIndex = 32; @@ -5249,7 +5105,7 @@ // // searchMessageResultTextBox // - this.searchMessageResultTextBox.Location = new System.Drawing.Point(8, 87); + this.searchMessageResultTextBox.Location = new System.Drawing.Point(3, 190); this.searchMessageResultTextBox.Multiline = true; this.searchMessageResultTextBox.Name = "searchMessageResultTextBox"; this.searchMessageResultTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; @@ -5273,6 +5129,16 @@ this.searchMessageButton.UseVisualStyleBackColor = true; this.searchMessageButton.Click += new System.EventHandler(this.searchMessageButton_Click); // + // replaceMessageButton + // + this.replaceMessageButton.Location = new System.Drawing.Point(8, 125); + this.replaceMessageButton.Name = "replaceMessageButton"; + this.replaceMessageButton.Size = new System.Drawing.Size(122, 22); + this.replaceMessageButton.TabIndex = 30; + this.replaceMessageButton.Text = "Replace"; + this.replaceMessageButton.UseVisualStyleBackColor = true; + this.replaceMessageButton.Click += new System.EventHandler(this.replaceMessageButton_Click); + // // removeStringButton // this.removeStringButton.Location = new System.Drawing.Point(142, 584); @@ -5909,6 +5775,235 @@ this.versionLabel.TabIndex = 9; this.versionLabel.Text = "ROM:"; // + // replaceMessageTextBox + // + this.replaceMessageTextBox.Location = new System.Drawing.Point(8, 99); + this.replaceMessageTextBox.Name = "replaceMessageTextBox"; + this.replaceMessageTextBox.Size = new System.Drawing.Size(232, 20); + this.replaceMessageTextBox.TabIndex = 36; + // + // replaceTextLabel + // + this.replaceTextLabel.AutoSize = true; + this.replaceTextLabel.Location = new System.Drawing.Point(6, 83); + this.replaceTextLabel.Name = "replaceTextLabel"; + this.replaceTextLabel.Size = new System.Drawing.Size(81, 13); + this.replaceTextLabel.TabIndex = 37; + this.replaceTextLabel.Text = "Text to replace:"; + // + // LineNumberTextBoxScript + // + this.LineNumberTextBoxScript.BackColor = System.Drawing.SystemColors.Window; + this.LineNumberTextBoxScript.Cursor = System.Windows.Forms.Cursors.PanNE; + this.LineNumberTextBoxScript.Dock = System.Windows.Forms.DockStyle.Left; + this.LineNumberTextBoxScript.Font = new System.Drawing.Font("Bahnschrift Light", 9.75F); + this.LineNumberTextBoxScript.ForeColor = System.Drawing.SystemColors.HotTrack; + this.LineNumberTextBoxScript.Location = new System.Drawing.Point(3, 3); + this.LineNumberTextBoxScript.Name = "LineNumberTextBoxScript"; + this.LineNumberTextBoxScript.ReadOnly = true; + this.LineNumberTextBoxScript.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; + this.LineNumberTextBoxScript.Size = new System.Drawing.Size(10, 562); + this.LineNumberTextBoxScript.TabIndex = 9; + this.LineNumberTextBoxScript.Text = ""; + this.LineNumberTextBoxScript.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LineNumberTextBoxScript_MouseDown); + // + // LineNumberTextBoxFunc + // + this.LineNumberTextBoxFunc.BackColor = System.Drawing.SystemColors.Window; + this.LineNumberTextBoxFunc.Cursor = System.Windows.Forms.Cursors.PanNE; + this.LineNumberTextBoxFunc.Dock = System.Windows.Forms.DockStyle.Left; + this.LineNumberTextBoxFunc.Font = new System.Drawing.Font("Bahnschrift Light", 9.75F); + this.LineNumberTextBoxFunc.ForeColor = System.Drawing.SystemColors.HotTrack; + this.LineNumberTextBoxFunc.Location = new System.Drawing.Point(3, 3); + this.LineNumberTextBoxFunc.Name = "LineNumberTextBoxFunc"; + this.LineNumberTextBoxFunc.ReadOnly = true; + this.LineNumberTextBoxFunc.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; + this.LineNumberTextBoxFunc.Size = new System.Drawing.Size(10, 562); + this.LineNumberTextBoxFunc.TabIndex = 15; + this.LineNumberTextBoxFunc.Text = ""; + this.LineNumberTextBoxFunc.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LineNumberTextBoxFunc_MouseDown); + // + // LineNumberTextBoxMov + // + this.LineNumberTextBoxMov.BackColor = System.Drawing.SystemColors.Window; + this.LineNumberTextBoxMov.Cursor = System.Windows.Forms.Cursors.PanNE; + this.LineNumberTextBoxMov.Dock = System.Windows.Forms.DockStyle.Left; + this.LineNumberTextBoxMov.Font = new System.Drawing.Font("Bahnschrift Light", 9.75F); + this.LineNumberTextBoxMov.ForeColor = System.Drawing.SystemColors.HotTrack; + this.LineNumberTextBoxMov.Location = new System.Drawing.Point(3, 3); + this.LineNumberTextBoxMov.Name = "LineNumberTextBoxMov"; + this.LineNumberTextBoxMov.ReadOnly = true; + this.LineNumberTextBoxMov.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None; + this.LineNumberTextBoxMov.Size = new System.Drawing.Size(10, 562); + this.LineNumberTextBoxMov.TabIndex = 18; + this.LineNumberTextBoxMov.Text = ""; + this.LineNumberTextBoxMov.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LineNumberTextBoxMov_MouseDown); + // + // 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.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(878, 566); + 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.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(878, 566); + 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.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(878, 566); + 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); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -5955,11 +6050,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); @@ -6095,6 +6187,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(); @@ -6449,6 +6544,7 @@ private System.Windows.Forms.Label label7; private System.Windows.Forms.TextBox searchMessageResultTextBox; private System.Windows.Forms.Button searchMessageButton; + private System.Windows.Forms.Button replaceMessageButton; private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.ProgressBar textSearchProgressBar; private System.Windows.Forms.Label label8; @@ -6544,6 +6640,11 @@ private System.Windows.Forms.ToolStripButton buildingEditorButton; private System.Windows.Forms.Button removeMapFileButton; private System.Windows.Forms.Button addMapFileButton; + private System.Windows.Forms.Label replaceTextLabel; + private System.Windows.Forms.TextBox replaceMessageTextBox; + private System.Windows.Forms.RichTextBox LineNumberTextBoxScript; + private System.Windows.Forms.RichTextBox LineNumberTextBoxFunc; + private System.Windows.Forms.RichTextBox LineNumberTextBoxMov; } } diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index 2a32f45..c97cb07 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -796,6 +796,48 @@ namespace DS_Map Narc.Open(workingFolder + tuple.Item1).ExtractToFolder(tuple.Item2); } } + private void UnpackNARCsBlackWhite2() + { + narcList = new string[] + { + @"data\a\0\7\0", + @"data\a\0\4\3", + @"data\a\0\4\2", + @"data\a\0\4\4", + @"data\a\0\4\0", + @"data\a\0\3\2", + @"data\a\0\6\5", + @"data\a\0\4\1", + @"data\a\0\2\7", + @"data\a\0\1\2", + @"data\a\0\8\1", + @"data\a\0\5\5", + @"data\a\0\3\7", + @"data\a\1\4\8" + }; + narcFolders = new string[] + { + romInfo.GetBuildingTexturesFolderPath(), + workingFolder + @"data\a\0\4\area_build", + romInfo.GetAreaDataFolderPath(), + romInfo.GetMapTexturesFolderPath(), + romInfo.GetBuildingModelsFolderPath(false), + romInfo.GetEventFolderPath(), + romInfo.GetMapFolderPath(), + romInfo.GetMatrixFolderPath(), + romInfo.GetMessageFolderPath(), + romInfo.GetScriptFolderPath(), + romInfo.GetOverworldFolderPath(), + romInfo.GetTrainerDataFolderPath(), + romInfo.GetEncounterFolderPath(), + romInfo.GetBuildingModelsFolderPath(true) + }; + + foreach (var tuple in narcList.Zip(narcFolders, Tuple.Create)) + { + Narc.Open(workingFolder + tuple.Item1).ExtractToFolder(tuple.Item2); + } + } private void WriteToArm9(int startOffset, byte[] bytesToWrite) { using (BinaryWriter writer = new BinaryWriter(File.OpenWrite(workingFolder + @"arm9.bin"))) @@ -3936,6 +3978,240 @@ namespace DS_Map } #endregion + #region LineNumbers Scripts + public int getWidthScript() + { + int w = 25; + // get total lines of scriptTextBox + int line = scriptTextBox.Lines.Length; + + if (line <= 99) + { + w = 20 + (int)scriptTextBox.Font.Size; + } + else if (line <= 999) + { + w = 30 + (int)scriptTextBox.Font.Size; + } + else + { + w = 50 + (int)scriptTextBox.Font.Size; + } + + return w; + } + + public void AddLineNumbersScript() + { + // create & set Point pt to (0,0) + Point pt = new Point(0, 0); + // get First Index & First Line from scriptTextBox + int First_Index = scriptTextBox.GetCharIndexFromPosition(pt); + int First_Line = scriptTextBox.GetLineFromCharIndex(First_Index); + // set X & Y coordinates of Point pt to ClientRectangle Width & Height respectively + pt.X = ClientRectangle.Width; + pt.Y = ClientRectangle.Height; + // get Last Index & Last Line from scriptTextBox + int Last_Index = scriptTextBox.GetCharIndexFromPosition(pt); + int Last_Line = scriptTextBox.GetLineFromCharIndex(Last_Index); + // set Center alignment to LineNumberTextBox + LineNumberTextBoxScript.SelectionAlignment = HorizontalAlignment.Center; + // set LineNumberTextBox text to null & width to getWidth() function value + LineNumberTextBoxScript.Text = ""; + LineNumberTextBoxScript.Width = getWidthScript(); + // now add each line number to LineNumberTextBox upto last line + for (int i = First_Line; i <= Last_Line + 2; i++) + { + LineNumberTextBoxScript.Text += i + 1 + "\n"; + } + } + + private void scriptTextBox_SelectionChanged(object sender, EventArgs e) + { + Point pt = scriptTextBox.GetPositionFromCharIndex(scriptTextBox.SelectionStart); + if (pt.X == 1) + { + AddLineNumbersScript(); + } + } + + private void scriptTextBox_VScroll(object sender, EventArgs e) + { + LineNumberTextBoxScript.Text = ""; + AddLineNumbersScript(); + LineNumberTextBoxScript.Invalidate(); + } + + private void scriptTextBox_TextChanged(object sender, EventArgs e) + { + if (scriptTextBox.Text == "") + { + AddLineNumbersScript(); + } + } + + private void LineNumberTextBoxScript_MouseDown(object sender, MouseEventArgs e) + { + scriptTextBox.Select(); + LineNumberTextBoxScript.DeselectAll(); + } + #endregion + #region LineNumbers Functions + public int getWidthFunc() + { + int w = 25; + // get total lines of functionTextBox + int line = functionTextBox.Lines.Length; + + if (line <= 99) + { + w = 20 + (int)functionTextBox.Font.Size; + } + else if (line <= 999) + { + w = 30 + (int)functionTextBox.Font.Size; + } + else + { + w = 50 + (int)functionTextBox.Font.Size; + } + + return w; + } + + public void AddLineNumbersFunc() + { + // create & set Point pt to (0,0) + Point pt = new Point(0, 0); + // get First Index & First Line from functionTextBox + int First_Index = functionTextBox.GetCharIndexFromPosition(pt); + int First_Line = functionTextBox.GetLineFromCharIndex(First_Index); + // set X & Y coordinates of Point pt to ClientRectangle Width & Height respectively + pt.X = ClientRectangle.Width; + pt.Y = ClientRectangle.Height; + // get Last Index & Last Line from functionTextBox + int Last_Index = functionTextBox.GetCharIndexFromPosition(pt); + int Last_Line = functionTextBox.GetLineFromCharIndex(Last_Index); + // set Center alignment to LineNumberTextBox + LineNumberTextBoxFunc.SelectionAlignment = HorizontalAlignment.Center; + // set LineNumberTextBox text to null & width to getWidth() function value + LineNumberTextBoxFunc.Text = ""; + LineNumberTextBoxFunc.Width = getWidthFunc(); + // now add each line number to LineNumberTextBox upto last line + for (int i = First_Line; i <= Last_Line + 2; i++) + { + LineNumberTextBoxFunc.Text += i + 1 + "\n"; + } + } + + private void functionTextBox_SelectionChanged(object sender, EventArgs e) + { + Point pt = functionTextBox.GetPositionFromCharIndex(functionTextBox.SelectionStart); + if (pt.X == 1) + { + AddLineNumbersFunc(); + } + } + + private void functionTextBox_VScroll(object sender, EventArgs e) + { + LineNumberTextBoxFunc.Text = ""; + AddLineNumbersFunc(); + LineNumberTextBoxFunc.Invalidate(); + } + + private void functionTextBox_TextChanged(object sender, EventArgs e) + { + if (functionTextBox.Text == "") + { + AddLineNumbersFunc(); + } + } + + private void LineNumberTextBoxFunc_MouseDown(object sender, MouseEventArgs e) + { + functionTextBox.Select(); + LineNumberTextBoxFunc.DeselectAll(); + } + #endregion + #region LineNumbers Movements + public int getWidthMov() + { + int w = 25; + // get total lines of movementTextBox + int line = movementTextBox.Lines.Length; + + if (line <= 99) + { + w = 20 + (int)movementTextBox.Font.Size; + } + else if (line <= 999) + { + w = 30 + (int)movementTextBox.Font.Size; + } + else + { + w = 50 + (int)movementTextBox.Font.Size; + } + + return w; + } + + public void AddLineNumbersMov() + { + // create & set Point pt to (0,0) + Point pt = new Point(0, 0); + // get First Index & First Line from movementTextBox + int First_Index = movementTextBox.GetCharIndexFromPosition(pt); + int First_Line = movementTextBox.GetLineFromCharIndex(First_Index); + // set X & Y coordinates of Point pt to ClientRectangle Width & Height respectively + pt.X = ClientRectangle.Width; + pt.Y = ClientRectangle.Height; + // get Last Index & Last Line from movementTextBox + int Last_Index = movementTextBox.GetCharIndexFromPosition(pt); + int Last_Line = movementTextBox.GetLineFromCharIndex(Last_Index); + // set Center alignment to LineNumberTextBox + LineNumberTextBoxMov.SelectionAlignment = HorizontalAlignment.Center; + // set LineNumberTextBox text to null & width to getWidth() function value + LineNumberTextBoxMov.Text = ""; + LineNumberTextBoxMov.Width = getWidthMov(); + // now add each line number to LineNumberTextBox upto last line + for (int i = First_Line; i <= Last_Line + 2; i++) + { + LineNumberTextBoxMov.Text += i + 1 + "\n"; + } + } + + private void movementTextBox_SelectionChanged(object sender, EventArgs e) + { + Point pt = movementTextBox.GetPositionFromCharIndex(movementTextBox.SelectionStart); + if (pt.X == 1) + { + AddLineNumbersMov(); + } + } + + private void movementTextBox_VScroll(object sender, EventArgs e) + { + LineNumberTextBoxMov.Text = ""; + AddLineNumbersMov(); + LineNumberTextBoxMov.Invalidate(); + } + + private void movementTextBox_TextChanged(object sender, EventArgs e) + { + if (movementTextBox.Text == "") + { + AddLineNumbersMov(); + } + } + + private void LineNumberTextBoxMov_MouseDown(object sender, MouseEventArgs e) + { + movementTextBox.Select(); + LineNumberTextBoxMov.DeselectAll(); + } + #endregion private void addScriptFileButton_Click(object sender, EventArgs e) { /* Add new event file to event folder */ @@ -4014,8 +4290,9 @@ namespace DS_Map List commands = new List(); /* Read script commands */ - while (scriptTextBox.Lines[i] != "End" && !scriptTextBox.Lines[i].Contains("Jump F")) + while (scriptTextBox.Lines[i] != "End" && !scriptTextBox.Lines[i].Contains("Jump F") && i < scriptTextBox.Lines.Length - 1) { + Console.WriteLine("Script line " + i.ToString()); commands.Add(new Command(scriptTextBox.Lines[i], romInfo.GetVersion(), false)); i++; } @@ -4157,6 +4434,9 @@ namespace DS_Map functionTextBox.Text += "Level script files currently not supported"; movementTextBox.Text += "Level script files currently not supported"; } + AddLineNumbersScript(); + AddLineNumbersFunc(); + AddLineNumbersMov(); } #region Miscellaneous @@ -4430,8 +4710,9 @@ namespace DS_Map searchMessageResultTextBox.Clear(); string searchString = searchMessageTextBox.Text; textSearchProgressBar.Maximum = romInfo.GetMessageCount(); - - for (int i = 0; i < romInfo.GetMessageCount(); i++) + int msgCount = romInfo.GetMessageCount(); + if (msgCount > 828) msgCount = 828; + for (int i = 0; i < msgCount; i++) { MessageFile file = LoadMessageFile(i); string result = "File" + " " + i + ", " + "n. "; @@ -4444,6 +4725,80 @@ namespace DS_Map textSearchProgressBar.Value = 0; } + private void replaceMessageButton_Click(object sender, EventArgs e) + { + // Usage: search box -> WORD_TO_REPLACE, NEW_WORD + searchMessageResultTextBox.Clear(); + string searchString = searchMessageTextBox.Text; + string replaceString = replaceMessageTextBox.Text; + textSearchProgressBar.Maximum = romInfo.GetMessageCount(); + int msgCount = romInfo.GetMessageCount(); + if (msgCount > 828) msgCount = 828; + for (int k = 0; k < msgCount; k++) + { + MessageFile file = LoadMessageFile(k); + currentMessageFile = file; + bool found = false; + + for (int j = 0; j < file.messages.Count; j++) + { + if (file.messages[j].Contains(searchString)) + { + file.messages[j] = file.messages[j].Replace(searchString, replaceString); + found = true; + } + + } + textSearchProgressBar.Value = k; + if (found) + { + disableHandlers = true; + textEditorDataGridView.Rows.Clear(); + searchMessageResultTextBox.AppendText(searchString + " found and replaced by " + replaceString + Environment.NewLine); + for (int i = 0; i < currentMessageFile.messages.Count; i++) + { + textEditorDataGridView.Rows.Add(currentMessageFile.messages[i]); + textEditorDataGridView.Rows[i].HeaderCell.Value = i.ToString(); + } + disableHandlers = false; + BinaryWriter textWriter = new BinaryWriter(new FileStream(romInfo.GetMessageFolderPath() + "\\" + k.ToString("D4"), FileMode.Create)); + textWriter.Write((UInt16)currentMessageFile.messages.Count); + textWriter.Write((UInt16)currentMessageFile.initialKey); + int key = (currentMessageFile.initialKey * 0x2FD) & 0xFFFF; + int key2 = 0; + int realKey = 0; + int offset = 0x4 + (currentMessageFile.messages.Count * 8); + int[] stringSize = new int[currentMessageFile.messages.Count]; + + for (int i = 0; i < currentMessageFile.messages.Count; i++) // Reads and stores string offsets and sizes + { + key2 = (key * (i + 1) & 0xFFFF); + realKey = key2 | (key2 << 16); + textWriter.Write(offset ^ realKey); + int length = currentMessageFile.GetStringLength(textEditorDataGridView[0, i].Value.ToString()); + stringSize[i] = length; + textWriter.Write(length ^ realKey); + offset += length * 2; + } + for (int i = 0; i < currentMessageFile.messages.Count; i++) // Encodes strings and writes them to file + { + key = (0x91BD3 * (i + 1)) & 0xFFFF; + int[] currentString = currentMessageFile.EncodeString(textEditorDataGridView[0, i].Value.ToString(), i, stringSize[i]); + for (int j = 0; j < stringSize[i] - 1; j++) + { + textWriter.Write((UInt16)(currentString[j] ^ key)); + key += 0x493D; + key &= 0xFFFF; + } + textWriter.Write((UInt16)(0xFFFF ^ key)); + } + textWriter.Close(); + } + //else searchMessageResultTextBox.AppendText(searchString + " not found in this file"); + //this.saveMessageFileButton_Click(sender, e); + } + textSearchProgressBar.Value = 0; + } private void selectTextFileComboBox_SelectedIndexChanged(object sender, EventArgs e) { disableHandlers = true; diff --git a/DS_Map/Main Window.resx b/DS_Map/Main Window.resx index 43d25f4..3e69290 100644 --- a/DS_Map/Main Window.resx +++ b/DS_Map/Main Window.resx @@ -467,7 +467,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACA - DwAAAk1TRnQBSQFMAgEBBwEAAWABAQFgAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + DwAAAk1TRnQBSQFMAgEBBwEAAeABAQHgAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/DS_Map/ScriptFile.cs b/DS_Map/ScriptFile.cs index 0ca339a..1638135 100644 --- a/DS_Map/ScriptFile.cs +++ b/DS_Map/ScriptFile.cs @@ -5,6 +5,7 @@ using System.Reflection; using System.Resources; using System.IO; using System.Linq; +using System.Collections; namespace DS_Map { @@ -516,7 +517,15 @@ namespace DS_Map this.description = getCommandName.GetString(id.ToString("X4")); if (description == null) description = id.ToString("X4"); this.isMovement = isMovement; - + for (int i = 0; i < parameters.Count; i++) + { + if (parameters[i].Length < 4) + { + byte[] temp = new byte[4]; + parameters[i].CopyTo(temp, 0); + parameters[i] = temp; + } + } switch (id) { case 0x16: // Jump @@ -547,8 +556,22 @@ namespace DS_Map break; } } + + private Object GetResxNameByValue(string value, ResourceManager rm) + { + var entry = + rm.GetResourceSet(System.Threading.Thread.CurrentThread.CurrentCulture, true, true) + .OfType() + .FirstOrDefault(e => e.Value.ToString() == value); + + var key = entry.Key; + return key; + + } + public Command(string description, string version, bool isMovement) { + Console.WriteLine(description); this.description = description; this.isMovement = isMovement; this.parameters = new List(); @@ -918,10 +941,24 @@ namespace DS_Map ["WaitMoveForever"] = 0x0068, ["End"] = 0x00FE }; - + ResourceManager getCommandName; // Load the resource file containing information on parameters for each command + switch (version) + { + case "Diamond": + case "Pearl": + getCommandName = new ResourceManager("DS_Map.Resources.ScriptNamesDP", Assembly.GetExecutingAssembly()); + break; + case "HeartGold": + case "SoulSilver": + getCommandName = new ResourceManager("DS_Map.Resources.ScriptNamesHGSS", Assembly.GetExecutingAssembly()); + break; + default: // Platinum + getCommandName = new ResourceManager("DS_Map.Resources.ScriptNamesDP", Assembly.GetExecutingAssembly()); + break; + } if (!isMovement) { - if (commandsDictDPPt.ContainsKey(words[0])) this.id = commandsDictDPPt[words[0]]; + if (getCommandName.GetString(words[0]) != null) this.id = (ushort)GetResxNameByValue(words[0], getCommandName); else UInt16.TryParse(words[0], NumberStyles.HexNumber, CultureInfo.InvariantCulture, out this.id); } else @@ -933,7 +970,7 @@ namespace DS_Map /* Read parameters from remainder of the description */ if (words.Length > 1 && this.id != 0) { - if(!isMovement) + if (!isMovement) { Dictionary operatorsDict = new Dictionary() { @@ -962,11 +999,13 @@ namespace DS_Map getCommandParameters = new ResourceManager("DS_Map.Resources.ScriptParametersDP", Assembly.GetExecutingAssembly()); break; } - + Console.WriteLine("ID = " + id.ToString()); string[] indexes = getCommandParameters.GetString(id.ToString("X4")).Split(' '); for (int i = 1; i < indexes.Length; i++) { + Console.WriteLine("Index : "+i.ToString()); + Console.WriteLine("Started word : "+words[i]); if (operatorsDict.ContainsKey(words[i])) parameters.Add(new byte[] { operatorsDict[words[i]] }); else { @@ -976,19 +1015,37 @@ namespace DS_Map NumberStyles style; if (words[i][index - 1] == 'x') style = NumberStyles.HexNumber; else style = NumberStyles.Integer; - /* Convert strings of parameters into the correct datatypes */ + Console.WriteLine("started params"); if (indexes[i] == "1") parameters.Add(new byte[] { Byte.Parse(words[i].Substring(index), style) }); if (indexes[i] == "2") parameters.Add(BitConverter.GetBytes(Int16.Parse(words[i].Substring(index), style))); if (indexes[i] == "4") parameters.Add(BitConverter.GetBytes(Int32.Parse(words[i].Substring(index), style))); + Console.WriteLine("finished params"); } + Console.WriteLine("Finished word : "+words[i]); } /* Fix function and movement references which are +1 greater than array indexes */ + Console.WriteLine("before fix"); + Console.WriteLine("Param length = "+parameters.Count.ToString()); if (id == 0x16 || id == 0x1A) parameters[0] = BitConverter.GetBytes(BitConverter.ToInt32(parameters[0], 0) - 1); + Console.WriteLine("passed parameters 0"); if (id == 0x1C || id == 0x1D || id == 0x5E) parameters[1] = BitConverter.GetBytes(BitConverter.ToInt32(parameters[1], 0) - 1); + Console.WriteLine("passed parameters 1"); + Console.WriteLine("passed fix"); + } + else + { + Console.WriteLine("in else"); + if (words[1].Length > 4) // Cases where movement is followed by an Overworld parameter + { + int index = 1 + words[1].IndexOf('#'); // FInd index of # + parameters.Add(BitConverter.GetBytes(Int32.Parse(words[1].Substring(index), NumberStyles.Integer))); // Add Overworld_# + parameters[0] = BitConverter.GetBytes(BitConverter.ToInt32(parameters[0], 0) - 1); // Add Overworld number + } // TODO: Check if other cases may apply to movement parameters + else parameters.Add(BitConverter.GetBytes(Int16.Parse(words[1].Substring(2), NumberStyles.HexNumber))); + Console.WriteLine("passed else"); } - else parameters.Add(BitConverter.GetBytes(Int16.Parse(words[1].Substring(2), NumberStyles.HexNumber))); } }