Merge pull request #50 from Mixone-FinallyHere/main

Adds Overlay Editor and fixes the unique string dictionary
This commit is contained in:
AdAstra-LD 2024-05-12 23:25:22 +02:00 committed by GitHub
commit d1285fb873
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 3358 additions and 1400 deletions

View File

@ -190,6 +190,12 @@
<Compile Include="MoveEditor.Designer.cs">
<DependentUpon>MoveEditor.cs</DependentUpon>
</Compile>
<Compile Include="OverlayEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="OverlayEditor.Designer.cs">
<DependentUpon>OverlayEditor.cs</DependentUpon>
</Compile>
<Compile Include="PersonalDataEditor.cs">
<SubType>Form</SubType>
</Compile>
@ -405,6 +411,9 @@
<EmbeddedResource Include="LearnsetEditor.resx">
<DependentUpon>LearnsetEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="OverlayEditor.resx">
<DependentUpon>OverlayEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PersonalDataEditor.resx">
<DependentUpon>PersonalDataEditor.cs</DependentUpon>
</EmbeddedResource>

View File

@ -36,11 +36,11 @@ namespace DSPRE {
/**
* Gets number of overlays
**/
public static long GetNumberOfOverlays() {
public static int GetNumberOfOverlays() {
using (FileStream fileStream = File.OpenRead(RomInfo.overlayTablePath))
{
// Get the length of the file in bytes
return fileStream.Length / 32;
return (int)(fileStream.Length / ENTRY_LEN);
}
}
}

View File

@ -809,6 +809,7 @@
this.texturizeNSBMDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.untexturizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.extractNSBTXFromNSBMDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.overlayEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.monEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.personalDataEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.learnsetsEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -2544,7 +2545,7 @@
this.setSpawnPointButton.Image = global::DSPRE.Properties.Resources.spawnCoordsMatrixeditorIcon;
this.setSpawnPointButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.setSpawnPointButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.setSpawnPointButton.Location = new System.Drawing.Point(12, -9463);
this.setSpawnPointButton.Location = new System.Drawing.Point(12, -10665);
this.setSpawnPointButton.Name = "setSpawnPointButton";
this.setSpawnPointButton.Size = new System.Drawing.Size(117, 43);
this.setSpawnPointButton.TabIndex = 35;
@ -2560,7 +2561,7 @@
this.saveMatrixButton.Image = global::DSPRE.Properties.Resources.save_rom;
this.saveMatrixButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.saveMatrixButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.saveMatrixButton.Location = new System.Drawing.Point(12, -9419);
this.saveMatrixButton.Location = new System.Drawing.Point(12, -10621);
this.saveMatrixButton.Name = "saveMatrixButton";
this.saveMatrixButton.Size = new System.Drawing.Size(117, 43);
this.saveMatrixButton.TabIndex = 34;
@ -2744,7 +2745,7 @@
this.matrixTabControl.Multiline = true;
this.matrixTabControl.Name = "matrixTabControl";
this.matrixTabControl.SelectedIndex = 0;
this.matrixTabControl.Size = new System.Drawing.Size(1040, 625);
this.matrixTabControl.Size = new System.Drawing.Size(1000, 625);
this.matrixTabControl.TabIndex = 18;
//
// headersTabPage
@ -2753,7 +2754,7 @@
this.headersTabPage.Location = new System.Drawing.Point(4, 22);
this.headersTabPage.Name = "headersTabPage";
this.headersTabPage.Padding = new System.Windows.Forms.Padding(3);
this.headersTabPage.Size = new System.Drawing.Size(1032, 599);
this.headersTabPage.Size = new System.Drawing.Size(992, 599);
this.headersTabPage.TabIndex = 1;
this.headersTabPage.Text = "Map Headers";
this.headersTabPage.UseVisualStyleBackColor = true;
@ -2816,7 +2817,7 @@
this.heightsTabPage.Controls.Add(this.heightsGridView);
this.heightsTabPage.Location = new System.Drawing.Point(4, 22);
this.heightsTabPage.Name = "heightsTabPage";
this.heightsTabPage.Size = new System.Drawing.Size(1032, 599);
this.heightsTabPage.Size = new System.Drawing.Size(992, 599);
this.heightsTabPage.TabIndex = 2;
this.heightsTabPage.Text = "Map Heights";
this.heightsTabPage.UseVisualStyleBackColor = true;
@ -2879,7 +2880,7 @@
this.mapFilesTabPage.Controls.Add(this.mapFilesGridView);
this.mapFilesTabPage.Location = new System.Drawing.Point(4, 22);
this.mapFilesTabPage.Name = "mapFilesTabPage";
this.mapFilesTabPage.Size = new System.Drawing.Size(1032, 599);
this.mapFilesTabPage.Size = new System.Drawing.Size(992, 599);
this.mapFilesTabPage.TabIndex = 3;
this.mapFilesTabPage.Text = "Map Files";
this.mapFilesTabPage.UseVisualStyleBackColor = true;
@ -4340,7 +4341,7 @@
this.radio3D.AutoSize = true;
this.radio3D.Checked = true;
this.radio3D.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.radio3D.Location = new System.Drawing.Point(-15792, -9439);
this.radio3D.Location = new System.Drawing.Point(-17778, -10641);
this.radio3D.Name = "radio3D";
this.radio3D.Size = new System.Drawing.Size(31, 23);
this.radio3D.TabIndex = 26;
@ -4355,7 +4356,7 @@
this.radio2D.Appearance = System.Windows.Forms.Appearance.Button;
this.radio2D.AutoSize = true;
this.radio2D.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.radio2D.Location = new System.Drawing.Point(-15792, -9415);
this.radio2D.Location = new System.Drawing.Point(-17778, -10617);
this.radio2D.Name = "radio2D";
this.radio2D.Size = new System.Drawing.Size(31, 23);
this.radio2D.TabIndex = 25;
@ -4370,7 +4371,7 @@
this.wireframeCheckBox.Appearance = System.Windows.Forms.Appearance.Button;
this.wireframeCheckBox.AutoSize = true;
this.wireframeCheckBox.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.wireframeCheckBox.Location = new System.Drawing.Point(1140, -9391);
this.wireframeCheckBox.Location = new System.Drawing.Point(1140, -10593);
this.wireframeCheckBox.Name = "wireframeCheckBox";
this.wireframeCheckBox.Size = new System.Drawing.Size(31, 23);
this.wireframeCheckBox.TabIndex = 27;
@ -10234,7 +10235,8 @@
this.NarcUtilityToolStripMenuItem,
this.listBasedBatchRenameToolStripMenuItem,
this.listBuilderToolStripMenuItem,
this.nSBMDUtilityToolStripMenuItem});
this.nSBMDUtilityToolStripMenuItem,
this.overlayEditorToolStripMenuItem});
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
this.aboutToolStripMenuItem.Text = "Tools";
@ -10418,6 +10420,14 @@
this.extractNSBTXFromNSBMDToolStripMenuItem.Text = "Save textures from NSBMD";
this.extractNSBTXFromNSBMDToolStripMenuItem.Click += new System.EventHandler(this.nsbmdExportTexButton_Click);
//
// overlayEditorToolStripMenuItem
//
this.overlayEditorToolStripMenuItem.Enabled = false;
this.overlayEditorToolStripMenuItem.Name = "overlayEditorToolStripMenuItem";
this.overlayEditorToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
this.overlayEditorToolStripMenuItem.Text = "Overlay Editor";
this.overlayEditorToolStripMenuItem.Click += new System.EventHandler(this.overlayEditorToolStripMenuItem_Click);
//
// monEditorToolStripMenuItem
//
this.monEditorToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -12003,6 +12013,7 @@
public System.Windows.Forms.TabPage tabPageEncountersEditor;
public Editors.EncountersEditor encountersEditor;
private System.Windows.Forms.Button scanUnusedCollisionTypesButton;
private System.Windows.Forms.ToolStripMenuItem overlayEditorToolStripMenuItem;
}
}

