Improved hg-engine compat and added mikelan compatwith BluRosie code

This commit is contained in:
Miguel Terol Espino 2023-06-16 16:14:57 +02:00 committed by AdAstra-LD
parent 5b2e2e44e6
commit e679a26b6c
3 changed files with 22 additions and 17 deletions

View File

@ -8777,14 +8777,18 @@ namespace DSPRE {
int paletteId = 0;
string iconTablePath;
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
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");
int iconPalTableOffsetFromFileStart;
if (File.Exists(DSUtils.GetOverlayPath(129))) {
// if overlay 129 exists, read it from there
iconPalTableOffsetFromFileStart = (int)(RomInfo.monIconPalTableAddress - DSUtils.GetOverlayRAMAddress(129));
iconTablePath = DSUtils.GetOverlayPath(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);
iconTablePath = gameDirs[DirNames.synthOverlay].unpackedDir + "\\" + ROMToolboxDialog.expandedARMfileID.ToString("D4");
} else {
// default handling
iconPalTableOffsetFromFileStart = (int)(RomInfo.monIconPalTableAddress - DSUtils.ARM9.address);
iconTablePath = RomInfo.arm9Path;
}

View File

@ -88,7 +88,7 @@ namespace DSPRE.ROMFiles {
pokemonText.Append(car.ToString("X4"));
specialCharON = false;
} else if (compressed) {
#region Compressed String
#region Compressed String
int shift = 0;
int trans = 0;
string uncomp = "";

View File

@ -526,20 +526,21 @@ namespace DSPRE {
using (DSUtils.EasyReader bReader = new DSUtils.EasyReader(ov1Path, ramAddrOfPointer - ov1Address)) { // read the pointer at the specified ram address and adjust accordingly below
uint ramAddressOfTable = bReader.ReadUInt32();
if (ramAddressOfTable >= 0x03000000) {
if ((((UInt32)(ramAddressOfTable) >> 0x18)) != 0x02) {
MessageBox.Show("Something went wrong reading the Overworld configuration table.\nOverworld sprites in the Event Editor will be " +
"displayed incorrectly or not displayed at all.", "Decompression error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (ramAddressOfTable >= RomInfo.synthOverlayLoadAddress) {
if (File.Exists(DSUtils.GetOverlayPath(131))) {
// if HGE field extension overlay exists
OWTableOffset = ramAddressOfTable - DSUtils.GetOverlayRAMAddress(131);
OWtablePath = DSUtils.GetOverlayPath(131);
}
else 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");
}
OWTableOffset = ramAddressOfTable - RomInfo.synthOverlayLoadAddress;
OWtablePath = gameDirs[DirNames.synthOverlay].unpackedDir + "\\" + ROMToolboxDialog.expandedARMfileID.ToString("D4");
} else {
OWTableOffset = ramAddressOfTable - ov1Address;
OWtablePath = ov1Path;