Skip to content

Commit

Permalink
Merge pull request #1455 from nicolasnoble/debug-map-fix
Browse files Browse the repository at this point in the history
Slightly fixing debug memory map system.
  • Loading branch information
nicolasnoble authored Oct 9, 2023
2 parents 755ec00 + a6d4b5f commit ac329d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 5 additions & 7 deletions src/core/debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,26 @@ void PCSX::Debug::markMap(uint32_t address, int mask) {
address = normalizeAddress(address);
uint32_t base = (address >> 20) & 0xffc;
uint32_t real = address & 0x7fffff;
uint32_t shortReal = address & 0x3fffff;
if (((base == 0x000) || (base == 0x800) || (base == 0xa00)) && (real < sizeof(m_mainMemoryMap))) {
m_mainMemoryMap[real] |= mask;
} else if ((base == 0x1f0) && (real < sizeof(m_parpMemoryMap))) {
m_parpMemoryMap[real] |= mask;
} else if ((base == 0x1f8) && (real < sizeof(m_scratchPadMap))) {
m_scratchPadMap[real] |= mask;
} else if ((base == 0xbfc) && (real < sizeof(m_biosMemoryMap))) {
m_biosMemoryMap[real] |= mask;
} else if ((base == 0xbfc) && (shortReal < sizeof(m_biosMemoryMap))) {
m_biosMemoryMap[shortReal] |= mask;
}
}

bool PCSX::Debug::isMapMarked(uint32_t address, int mask) {
address = normalizeAddress(address);
uint32_t base = (address >> 20) & 0xffc;
uint32_t real = address & 0x7fffff;
uint32_t shortReal = address & 0x3fffff;
if (((base == 0x000) || (base == 0x800) || (base == 0xa00)) && (real < sizeof(m_mainMemoryMap))) {
return m_mainMemoryMap[real] & mask;
} else if ((base == 0x1f0) && (real < sizeof(m_parpMemoryMap))) {
return m_parpMemoryMap[real] & mask;
} else if ((base == 0x1f8) && (real < sizeof(m_scratchPadMap))) {
return m_scratchPadMap[real] & mask;
} else if ((base == 0xbfc) && (real < sizeof(m_biosMemoryMap))) {
} else if ((base == 0xbfc) && (shortReal < sizeof(m_biosMemoryMap))) {
return m_biosMemoryMap[real] & mask;
}
return false;
Expand Down
2 changes: 0 additions & 2 deletions src/core/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class Debug {
void clearMaps() {
memset(m_mainMemoryMap, 0, sizeof(m_mainMemoryMap));
memset(m_biosMemoryMap, 0, sizeof(m_biosMemoryMap));
memset(m_parpMemoryMap, 0, sizeof(m_parpMemoryMap));
memset(m_scratchPadMap, 0, sizeof(m_scratchPadMap));
}

Expand Down Expand Up @@ -146,7 +145,6 @@ class Debug {

uint8_t m_mainMemoryMap[0x00800000] = {0};
uint8_t m_biosMemoryMap[0x00080000] = {0};
uint8_t m_parpMemoryMap[0x00010000] = {0};
uint8_t m_scratchPadMap[0x00000400] = {0};

void markMap(uint32_t address, int mask);
Expand Down

0 comments on commit ac329d2

Please sign in to comment.