View File

@ -690,11 +690,14 @@ namespace DSPRE {
spawnEditorToolStripButton.Enabled = true;
spawnEditorToolStripMenuItem.Enabled = true;
monEditorToolStripMenuItem.Enabled = true;
scriptCommandsButton.Enabled = true;
if (!RomInfo.gameFamily.Equals(GameFamilies.HGSS)) {
mainTabControl.TabPages.Remove(tabPageEncountersEditor);
} else {
overlayEditorToolStripMenuItem.Enabled = true;
}
Helpers.statusLabelMessage();
this.Text += " - " + RomInfo.fileName;
}
@ -9868,5 +9871,15 @@ namespace DSPRE {
private void evolutionsEditorToolStripMenuItem_Click(object sender, EventArgs e) {
// Dummy func, to be deleted from MainWIndow
}
private void overlayEditorToolStripMenuItem_Click(object sender, EventArgs e) {
Helpers.statusLabelMessage("Setting up Overlay Editor...");
Update();
OverlayEditor ovlEditor = new OverlayEditor();
ovlEditor.ShowDialog();
Helpers.statusLabelMessage();
Update();
}
}
}

View File

@ -956,7 +956,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACM
EgAAAk1TRnQBSQFMAgEBCgEAAXgBHAF4ARwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
EgAAAk1TRnQBSQFMAgEBCgEAAYgBHAGIARwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

