diff --git a/DS_Map/BuildingEditor.cs b/DS_Map/BuildingEditor.cs index 1409886..c228565 100644 --- a/DS_Map/BuildingEditor.cs +++ b/DS_Map/BuildingEditor.cs @@ -34,7 +34,7 @@ namespace DSPRE { buildingOpenGLControl.MouseWheel += new MouseEventHandler(buildingOpenGLControl_MouseWheel); Gl.glEnable(Gl.GL_TEXTURE_2D); - if (RomInfo.gameFamily == "HGSS") + if (RomInfo.gameFamily == gFamEnum.HGSS) interiorCheckBox.Enabled = true; disableHandlers = true; diff --git a/DS_Map/DSUtils.cs b/DS_Map/DSUtils.cs index ff1117b..01fd8af 100644 --- a/DS_Map/DSUtils.cs +++ b/DS_Map/DSUtils.cs @@ -21,13 +21,14 @@ namespace DSPRE { public const string backupSuffix = ".backup"; - public static void WriteToFile(string filepath, byte[] bytesToWrite, uint writeAt = 0, int readFrom = 0, bool fromScratch = false) { - if (fromScratch) + public static void WriteToFile(string filepath, byte[] toOutput, uint writeAt = 0, int indexFirstByteToWrite = 0, int? indexLastByteToWrite = null, bool fromScratch = false) { + if (fromScratch) { File.Delete(filepath); + } using (BinaryWriter writer = new BinaryWriter(File.OpenWrite(filepath))) { writer.BaseStream.Position = writeAt; - writer.Write(bytesToWrite, readFrom, bytesToWrite.Length - readFrom); + writer.Write(toOutput, indexFirstByteToWrite, indexLastByteToWrite is null ? toOutput.Length - indexFirstByteToWrite : (int)indexLastByteToWrite); } } public static byte[] ReadFromFile(string filepath, long startOffset = 0, long numberOfBytes = 0) { @@ -226,11 +227,17 @@ namespace DSPRE { repack.WaitForExit(); } - public static byte[] ReadFromArm9(uint startOffset, long numberOfBytes = 0) { + public static byte[] ReadBytesFromArm9(uint startOffset, long numberOfBytes = 0) { return ReadFromFile(RomInfo.arm9Path, startOffset, numberOfBytes); } - public static void WriteToArm9(byte[] bytesToWrite, uint writeAt = 0, int readFrom = 0) { - WriteToFile(RomInfo.arm9Path, bytesToWrite, writeAt, readFrom); + public static void WriteBytesToArm9(byte[] bytesToWrite, uint destOffset, int indexFirstByteToWrite = 0, int? indexLastByteToWrite = null) { + WriteToFile(RomInfo.arm9Path, bytesToWrite, destOffset, indexFirstByteToWrite, indexLastByteToWrite); + } + public static byte ReadByteFromArm9(uint startOffset) { + return ReadFromFile(RomInfo.arm9Path, startOffset, 1)[0]; + } + public static void WriteByteToArm9(byte value, uint destOffset) { + WriteToFile(RomInfo.arm9Path, BitConverter.GetBytes(value), destOffset, 0); } public static byte[] StringToByteArray(String hex) { diff --git a/DS_Map/Main Window.Designer.cs b/DS_Map/Main Window.Designer.cs index e8d01f3..397f242 100644 --- a/DS_Map/Main Window.Designer.cs +++ b/DS_Map/Main Window.Designer.cs @@ -30,23 +30,23 @@ { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainProgram)); - 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(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); - 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.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle(); this.mainTabControl = new System.Windows.Forms.TabControl(); this.headerEditorTabPage = new System.Windows.Forms.TabPage(); this.removeLastHeaderBTN = new System.Windows.Forms.Button(); @@ -674,6 +674,9 @@ this.partyPokemon1ComboBox = new System.Windows.Forms.ComboBox(); this.trainerSaveCurrentButton = new System.Windows.Forms.Button(); this.groupBox27 = new System.Windows.Forms.GroupBox(); + this.encounterSSEQNupDown = new System.Windows.Forms.NumericUpDown(); + this.label67 = new System.Windows.Forms.Label(); + this.encounterSSEQDupDown = new System.Windows.Forms.NumericUpDown(); this.trainerClassFrameMaxLabel = new System.Windows.Forms.Label(); this.label40 = new System.Windows.Forms.Label(); this.trClassFramePreviewUpDown = new System.Windows.Forms.NumericUpDown(); @@ -966,6 +969,8 @@ ((System.ComponentModel.ISupportInitialize)(this.partyBall1UpDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.partyPokemon1PictureBox)).BeginInit(); this.groupBox27.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.encounterSSEQNupDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.encounterSSEQDupDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trClassFramePreviewUpDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trClassVSAnimationUpDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trClassBattleSSEQUpDown)).BeginInit(); @@ -2624,46 +2629,46 @@ this.headersGridView.AllowUserToDeleteRows = false; this.headersGridView.AllowUserToResizeColumns = false; this.headersGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.headersGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.headersGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle18; 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; + dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle19.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle19.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle19.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle19.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.headersGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle19; 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; + dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle20.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle20.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle20.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle20.Format = "D4"; + dataGridViewCellStyle20.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle20.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.headersGridView.DefaultCellStyle = dataGridViewCellStyle20; 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; + dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle21.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle21.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle21.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle21.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle21.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.headersGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle21; 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; + dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle22.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.headersGridView.RowsDefaultCellStyle = dataGridViewCellStyle22; this.headersGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.headersGridView.RowTemplate.Height = 18; this.headersGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; @@ -2692,46 +2697,46 @@ this.heightsGridView.AllowUserToDeleteRows = false; this.heightsGridView.AllowUserToResizeColumns = false; this.heightsGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.heightsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.heightsGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle23; 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; + dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle24.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle24.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle24.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle24.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle24.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle24.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.heightsGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle24; 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; + dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle25.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle25.Font = new System.Drawing.Font("Tahoma", 8.25F); + dataGridViewCellStyle25.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle25.Format = "D2"; + dataGridViewCellStyle25.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle25.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle25.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.heightsGridView.DefaultCellStyle = dataGridViewCellStyle25; 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; + dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle26.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle26.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle26.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle26.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle26.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle26.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.heightsGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle26; 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; + dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle27.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.heightsGridView.RowsDefaultCellStyle = dataGridViewCellStyle27; this.heightsGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.heightsGridView.RowTemplate.Height = 18; this.heightsGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; @@ -2758,46 +2763,46 @@ this.mapFilesGridView.AllowUserToDeleteRows = false; this.mapFilesGridView.AllowUserToResizeColumns = false; this.mapFilesGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.mapFilesGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11; + dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + this.mapFilesGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle28; 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; + dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle29.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle29.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle29.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle29.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle29.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle29.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.mapFilesGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle29; 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; + dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle30.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle30.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle30.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle30.Format = "D4"; + dataGridViewCellStyle30.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle30.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle30.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.mapFilesGridView.DefaultCellStyle = dataGridViewCellStyle30; 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; + dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle31.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle31.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F); + dataGridViewCellStyle31.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle31.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle31.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle31.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.mapFilesGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle31; 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; + dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle32.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.mapFilesGridView.RowsDefaultCellStyle = dataGridViewCellStyle32; this.mapFilesGridView.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.mapFilesGridView.RowTemplate.Height = 18; this.mapFilesGridView.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; @@ -7267,8 +7272,8 @@ this.textEditorDataGridView.Location = new System.Drawing.Point(12, 77); this.textEditorDataGridView.Name = "textEditorDataGridView"; this.textEditorDataGridView.RowHeadersWidth = 68; - dataGridViewCellStyle16.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textEditorDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle16; + dataGridViewCellStyle33.Font = new System.Drawing.Font("Consolas", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textEditorDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle33; this.textEditorDataGridView.Size = new System.Drawing.Size(873, 496); this.textEditorDataGridView.TabIndex = 24; this.textEditorDataGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.textEditorDataGridView_CellValueChanged); @@ -7427,14 +7432,14 @@ this.cameraEditorDataGridView.CausesValidation = false; this.cameraEditorDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised; this.cameraEditorDataGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; - dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle17.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle17.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle17.ForeColor = System.Drawing.SystemColors.Info; - dataGridViewCellStyle17.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle17.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.cameraEditorDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle17; + dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle34.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle34.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle34.ForeColor = System.Drawing.SystemColors.Info; + dataGridViewCellStyle34.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle34.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle34.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.cameraEditorDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle34; this.cameraEditorDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.cameraEditorDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.DistanceGVCol, @@ -8689,6 +8694,9 @@ // // groupBox27 // + this.groupBox27.Controls.Add(this.encounterSSEQNupDown); + this.groupBox27.Controls.Add(this.label67); + this.groupBox27.Controls.Add(this.encounterSSEQDupDown); this.groupBox27.Controls.Add(this.trainerClassFrameMaxLabel); this.groupBox27.Controls.Add(this.label40); this.groupBox27.Controls.Add(this.trClassFramePreviewUpDown); @@ -8702,11 +8710,45 @@ this.groupBox27.Controls.Add(this.trainerClassPicBox); this.groupBox27.Location = new System.Drawing.Point(26, 486); this.groupBox27.Name = "groupBox27"; - this.groupBox27.Size = new System.Drawing.Size(387, 123); + this.groupBox27.Size = new System.Drawing.Size(401, 123); this.groupBox27.TabIndex = 30; this.groupBox27.TabStop = false; this.groupBox27.Text = "Trainer Class"; // + // encounterSSEQNupDown + // + this.encounterSSEQNupDown.Enabled = false; + this.encounterSSEQNupDown.Location = new System.Drawing.Point(199, 85); + this.encounterSSEQNupDown.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.encounterSSEQNupDown.Name = "encounterSSEQNupDown"; + this.encounterSSEQNupDown.Size = new System.Drawing.Size(49, 20); + this.encounterSSEQNupDown.TabIndex = 35; + // + // label67 + // + this.label67.AutoSize = true; + this.label67.Location = new System.Drawing.Point(149, 69); + this.label67.Name = "label67"; + this.label67.Size = new System.Drawing.Size(93, 13); + this.label67.TabIndex = 34; + this.label67.Text = "Encounter SSEQs"; + // + // encounterSSEQDupDown + // + this.encounterSSEQDupDown.Location = new System.Drawing.Point(146, 85); + this.encounterSSEQDupDown.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.encounterSSEQDupDown.Name = "encounterSSEQDupDown"; + this.encounterSSEQDupDown.Size = new System.Drawing.Size(49, 20); + this.encounterSSEQDupDown.TabIndex = 33; + // // trainerClassFrameMaxLabel // this.trainerClassFrameMaxLabel.AutoSize = true; @@ -8721,9 +8763,9 @@ this.label40.AutoSize = true; this.label40.Location = new System.Drawing.Point(143, 14); this.label40.Name = "label40"; - this.label40.Size = new System.Drawing.Size(77, 13); + this.label40.Size = new System.Drawing.Size(45, 13); this.label40.TabIndex = 31; - this.label40.Text = "Frame Preview"; + this.label40.Text = "Preview"; // // trClassFramePreviewUpDown // @@ -8737,7 +8779,7 @@ // this.saveTrainerClassButton.Image = global::DSPRE.Properties.Resources.save_rom; this.saveTrainerClassButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.saveTrainerClassButton.Location = new System.Drawing.Point(301, 66); + this.saveTrainerClassButton.Location = new System.Drawing.Point(320, 14); this.saveTrainerClassButton.Name = "saveTrainerClassButton"; this.saveTrainerClassButton.Size = new System.Drawing.Size(75, 45); this.saveTrainerClassButton.TabIndex = 29; @@ -8750,7 +8792,7 @@ // this.label22.AutoSize = true; this.label22.Enabled = false; - this.label22.Location = new System.Drawing.Point(219, 68); + this.label22.Location = new System.Drawing.Point(326, 69); this.label22.Name = "label22"; this.label22.Size = new System.Drawing.Size(70, 13); this.label22.TabIndex = 28; @@ -8759,7 +8801,7 @@ // trClassVSAnimationUpDown // this.trClassVSAnimationUpDown.Enabled = false; - this.trClassVSAnimationUpDown.Location = new System.Drawing.Point(223, 84); + this.trClassVSAnimationUpDown.Location = new System.Drawing.Point(332, 85); this.trClassVSAnimationUpDown.Name = "trClassVSAnimationUpDown"; this.trClassVSAnimationUpDown.Size = new System.Drawing.Size(54, 20); this.trClassVSAnimationUpDown.TabIndex = 27; @@ -8768,7 +8810,7 @@ // this.label21.AutoSize = true; this.label21.Enabled = false; - this.label21.Location = new System.Drawing.Point(143, 68); + this.label21.Location = new System.Drawing.Point(258, 69); this.label21.Name = "label21"; this.label21.Size = new System.Drawing.Size(66, 13); this.label21.TabIndex = 26; @@ -8777,22 +8819,27 @@ // trClassBattleSSEQUpDown // this.trClassBattleSSEQUpDown.Enabled = false; - this.trClassBattleSSEQUpDown.Location = new System.Drawing.Point(146, 84); + this.trClassBattleSSEQUpDown.Location = new System.Drawing.Point(263, 85); + this.trClassBattleSSEQUpDown.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); this.trClassBattleSSEQUpDown.Name = "trClassBattleSSEQUpDown"; this.trClassBattleSSEQUpDown.Size = new System.Drawing.Size(54, 20); this.trClassBattleSSEQUpDown.TabIndex = 25; // // trainerClassNameTextbox // - this.trainerClassNameTextbox.Location = new System.Drawing.Point(225, 29); + this.trainerClassNameTextbox.Location = new System.Drawing.Point(213, 29); this.trainerClassNameTextbox.Name = "trainerClassNameTextbox"; - this.trainerClassNameTextbox.Size = new System.Drawing.Size(152, 20); + this.trainerClassNameTextbox.Size = new System.Drawing.Size(95, 20); this.trainerClassNameTextbox.TabIndex = 24; // // label17 // this.label17.AutoSize = true; - this.label17.Location = new System.Drawing.Point(222, 13); + this.label17.Location = new System.Drawing.Point(210, 13); this.label17.Name = "label17"; this.label17.Size = new System.Drawing.Size(63, 13); this.label17.TabIndex = 23; @@ -8820,7 +8867,7 @@ this.groupBox25.Controls.Add(this.trainerClassListBox); this.groupBox25.Location = new System.Drawing.Point(26, 75); this.groupBox25.Name = "groupBox25"; - this.groupBox25.Size = new System.Drawing.Size(387, 405); + this.groupBox25.Size = new System.Drawing.Size(401, 405); this.groupBox25.TabIndex = 29; this.groupBox25.TabStop = false; this.groupBox25.Text = "Trainer Properties"; @@ -8840,7 +8887,7 @@ this.TrainerAIGroupBox.Controls.Add(this.trainerAI1CheckBox); this.TrainerAIGroupBox.Location = new System.Drawing.Point(9, 282); this.TrainerAIGroupBox.Name = "TrainerAIGroupBox"; - this.TrainerAIGroupBox.Size = new System.Drawing.Size(365, 116); + this.TrainerAIGroupBox.Size = new System.Drawing.Size(384, 116); this.TrainerAIGroupBox.TabIndex = 27; this.TrainerAIGroupBox.TabStop = false; this.TrainerAIGroupBox.Text = "AI"; @@ -8848,7 +8895,7 @@ // trainerAI11CheckBox // this.trainerAI11CheckBox.AutoSize = true; - this.trainerAI11CheckBox.Location = new System.Drawing.Point(266, 67); + this.trainerAI11CheckBox.Location = new System.Drawing.Point(271, 67); this.trainerAI11CheckBox.Name = "trainerAI11CheckBox"; this.trainerAI11CheckBox.Size = new System.Drawing.Size(44, 17); this.trainerAI11CheckBox.TabIndex = 10; @@ -8859,7 +8906,7 @@ // trainerAI10CheckBox // this.trainerAI10CheckBox.AutoSize = true; - this.trainerAI10CheckBox.Location = new System.Drawing.Point(266, 44); + this.trainerAI10CheckBox.Location = new System.Drawing.Point(271, 44); this.trainerAI10CheckBox.Name = "trainerAI10CheckBox"; this.trainerAI10CheckBox.Size = new System.Drawing.Size(67, 17); this.trainerAI10CheckBox.TabIndex = 9; @@ -8870,7 +8917,7 @@ // trainerAI9CheckBox // this.trainerAI9CheckBox.AutoSize = true; - this.trainerAI9CheckBox.Location = new System.Drawing.Point(266, 21); + this.trainerAI9CheckBox.Location = new System.Drawing.Point(271, 21); this.trainerAI9CheckBox.Name = "trainerAI9CheckBox"; this.trainerAI9CheckBox.Size = new System.Drawing.Size(75, 17); this.trainerAI9CheckBox.TabIndex = 8; @@ -8881,7 +8928,7 @@ // trainerAI8CheckBox // this.trainerAI8CheckBox.AutoSize = true; - this.trainerAI8CheckBox.Location = new System.Drawing.Point(135, 90); + this.trainerAI8CheckBox.Location = new System.Drawing.Point(138, 90); this.trainerAI8CheckBox.Name = "trainerAI8CheckBox"; this.trainerAI8CheckBox.Size = new System.Drawing.Size(87, 17); this.trainerAI8CheckBox.TabIndex = 7; @@ -8892,7 +8939,7 @@ // trainerAI7CheckBox // this.trainerAI7CheckBox.AutoSize = true; - this.trainerAI7CheckBox.Location = new System.Drawing.Point(135, 67); + this.trainerAI7CheckBox.Location = new System.Drawing.Point(138, 67); this.trainerAI7CheckBox.Name = "trainerAI7CheckBox"; this.trainerAI7CheckBox.Size = new System.Drawing.Size(80, 17); this.trainerAI7CheckBox.TabIndex = 6; @@ -8903,7 +8950,7 @@ // trainerAI6CheckBox // this.trainerAI6CheckBox.AutoSize = true; - this.trainerAI6CheckBox.Location = new System.Drawing.Point(135, 44); + this.trainerAI6CheckBox.Location = new System.Drawing.Point(138, 44); this.trainerAI6CheckBox.Name = "trainerAI6CheckBox"; this.trainerAI6CheckBox.Size = new System.Drawing.Size(100, 17); this.trainerAI6CheckBox.TabIndex = 5; @@ -8914,7 +8961,7 @@ // trainerAI5CheckBox // this.trainerAI5CheckBox.AutoSize = true; - this.trainerAI5CheckBox.Location = new System.Drawing.Point(135, 21); + this.trainerAI5CheckBox.Location = new System.Drawing.Point(138, 21); this.trainerAI5CheckBox.Name = "trainerAI5CheckBox"; this.trainerAI5CheckBox.Size = new System.Drawing.Size(47, 17); this.trainerAI5CheckBox.TabIndex = 4; @@ -8972,9 +9019,9 @@ this.trainerItemsGroupBox.Controls.Add(this.trainerItem3ComboBox); this.trainerItemsGroupBox.Controls.Add(this.trainerItem2ComboBox); this.trainerItemsGroupBox.Controls.Add(this.trainerItem1ComboBox); - this.trainerItemsGroupBox.Location = new System.Drawing.Point(191, 145); + this.trainerItemsGroupBox.Location = new System.Drawing.Point(202, 145); this.trainerItemsGroupBox.Name = "trainerItemsGroupBox"; - this.trainerItemsGroupBox.Size = new System.Drawing.Size(183, 130); + this.trainerItemsGroupBox.Size = new System.Drawing.Size(190, 130); this.trainerItemsGroupBox.TabIndex = 26; this.trainerItemsGroupBox.TabStop = false; this.trainerItemsGroupBox.Text = "Trainer Items"; @@ -8982,7 +9029,7 @@ // trainerItem4ComboBox // this.trainerItem4ComboBox.FormattingEnabled = true; - this.trainerItem4ComboBox.Location = new System.Drawing.Point(16, 101); + this.trainerItem4ComboBox.Location = new System.Drawing.Point(15, 101); this.trainerItem4ComboBox.Name = "trainerItem4ComboBox"; this.trainerItem4ComboBox.Size = new System.Drawing.Size(159, 21); this.trainerItem4ComboBox.TabIndex = 3; @@ -8991,7 +9038,7 @@ // trainerItem3ComboBox // this.trainerItem3ComboBox.FormattingEnabled = true; - this.trainerItem3ComboBox.Location = new System.Drawing.Point(16, 47); + this.trainerItem3ComboBox.Location = new System.Drawing.Point(15, 47); this.trainerItem3ComboBox.Name = "trainerItem3ComboBox"; this.trainerItem3ComboBox.Size = new System.Drawing.Size(159, 21); this.trainerItem3ComboBox.TabIndex = 2; @@ -9000,7 +9047,7 @@ // trainerItem2ComboBox // this.trainerItem2ComboBox.FormattingEnabled = true; - this.trainerItem2ComboBox.Location = new System.Drawing.Point(16, 74); + this.trainerItem2ComboBox.Location = new System.Drawing.Point(15, 74); this.trainerItem2ComboBox.Name = "trainerItem2ComboBox"; this.trainerItem2ComboBox.Size = new System.Drawing.Size(159, 21); this.trainerItem2ComboBox.TabIndex = 1; @@ -9009,7 +9056,7 @@ // trainerItem1ComboBox // this.trainerItem1ComboBox.FormattingEnabled = true; - this.trainerItem1ComboBox.Location = new System.Drawing.Point(16, 20); + this.trainerItem1ComboBox.Location = new System.Drawing.Point(15, 20); this.trainerItem1ComboBox.Name = "trainerItem1ComboBox"; this.trainerItem1ComboBox.Size = new System.Drawing.Size(159, 21); this.trainerItem1ComboBox.TabIndex = 0; @@ -9018,7 +9065,7 @@ // trainerItemsCheckBox // this.trainerItemsCheckBox.AutoSize = true; - this.trainerItemsCheckBox.Location = new System.Drawing.Point(197, 119); + this.trainerItemsCheckBox.Location = new System.Drawing.Point(205, 119); this.trainerItemsCheckBox.Name = "trainerItemsCheckBox"; this.trainerItemsCheckBox.Size = new System.Drawing.Size(117, 17); this.trainerItemsCheckBox.TabIndex = 25; @@ -9029,7 +9076,7 @@ // trainerMovesCheckBox // this.trainerMovesCheckBox.AutoSize = true; - this.trainerMovesCheckBox.Location = new System.Drawing.Point(197, 98); + this.trainerMovesCheckBox.Location = new System.Drawing.Point(205, 98); this.trainerMovesCheckBox.Name = "trainerMovesCheckBox"; this.trainerMovesCheckBox.Size = new System.Drawing.Size(97, 17); this.trainerMovesCheckBox.TabIndex = 24; @@ -9040,7 +9087,7 @@ // trainerDoubleCheckBox // this.trainerDoubleCheckBox.AutoSize = true; - this.trainerDoubleCheckBox.Location = new System.Drawing.Point(197, 76); + this.trainerDoubleCheckBox.Location = new System.Drawing.Point(205, 76); this.trainerDoubleCheckBox.Name = "trainerDoubleCheckBox"; this.trainerDoubleCheckBox.Size = new System.Drawing.Size(90, 17); this.trainerDoubleCheckBox.TabIndex = 23; @@ -9050,7 +9097,7 @@ // // trainerNameTextBox // - this.trainerNameTextBox.Location = new System.Drawing.Point(197, 39); + this.trainerNameTextBox.Location = new System.Drawing.Point(205, 39); this.trainerNameTextBox.Name = "trainerNameTextBox"; this.trainerNameTextBox.Size = new System.Drawing.Size(152, 20); this.trainerNameTextBox.TabIndex = 22; @@ -9058,7 +9105,7 @@ // label44 // this.label44.AutoSize = true; - this.label44.Location = new System.Drawing.Point(194, 23); + this.label44.Location = new System.Drawing.Point(202, 23); this.label44.Name = "label44"; this.label44.Size = new System.Drawing.Size(71, 13); this.label44.TabIndex = 21; @@ -9078,7 +9125,7 @@ this.trainerClassListBox.FormattingEnabled = true; this.trainerClassListBox.Location = new System.Drawing.Point(13, 39); this.trainerClassListBox.Name = "trainerClassListBox"; - this.trainerClassListBox.Size = new System.Drawing.Size(165, 238); + this.trainerClassListBox.Size = new System.Drawing.Size(181, 238); this.trainerClassListBox.TabIndex = 0; this.trainerClassListBox.SelectedIndexChanged += new System.EventHandler(this.trainerClassListBox_SelectedIndexChanged); // @@ -9960,6 +10007,8 @@ ((System.ComponentModel.ISupportInitialize)(this.partyPokemon1PictureBox)).EndInit(); this.groupBox27.ResumeLayout(false); this.groupBox27.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.encounterSSEQNupDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.encounterSSEQDupDown)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trClassFramePreviewUpDown)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trClassVSAnimationUpDown)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trClassBattleSSEQUpDown)).EndInit(); @@ -10706,6 +10755,9 @@ private System.Windows.Forms.Button HOWconditionalMusicTableButton; private System.Windows.Forms.Label label66; private System.Windows.Forms.Button mapScreenshotButton; + private System.Windows.Forms.NumericUpDown encounterSSEQNupDown; + private System.Windows.Forms.Label label67; + private System.Windows.Forms.NumericUpDown encounterSSEQDupDown; } } diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index a1ad371..01c73fd 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -8,8 +8,6 @@ using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; -using System.Resources; -using System.Reflection; using NarcAPI; using Tao.OpenGl; using LibNDSFormats.NSBMD; @@ -20,7 +18,6 @@ using static DSPRE.RomInfo; using System.Globalization; using Images; using Ekona.Images; -using System.Xml.Linq; using Microsoft.WindowsAPICodePack.Dialogs; namespace DSPRE { @@ -46,8 +43,6 @@ namespace DSPRE { public bool trainerEditorIsReady { get; private set; } = false; public bool tableEditorIsReady { get; private set; } = false; - public const ushort MAPMODEL_CRITICALSIZE = 61000; - /* ROM Information */ public static string gameCode; public static byte europeByte; @@ -449,13 +444,13 @@ namespace DSPRE { if (forceUnpack) { DSUtils.ForceUnpackNarcs(toUnpack, toolStripProgressBar); - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { DSUtils.ForceUnpackNarcs(new List { DirNames.interiorBuildingModels }, toolStripProgressBar);// Last = interior buildings dir } } else { DSUtils.TryUnpackNarcs(toUnpack, toolStripProgressBar); - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { DSUtils.TryUnpackNarcs(new List { DirNames.interiorBuildingModels }, toolStripProgressBar); } } @@ -537,13 +532,7 @@ namespace DSPRE { } private void CheckROMLanguage() { - if (RomInfo.gameVersion is null) { - statusLabel.Text = "Unsupported ROM"; - Update(); - return; - } - - versionLabel.Text = "Pokémon " + RomInfo.gameName + " [" + RomInfo.romID + "]"; + versionLabel.Text = "Pokémon " + RomInfo.gameVersion.ToString() + " [" + RomInfo.romID + "]"; languageLabel.Text = "Language: " + RomInfo.gameLanguage; if (RomInfo.gameLanguage == "ENG") { @@ -587,8 +576,8 @@ namespace DSPRE { private void ReadROMInitData() { switch (RomInfo.gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: break; default: if (!DSUtils.DecompressArm9()) { @@ -667,7 +656,7 @@ namespace DSPRE { //DeleteTempFolders(); DSUtils.RepackROM(saveRom.FileName); - if (RomInfo.gameFamily != "DP" && RomInfo.gameFamily != "Plat") { + if (RomInfo.gameFamily != gFamEnum.DP && RomInfo.gameFamily != gFamEnum.Plat) { if (eventEditorIsReady) { if (DSUtils.OverlayIsCompressed(1)) { DSUtils.DecompressOverlay(1); @@ -734,13 +723,13 @@ namespace DSPRE { } } private void diamondAndPearlToolStripMenuItem_Click(object sender, EventArgs e) { - OpenCommandsDatabase(RomInfo.BuildCommandNamesDatabase("D"), RomInfo.BuildCommandParametersDatabase("D")); + OpenCommandsDatabase(RomInfo.BuildCommandNamesDatabase(gFamEnum.DP), RomInfo.BuildCommandParametersDatabase(gFamEnum.DP)); } private void platinumToolStripMenuItem_Click(object sender, EventArgs e) { - OpenCommandsDatabase(RomInfo.BuildCommandNamesDatabase("Plat"), RomInfo.BuildCommandParametersDatabase("Plat")); + OpenCommandsDatabase(RomInfo.BuildCommandNamesDatabase(gFamEnum.Plat), RomInfo.BuildCommandParametersDatabase(gFamEnum.Plat)); } private void heartGoldAndSoulSilverToolStripMenuItem_Click(object sender, EventArgs e) { - OpenCommandsDatabase(RomInfo.BuildCommandNamesDatabase("HG"), RomInfo.BuildCommandParametersDatabase("HG")); + OpenCommandsDatabase(RomInfo.BuildCommandNamesDatabase(gFamEnum.HGSS), RomInfo.BuildCommandParametersDatabase(gFamEnum.HGSS)); } private void mainTabControl_SelectedIndexChanged(object sender, EventArgs e) { if (mainTabControl.SelectedTab == headerEditorTabPage) { @@ -783,6 +772,7 @@ namespace DSPRE { } else if (mainTabControl.SelectedTab == trainerEditorTabPage) { if (!trainerEditorIsReady) { SetupTrainerEditor(); + SetupTrainerClassEncounterMusicTable(); trainerEditorIsReady = true; } } else if (mainTabControl.SelectedTab == tableEditorTabPage) { @@ -832,8 +822,8 @@ namespace DSPRE { } switch (RomInfo.gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: using (WildEditorDPPt editor = new WildEditorDPPt(wildPokeUnpackedPath, romInfo.GetPokémonNames(), encToOpen)) editor.ShowDialog(); break; @@ -896,7 +886,7 @@ namespace DSPRE { /*Add list of options to each control */ locationNameComboBox.Items.AddRange(new TextArchive(RomInfo.locationNamesTextNumber).messages.ToArray()); switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: areaIconComboBox.Enabled = false; areaIconPictureBox.Image = (Image)Properties.Resources.ResourceManager.GetObject("dpareaicon"); areaSettingsLabel.Text = "Show nametag:"; @@ -910,7 +900,7 @@ namespace DSPRE { battleBackgroundLabel.Location = new Point(battleBackgroundLabel.Location.X - 25, battleBackgroundLabel.Location.Y - 8); battleBackgroundUpDown.Location = new Point(battleBackgroundUpDown.Location.X - 25, battleBackgroundUpDown.Location.Y - 8); break; - case "Plat": + case gFamEnum.Plat: areaIconComboBox.Items.AddRange(PokeDatabase.Area.PtAreaIconValues); areaSettingsLabel.Text = "Show nametag:"; cameraComboBox.Items.AddRange(PokeDatabase.CameraAngles.DPPtCameraDict.Values.ToArray()); @@ -1011,9 +1001,9 @@ namespace DSPRE { string imageName; switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: break; - case "Plat": + case gFamEnum.Plat: ((HeaderPt)currentHeader).areaIcon = (byte)areaIconComboBox.SelectedIndex; imageName = "areaicon0" + areaIconComboBox.SelectedIndex.ToString(); areaIconPictureBox.Image = (Image)Properties.Resources.ResourceManager.GetObject(imageName); @@ -1068,7 +1058,7 @@ namespace DSPRE { if (flag3CheckBox.Checked) flagVal += (byte)Math.Pow(2, 3); - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { if (flag4CheckBox.Checked) flagVal += (byte)Math.Pow(2, 4); if (flag5CheckBox.Checked) @@ -1110,7 +1100,7 @@ namespace DSPRE { cameraUpDown.Value = currentHeader.cameraAngleID; battleBackgroundUpDown.Value = currentHeader.battleBackground; - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { areaSettingsComboBox.SelectedIndex = ((HeaderHGSS)currentHeader).locationType; } @@ -1119,7 +1109,7 @@ namespace DSPRE { /* Setup controls for fields with version-specific differences */ try { switch (RomInfo.gameFamily) { - case "DP": { + case gFamEnum.DP: { HeaderDP h = (HeaderDP)currentHeader; locationNameComboBox.SelectedIndex = h.locationName; @@ -1128,7 +1118,7 @@ namespace DSPRE { areaSettingsComboBox.SelectedIndex = areaSettingsComboBox.FindString("[" + $"{currentHeader.locationSpecifier:D3}"); break; } - case "Plat": { + case gFamEnum.Plat: { HeaderPt h = (HeaderPt)currentHeader; areaIconComboBox.SelectedIndex = h.areaIcon; @@ -1168,7 +1158,7 @@ namespace DSPRE { flag2CheckBox.Checked = ba[2]; flag3CheckBox.Checked = ba[3]; - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { flag4CheckBox.Checked = ba[4]; flag5CheckBox.Checked = ba[5]; flag6CheckBox.Checked = ba[6]; @@ -1205,10 +1195,10 @@ namespace DSPRE { return; switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: ((HeaderDP)currentHeader).locationName = (ushort)locationNameComboBox.SelectedIndex; break; - case "Plat": + case gFamEnum.Plat: ((HeaderPt)currentHeader).locationName = (byte)locationNameComboBox.SelectedIndex; break; default: @@ -1225,10 +1215,10 @@ namespace DSPRE { if (disableHandlers) return; switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: currentHeader.musicDayID = (ushort)(musicDayUpDown.Value = PokeDatabase.MusicDB.DPMusicDict.Keys.ElementAt(musicDayComboBox.SelectedIndex)); break; - case "Plat": + case gFamEnum.Plat: currentHeader.musicDayID = (ushort)(musicDayUpDown.Value = PokeDatabase.MusicDB.PtMusicDict.Keys.ElementAt(musicDayComboBox.SelectedIndex)); break; default: @@ -1241,10 +1231,10 @@ namespace DSPRE { return; switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: currentHeader.musicNightID = (ushort)(musicNightUpDown.Value = PokeDatabase.MusicDB.DPMusicDict.Keys.ElementAt(musicNightComboBox.SelectedIndex)); break; - case "Plat": + case gFamEnum.Plat: currentHeader.musicNightID = (ushort)(musicNightUpDown.Value = PokeDatabase.MusicDB.PtMusicDict.Keys.ElementAt(musicNightComboBox.SelectedIndex)); break; default: @@ -1261,10 +1251,10 @@ namespace DSPRE { currentHeader.musicDayID = updValue; try { switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: musicDayComboBox.SelectedItem = PokeDatabase.MusicDB.DPMusicDict[updValue]; break; - case "Plat": + case gFamEnum.Plat: musicDayComboBox.SelectedItem = PokeDatabase.MusicDB.PtMusicDict[updValue]; break; default: @@ -1285,10 +1275,10 @@ namespace DSPRE { currentHeader.musicNightID = updValue; try { switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: musicNightComboBox.SelectedItem = PokeDatabase.MusicDB.DPMusicDict[updValue]; break; - case "Plat": + case gFamEnum.Plat: musicNightComboBox.SelectedItem = PokeDatabase.MusicDB.PtMusicDict[updValue]; break; default: @@ -1314,10 +1304,10 @@ namespace DSPRE { disableHandlers = true; try { switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: weatherComboBox.SelectedItem = PokeDatabase.Weather.DPWeatherDict[currentHeader.weatherID]; break; - case "Plat": + case gFamEnum.Plat: weatherComboBox.SelectedItem = PokeDatabase.Weather.PtWeatherDict[currentHeader.weatherID]; break; default: @@ -1333,10 +1323,10 @@ namespace DSPRE { try { Dictionary dict; switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: dict = PokeDatabase.System.WeatherPics.dpWeatherImageDict; break; - case "Plat": + case gFamEnum.Plat: dict = PokeDatabase.System.WeatherPics.ptWeatherImageDict; break; default: @@ -1366,10 +1356,10 @@ namespace DSPRE { disableHandlers = true; try { switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: cameraComboBox.SelectedItem = PokeDatabase.CameraAngles.DPPtCameraDict[currentHeader.cameraAngleID]; break; - case "Plat": + case gFamEnum.Plat: cameraComboBox.SelectedItem = PokeDatabase.CameraAngles.DPPtCameraDict[currentHeader.cameraAngleID]; break; default: @@ -1385,11 +1375,11 @@ namespace DSPRE { string imageName; try { switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: currentHeader.cameraAngleID = (byte)cameraComboBox.SelectedIndex; imageName = "dpcamera" + cameraUpDown.Value.ToString(); break; - case "Plat": + case gFamEnum.Plat: currentHeader.cameraAngleID = (byte)cameraComboBox.SelectedIndex; imageName = "ptcamera" + cameraUpDown.Value.ToString(); break; @@ -1409,10 +1399,10 @@ namespace DSPRE { return; switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: weatherUpDown.Value = PokeDatabase.Weather.DPWeatherDict.Keys.ElementAt(weatherComboBox.SelectedIndex); break; - case "Plat": + case gFamEnum.Plat: weatherUpDown.Value = PokeDatabase.Weather.PtWeatherDict.Keys.ElementAt(weatherComboBox.SelectedIndex); break; default: @@ -1430,10 +1420,10 @@ namespace DSPRE { return; switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: cameraUpDown.Value = PokeDatabase.CameraAngles.DPPtCameraDict.Keys.ElementAt(cameraComboBox.SelectedIndex); break; - case "Plat": + case gFamEnum.Plat: cameraUpDown.Value = PokeDatabase.CameraAngles.DPPtCameraDict.Keys.ElementAt(cameraComboBox.SelectedIndex); break; default: @@ -1498,10 +1488,10 @@ namespace DSPRE { private void saveHeaderButton_Click(object sender, EventArgs e) { /* Check if dynamic headers patch has been applied, and save header to arm9 or a/0/5/0 accordingly */ if (ROMToolboxDialog.flag_DynamicHeadersPatchApplied || ROMToolboxDialog.CheckFilesDynamicHeadersPatchApplied()) { - DSUtils.WriteToFile(RomInfo.gameDirs[DirNames.dynamicHeaders].unpackedDir + "\\" + currentHeader.ID.ToString("D4"), currentHeader.ToByteArray(), 0, 0, true); + DSUtils.WriteToFile(RomInfo.gameDirs[DirNames.dynamicHeaders].unpackedDir + "\\" + currentHeader.ID.ToString("D4"), currentHeader.ToByteArray(), 0, 0, fromScratch: true); } else { uint headerOffset = (uint)(RomInfo.headerTableOffset + MapHeader.length * currentHeader.ID); - DSUtils.WriteToArm9(currentHeader.ToByteArray(), headerOffset); + DSUtils.WriteBytesToArm9(currentHeader.ToByteArray(), headerOffset); } disableHandlers = true; @@ -1558,13 +1548,13 @@ namespace DSPRE { string locationName = ""; switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: locationName = locationNameComboBox.Items[((HeaderDP)h).locationName].ToString(); break; - case "Plat": + case gFamEnum.Plat: locationName = locationNameComboBox.Items[((HeaderPt)h).locationName].ToString(); break; - case "HGSS": + case gFamEnum.HGSS: locationName = locationNameComboBox.Items[((HeaderHGSS)h).locationName].ToString(); break; } @@ -1597,11 +1587,11 @@ namespace DSPRE { return; switch (RomInfo.gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: currentHeader.locationSpecifier = Byte.Parse(areaSettingsComboBox.SelectedItem.ToString().Substring(1, 3)); break; - case "HGSS": + case gFamEnum.HGSS: HeaderHGSS ch = (HeaderHGSS)currentHeader; ch.locationType = (byte)areaSettingsComboBox.SelectedIndex; //areaImageLabel.Text = "Area icon"; @@ -1656,10 +1646,10 @@ namespace DSPRE { currentHeader = h; /* Check if dynamic headers patch has been applied, and save header to arm9 or a/0/5/0 accordingly */ if (ROMToolboxDialog.flag_DynamicHeadersPatchApplied || ROMToolboxDialog.CheckFilesDynamicHeadersPatchApplied()) { - DSUtils.WriteToFile(RomInfo.gameDirs[DirNames.dynamicHeaders].unpackedDir + "\\" + currentHeader.ID.ToString("D4"), currentHeader.ToByteArray(), 0, 0, true); + DSUtils.WriteToFile(RomInfo.gameDirs[DirNames.dynamicHeaders].unpackedDir + "\\" + currentHeader.ID.ToString("D4"), currentHeader.ToByteArray(), 0, 0, fromScratch: true); } else { uint headerOffset = (uint)(RomInfo.headerTableOffset + MapHeader.length * currentHeader.ID); - DSUtils.WriteToArm9(currentHeader.ToByteArray(), headerOffset); + DSUtils.WriteBytesToArm9(currentHeader.ToByteArray(), headerOffset); } try { @@ -1864,11 +1854,11 @@ namespace DSPRE { wildPokeUpDown.Value = encountersIDCopy; switch (RomInfo.gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: areaSettingsComboBox.SelectedIndex = shownameCopy; break; - case "HGSS": + case gFamEnum.HGSS: areaSettingsComboBox.SelectedIndex = areaSettingsCopy; break; } @@ -2758,7 +2748,7 @@ namespace DSPRE { DirNames.areaData, }); - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { DSUtils.TryUnpackNarcs(new List { DirNames.interiorBuildingModels }, toolStripProgressBar); } @@ -2769,8 +2759,8 @@ namespace DSPRE { collisionPainterPictureBox.Image = new Bitmap(100, 100); typePainterPictureBox.Image = new Bitmap(100, 100); switch (RomInfo.gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: mapPartsTabControl.TabPages.Remove(bgsTabPage); break; default: @@ -2783,8 +2773,8 @@ namespace DSPRE { for (int i = 0; i < romInfo.GetMapCount(); i++) { using (BinaryReader reader = new BinaryReader(File.OpenRead(RomInfo.gameDirs[DirNames.maps].unpackedDir + "\\" + i.ToString("D4")))) { switch (RomInfo.gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: reader.BaseStream.Position = 0x10 + reader.ReadUInt32() + reader.ReadUInt32() + 0x34; break; default: @@ -2842,12 +2832,12 @@ namespace DSPRE { selectMapComboBox.SelectedIndex = 0; exteriorbldRadioButton.Checked = true; switch (RomInfo.gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: mapTextureComboBox.SelectedIndex = 7; buildTextureComboBox.SelectedIndex = 1; break; - case "HGSS": + case gFamEnum.HGSS: mapTextureComboBox.SelectedIndex = 3; buildTextureComboBox.SelectedIndex = 1; break; @@ -3190,7 +3180,7 @@ namespace DSPRE { ModelSizeTXT.Text = currentMapFile.mapModelData.Length.ToString() + " B"; TerrainSizeTXT.Text = currentMapFile.bdhc.Length.ToString() + " B"; - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { BGSSizeTXT.Text = currentMapFile.bgs.Length.ToString() + " B"; } } @@ -3964,6 +3954,7 @@ namespace DSPRE { #endregion #region 3D Model Editor + public const ushort MAPMODEL_CRITICALSIZE = 61000; private void importMapButton_Click(object sender, EventArgs e) { OpenFileDialog im = new OpenFileDialog { Filter = "NSBMD model (*.nsbmd)|*.nsbmd" @@ -4014,7 +4005,7 @@ namespace DSPRE { #region BDHC Editor private void bdhcImportButton_Click(object sender, EventArgs e) { OpenFileDialog it = new OpenFileDialog(); - if (RomInfo.gameFamily == "DP") { + if (RomInfo.gameFamily == gFamEnum.DP) { it.Filter = "Terrain File (*.bdhc)|*.bdhc"; } else { it.Filter = "Terrain File (*.bdhc, *.bdhcam)|*.bdhc;*.bdhcam"; @@ -4263,7 +4254,7 @@ namespace DSPRE { eventMapFile.mapModel = LoadModelTextures(eventMapFile.mapModel, RomInfo.gameDirs[DirNames.mapTextures].unpackedDir, areaData.mapTileset); bool isInteriorMap = false; - if ((RomInfo.gameVersion == "HG" || RomInfo.gameVersion == "SS") && areaData.areaType == 0x0) + if ((RomInfo.gameVersion == gVerEnum.HeartGold || RomInfo.gameVersion == gVerEnum.SoulSilver) && areaData.areaType == 0x0) isInteriorMap = true; for (int i = 0; i < eventMapFile.buildings.Count; i++) { @@ -4540,15 +4531,15 @@ namespace DSPRE { RomInfo.SetOWtable(); RomInfo.Set3DOverworldsDict(); - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { DSUtils.TryUnpackNarcs(new List { DirNames.interiorBuildingModels }, toolStripProgressBar); } disableHandlers = true; if (File.Exists(RomInfo.OWtablePath)) { switch (RomInfo.gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: break; default: // HGSS Overlay 1 must be decompressed in order to read the overworld table @@ -6243,8 +6234,8 @@ namespace DSPRE { /* Enable gameVersion-specific controls */ switch (RomInfo.gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: break; default: areaDataDynamicTexturesNumericUpDown.Enabled = true; @@ -6709,6 +6700,39 @@ namespace DSPRE { ImageBase tiles; SpriteBase sprite; + Dictionary trainerClassEncounterMusicDict; + private void SetupTrainerClassEncounterMusicTable() { + RomInfo.SetEncounterMusicTableOffsetToRAMAddress(); + trainerClassEncounterMusicDict = new Dictionary(); + + uint encounterMusicTableTableStartAddress = BitConverter.ToUInt32(DSUtils.ReadBytesFromArm9(RomInfo.encounterMusicTableOffsetToRAMAddress, 4), 0) - 0x02000000; + + uint entrySize = 4; + uint tableSizeOffset = 10; + if (gameFamily == gFamEnum.HGSS) { + entrySize += 2; + tableSizeOffset += 2; + encounterSSEQNupDown.Enabled = true; + } + + byte tableEntriesCount = DSUtils.ReadByteFromArm9(RomInfo.encounterMusicTableOffsetToRAMAddress - tableSizeOffset); + + for (uint i = 0; i < tableEntriesCount; i++) { + uint entryOffset = encounterMusicTableTableStartAddress + entrySize * i; + + byte tclass = DSUtils.ReadByteFromArm9(entryOffset); + ushort musicD = BitConverter.ToUInt16(DSUtils.ReadBytesFromArm9(entryOffset + 2, 2), 0); + ushort? musicN; + + if (gameFamily == gFamEnum.HGSS) { + musicN = BitConverter.ToUInt16(DSUtils.ReadBytesFromArm9(entryOffset + 4, 2), 0); + } else { + musicN = null; + } + + trainerClassEncounterMusicDict[tclass] = (entryOffset, musicD, musicN); + } + } private void SetupTrainerEditor() { /* Extract essential NARCs sub-archives*/ statusLabel.Text = "Setting up Trainer Editor..."; @@ -7230,14 +7254,33 @@ namespace DSPRE { if (trainerClassListBox.SelectedIndex < 0) { return; } - LoadTrainerClassPic(); - UpdateTrainerClassPic(); + + try { + LoadTrainerClassPic(); + UpdateTrainerClassPic(); + } catch { + trClassFramePreviewUpDown.Maximum = 0; + } + trainerClassNameTextbox.Text = GetTrainerClassNameFromListbox(trainerClassListBox.SelectedItem); if (disableHandlers) { return; } currentTrainerFile.trp.trainerClass = (byte)trainerClassListBox.SelectedIndex; + + + (uint entryOffset, ushort musicD, ushort? musicN) output; + if (trainerClassEncounterMusicDict.TryGetValue(currentTrainerFile.trp.trainerClass, out output)) { + encounterSSEQDupDown.Value = output.musicD; + + if (gameFamily == gFamEnum.HGSS) { + encounterSSEQNupDown.Value = (ushort)output.musicN; + } + } else { + encounterSSEQDupDown.Value = 0; + encounterSSEQNupDown.Value = 0; + } } private void LoadTrainerClassPic() { @@ -7249,9 +7292,11 @@ namespace DSPRE { string tilesFilename = tilesFileID.ToString("D4"); tiles = new NCGR(gameDirs[DirNames.trainerGraphics].unpackedDir + "\\" + tilesFilename, tilesFileID, tilesFilename); - int spriteFileID = (trainerClassListBox.SelectedIndex * 5 + 2); - string spriteFilename = spriteFileID.ToString("D4"); - sprite = new NCER(gameDirs[DirNames.trainerGraphics].unpackedDir + "\\" + spriteFilename, spriteFileID, spriteFilename); + if (gameFamily == gFamEnum.HGSS) { + int spriteFileID = (trainerClassListBox.SelectedIndex * 5 + 2); + string spriteFilename = spriteFileID.ToString("D4"); + sprite = new NCER(gameDirs[DirNames.trainerGraphics].unpackedDir + "\\" + spriteFilename, spriteFileID, spriteFilename); + } trClassFramePreviewUpDown.Maximum = sprite.Banks.Length - 1; trainerClassFrameMaxLabel.Text = "/" + trClassFramePreviewUpDown.Maximum; @@ -7369,6 +7414,7 @@ namespace DSPRE { string trClass = GetTrainerClassNameFromListbox(trainerClassListBox.SelectedItem); trainerClassListBox.Items[currentClassID] = "[" + currentClassID + "]" + " " + newName; + DSUtils.WriteBytesToArm9(BitConverter.GetBytes((ushort)encounterSSEQDupDown.Value), trainerClassEncounterMusicDict[(byte)currentClassID].entryOffset, 0); disableHandlers = false; trainerClassListBox_SelectedIndexChanged(null, null); @@ -7384,17 +7430,17 @@ namespace DSPRE { List<(ushort header, ushort flag, ushort music)> conditionalMusicTable; uint conditionalMusicTableStartAddress; private void SetupTableEditor() { - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { RomInfo.SetConditionalMusicTableOffsetToRAMAddress(); conditionalMusicTable = new List<(ushort, ushort, ushort)>(); - conditionalMusicTableStartAddress = BitConverter.ToUInt32(DSUtils.ReadFromArm9(RomInfo.conditionalMusicTableOffsetToRAMAddress, 4), 0) - 0x02000000; - byte tableEntriesCount = DSUtils.ReadFromArm9(RomInfo.conditionalMusicTableOffsetToRAMAddress - 8, 1)[0]; + conditionalMusicTableStartAddress = BitConverter.ToUInt32(DSUtils.ReadBytesFromArm9(RomInfo.conditionalMusicTableOffsetToRAMAddress, 4), 0) - 0x02000000; + byte tableEntriesCount = DSUtils.ReadByteFromArm9(RomInfo.conditionalMusicTableOffsetToRAMAddress - 8); for (uint i = 0; i < tableEntriesCount; i++) { - ushort header = BitConverter.ToUInt16(DSUtils.ReadFromArm9(conditionalMusicTableStartAddress + 6 * i, 2), 0); - ushort flag = BitConverter.ToUInt16(DSUtils.ReadFromArm9(conditionalMusicTableStartAddress + 6 * i + 2, 2), 0); - ushort musicID = BitConverter.ToUInt16(DSUtils.ReadFromArm9(conditionalMusicTableStartAddress + 6 * i + 4, 2), 0); + ushort header = BitConverter.ToUInt16(DSUtils.ReadBytesFromArm9(conditionalMusicTableStartAddress + 6 * i, 2), 0); + ushort flag = BitConverter.ToUInt16(DSUtils.ReadBytesFromArm9(conditionalMusicTableStartAddress + 6 * i + 2, 2), 0); + ushort musicID = BitConverter.ToUInt16(DSUtils.ReadBytesFromArm9(conditionalMusicTableStartAddress + 6 * i + 4, 2), 0); conditionalMusicTable.Add((header, flag, musicID)); conditionalMusicTableListBox.Items.Add(headerListBox.Items[header]); @@ -7433,13 +7479,13 @@ namespace DSPRE { MapHeader selected = MapHeader.LoadFromARM9(newTuple.header); switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: locationNameConditionalMusicLBL.Text = RomInfo.GetLocationNames()[(selected as HeaderDP).locationName]; break; - case "Plat": + case gFamEnum.Plat: locationNameConditionalMusicLBL.Text = RomInfo.GetLocationNames()[(selected as HeaderPt).locationName]; break; - case "HGSS": + case gFamEnum.HGSS: locationNameConditionalMusicLBL.Text = RomInfo.GetLocationNames()[(selected as HeaderHGSS).locationName]; break; } @@ -7467,11 +7513,12 @@ namespace DSPRE { private void saveConditionalMusicTableBTN_Click(object sender, EventArgs e) { for (int i = 0; i < conditionalMusicTable.Count; i++) { - DSUtils.WriteToArm9(BitConverter.GetBytes(conditionalMusicTable[i].header), (uint)(conditionalMusicTableStartAddress + 6 * i)); - DSUtils.WriteToArm9(BitConverter.GetBytes(conditionalMusicTable[i].flag), (uint)(conditionalMusicTableStartAddress + 6 * i + 2)); - DSUtils.WriteToArm9(BitConverter.GetBytes(conditionalMusicTable[i].music), (uint)(conditionalMusicTableStartAddress + 6 * i + 4)); + DSUtils.WriteBytesToArm9(BitConverter.GetBytes(conditionalMusicTable[i].header), (uint)(conditionalMusicTableStartAddress + 6 * i)); + DSUtils.WriteBytesToArm9(BitConverter.GetBytes(conditionalMusicTable[i].flag), (uint)(conditionalMusicTableStartAddress + 6 * i + 2)); + DSUtils.WriteBytesToArm9(BitConverter.GetBytes(conditionalMusicTable[i].music), (uint)(conditionalMusicTableStartAddress + 6 * i + 4)); } } + #endregion private void ExclusiveCBInvert(CheckBox cb) { if (disableHandlers) diff --git a/DS_Map/Main Window.resx b/DS_Map/Main Window.resx index c08dd74..28ec663 100644 --- a/DS_Map/Main Window.resx +++ b/DS_Map/Main Window.resx @@ -117,6 +117,91 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 239, 17 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w + LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABy + EQAAAk1TRnQBSQFMAgEBCQEAAXwBFQF8ARUBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA + AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 + AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA + AWYDAAGZAwABzAIAATMDAAIzAgABMwFmAgABMwGZAgABMwHMAgABMwH/AgABZgMAAWYBMwIAAmYCAAFm + AZkCAAFmAcwCAAFmAf8CAAGZAwABmQEzAgABmQFmAgACmQIAAZkBzAIAAZkB/wIAAcwDAAHMATMCAAHM + AWYCAAHMAZkCAALMAgABzAH/AgAB/wFmAgAB/wGZAgAB/wHMAQABMwH/AgAB/wEAATMBAAEzAQABZgEA + ATMBAAGZAQABMwEAAcwBAAEzAQAB/wEAAf8BMwIAAzMBAAIzAWYBAAIzAZkBAAIzAcwBAAIzAf8BAAEz + AWYCAAEzAWYBMwEAATMCZgEAATMBZgGZAQABMwFmAcwBAAEzAWYB/wEAATMBmQ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iwHzBAAB8AEjATcBMQEOCwABSQFxApcBeAOX + AXEBSQQAARUBDwEVAwABFQEPARUHAAESAbwCAAEHAbMB1AGzAmwB7wgAAe8CDgHzDAABbAFxBJcBcQFs + GQABBwISAbwdAARxFwAB9AvzAfQTAA3zEwABBwvvAQcCAA8QAQABBw2zAQcHAARDBwAB7wEAAbsGswG7 + AgAB7wIAARAGOAEQBtMBEAEAAbMNAAGzBQACQwTwAkMFAAHvAQABswYAAbMCAAHvAgABEAI4AwABOAEQ + AtMCAALTARABAAGzDQABswQAAUMI8AFDBAAB7wEAAa0BAAGXAlYBlwEAAbMCAAHvAgABEAM4AQACOAEQ + AdMBAALTAQAB0wEQAQABswEAAVYJUAFWAQABswMAAUMD8AGSAkMBkgPwAUMDAAHvAQABrQEABFYBAAGz + AfQBAAHvAgABEAI4AgACOAEQAdMBAALTAQAB0wEQAQABswEAC1YBAAGzAwABQwHwAZIBEgFDAfABkgFD + ARIBkgHwAUMDAAHvAQABrQEABFYBAAGzAfQBAAHvAgABEAM4AQACOAEQAtMCAALTARABAAGzAQALVgEA + AbMCAAFDAfABEgJjAUMBAAHwAUMCYwESAfABQwIAAe8BAAGtAQAEeAEAAbMB9AEAAe8CAAEQBjgBEAbT + ARABAAGzAQALVgEAAbMCAAFDARIERwJDBEcBEgFDAgAB7wEAAa0GAAGzAfMBAAHvAgAPEAEAAbMBAAtW + AQABswIAAUMMRwFDAgAB7wEAAbsCrQSzAbsB8wEAAe8CAAEQBkcBEAYAARABAAGzAQALVgEAAbMCAAFD + DEcBQwIAAe8BAAHzA/QB8wH0BAAB7wIAARACRwIAAkcBEAYAARABAAGzAQALVgEAAbMDAAFDAkcClAZH + AUMDAAHvAQABdAIyASwBdAEAAbwC9wEAAe8CAAEQAUcBAAJHAQABRwEQBgABEAEAAbMBAAFWCXgBVgEA + AbMDAAFDAUcElAVHAUMDAAHvAQABLAPDAVMBAAH3AgAB8wHwAgABEAFHAQACRwEAAUcBEAYAARABAAGz + AQALeAEAAb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kNswEJEQABQgFNAT4HAAE+AwABKAMAAUADAAEwAwABAQEAAQEFAAGAAQEWAAP/AQAC/wYA - Af8BgQYAAf8HAAH/ATAGAAH/AeEGAAH/AcEGAAHxAYMGAAHhAQ4GAAHgBwABwAGBBgABwAF/BgABxAF/ - BgABhAF/BgABhAE/BgABjAF/BgAC/wYAAf8BjwG/Af8B4AEHAv8B+AEHAo8BwAEDAv8BwAEHAY8BBwHA - AQMBgAE8AYABBwGOAQMBgAEBAQABGAGAAQMBgAEBAYABAQIAAYABAwGAAQEBgAEBAgABgAEBAYABAAGA - AQECAAHAAQEBwAEAAYABAQEAARgBwAEAAcABAQGAAQEBgAE8AcABAAHAAQEBgAEBAY4BPwHAAQAB4AEP - AYABAQEEAR8BgAEAAeABHwHAAQMBJAGfAgAB4AE/AcABAwEEAR8BAAEBAeAB/wHgAQcBjgE/AZgBDwHw - Af8B8AEPAv8B+AF/Av8B/AE/Av8BgAEDAv8BgAEDAv8BgAEDAQABAQEAAQEB/AE/AaABGwEAAQEBfwH9 - AfABDwGvAdsBAAExAX8B/QHgAQcBqAFbAQABSQFAAQUBwAEDAagBSwEAAUkBQAEFAcABAwGoAUsBAAEx - AUABBQGBAQEBqAFLAQABAQFAAQUBgAEBAa8BywEAAQEBQAEFAYABAQGgAQsBAAH9AUABBQGAAQEBoAF7 - ARgBxQFAAQUBwAEDAaABiwEkAe0BQAEFAcABAwGgAbMBJAHNAUABBQHgAQcBoAGnARgB7QFAAQUB8AEP - Ab8BzwEAAf0BfwH9AfwBPwGAAR8BAAEBAQABAQL/Cw== - - 17, 17 @@ -1027,6 +1030,9 @@ qcnkDWXJtp9DVaw7AAAAAElFTkSuQmCC + + 533, 20 + 25 diff --git a/DS_Map/ROMFiles/MapFile.cs b/DS_Map/ROMFiles/MapFile.cs index 100b1d7..4e2dac0 100644 --- a/DS_Map/ROMFiles/MapFile.cs +++ b/DS_Map/ROMFiles/MapFile.cs @@ -67,7 +67,7 @@ namespace DSPRE.ROMFiles { int bdhcSectionLength = reader.ReadInt32(); /* Read background sounds section */ - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { ushort signature = reader.ReadUInt16(); if (signature != 0x1234) { MessageBox.Show("The header section of this map's BackGround Sound data is corrupted.", @@ -188,7 +188,7 @@ namespace DSPRE.ROMFiles { writer.Write(bdhc.Length); /* Write soundplate section for HG/SS */ - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { writer.Write(bgs); } diff --git a/DS_Map/ROMFiles/MapHeader.cs b/DS_Map/ROMFiles/MapHeader.cs index 89876cb..e0108ae 100644 --- a/DS_Map/ROMFiles/MapHeader.cs +++ b/DS_Map/ROMFiles/MapHeader.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.IO; using System.Windows.Forms; +using static DSPRE.RomInfo; namespace DSPRE.ROMFiles { /* ---------------------- HEADER DATA STRUCTURE (DPPt):---------------------------- @@ -132,9 +133,9 @@ namespace DSPRE.ROMFiles { } switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: return new HeaderDP(headerNumber, new MemoryStream(headerData)); - case "Plat": + case gFamEnum.Plat: return new HeaderPt(headerNumber, new MemoryStream(headerData)); default: return new HeaderHGSS(headerNumber, new MemoryStream(headerData)); diff --git a/DS_Map/ROMFiles/ScriptFile.cs b/DS_Map/ROMFiles/ScriptFile.cs index 56e69a6..07ff515 100644 --- a/DS_Map/ROMFiles/ScriptFile.cs +++ b/DS_Map/ROMFiles/ScriptFile.cs @@ -177,8 +177,8 @@ namespace DSPRE.ROMFiles { /* How to read parameters for different commands for DPPt*/ switch (RomInfo.gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: switch (id) { case 0x16: //Jump case 0x1A: //Call @@ -288,7 +288,7 @@ namespace DSPRE.ROMFiles { break; case 0x2C5: { - if (RomInfo.gameVersion == "Plat") { + if (RomInfo.gameVersion == gVerEnum.Platinum) { parameterList.Add(dataReader.ReadBytes(2)); parameterList.Add(dataReader.ReadBytes(2)); } else { @@ -300,12 +300,12 @@ namespace DSPRE.ROMFiles { case 0x2C9: case 0x2CA: case 0x2CD: - if (RomInfo.gameVersion == "Plat") + if (RomInfo.gameVersion == gVerEnum.Platinum) break; else goto default; case 0x2CF: - if (RomInfo.gameVersion == "Plat") { + if (RomInfo.gameVersion == gVerEnum.Platinum) { parameterList.Add(dataReader.ReadBytes(2)); parameterList.Add(dataReader.ReadBytes(2)); } else { @@ -317,7 +317,7 @@ namespace DSPRE.ROMFiles { break; } break; - case "HGSS": + case gFamEnum.HGSS: switch (id) { case 0x16: //Jump case 0x1A: //Call diff --git a/DS_Map/ROMToolboxDialog.cs b/DS_Map/ROMToolboxDialog.cs index d8316f1..8026386 100644 --- a/DS_Map/ROMToolboxDialog.cs +++ b/DS_Map/ROMToolboxDialog.cs @@ -25,7 +25,7 @@ namespace DSPRE { initOffset = ToolboxDB.arm9ExpansionOffsetsDB[nameof(initOffset) + "_" + RomInfo.gameFamily + "_" + RomInfo.gameLanguage] - 0x02000000; branchString = ToolboxDB.arm9ExpansionCodeDB[nameof(branchString) + "_" + RomInfo.gameFamily + "_" + RomInfo.gameLanguage]; - if (RomInfo.gameFamily == "Plat") { + if (RomInfo.gameFamily == gFamEnum.Plat) { initString = ToolboxDB.arm9ExpansionCodeDB[nameof(initString) + "_" + RomInfo.gameFamily + "_" + RomInfo.gameLanguage]; } else { initString = ToolboxDB.arm9ExpansionCodeDB[nameof(initString) + "_" + RomInfo.gameFamily]; @@ -48,7 +48,7 @@ namespace DSPRE { internal BDHCAMPatchData() { switch (RomInfo.gameFamily) { - case "Plat": + case gFamEnum.Plat: overlayNumber = 5; branchString = ToolboxDB.BDHCamCodeDB[nameof(branchString) + "_" + RomInfo.gameFamily + "_" + RomInfo.gameLanguage]; @@ -56,7 +56,7 @@ namespace DSPRE { overlayOffset1 = ToolboxDB.BDHCamOffsetsDB[nameof(overlayOffset1) + "_" + RomInfo.gameFamily + "_" + RomInfo.gameLanguage]; overlayOffset2 = ToolboxDB.BDHCamOffsetsDB[nameof(overlayOffset2) + "_" + RomInfo.gameFamily + "_" + RomInfo.gameLanguage]; break; - case "HGSS": + case gFamEnum.HGSS: overlayNumber = 1; branchString = ToolboxDB.BDHCamCodeDB[nameof(branchString) + "_" + RomInfo.gameFamily]; @@ -89,7 +89,7 @@ namespace DSPRE { initOffset = ToolboxDB.getDynamicHeadersInitOffset(RomInfo.romID); initString = ToolboxDB.getDynamicHeadersInitString(RomInfo.romID); - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { pointerDiff = (int)(initOffset - ToolboxDB.getDynamicHeadersInitOffset("IPKE")); } else { pointerDiff = (int)(initOffset - ToolboxDB.getDynamicHeadersInitOffset("CPUE")); @@ -120,20 +120,20 @@ namespace DSPRE { } switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: DisableOverlay1patch("Unsupported"); DisableDynamicHeadersPatch("Unsupported"); DisableMatrixExpansionPatch("Unsupported"); DisableScrcmdRepointPatch("Unsupported"); break; - case "Plat": + case gFamEnum.Plat: DisableOverlay1patch("Unsupported"); DisableMatrixExpansionPatch("Unsupported"); DisableScrcmdRepointPatch("Unsupported"); CheckBDHCamPatchApplied(); CheckDynamicHeadersPatchApplied(); break; - case "HGSS": + case gFamEnum.HGSS: if (!DSUtils.CheckOverlayHasCompressionFlag(1)) { DisableOverlay1patch("Already applied"); overlay1CB.Visible = true; @@ -207,12 +207,12 @@ namespace DSPRE { ARM9PatchData data = new ARM9PatchData(); byte[] branchCode = DSUtils.HexStringToByteArray(data.branchString); - byte[] branchCodeRead = DSUtils.ReadFromArm9(data.branchOffset, data.branchString.Length / 3 + 1); //Read branchCode + byte[] branchCodeRead = DSUtils.ReadBytesFromArm9(data.branchOffset, data.branchString.Length / 3 + 1); //Read branchCode if (branchCodeRead.Length != branchCode.Length || !branchCodeRead.SequenceEqual(branchCode)) return false; byte[] initCode = DSUtils.HexStringToByteArray(data.initString); - byte[] initCodeRead = DSUtils.ReadFromArm9(data.initOffset, data.initString.Length / 3 + 1); //Read initCode + byte[] initCodeRead = DSUtils.ReadBytesFromArm9(data.initOffset, data.initString.Length / 3 + 1); //Read initCode if (initCodeRead.Length != initCode.Length || !initCodeRead.SequenceEqual(initCode)) return false; @@ -222,7 +222,7 @@ namespace DSPRE { BDHCAMPatchData data = new BDHCAMPatchData(); byte[] branchCode = DSUtils.HexStringToByteArray(data.branchString); - byte[] branchCodeRead = DSUtils.ReadFromArm9(data.branchOffset, branchCode.Length); + byte[] branchCodeRead = DSUtils.ReadBytesFromArm9(data.branchOffset, branchCode.Length); if (branchCode.Length != branchCodeRead.Length || !branchCode.SequenceEqual(branchCodeRead)) return false; @@ -256,7 +256,7 @@ namespace DSPRE { if (RomInfo.romID == "IPKE" || RomInfo.romID == "IPGE" || RomInfo.romID == "IPGS") languageOffset = +8; - byte[] read = DSUtils.ReadFromArm9((uint)(offset - 0x02000000 + languageOffset), kv.Value.Length / 3 + 1); + byte[] read = DSUtils.ReadBytesFromArm9((uint)(offset - 0x02000000 + languageOffset), kv.Value.Length / 3 + 1); byte[] code = DSUtils.HexStringToByteArray(kv.Value); if (read.Length != code.Length || !read.SequenceEqual(code)) return false; @@ -315,8 +315,8 @@ namespace DSPRE { DisableARM9patch("Already applied"); switch (RomInfo.gameFamily) { - case "Plat": - case "HGSS": + case gFamEnum.Plat: + case gFamEnum.HGSS: BDHCamARM9requiredLBL.Visible = false; BDHCamPatchButton.Enabled = true; BDHCamPatchLBL.Enabled = true; @@ -342,7 +342,7 @@ namespace DSPRE { public static bool CheckFilesDynamicHeadersPatchApplied() { DynamicHeadersPatchData data = new DynamicHeadersPatchData(); - ushort initValue = BitConverter.ToUInt16(DSUtils.ReadFromArm9(data.initOffset, 0x2), 0); + ushort initValue = BitConverter.ToUInt16(DSUtils.ReadBytesFromArm9(data.initOffset, 0x2), 0); return initValue == 0xB500; } @@ -397,7 +397,7 @@ namespace DSPRE { private void BDHCAMPatchButton_Click(object sender, EventArgs e) { BDHCAMPatchData data = new BDHCAMPatchData(); - if (RomInfo.gameFamily == "HGSS") { + if (RomInfo.gameFamily == gFamEnum.HGSS) { if (DSUtils.CheckOverlayHasCompressionFlag(data.overlayNumber)) { DialogResult d1 = MessageBox.Show("It is STRONGLY recommended to configure Overlay1 as uncompressed before proceeding.\n\n" + "More details in the following dialog.\n\n" + "Do you want to know more?", @@ -424,7 +424,7 @@ namespace DSPRE { File.Copy(RomInfo.arm9Path, RomInfo.arm9Path + backupSuffix, overwrite: true); try { - DSUtils.WriteToArm9(DSUtils.HexStringToByteArray(data.branchString), data.branchOffset); //Write new branchOffset + DSUtils.WriteBytesToArm9(DSUtils.HexStringToByteArray(data.branchString), data.branchOffset); //Write new branchOffset /* Write to overlayfile */ string overlayFilePath = RomInfo.workDir + "overlay" + "\\" + "overlay_" + data.overlayNumber.ToString("D4") + ".bin"; @@ -549,8 +549,8 @@ namespace DSPRE { File.Copy(RomInfo.arm9Path, RomInfo.arm9Path + backupSuffix, overwrite: true); try { - DSUtils.WriteToArm9(DSUtils.HexStringToByteArray(data.branchString), data.branchOffset); //Write new branchOffset - DSUtils.WriteToArm9(DSUtils.HexStringToByteArray(data.initString), data.initOffset); //Write new initOffset + DSUtils.WriteBytesToArm9(DSUtils.HexStringToByteArray(data.branchString), data.branchOffset); //Write new branchOffset + DSUtils.WriteBytesToArm9(DSUtils.HexStringToByteArray(data.initString), data.initOffset); //Write new initOffset string fullFilePath = RomInfo.gameDirs[DirNames.synthOverlay].unpackedDir + '\\' + expandedARMfileID.ToString("D4"); File.Delete(fullFilePath); @@ -564,8 +564,8 @@ namespace DSPRE { ROMToolboxDialog.flag_arm9Expanded = true; switch (RomInfo.gameFamily) { - case "Plat": - case "HGSS": + case gFamEnum.Plat: + case gFamEnum.HGSS: BDHCamPatchButton.Text = "Apply Patch"; BDHCamPatchButton.Enabled = true; BDHCamPatchLBL.Enabled = true; @@ -614,7 +614,7 @@ namespace DSPRE { try { foreach (KeyValuePair kv in ToolboxDB.matrixExpansionDB) { foreach (uint offset in kv.Key) { - DSUtils.WriteToArm9(DSUtils.HexStringToByteArray(kv.Value), (uint)(offset - 0x02000000 + languageOffset)); + DSUtils.WriteBytesToArm9(DSUtils.HexStringToByteArray(kv.Value), (uint)(offset - 0x02000000 + languageOffset)); } } } catch { @@ -633,7 +633,7 @@ namespace DSPRE { DynamicHeadersPatchData data = new DynamicHeadersPatchData(); var headersDir = RomInfo.gameDirs[DirNames.dynamicHeaders]; - bool specialCase = RomInfo.gameFamily == "HGSS" && RomInfo.gameLanguage != "JAP" && RomInfo.gameLanguage != "ESP"; + bool specialCase = RomInfo.gameFamily == gFamEnum.HGSS && RomInfo.gameLanguage != "JAP" && RomInfo.gameLanguage != "ESP"; string specialCaseChanges = ""; if (specialCase) { @@ -695,7 +695,7 @@ namespace DSPRE { DE F7 3D F9 bl 0x02017E6C @Free_Memory */ - DSUtils.WriteToArm9(DSUtils.HexStringToByteArray(data.initString), data.initOffset); + DSUtils.WriteBytesToArm9(DSUtils.HexStringToByteArray(data.initString), data.initOffset); /* - Neutralize instances of (HeaderID * 0x18) so the base offset which the data is read from is always 0x0: @@ -717,18 +717,18 @@ namespace DSPRE { */ foreach (Tuple reference in ToolboxDB.dynamicHeadersPointersDB [RomInfo.gameFamily]) { - DSUtils.WriteToArm9(DSUtils.HexStringToByteArray(data.REFERENCE_STRING), (uint)(reference.Item1 + data.pointerDiff)); - uint pointerValue = BitConverter.ToUInt32(DSUtils.ReadFromArm9((uint)(reference.Item2 + data.pointerDiff), 4), 0) - RomInfo.headerTableOffset - 0x02000000; - DSUtils.WriteToArm9(BitConverter.GetBytes(pointerValue), (uint)(reference.Item2 + data.pointerDiff)); + DSUtils.WriteBytesToArm9(DSUtils.HexStringToByteArray(data.REFERENCE_STRING), (uint)(reference.Item1 + data.pointerDiff)); + uint pointerValue = BitConverter.ToUInt32(DSUtils.ReadBytesFromArm9((uint)(reference.Item2 + data.pointerDiff), 4), 0) - RomInfo.headerTableOffset - 0x02000000; + DSUtils.WriteBytesToArm9(BitConverter.GetBytes(pointerValue), (uint)(reference.Item2 + data.pointerDiff)); } if (specialCase) { /* Special case: at 0x3B522 (non-JAP and non-Spanish HG offset) there is an instruction between the (mov r1, #0x18) and (mul r1, r0) commands, so we must handle this separately */ - DSUtils.WriteToArm9(DSUtils.HexStringToByteArray(data.specialCaseData1), (uint)(data.specialCaseOffset1 + data.pointerDiff)); - DSUtils.WriteToArm9(DSUtils.HexStringToByteArray(data.specialCaseData2), (uint)(data.specialCaseOffset2 + data.pointerDiff)); - DSUtils.WriteToArm9(DSUtils.HexStringToByteArray(data.specialCaseData3), (uint)(data.specialCaseOffset3 + data.pointerDiff)); + DSUtils.WriteBytesToArm9(DSUtils.HexStringToByteArray(data.specialCaseData1), (uint)(data.specialCaseOffset1 + data.pointerDiff)); + DSUtils.WriteBytesToArm9(DSUtils.HexStringToByteArray(data.specialCaseData2), (uint)(data.specialCaseOffset2 + data.pointerDiff)); + DSUtils.WriteBytesToArm9(DSUtils.HexStringToByteArray(data.specialCaseData3), (uint)(data.specialCaseOffset3 + data.pointerDiff)); } // Clear the dynamic headers directory in 'unpacked' @@ -847,29 +847,27 @@ namespace DSPRE { int asmOffset = Int32.Parse(node.Element("asmoffset").Value, System.Globalization.NumberStyles.HexNumber); string asmCode = node.Element("asmcode").Value.Replace("\n", "").Replace("\t", "").Replace(" ", ""); - if ((RomInfo.gameVersion != targetROM) || (RomInfo.gameLanguage != targetLang)) { - continue; - } - - expandedReader.BaseStream.Position = 0x200 + commandID * 4; - if (expandedReader.ReadUInt32() != 0) { - DialogResult d; - d = MessageBox.Show("Script command " + commandID.ToString("X4") + " is already used.\n\n" + - "Do you really want to overwrite it?", - "Confirm to proceed", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - if (d == DialogResult.No) { - continue; + if (RomInfo.gameVersion.ToString().Equals(targetROM) && RomInfo.gameLanguage.Equals(targetLang)) { + expandedReader.BaseStream.Position = 0x200 + commandID * 4; + if (expandedReader.ReadUInt32() != 0) { + DialogResult d; + d = MessageBox.Show("Script command " + commandID.ToString("X4") + " is already used.\n\n" + + "Do you really want to overwrite it?", + "Confirm to proceed", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (d == DialogResult.No) { + continue; + } } + + expandedWriter.BaseStream.Position = 0x200 + commandID * 4; + expandedWriter.Write((UInt32)(0x023C8000 + asmOffset + 1)); + + byte[] asmCodeBytes = DSUtils.StringToByteArray(asmCode); + expandedWriter.BaseStream.Position = asmOffset; + expandedWriter.Write(asmCodeBytes); + + appliedPatches++; } - - expandedWriter.BaseStream.Position = 0x200 + commandID * 4; - expandedWriter.Write((UInt32)(0x023C8000 + asmOffset + 1)); - - byte[] asmCodeBytes = DSUtils.StringToByteArray(asmCode); - expandedWriter.BaseStream.Position = asmOffset; - expandedWriter.Write(asmCodeBytes); - - appliedPatches++; } } catch { diff --git a/DS_Map/Resources/PokeDatabase.cs b/DS_Map/Resources/PokeDatabase.cs index 58950e3..b67e1de 100644 --- a/DS_Map/Resources/PokeDatabase.cs +++ b/DS_Map/Resources/PokeDatabase.cs @@ -1,6 +1,7 @@ using DSPRE.ROMFiles; using System.Collections.Generic; using System.Drawing; +using static DSPRE.RomInfo; namespace DSPRE.Resources { public static class PokeDatabase { @@ -17,6 +18,7 @@ namespace DSPRE.Resources { "[08] Island", "[09] Wood" }; + public static Dictionary HGSSAreaIconsDict = new Dictionary() { [00] = "Not displayed", [01] = "Wall", @@ -3436,42 +3438,42 @@ namespace DSPRE.Resources { }; } public static class System { - public static Dictionary versionsDict = new Dictionary() { - ["ADAE"] = "D", - ["ADAS"] = "D", - ["ADAI"] = "D", - ["ADAF"] = "D", - ["ADAD"] = "D", - ["ADAJ"] = "D", + public static Dictionary versionsDict = new Dictionary() { + ["ADAE"] = gVerEnum.Diamond, + ["ADAS"] = gVerEnum.Diamond, + ["ADAI"] = gVerEnum.Diamond, + ["ADAF"] = gVerEnum.Diamond, + ["ADAD"] = gVerEnum.Diamond, + ["ADAJ"] = gVerEnum.Diamond, - ["APAE"] = "P", - ["APAS"] = "P", - ["APAI"] = "P", - ["APAF"] = "P", - ["APAD"] = "P", - ["APAJ"] = "P", + ["APAE"] = gVerEnum.Pearl, + ["APAS"] = gVerEnum.Pearl, + ["APAI"] = gVerEnum.Pearl, + ["APAF"] = gVerEnum.Pearl, + ["APAD"] = gVerEnum.Pearl, + ["APAJ"] = gVerEnum.Pearl, - ["CPUE"] = "Plat", - ["CPUS"] = "Plat", - ["CPUI"] = "Plat", - ["CPUF"] = "Plat", - ["CPUD"] = "Plat", - ["CPUJ"] = "Plat", - ["CPUP"] = "Plat", + ["CPUE"] = gVerEnum.Platinum, + ["CPUS"] = gVerEnum.Platinum, + ["CPUI"] = gVerEnum.Platinum, + ["CPUF"] = gVerEnum.Platinum, + ["CPUD"] = gVerEnum.Platinum, + ["CPUJ"] = gVerEnum.Platinum, + ["CPUP"] = gVerEnum.Platinum, - ["IPKE"] = "HG", - ["IPKS"] = "HG", - ["IPKI"] = "HG", - ["IPKF"] = "HG", - ["IPKD"] = "HG", - ["IPKJ"] = "HG", + ["IPKE"] = gVerEnum.HeartGold, + ["IPKS"] = gVerEnum.HeartGold, + ["IPKI"] = gVerEnum.HeartGold, + ["IPKF"] = gVerEnum.HeartGold, + ["IPKD"] = gVerEnum.HeartGold, + ["IPKJ"] = gVerEnum.HeartGold, - ["IPGE"] = "SS", - ["IPGS"] = "SS", - ["IPGI"] = "SS", - ["IPGF"] = "SS", - ["IPGD"] = "SS", - ["IPGJ"] = "SS" + ["IPGE"] = gVerEnum.SoulSilver, + ["IPGS"] = gVerEnum.SoulSilver, + ["IPGI"] = gVerEnum.SoulSilver, + ["IPGF"] = gVerEnum.SoulSilver, + ["IPGD"] = gVerEnum.SoulSilver, + ["IPGJ"] = gVerEnum.SoulSilver }; public static Dictionary MapCollisionPainters = new Dictionary() { @@ -4087,7 +4089,6 @@ namespace DSPRE.Resources { [494] = "Egg", [495] = "Bad Egg" }; - public static class MatrixCellColors { /* Initialize dictionary of colors corresponding to border maps in the matrix editor */ public static Dictionary, (Color back, Color fore)> DPPtmatrixColorsDict = new Dictionary, (Color back, Color fore)> { @@ -4175,9 +4176,8 @@ namespace DSPRE.Resources { [new byte[] { 28 }] = "ptredish", [new byte[] { 29 }] = "ptblueish", [new byte[] { 30 }] = "ptdim", - - }; + public static Dictionary hgssweatherImageDict = new Dictionary() { [new byte[] { 0}] = "hgssnormal", [new byte[] { 1, 2, 3, 4 }] = "hgssrain", diff --git a/DS_Map/Resources/ROMToolboxDB/ToolboxDB.cs b/DS_Map/Resources/ROMToolboxDB/ToolboxDB.cs index a3a39e7..c134111 100644 --- a/DS_Map/Resources/ROMToolboxDB/ToolboxDB.cs +++ b/DS_Map/Resources/ROMToolboxDB/ToolboxDB.cs @@ -1,12 +1,13 @@ using System; using System.Collections.Generic; +using static DSPRE.RomInfo; namespace DSPRE.Resources.ROMToolboxDB { public class ToolboxDB { - public static Dictionary syntheticOverlayFileNumbersDB = new Dictionary() { - ["DP"] = 9, - ["Plat"] = 9, - ["HGSS"] = 0, + public static Dictionary syntheticOverlayFileNumbersDB = new Dictionary() { + [gFamEnum.DP] = 9, + [gFamEnum.Plat] = 9, + [gFamEnum.HGSS] = 0, }; public static Dictionary arm9ExpansionCodeDB = new Dictionary() { @@ -98,10 +99,10 @@ namespace DSPRE.Resources.ROMToolboxDB { return "00 B5 01 1C 32 20 00 22 CC F7 58 F9 03 1C DF F7 49 FC 00 BD"; } } - public static Dictionary[]> dynamicHeadersPointersDB = new Dictionary[]>() { + public static Dictionary[]> dynamicHeadersPointersDB = new Dictionary[]>() { // format: headerID*18 offset, (ARM9_HEADER_TABLE_OFFSET + n) offset - ["Plat"] = new Tuple[] { + [gFamEnum.Plat] = new Tuple[] { new Tuple(0x3A03E, 0x3A048), new Tuple(0x3A052, 0x3A05C), new Tuple(0x3A066, 0x3A080), @@ -124,7 +125,7 @@ namespace DSPRE.Resources.ROMToolboxDB { new Tuple(0x3A212, 0x3A224), }, - ["HGSS"] = new Tuple[] { + [gFamEnum.HGSS] = new Tuple[] { new Tuple(0x3B282, 0x3B28C), new Tuple(0x3B296, 0x3B2A8), new Tuple(0x3B2B2, 0x3B2BC), diff --git a/DS_Map/RomInfo.cs b/DS_Map/RomInfo.cs index 005f4aa..8aa79d9 100644 --- a/DS_Map/RomInfo.cs +++ b/DS_Map/RomInfo.cs @@ -21,10 +21,9 @@ namespace DSPRE { public static string arm9Path { get; private set; } public static string overlayTablePath { get; set; } public static string overlayPath { get; set; } - public static string gameVersion { get; private set; } public static string gameLanguage { get; private set; } - public static string gameFamily { get; private set; } - public static string gameName { get; private set; } + public static gVerEnum gameVersion { get; private set; } + public static gFamEnum gameFamily { get; private set; } public static uint arm9spawnOffset { get; private set; } public static int initialMoneyOverlayNumber { get; private set; } @@ -35,6 +34,7 @@ namespace DSPRE { public static uint headerTableOffset { get; private set; } public static uint conditionalMusicTableOffsetToRAMAddress { get; internal set; } + public static uint encounterMusicTableOffsetToRAMAddress { get; internal set; } public static uint OWTableOffset { get; internal set; } public static string OWtablePath { get; private set; } @@ -59,6 +59,19 @@ namespace DSPRE { public static uint[] overworldTableKeys { get; private set; } public static Dictionary ow3DSpriteDict { get; private set; } + public enum gVerEnum : byte { + Diamond, Pearl, Platinum, + HeartGold, SoulSilver, + Black, White, + Black2, White2 + } + public enum gFamEnum : byte { + DP, + Plat, + HGSS, + BW, + BW2 + } public enum DirNames : byte { synthOverlay, dynamicHeaders, @@ -103,13 +116,15 @@ namespace DSPRE { overlayPath = workDir + "overlay"; internalNamesLocation = workDir + @"data\fielddata\maptable\mapname.bin"; - LoadGameVersion(); - if (gameVersion is null) { + try { + gameVersion = PokeDatabase.System.versionsDict[romID]; + } catch (KeyNotFoundException) { + MessageBox.Show("The ROM you attempted to load is not supported.\nYou can only load Gen IV Pokémon ROMS, for now.", "Unsupported ROM", + MessageBoxButtons.OK, MessageBoxIcon.Error); return; } LoadGameFamily(); - LoadGameName(); LoadGameLanguage(); SetNarcDirs(); @@ -125,23 +140,23 @@ namespace DSPRE { SetTrainerClassMessageNumber(); /* System */ - ScriptCommandNamesDict = BuildCommandNamesDatabase(gameVersion); - ScriptCommandParametersDict = BuildCommandParametersDatabase(gameVersion); - ScriptActionNamesDict = BuildActionNamesDatabase(gameVersion); + ScriptCommandNamesDict = BuildCommandNamesDatabase(gameFamily); + ScriptCommandParametersDict = BuildCommandParametersDatabase(gameFamily); + ScriptActionNamesDict = BuildActionNamesDatabase(gameFamily); } #endregion #region Methods (22) - public static Dictionary BuildCommandNamesDatabase(string gameVer) { + public static Dictionary BuildCommandNamesDatabase(gFamEnum gameFam) { Dictionary commonDictionaryNames; Dictionary specificDictionaryNames; - switch (gameFamily) { - case "DP": + switch (gameFam) { + case gFamEnum.DP: commonDictionaryNames = PokeDatabase.ScriptEditor.DPPtScrCmdNames; specificDictionaryNames = PokeDatabase.ScriptEditor.DPScrCmdNames; break; - case "Plat": + case gFamEnum.Plat: commonDictionaryNames = PokeDatabase.ScriptEditor.DPPtScrCmdNames; specificDictionaryNames = PokeDatabase.ScriptEditor.PlatScrCmdNames; break; @@ -152,16 +167,16 @@ namespace DSPRE { } return commonDictionaryNames.Concat(specificDictionaryNames).ToLookup(x => x.Key, x => x.Value).ToDictionary(x => x.Key, g => g.First()); } - public static Dictionary BuildCommandParametersDatabase(string gameVer) { + public static Dictionary BuildCommandParametersDatabase(gFamEnum gameFam) { Dictionary commonDictionaryParams; Dictionary specificDictionaryParams; - switch (gameFamily) { - case "DP": + switch (gameFam) { + case gFamEnum.DP: commonDictionaryParams = PokeDatabase.ScriptEditor.DPPtScrCmdParameters; specificDictionaryParams = PokeDatabase.ScriptEditor.DPScrCmdParameters; break; - case "Plat": + case gFamEnum.Plat: commonDictionaryParams = PokeDatabase.ScriptEditor.DPPtScrCmdParameters; specificDictionaryParams = PokeDatabase.ScriptEditor.PlatScrCmdParameters; break; @@ -172,10 +187,10 @@ namespace DSPRE { } return commonDictionaryParams.Concat(specificDictionaryParams).ToLookup(x => x.Key, x => x.Value).ToDictionary(x => x.Key, g => g.First()); } - public static Dictionary BuildActionNamesDatabase(string gameVer) { - switch (gameFamily) { - case "DP": - case "Plat": + public static Dictionary BuildActionNamesDatabase(gFamEnum gameFam) { + switch (gameFam) { + case gFamEnum.DP: + case gFamEnum.Plat: return PokeDatabase.ScriptEditor.movementsDictIDName; default: var commonDictionaryParams = PokeDatabase.ScriptEditor.movementsDictIDName; @@ -197,7 +212,7 @@ namespace DSPRE { } public static void SetHeaderTableOffset() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: switch (gameLanguage) { case "ENG": headerTableOffset = 0xEEDBC; @@ -215,11 +230,11 @@ namespace DSPRE { headerTableOffset = 0xEEDCC; break; case "JAP": - headerTableOffset = 0xF0D68; + headerTableOffset = gameVersion == gVerEnum.Diamond ? (uint)0xF0D68 : 0xF0D6C; break; } break; - case "Plat": + case gFamEnum.Plat: switch (gameLanguage) { case "ENG": headerTableOffset = 0xE601C; @@ -241,13 +256,13 @@ namespace DSPRE { break; } break; - case "HGSS": + case gFamEnum.HGSS: switch (gameLanguage) { case "ENG": headerTableOffset = 0xF6BE0; break; case "ESP": - headerTableOffset = gameVersion == "HG" ? 0xF6BC8 : (uint)0xF6BD0; + headerTableOffset = gameVersion == gVerEnum.HeartGold ? 0xF6BC8 : (uint)0xF6BD0; break; case "ITA": headerTableOffset = 0xF6B58; @@ -267,7 +282,7 @@ namespace DSPRE { } public static void SetupSpawnSettings() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: initialMoneyOverlayNumber = 52; initialMoneyOverlayOffset = 0x1E4; switch (gameLanguage) { @@ -291,7 +306,7 @@ namespace DSPRE { break; } break; - case "Plat": + case gFamEnum.Plat: initialMoneyOverlayNumber = 57; initialMoneyOverlayOffset = 0x1EC; switch (gameLanguage) { @@ -315,7 +330,7 @@ namespace DSPRE { break; } break; - case "HGSS": + case gFamEnum.HGSS: initialMoneyOverlayNumber = 36; initialMoneyOverlayOffset = 0x2FC; switch (gameLanguage) { @@ -323,7 +338,7 @@ namespace DSPRE { arm9spawnOffset = 0xFA17C; break; case "ESP": - arm9spawnOffset = gameVersion == "HG" ? 0xFA164 : (uint)0xFA16C; + arm9spawnOffset = gameVersion == gVerEnum.HeartGold ? 0xFA164 : (uint)0xFA16C; break; case "ITA": arm9spawnOffset = 0xFA0F4; @@ -343,17 +358,17 @@ namespace DSPRE { } public static void PrepareCameraData() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: cameraTblOverlayNumber = 5; cameraTblOffsetsToRAMaddress = gameLanguage.Equals("JAP") ? (new uint[] { 0x4C50 }) : (new uint[] { 0x4908 }); cameraSize = 24; break; - case "Plat": + case gFamEnum.Plat: cameraTblOverlayNumber = 5; cameraTblOffsetsToRAMaddress = new uint[] { 0x4E24 }; cameraSize = 24; break; - case "HGSS": + case gFamEnum.HGSS: cameraTblOverlayNumber = 1; cameraSize = 36; switch (gameLanguage) { @@ -373,7 +388,7 @@ namespace DSPRE { } public static void SetOWtable() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: OWtablePath = workDir + "overlay" + "\\" + "overlay_0005.bin"; switch (gameLanguage) { // Go to the beginning of the overworld table case "ENG": @@ -387,7 +402,7 @@ namespace DSPRE { break; } break; - case "Plat": + case gFamEnum.Plat: OWtablePath = workDir + "overlay" + "\\" + "overlay_0005.bin"; switch (gameLanguage) { // Go to the beginning of the overworld table case "ITA": @@ -408,7 +423,7 @@ namespace DSPRE { break; } break; - case "HGSS": + case gFamEnum.HGSS: OWtablePath = workDir + "overlay" + "\\" + "overlay_0001.bin"; OWTableOffset = 0x21BA8; break; @@ -416,10 +431,10 @@ namespace DSPRE { } public static void SetConditionalMusicTableOffsetToRAMAddress() { switch (gameFamily) { - case "HGSS": + case gFamEnum.HGSS: switch (gameLanguage) { case "ESP": - conditionalMusicTableOffsetToRAMAddress = gameVersion == "HG" ? (uint)0x667D0 : 0x667D8; + conditionalMusicTableOffsetToRAMAddress = gameVersion == gVerEnum.HeartGold ? (uint)0x667D0 : 0x667D8; break; case "ENG": case "ITA": @@ -434,12 +449,66 @@ namespace DSPRE { break; } } + public static void SetEncounterMusicTableOffsetToRAMAddress() { + switch (gameFamily) { + case gFamEnum.HGSS: + switch (gameLanguage) { + case "ESP": + encounterMusicTableOffsetToRAMAddress = gameVersion == gVerEnum.HeartGold ? (uint)0x550D8 : 0x550E0; + break; + case "ENG": + case "ITA": + case "FRA": + case "GER": + encounterMusicTableOffsetToRAMAddress = 0x550E0; + break; + case "JAP": + encounterMusicTableOffsetToRAMAddress = 0x54B44; + break; + } + break; + + case gFamEnum.Plat: + switch (gameLanguage) { + case "ENG": + encounterMusicTableOffsetToRAMAddress = 0x5563C; + break; + case "ITA": + case "FRA": + case "ESP": + case "GER": + encounterMusicTableOffsetToRAMAddress = 0x556E0; + break; + case "JAP": + encounterMusicTableOffsetToRAMAddress = 0x54F04; + break; + } + break; + + case gFamEnum.DP: + switch (gameLanguage) { + case "ENG": + encounterMusicTableOffsetToRAMAddress = 0x4AD3C; + break; + case "ITA": + case "FRA": + case "ESP": + case "GER": + encounterMusicTableOffsetToRAMAddress = 0x4ADAC; + break; + case "JAP": + encounterMusicTableOffsetToRAMAddress = 0x4D9AC; + break; + } + break; + } + } private void SetItemScriptFileNumber() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: itemScriptFileNumber = 370; break; - case "Plat": + case gFamEnum.Plat: itemScriptFileNumber = 404; break; default: @@ -449,21 +518,21 @@ namespace DSPRE { } private void SetNullEncounterID() { switch (gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: nullEncounterID = ushort.MaxValue; break; - case "HGSS": + case gFamEnum.HGSS: nullEncounterID = Byte.MaxValue; break; } } private void SetAttackNamesTextNumber() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: attackNamesTextNumber = 588; break; - case "Plat": + case gFamEnum.Plat: attackNamesTextNumber = 647; break; default: @@ -473,10 +542,10 @@ namespace DSPRE { } private void SetItemNamesTextNumber() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: itemNamesTextNumber = 344; break; - case "Plat": + case gFamEnum.Plat: itemNamesTextNumber = 392; break; default: @@ -486,10 +555,10 @@ namespace DSPRE { } private void SetLocationNamesTextNumber() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: locationNamesTextNumber = 382; break; - case "Plat": + case gFamEnum.Plat: locationNamesTextNumber = 433; break; default: @@ -499,26 +568,26 @@ namespace DSPRE { } private void SetPokémonNamesTextNumber() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: pokemonNamesTextNumbers = new int[2] { 362, 363 }; break; - case "Plat": + case gFamEnum.Plat: pokemonNamesTextNumbers = new int[7] { 412, 413, 712, 713, 714, 715, 716 }; //413? break; - case "HGSS": + case gFamEnum.HGSS: pokemonNamesTextNumbers = new int[7] { 237, 238, 817, 818, 819, 820, 821 }; //238? break; } } private void SetTrainerNamesMessageNumber() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: trainerNamesMessageNumber = 559; if (gameLanguage.Equals("JAP")) { trainerNamesMessageNumber -= 9; } break; - case "Plat": + case gFamEnum.Plat: trainerNamesMessageNumber = 618; break; default: @@ -531,13 +600,13 @@ namespace DSPRE { } private void SetTrainerClassMessageNumber() { switch (gameFamily) { - case "DP": + case gFamEnum.DP: trainerClassMessageNumber = 560; if (gameLanguage.Equals("JAP")) { trainerClassMessageNumber -= 9; } break; - case "Plat": + case gFamEnum.Plat: trainerClassMessageNumber = 619; break; default: @@ -571,33 +640,6 @@ namespace DSPRE { #endregion #region System Methods - private void LoadGameVersion() { - try { - gameVersion = PokeDatabase.System.versionsDict[romID]; - } catch (KeyNotFoundException) { - MessageBox.Show("The ROM you attempted to load is not supported.\nYou can only load Gen IV Pokémon ROMS, for now.", "Unsupported ROM", - MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - private void LoadGameName() { - switch (gameVersion) { - case "D": - gameName = "Diamond"; - break; - case "P": - gameName = "Pearl"; - break; - case "Plat": - gameName = "Platinum"; - break; - case "HG": - gameName = "HeartGold"; - break; - case "SS": - gameName = "SoulSilver"; - break; - } - } private void LoadGameLanguage() { switch (romID) { case "ADAE": @@ -648,23 +690,23 @@ namespace DSPRE { } private void LoadGameFamily() { switch (gameVersion) { - case "D": - case "P": - gameFamily = "DP"; + case gVerEnum.Diamond: + case gVerEnum.Pearl: + gameFamily = gFamEnum.DP; break; - case "Plat": - gameFamily = "Plat"; + case gVerEnum.Platinum: + gameFamily = gFamEnum.Plat; break; - case "HG": - case "SS": - gameFamily = "HGSS"; + case gVerEnum.HeartGold: + case gVerEnum.SoulSilver: + gameFamily = gFamEnum.HGSS; break; } - } + } private void SetNarcDirs() { Dictionary packedDirsDict = null; switch (gameFamily) { - case "DP": + case gFamEnum.DP: string suffix = ""; if (!gameLanguage.Equals("JAP")) suffix = "_release"; @@ -691,15 +733,15 @@ namespace DSPRE { [DirNames.trainerParty] = @"data\poketool\trainer\trpoke.narc", [DirNames.trainerGraphics] = @"data\poketool\trgra\trfgra.narc", - [DirNames.encounters] = @"data\fielddata\encountdata\" + char.ToLower(gameVersion[0]) + '_' + "enc_data.narc" + [DirNames.encounters] = @"data\fielddata\encountdata\" + char.ToLower(gameVersion.ToString()[0]) + '_' + "enc_data.narc" }; break; - case "Plat": + case gFamEnum.Plat: packedDirsDict = new Dictionary() { [DirNames.synthOverlay] = @"data\data\weather_sys.narc", [DirNames.dynamicHeaders] = @"data\debug\cb_edit\d_test.narc", - [DirNames.textArchives] = @"data\msgdata\" + gameVersion.Substring(0, 2).ToLower() + '_' + "msg.narc", + [DirNames.textArchives] = @"data\msgdata\" + gameVersion.ToString().Substring(0, 2).ToLower() + '_' + "msg.narc", [DirNames.matrices] = @"data\fielddata\mapmatrix\map_matrix.narc", @@ -719,10 +761,10 @@ namespace DSPRE { [DirNames.trainerParty] = @"data\poketool\trainer\trpoke.narc", [DirNames.trainerGraphics] = @"data\poketool\trgra\trfgra.narc", - [DirNames.encounters] = @"data\fielddata\encountdata\" + gameVersion.Substring(0, 2).ToLower() + '_' + "enc_data.narc" + [DirNames.encounters] = @"data\fielddata\encountdata\" + gameVersion.ToString().Substring(0, 2).ToLower() + '_' + "enc_data.narc" }; break; - case "HGSS": + case gFamEnum.HGSS: packedDirsDict = new Dictionary() { [DirNames.synthOverlay] = @"data\a\0\2\8", [DirNames.dynamicHeaders] = @"data\a\0\5\0", @@ -751,7 +793,7 @@ namespace DSPRE { }; //Encounter archive is different for SS - packedDirsDict[DirNames.encounters] = gameVersion == "HG" ? @"data\a\0\3\7" : @"data\a\1\3\6"; + packedDirsDict[DirNames.encounters] = gameVersion == gVerEnum.HeartGold ? @"data\a\0\3\7" : @"data\a\1\3\6"; break; } @@ -762,11 +804,11 @@ namespace DSPRE { } public static void LoadMapCellsColorDictionary() { switch (gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: MapCellsColorDictionary = PokeDatabase.System.MatrixCellColors.DPPtmatrixColorsDict; break; - case "HGSS": + case gFamEnum.HGSS: MapCellsColorDictionary = PokeDatabase.System.MatrixCellColors.HGSSmatrixColorsDict; break; } @@ -777,8 +819,8 @@ namespace DSPRE { public static void ReadOWTable() { OverworldTable = new SortedDictionary(); switch (gameFamily) { - case "DP": - case "Plat": + case gFamEnum.DP: + case gFamEnum.Plat: using (BinaryReader idReader = new BinaryReader(new FileStream(OWtablePath, FileMode.Open))) { idReader.BaseStream.Position = OWTableOffset; @@ -791,7 +833,7 @@ namespace DSPRE { } } break; - case "HGSS": + case gFamEnum.HGSS: using (BinaryReader idReader = new BinaryReader(new FileStream(OWtablePath, FileMode.Open))) { idReader.BaseStream.Position = OWTableOffset; diff --git a/DS_Map/SpawnEditor.cs b/DS_Map/SpawnEditor.cs index 68b7290..5c9975d 100644 --- a/DS_Map/SpawnEditor.cs +++ b/DS_Map/SpawnEditor.cs @@ -54,10 +54,10 @@ namespace DSPRE { string moneyOverlayPath = DSUtils.GetOverlayPath(RomInfo.initialMoneyOverlayNumber); ushort headerNumber = ushort.Parse(spawnHeaderComboBox.SelectedItem.ToString().Split()[0]); - DSUtils.WriteToArm9(BitConverter.GetBytes(headerNumber), RomInfo.arm9spawnOffset); - DSUtils.WriteToArm9(BitConverter.GetBytes((short)(matrixxUpDown.Value * 32 + localmapxUpDown.Value)), RomInfo.arm9spawnOffset + 8); - DSUtils.WriteToArm9(BitConverter.GetBytes((short)(matrixyUpDown.Value * 32 + localmapyUpDown.Value)), RomInfo.arm9spawnOffset + 12); - DSUtils.WriteToArm9(BitConverter.GetBytes((short)playerDirCombobox.SelectedIndex), RomInfo.arm9spawnOffset + 16); + DSUtils.WriteBytesToArm9(BitConverter.GetBytes(headerNumber), RomInfo.arm9spawnOffset); + DSUtils.WriteBytesToArm9(BitConverter.GetBytes((short)(matrixxUpDown.Value * 32 + localmapxUpDown.Value)), RomInfo.arm9spawnOffset + 8); + DSUtils.WriteBytesToArm9(BitConverter.GetBytes((short)(matrixyUpDown.Value * 32 + localmapyUpDown.Value)), RomInfo.arm9spawnOffset + 12); + DSUtils.WriteBytesToArm9(BitConverter.GetBytes((short)playerDirCombobox.SelectedIndex), RomInfo.arm9spawnOffset + 16); DSUtils.WriteToFile(moneyOverlayPath, BitConverter.GetBytes((int)initialMoneyUpDown.Value), RomInfo.initialMoneyOverlayOffset); MessageBox.Show("Your spawn settings have been changed.", "Operation successful", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -68,9 +68,9 @@ namespace DSPRE { private void readDefaultSpawnPosButton_Click(object sender, EventArgs e) {; SetupFields(names); - ushort headerNumber = BitConverter.ToUInt16(DSUtils.ReadFromArm9(RomInfo.arm9spawnOffset, 2), 0); - ushort globalX = BitConverter.ToUInt16(DSUtils.ReadFromArm9(RomInfo.arm9spawnOffset + 8, 2), 0); - ushort globalY = BitConverter.ToUInt16(DSUtils.ReadFromArm9(RomInfo.arm9spawnOffset + 12, 2), 0); + ushort headerNumber = BitConverter.ToUInt16(DSUtils.ReadBytesFromArm9(RomInfo.arm9spawnOffset, 2), 0); + ushort globalX = BitConverter.ToUInt16(DSUtils.ReadBytesFromArm9(RomInfo.arm9spawnOffset + 8, 2), 0); + ushort globalY = BitConverter.ToUInt16(DSUtils.ReadBytesFromArm9(RomInfo.arm9spawnOffset + 12, 2), 0); spawnHeaderComboBox.SelectedIndex = headerNumber; @@ -91,7 +91,7 @@ namespace DSPRE { } ReadDefaultMoney(); - playerDirCombobox.SelectedIndex = BitConverter.ToUInt16(DSUtils.ReadFromArm9(RomInfo.arm9spawnOffset + 16, 2), 0); + playerDirCombobox.SelectedIndex = BitConverter.ToUInt16(DSUtils.ReadBytesFromArm9(RomInfo.arm9spawnOffset + 16, 2), 0); } private void ReadDefaultMoney() { if (DSUtils.CheckOverlayHasCompressionFlag(RomInfo.initialMoneyOverlayNumber)) { @@ -119,13 +119,13 @@ namespace DSPRE { matrixyUpDown.Maximum = headerMatrix.maps.GetLength(0) - 1; switch (RomInfo.gameFamily) { - case "DP": + case gFamEnum.DP: locationNameLBL.Text = locations[((HeaderDP)currentHeader).locationName]; break; - case "Plat": + case gFamEnum.Plat: locationNameLBL.Text = locations[((HeaderPt)currentHeader).locationName]; break; - case "HGSS": + case gFamEnum.HGSS: locationNameLBL.Text = locations[((HeaderHGSS)currentHeader).locationName]; break; }