From 7b9d9ac8ce1ca09740e39dec9bcd0a5caf4f503d Mon Sep 17 00:00:00 2001 From: Miguel Terol Espino Date: Thu, 15 Jun 2023 17:27:29 +0200 Subject: [PATCH] Merge of BluRosie code to add compat for HG-Engine --- DS_Map/Main Window.cs | 5 ++++- DS_Map/RomInfo.cs | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/DS_Map/Main Window.cs b/DS_Map/Main Window.cs index 138a941..8331fca 100644 --- a/DS_Map/Main Window.cs +++ b/DS_Map/Main Window.cs @@ -8782,7 +8782,10 @@ namespace DSPRE { int iconPalTableOffsetFromFileStart = (int)(RomInfo.monIconPalTableAddress - RomInfo.synthOverlayLoadAddress); if (iconPalTableOffsetFromFileStart >= 0) { // if iconPalTableAddress >= RomInfo.synthOverlayLoadAddress //In other words, if the pointer shows the table was moved to the synthetic overlay - iconTablePath = gameDirs[DirNames.synthOverlay].unpackedDir + "\\" + ROMToolboxDialog.expandedARMfileID.ToString("D4"); + if (File.Exists(DSUtils.GetOverlayPath(129))) + iconTablePath = DSUtils.GetOverlayPath(129); // HG-engine new overlay for icons + else + iconTablePath = gameDirs[DirNames.synthOverlay].unpackedDir + "\\" + ROMToolboxDialog.expandedARMfileID.ToString("D4"); } else { iconPalTableOffsetFromFileStart = (int)(RomInfo.monIconPalTableAddress - DSUtils.ARM9.address); iconTablePath = RomInfo.arm9Path; diff --git a/DS_Map/RomInfo.cs b/DS_Map/RomInfo.cs index c2265d0..c8b3ee5 100644 --- a/DS_Map/RomInfo.cs +++ b/DS_Map/RomInfo.cs @@ -531,9 +531,15 @@ namespace DSPRE { "displayed incorrectly or not displayed at all.", "Decompression error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } - if (ramAddressOfTable >= RomInfo.synthOverlayLoadAddress) { // if the pointer shows the table was moved to the synthetic overlay - OWTableOffset = ramAddressOfTable - RomInfo.synthOverlayLoadAddress; - OWtablePath = gameDirs[DirNames.synthOverlay].unpackedDir + "\\" + ROMToolboxDialog.expandedARMfileID.ToString("D4"); + if (ramAddressOfTable >= RomInfo.synthOverlayLoadAddress) { + // if the pointer shows the table was moved to the synthetic overlay + if (File.Exists(DSUtils.GetOverlayPath(131))) { + OWTableOffset = ramAddressOfTable - DSUtils.GetOverlayRAMAddress(131); + OWtablePath = DSUtils.GetOverlayPath(131); // HG-Engine new OW overlay + } else { + OWTableOffset = ramAddressOfTable - RomInfo.synthOverlayLoadAddress; + OWtablePath = gameDirs[DirNames.synthOverlay].unpackedDir + "\\" + ROMToolboxDialog.expandedARMfileID.ToString("D4"); + } } else { OWTableOffset = ramAddressOfTable - ov1Address; OWtablePath = ov1Path;