113
DS_Map/OverlayEditor.Designer.cs generated Normal file
View File

@ -0,0 +1,113 @@
namespace DSPRE {
partial class OverlayEditor {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OverlayEditor));
this.overlayDataGrid = new System.Windows.Forms.DataGridView();
this.isCompressedButton = new System.Windows.Forms.Button();
this.isMarkedCompressedButton = new System.Windows.Forms.Button();
this.saveChangesButton = new System.Windows.Forms.Button();
this.revertChangesButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.overlayDataGrid)).BeginInit();
this.SuspendLayout();
//
// overlayDataGrid
//
this.overlayDataGrid.AllowUserToAddRows = false;
this.overlayDataGrid.AllowUserToDeleteRows = false;
this.overlayDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.overlayDataGrid.Location = new System.Drawing.Point(12, 12);
this.overlayDataGrid.Name = "overlayDataGrid";
this.overlayDataGrid.Size = new System.Drawing.Size(517, 271);
this.overlayDataGrid.TabIndex = 0;
this.overlayDataGrid.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.overlayDataGrid_CellFormatting);
//
// isCompressedButton
//
this.isCompressedButton.Location = new System.Drawing.Point(13, 290);
this.isCompressedButton.Name = "isCompressedButton";
this.isCompressedButton.Size = new System.Drawing.Size(127, 42);
this.isCompressedButton.TabIndex = 1;
this.isCompressedButton.Text = "Compress/Decompress All";
this.isCompressedButton.UseVisualStyleBackColor = true;
this.isCompressedButton.Click += new System.EventHandler(this.isCompressedButton_Click);
//
// isMarkedCompressedButton
//
this.isMarkedCompressedButton.Location = new System.Drawing.Point(146, 290);
this.isMarkedCompressedButton.Name = "isMarkedCompressedButton";
this.isMarkedCompressedButton.Size = new System.Drawing.Size(123, 43);
this.isMarkedCompressedButton.TabIndex = 2;
this.isMarkedCompressedButton.Text = "Mark/Unmark Compression All";
this.isMarkedCompressedButton.UseVisualStyleBackColor = true;
this.isMarkedCompressedButton.Click += new System.EventHandler(this.isMarkedCompressedButton_Click);
//
// saveChangesButton
//
this.saveChangesButton.Location = new System.Drawing.Point(428, 290);
this.saveChangesButton.Name = "saveChangesButton";
this.saveChangesButton.Size = new System.Drawing.Size(101, 42);
this.saveChangesButton.TabIndex = 3;
this.saveChangesButton.Text = "Save Changes";
this.saveChangesButton.UseVisualStyleBackColor = true;
this.saveChangesButton.Click += new System.EventHandler(this.saveChangesButton_Click);
//
// revertChangesButton
//
this.revertChangesButton.Location = new System.Drawing.Point(310, 290);
this.revertChangesButton.Name = "revertChangesButton";
this.revertChangesButton.Size = new System.Drawing.Size(112, 42);
this.revertChangesButton.TabIndex = 4;
this.revertChangesButton.Text = "Revert Current Changes";
this.revertChangesButton.UseVisualStyleBackColor = true;
this.revertChangesButton.Click += new System.EventHandler(this.revertChangesButton_Click);
//
// OverlayEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(539, 344);
this.Controls.Add(this.revertChangesButton);
this.Controls.Add(this.saveChangesButton);
this.Controls.Add(this.isMarkedCompressedButton);
this.Controls.Add(this.isCompressedButton);
this.Controls.Add(this.overlayDataGrid);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "OverlayEditor";
this.Text = "OverlayEditor";
((System.ComponentModel.ISupportInitialize)(this.overlayDataGrid)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView overlayDataGrid;
private System.Windows.Forms.Button isCompressedButton;
private System.Windows.Forms.Button isMarkedCompressedButton;
private System.Windows.Forms.Button saveChangesButton;
private System.Windows.Forms.Button revertChangesButton;
}
}

