From f5d27185188bb4c7ae6f7605c555ab05eb5e980e Mon Sep 17 00:00:00 2001 From: Mixone-FinallyHere Date: Wed, 22 Oct 2025 21:18:08 +0200 Subject: [PATCH 1/6] Introduces check for overl129 string HGE --- DS_Map/RomInfo.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/DS_Map/RomInfo.cs b/DS_Map/RomInfo.cs index 2281f93..817bcad 100644 --- a/DS_Map/RomInfo.cs +++ b/DS_Map/RomInfo.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; +using System.Text; using System.Windows.Forms; using Path = System.IO.Path; @@ -20,6 +21,7 @@ namespace DSPRE public const string folderSuffix = "_DSPRE_contents"; // changed back to public static string private const string dataFolderName = @"data"; + public static bool isHGE { get; private set; } public static string romID { get; private set; } public static string projectName { get; private set; } public static string workDir { get; private set; } @@ -212,6 +214,28 @@ namespace DSPRE } romID = id; + if (gameVersion == GameVersions.HeartGold && gameLanguage == GameLanguages.English) + { + string ov129path = OverlayUtils.GetPath(129); + if (File.Exists(ov129path)) + { + using (DSUtils.EasyReader br = new DSUtils.EasyReader(ov129path)) + { + string gameCode = Encoding.UTF8.GetString(br.ReadBytes(16)); + if (gameCode == "hg-engine") + { + isHGE = true; + } + else + { + isHGE = false; + } + } + } else + { + isHGE = false; + } + } projectName = Path.GetFileNameWithoutExtension(romFolderName); LoadGameFamily(); From 016de298d4dc57800ed396b0f8c4c3de0ab35b02 Mon Sep 17 00:00:00 2001 From: Mixone-FinallyHere Date: Wed, 22 Oct 2025 21:18:31 +0200 Subject: [PATCH 2/6] Update icon search to use new static --- DS_Map/DSUtils/DSUtils.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DS_Map/DSUtils/DSUtils.cs b/DS_Map/DSUtils/DSUtils.cs index d1eadd7..636064f 100644 --- a/DS_Map/DSUtils/DSUtils.cs +++ b/DS_Map/DSUtils/DSUtils.cs @@ -297,11 +297,10 @@ namespace DSPRE { string iconTablePath; int iconPalTableOffsetFromFileStart; - string ov129path = OverlayUtils.GetPath(129); - if (File.Exists(ov129path)) { + if (RomInfo.isHGE) { // if overlay 129 exists, read it from there iconPalTableOffsetFromFileStart = (int)(RomInfo.monIconPalTableAddress - OverlayUtils.OverlayTable.GetRAMAddress(129)); - iconTablePath = ov129path; + iconTablePath = OverlayUtils.GetPath(129); } else if ((int)(RomInfo.monIconPalTableAddress - RomInfo.synthOverlayLoadAddress) >= 0) { // if there is a synthetic overlay, read it from there iconPalTableOffsetFromFileStart = (int)(RomInfo.monIconPalTableAddress - RomInfo.synthOverlayLoadAddress); From 0bac8cf4eadb7489ae42126fa95a2fc962394442 Mon Sep 17 00:00:00 2001 From: Mixone-FinallyHere Date: Wed, 22 Oct 2025 21:18:50 +0200 Subject: [PATCH 3/6] Disable elements if on HGE. TODO: Explain why disabled --- DS_Map/Main Window.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index fc88236..14de0ad 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -95,6 +95,15 @@ namespace DSPRE AppLogger.Debug("No stored ROM folder found on startup."); } + if (RomInfo.isHGE) + { + EditorPanels.trainerEditorTabPage.Parent = null; // Hide Trainer Editor for HGE + EditorPanels.tabPageEncountersEditor.Parent = null; // Hide Encounters Editor for HGE + wildEditorButton.Visible = false; // Hide Wild Editor button for HGE + personalDataEditorToolStripMenuItem.Visible = false; // Hide Personal Data Editor menu item for HGE + itemEditorToolStripMenuItem.Visible = false; // Hide Item Editor menu item for HGE + } + } #region Program Window From a5f47c7edd8a76f0bcac906ba16765106304ddb7 Mon Sep 17 00:00:00 2001 From: Mixone-FinallyHere Date: Wed, 22 Oct 2025 21:43:13 +0200 Subject: [PATCH 4/6] that wasnt 16 bytes --- DS_Map/RomInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DS_Map/RomInfo.cs b/DS_Map/RomInfo.cs index 817bcad..e64d9e7 100644 --- a/DS_Map/RomInfo.cs +++ b/DS_Map/RomInfo.cs @@ -222,7 +222,7 @@ namespace DSPRE using (DSUtils.EasyReader br = new DSUtils.EasyReader(ov129path)) { string gameCode = Encoding.UTF8.GetString(br.ReadBytes(16)); - if (gameCode == "hg-engine") + if (gameCode == "hg-engine rocks!") { isHGE = true; } From 6f74ac8ce2d04137288b8cc7c5901d5c94063104 Mon Sep 17 00:00:00 2001 From: Mixone-FinallyHere Date: Wed, 22 Oct 2025 22:08:00 +0200 Subject: [PATCH 5/6] Yes, checking RomInfo before the rom was loaded was a super smart idea --- DS_Map/Main Window.cs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index 14de0ad..8f50557 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -93,16 +93,7 @@ namespace DSPRE else { AppLogger.Debug("No stored ROM folder found on startup."); - } - - if (RomInfo.isHGE) - { - EditorPanels.trainerEditorTabPage.Parent = null; // Hide Trainer Editor for HGE - EditorPanels.tabPageEncountersEditor.Parent = null; // Hide Encounters Editor for HGE - wildEditorButton.Visible = false; // Hide Wild Editor button for HGE - personalDataEditorToolStripMenuItem.Visible = false; // Hide Personal Data Editor menu item for HGE - itemEditorToolStripMenuItem.Visible = false; // Hide Item Editor menu item for HGE - } + } } @@ -989,6 +980,21 @@ namespace DSPRE overlayEditorToolStripMenuItem.Enabled = true; } + if (RomInfo.isHGE) + { + AppLogger.Info("HGE ROM detected, disabling unsupported editors."); + EditorPanels.trainerEditorTabPage.Parent = null; // Hide Trainer Editor for HGE + EditorPanels.tabPageEncountersEditor.Parent = null; // Hide Encounters Editor for HGE + wildEditorButton.Visible = false; // Hide Wild Editor button for HGE + personalDataEditorToolStripMenuItem.Visible = false; // Hide Personal Data Editor menu item for HGE + itemEditorToolStripMenuItem.Visible = false; // Hide Item Editor menu item for HGE + MessageBox.Show("HGE ROM detected.\nCertain editors have been disabled as they are not compatible with HGE ROMs.\nAdditionally the following information is important:"+ + "\n\n- Certain editors such as Move Data or Trade Editor seem to work without crashing but it is no gaurantee, use at your own peril. ALso, move data will always get overwritten by hg-engine."+ + "\n\n- Certain text files or script files that HGE edits will be overwritten, please make sure you are aware which are the ones you have to manage with hg-engine."+ + "\n\n- After making edits in DSPRE and want to use as the new base rom for hg-engine make sure to run 'make clean' or otherwise hg-engine will just grab your old rom.nds data.", + "HGE Detected", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + Helpers.statusLabelMessage(); this.Text += " - " + RomInfo.projectName; } From c61bcad75795a96861e4cacc7e428f86d8662588 Mon Sep 17 00:00:00 2001 From: Mixone-FinallyHere Date: Wed, 22 Oct 2025 22:09:25 +0200 Subject: [PATCH 6/6] at least i know nobody will think it was done by ai with my dumbass typos --- DS_Map/Main Window.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index 8f50557..9194d6e 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -989,7 +989,7 @@ namespace DSPRE personalDataEditorToolStripMenuItem.Visible = false; // Hide Personal Data Editor menu item for HGE itemEditorToolStripMenuItem.Visible = false; // Hide Item Editor menu item for HGE MessageBox.Show("HGE ROM detected.\nCertain editors have been disabled as they are not compatible with HGE ROMs.\nAdditionally the following information is important:"+ - "\n\n- Certain editors such as Move Data or Trade Editor seem to work without crashing but it is no gaurantee, use at your own peril. ALso, move data will always get overwritten by hg-engine."+ + "\n\n- Certain editors such as Move Data or Trade Editor seem to work without crashing but it is no gaurantee, use at your own peril. Also, move data will always get overwritten by hg-engine."+ "\n\n- Certain text files or script files that HGE edits will be overwritten, please make sure you are aware which are the ones you have to manage with hg-engine."+ "\n\n- After making edits in DSPRE and want to use as the new base rom for hg-engine make sure to run 'make clean' or otherwise hg-engine will just grab your old rom.nds data.", "HGE Detected", MessageBoxButtons.OK, MessageBoxIcon.Information);