132
DS_Map/OverlayEditor.cs Normal file
View File

@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DSPRE {
public partial class OverlayEditor : Form {
private List<Overlay> overlays;
private bool currentValComp = true;
private bool currentValMark = true;
public OverlayEditor() {
InitializeComponent();
overlays = new List<Overlay>();
int numOverlays = OverlayUtils.OverlayTable.GetNumberOfOverlays();
for (int i = 0; i < numOverlays; i++) {
Overlay ovl = new Overlay();
ovl.number = i;
ovl.isCompressed = OverlayUtils.IsCompressed(i);
ovl.isMarkedCompressed = OverlayUtils.OverlayTable.IsDefaultCompressed(i);
ovl.RAMAddress = OverlayUtils.OverlayTable.GetRAMAddress(i);
ovl.uncompressedSize = OverlayUtils.OverlayTable.GetUncompressedSize(i);
overlays.Add(ovl);
}
overlayDataGrid.DataSource = overlays;
overlayDataGrid.Columns[0].HeaderText = "Overlay ID";
overlayDataGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader;
overlayDataGrid.AllowUserToResizeColumns = false;
overlayDataGrid.Columns[1].HeaderText = "Compressed";
overlayDataGrid.Columns[2].HeaderText = "Marked Compressed";
overlayDataGrid.Columns[3].HeaderText = "RAM Address";
overlayDataGrid.Columns[4].HeaderText = "Uncompressed Size";
overlayDataGrid.Columns[0].ReadOnly = true;
overlayDataGrid.Columns[3].ReadOnly = true;
overlayDataGrid.Columns[4].ReadOnly = true;
}
private void isMarkedCompressedButton_Click(object sender, EventArgs e) {
foreach (DataGridViewRow r in overlayDataGrid.Rows) {
r.Cells[2].Value = currentValMark;
}
currentValMark = !currentValMark;
}
private void isCompressedButton_Click(object sender, EventArgs e) {
foreach (DataGridViewRow r in overlayDataGrid.Rows) {
r.Cells[1].Value = currentValComp;
}
currentValComp = !currentValComp;
}
private void revertChangesButton_Click(object sender, EventArgs e) {
overlays = new List<Overlay>();
int numOverlays = OverlayUtils.OverlayTable.GetNumberOfOverlays();
for (int i = 0; i < numOverlays; i++) {
Overlay ovl = new Overlay();
ovl.number = i;
ovl.isCompressed = OverlayUtils.IsCompressed(i);
ovl.isMarkedCompressed = OverlayUtils.OverlayTable.IsDefaultCompressed(i);
ovl.RAMAddress = OverlayUtils.OverlayTable.GetRAMAddress(i);
ovl.uncompressedSize = OverlayUtils.OverlayTable.GetUncompressedSize(i);
overlays.Add(ovl);
}
overlayDataGrid.DataSource = overlays;
}
private void overlayDataGrid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) {
if (e.ColumnIndex == 3 && e.Value != null) {
long value = 0;
if (long.TryParse(e.Value.ToString(), out value)) {
e.Value = "0x" + value.ToString("X");
e.FormattingApplied = true;
}
}
}
private void saveChangesButton_Click(object sender, EventArgs e) {
// This whole function needs proper optimizing, im just making dumb lists
List<Overlay> originalOverlays = new List<Overlay>();
int numOverlays = OverlayUtils.OverlayTable.GetNumberOfOverlays();
for (int i = 0; i < numOverlays; i++) {
Overlay ovl = new Overlay();
ovl.number = i;
ovl.isCompressed = OverlayUtils.IsCompressed(i);
ovl.isMarkedCompressed = OverlayUtils.OverlayTable.IsDefaultCompressed(i);
ovl.RAMAddress = OverlayUtils.OverlayTable.GetRAMAddress(i);
ovl.uncompressedSize = OverlayUtils.OverlayTable.GetUncompressedSize(i);
originalOverlays.Add(ovl);
}
List<string> modifiedNumbers = new List<string>();
List<Overlay> modifiedOverlays = new List<Overlay>();
for (int i = 0; i < originalOverlays.Count; i++) {
Overlay originalOverlay = originalOverlays[i];
Overlay newOverlay = overlays[i];
// Compare properties
if (originalOverlay.isCompressed != newOverlay.isCompressed || originalOverlay.isMarkedCompressed != newOverlay.isMarkedCompressed) {
modifiedOverlays.Add(newOverlay);
modifiedNumbers.Add(newOverlay.number.ToString());
}
}
DialogResult d = MessageBox.Show("This operation will modify the following overlays: " + Environment.NewLine
+ String.Join(", ", modifiedNumbers)
+ "\nProceed?", "Confirmation required", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (d == DialogResult.Yes) {
foreach (Overlay overlay in modifiedOverlays) {
OverlayUtils.OverlayTable.SetDefaultCompressed(overlay.number, overlay.isMarkedCompressed);
if (overlay.isCompressed && !OverlayUtils.IsCompressed(overlay.number))
OverlayUtils.Compress(overlay.number);
if (!overlay.isCompressed && OverlayUtils.IsCompressed(overlay.number))
OverlayUtils.Decompress(overlay.number);
}
}
}
}
public class Overlay {
public int number { get; set; }
public bool isCompressed { get; set; }
public bool isMarkedCompressed { get; set; }
public uint RAMAddress { get; set; }
public uint uncompressedSize { get; set; }
}
}

1677
DS_Map/OverlayEditor.resx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -333,7 +333,7 @@
//
this.removeEventFileButton.Image = global::DSPRE.Properties.Resources.deleteIcon;
this.removeEventFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.removeEventFileButton.Location = new System.Drawing.Point(500, 13);
this.removeEventFileButton.Location = new System.Drawing.Point(101, 667);
this.removeEventFileButton.Name = "removeEventFileButton";
this.removeEventFileButton.Size = new System.Drawing.Size(95, 35);
this.removeEventFileButton.TabIndex = 60;
@ -346,7 +346,7 @@
//
this.addEventFileButton.Image = global::DSPRE.Properties.Resources.addIcon;
this.addEventFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.addEventFileButton.Location = new System.Drawing.Point(426, 13);
this.addEventFileButton.Location = new System.Drawing.Point(19, 667);
this.addEventFileButton.Name = "addEventFileButton";
this.addEventFileButton.Size = new System.Drawing.Size(72, 35);
this.addEventFileButton.TabIndex = 59;
@ -361,7 +361,7 @@
this.selectEncounterComboBox.FormattingEnabled = true;
this.selectEncounterComboBox.Location = new System.Drawing.Point(14, 26);
this.selectEncounterComboBox.Name = "selectEncounterComboBox";
this.selectEncounterComboBox.Size = new System.Drawing.Size(175, 21);
this.selectEncounterComboBox.Size = new System.Drawing.Size(438, 21);
this.selectEncounterComboBox.TabIndex = 58;
this.selectEncounterComboBox.SelectedIndexChanged += new System.EventHandler(this.selectEncounterComboBox_SelectedIndexChanged);
//
@ -369,7 +369,7 @@
//
this.exportEncounterFileButton.Image = global::DSPRE.Properties.Resources.exportArrow;
this.exportEncounterFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.exportEncounterFileButton.Location = new System.Drawing.Point(288, 13);
this.exportEncounterFileButton.Location = new System.Drawing.Point(623, 13);
this.exportEncounterFileButton.Name = "exportEncounterFileButton";
this.exportEncounterFileButton.Size = new System.Drawing.Size(90, 35);
this.exportEncounterFileButton.TabIndex = 57;
@ -382,7 +382,7 @@
//
this.importEncounterFileButton.Image = global::DSPRE.Properties.Resources.importArrow;
this.importEncounterFileButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.importEncounterFileButton.Location = new System.Drawing.Point(195, 13);
this.importEncounterFileButton.Location = new System.Drawing.Point(520, 13);
this.importEncounterFileButton.Name = "importEncounterFileButton";
this.importEncounterFileButton.Size = new System.Drawing.Size(90, 35);
this.importEncounterFileButton.TabIndex = 56;
@ -395,7 +395,7 @@
//
this.saveEventsButton.Image = global::DSPRE.Properties.Resources.saveButton;
this.saveEventsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.saveEventsButton.Location = new System.Drawing.Point(655, 13);
this.saveEventsButton.Location = new System.Drawing.Point(655, 667);
this.saveEventsButton.Name = "saveEventsButton";
this.saveEventsButton.Size = new System.Drawing.Size(117, 35);
this.saveEventsButton.TabIndex = 55;
@ -577,7 +577,7 @@
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 193F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 12F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 39F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 197F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 198F));
this.tableLayoutPanel3.Controls.Add(this.label33, 0, 6);
this.tableLayoutPanel3.Controls.Add(this.leafGreenFirstComboBox, 4, 5);
this.tableLayoutPanel3.Controls.Add(this.fireRedSecondComboBox, 1, 6);
@ -631,7 +631,7 @@
this.leafGreenFirstComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.leafGreenFirstComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.leafGreenFirstComboBox.FormattingEnabled = true;
this.leafGreenFirstComboBox.Location = new System.Drawing.Point(276, 104);
this.leafGreenFirstComboBox.Location = new System.Drawing.Point(275, 104);
this.leafGreenFirstComboBox.Name = "leafGreenFirstComboBox";
this.leafGreenFirstComboBox.Size = new System.Drawing.Size(184, 21);
this.leafGreenFirstComboBox.TabIndex = 207;
@ -660,7 +660,7 @@
// label37
//
this.label37.AutoSize = true;
this.label37.Location = new System.Drawing.Point(249, 131);
this.label37.Location = new System.Drawing.Point(248, 131);
this.label37.Name = "label37";
this.label37.Size = new System.Drawing.Size(21, 13);
this.label37.TabIndex = 210;
@ -680,7 +680,7 @@
this.leafGreenSecondComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.leafGreenSecondComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.leafGreenSecondComboBox.FormattingEnabled = true;
this.leafGreenSecondComboBox.Location = new System.Drawing.Point(276, 134);
this.leafGreenSecondComboBox.Location = new System.Drawing.Point(275, 134);
this.leafGreenSecondComboBox.Name = "leafGreenSecondComboBox";
this.leafGreenSecondComboBox.Size = new System.Drawing.Size(183, 21);
this.leafGreenSecondComboBox.TabIndex = 209;
@ -718,7 +718,7 @@
// label39
//
this.label39.AutoSize = true;
this.label39.Location = new System.Drawing.Point(249, 101);
this.label39.Location = new System.Drawing.Point(248, 101);
this.label39.Name = "label39";
this.label39.Size = new System.Drawing.Size(21, 13);
this.label39.TabIndex = 208;
@ -749,7 +749,7 @@
// label36
//
this.label36.AutoSize = true;
this.label36.Location = new System.Drawing.Point(276, 84);
this.label36.Location = new System.Drawing.Point(275, 84);
this.label36.Name = "label36";
this.label36.Size = new System.Drawing.Size(60, 13);
this.label36.TabIndex = 216;
@ -767,7 +767,7 @@
// label27
//
this.label27.AutoSize = true;
this.label27.Location = new System.Drawing.Point(276, 0);
this.label27.Location = new System.Drawing.Point(275, 0);
this.label27.Name = "label27";
this.label27.Size = new System.Drawing.Size(49, 9);
this.label27.TabIndex = 201;
@ -776,7 +776,7 @@
// label30
//
this.label30.AutoSize = true;
this.label30.Location = new System.Drawing.Point(249, 9);
this.label30.Location = new System.Drawing.Point(248, 9);
this.label30.Name = "label30";
this.label30.Size = new System.Drawing.Size(21, 13);
this.label30.TabIndex = 193;
@ -785,7 +785,7 @@
// label28
//
this.label28.AutoSize = true;
this.label28.Location = new System.Drawing.Point(249, 45);
this.label28.Location = new System.Drawing.Point(248, 45);
this.label28.Name = "label28";
this.label28.Size = new System.Drawing.Size(21, 13);
this.label28.TabIndex = 195;
@ -796,7 +796,7 @@
this.sapphireFirstComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.sapphireFirstComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.sapphireFirstComboBox.FormattingEnabled = true;
this.sapphireFirstComboBox.Location = new System.Drawing.Point(276, 12);
this.sapphireFirstComboBox.Location = new System.Drawing.Point(275, 12);
this.sapphireFirstComboBox.Name = "sapphireFirstComboBox";
this.sapphireFirstComboBox.Size = new System.Drawing.Size(184, 21);
this.sapphireFirstComboBox.TabIndex = 192;
@ -807,7 +807,7 @@
this.sapphireSecondComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.sapphireSecondComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.sapphireSecondComboBox.FormattingEnabled = true;
this.sapphireSecondComboBox.Location = new System.Drawing.Point(276, 48);
this.sapphireSecondComboBox.Location = new System.Drawing.Point(275, 48);
this.sapphireSecondComboBox.Name = "sapphireSecondComboBox";
this.sapphireSecondComboBox.Size = new System.Drawing.Size(183, 21);
this.sapphireSecondComboBox.TabIndex = 194;
@ -816,7 +816,7 @@
// label32
//
this.label32.AutoSize = true;
this.label32.Location = new System.Drawing.Point(481, 45);
this.label32.Location = new System.Drawing.Point(480, 45);
this.label32.Name = "label32";
this.label32.Size = new System.Drawing.Size(21, 13);
this.label32.TabIndex = 199;
@ -827,7 +827,7 @@
this.emeraldSecondComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.emeraldSecondComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.emeraldSecondComboBox.FormattingEnabled = true;
this.emeraldSecondComboBox.Location = new System.Drawing.Point(520, 48);
this.emeraldSecondComboBox.Location = new System.Drawing.Point(519, 48);
this.emeraldSecondComboBox.Name = "emeraldSecondComboBox";
this.emeraldSecondComboBox.Size = new System.Drawing.Size(184, 21);
this.emeraldSecondComboBox.TabIndex = 198;
@ -836,7 +836,7 @@
// label31
//
this.label31.AutoSize = true;
this.label31.Location = new System.Drawing.Point(481, 9);
this.label31.Location = new System.Drawing.Point(480, 9);
this.label31.Name = "label31";
this.label31.Size = new System.Drawing.Size(21, 13);
this.label31.TabIndex = 197;
@ -847,7 +847,7 @@
this.emeraldFirstComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.emeraldFirstComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.emeraldFirstComboBox.FormattingEnabled = true;
this.emeraldFirstComboBox.Location = new System.Drawing.Point(520, 12);
this.emeraldFirstComboBox.Location = new System.Drawing.Point(519, 12);
this.emeraldFirstComboBox.Name = "emeraldFirstComboBox";
this.emeraldFirstComboBox.Size = new System.Drawing.Size(184, 21);
this.emeraldFirstComboBox.TabIndex = 196;
@ -856,7 +856,7 @@
// label25
//
this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(520, 0);
this.label25.Location = new System.Drawing.Point(519, 0);
this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(45, 9);
this.label25.TabIndex = 202;
@ -2644,7 +2644,7 @@
// repairAllButton
//
this.repairAllButton.Image = global::DSPRE.Properties.Resources.wrenchIcon;
this.repairAllButton.Location = new System.Drawing.Point(616, 11);
this.repairAllButton.Location = new System.Drawing.Point(734, 13);
this.repairAllButton.Name = "repairAllButton";
this.repairAllButton.Size = new System.Drawing.Size(38, 40);
this.repairAllButton.TabIndex = 61;
@ -2655,7 +2655,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(791, 673);
this.ClientSize = new System.Drawing.Size(777, 711);
this.Controls.Add(this.repairAllButton);
this.Controls.Add(this.mainTabControl);
this.Controls.Add(this.removeEventFileButton);

View File

@ -19,7 +19,7 @@ namespace DSPRE {
MapHeader tempMapHeader;
List<string> locationNames = RomInfo.GetLocationNames();
Dictionary<int, string> EncounterFileLocationName = new Dictionary<int, string>();
Dictionary<int, List<string>> EncounterFileLocationNames = new Dictionary<int, List<string>>();
for (ushort i = 0; i < totalNumHeaderFiles; i++) {
if (PatchToolboxDialog.flag_DynamicHeadersPatchApplied || PatchToolboxDialog.CheckFilesDynamicHeadersPatchApplied()) {
@ -27,20 +27,19 @@ namespace DSPRE {
} else {
tempMapHeader = MapHeader.LoadFromARM9(i);
}
if (tempMapHeader.wildPokemon != MapHeader.DPPT_NULL_ENCOUNTER_FILE_ID) {
if (RomInfo.gameFamily == GameFamilies.DP) {
EncounterFileLocationName.Add(tempMapHeader.wildPokemon, locationNames[((HeaderDP)tempMapHeader).locationName]);
} else {
EncounterFileLocationName.Add(tempMapHeader.wildPokemon, locationNames[((HeaderPt)tempMapHeader).locationName]);
if (tempMapHeader.wildPokemon != MapHeader.DPPT_NULL_ENCOUNTER_FILE_ID) {
if (!EncounterFileLocationNames.ContainsKey(tempMapHeader.wildPokemon)) {
EncounterFileLocationNames[tempMapHeader.wildPokemon] = new List<string>();
}
EncounterFileLocationNames[tempMapHeader.wildPokemon].Add((gameFamily == GameFamilies.DP) ?
locationNames[((HeaderDP)tempMapHeader).locationName] :
locationNames[((HeaderPt)tempMapHeader).locationName]);
}
}
for (int i = 0; i < Directory.GetFiles(encounterFileFolder).Length; i++) {
if (EncounterFileLocationName.ContainsKey(i)) {
selectEncounterComboBox.Items.Add("[" + i + "] " + EncounterFileLocationName[i]);
if (EncounterFileLocationNames.ContainsKey(i)) {
selectEncounterComboBox.Items.Add("[" + i + "] " + String.Join(" + ", EncounterFileLocationNames[i]));
} else {
selectEncounterComboBox.Items.Add("[" + i + "] " + " Unused");
}

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@ namespace DSPRE {
Text = "DSPRE Reloaded " + GetDSPREVersion() + " - HGSS Encounters Editor";
MapHeader tempMapHeader;
List<string> locationNames = RomInfo.GetLocationNames();
Dictionary<int, string> EncounterFileLocationName = new Dictionary<int, string>();
Dictionary<int, List<string>> EncounterFileLocationNames = new Dictionary<int, List<string>>();
for (ushort i = 0; i < totalNumHeaderFiles; i++)
{
@ -32,14 +32,18 @@ namespace DSPRE {
tempMapHeader = MapHeader.LoadFromARM9(i);
}
if (tempMapHeader.wildPokemon != MapHeader.HGSS_NULL_ENCOUNTER_FILE_ID)
EncounterFileLocationName.Add(tempMapHeader.wildPokemon, locationNames[((HeaderHGSS)tempMapHeader).locationName]);
if (tempMapHeader.wildPokemon != MapHeader.HGSS_NULL_ENCOUNTER_FILE_ID) {
if (!EncounterFileLocationNames.ContainsKey(tempMapHeader.wildPokemon)) {
EncounterFileLocationNames[tempMapHeader.wildPokemon] = new List<string>();
}
EncounterFileLocationNames[tempMapHeader.wildPokemon].Add(locationNames[((HeaderHGSS)tempMapHeader).locationName] );
}
}
for (int i = 0; i < Directory.GetFiles(encounterFileFolder).Length; i++) {
if (EncounterFileLocationName.ContainsKey(i))
selectEncounterComboBox.Items.Add( "[" + i + "] " + EncounterFileLocationName[i]);
if (EncounterFileLocationNames.ContainsKey(i))
selectEncounterComboBox.Items.Add( "[" + i + "] " + String.Join(" + ", EncounterFileLocationNames[i]));
else
selectEncounterComboBox.Items.Add("[" + i + "] " + " Unused");
}