Skip to content

Commit

Permalink
More generic data breakpoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasnoble committed May 9, 2019
1 parent 6ca12c9 commit cdd49f0
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions src/core/psxmem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ uint8_t PCSX::Memory::psxMemRead8(uint32_t mem) {
char *p;
uint32_t t;

if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BR1);
}

if (!PCSX::g_emulator.config().MemHack) {
PCSX::g_emulator.m_psxCpu->m_psxRegs.cycle += 1;
}
Expand All @@ -123,9 +127,6 @@ uint8_t PCSX::Memory::psxMemRead8(uint32_t mem) {
} else {
p = (char *)(g_psxMemRLUT[t]);
if (p != NULL) {
if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BR1);
}
return *(uint8_t *)(p + (mem & 0xffff));
} else {
PSXMEM_LOG("err lb %8.8lx\n", mem);
Expand All @@ -138,6 +139,10 @@ uint16_t PCSX::Memory::psxMemRead16(uint32_t mem) {
char *p;
uint32_t t;

if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BR2);
}

if (!PCSX::g_emulator.config().MemHack) {
PCSX::g_emulator.m_psxCpu->m_psxRegs.cycle += 1;
}
Expand All @@ -151,9 +156,6 @@ uint16_t PCSX::Memory::psxMemRead16(uint32_t mem) {
} else {
p = (char *)(g_psxMemRLUT[t]);
if (p != NULL) {
if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BR2);
}
return SWAP_LEu16(*(uint16_t *)(p + (mem & 0xffff)));
} else {
PSXMEM_LOG("err lh %8.8lx\n", mem);
Expand All @@ -166,6 +168,10 @@ uint32_t PCSX::Memory::psxMemRead32(uint32_t mem) {
char *p;
uint32_t t;

if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BR4);
}

if (!PCSX::g_emulator.config().MemHack) {
PCSX::g_emulator.m_psxCpu->m_psxRegs.cycle += 1;
}
Expand All @@ -179,9 +185,6 @@ uint32_t PCSX::Memory::psxMemRead32(uint32_t mem) {
} else {
p = (char *)(g_psxMemRLUT[t]);
if (p != NULL) {
if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BR4);
}
return SWAP_LEu32(*(uint32_t *)(p + (mem & 0xffff)));
} else {
if (m_writeok) {
Expand All @@ -196,6 +199,10 @@ void PCSX::Memory::psxMemWrite8(uint32_t mem, uint8_t value) {
char *p;
uint32_t t;

if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BW1);
}

if (!PCSX::g_emulator.config().MemHack) {
PCSX::g_emulator.m_psxCpu->m_psxRegs.cycle += 1;
}
Expand All @@ -209,9 +216,6 @@ void PCSX::Memory::psxMemWrite8(uint32_t mem, uint8_t value) {
} else {
p = (char *)(g_psxMemWLUT[t]);
if (p != NULL) {
if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BW1);
}
*(uint8_t *)(p + (mem & 0xffff)) = value;
PCSX::g_emulator.m_psxCpu->Clear((mem & (~3)), 1);
} else {
Expand All @@ -224,6 +228,10 @@ void PCSX::Memory::psxMemWrite16(uint32_t mem, uint16_t value) {
char *p;
uint32_t t;

if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BW2);
}

if (!PCSX::g_emulator.config().MemHack) {
PCSX::g_emulator.m_psxCpu->m_psxRegs.cycle += 1;
}
Expand All @@ -237,9 +245,6 @@ void PCSX::Memory::psxMemWrite16(uint32_t mem, uint16_t value) {
} else {
p = (char *)(g_psxMemWLUT[t]);
if (p != NULL) {
if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BW2);
}
*(uint16_t *)(p + (mem & 0xffff)) = SWAP_LEu16(value);
PCSX::g_emulator.m_psxCpu->Clear((mem & (~3)), 1);
} else {
Expand All @@ -252,6 +257,10 @@ void PCSX::Memory::psxMemWrite32(uint32_t mem, uint32_t value) {
char *p;
uint32_t t;

if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BW4);
}

if (!PCSX::g_emulator.config().MemHack) {
PCSX::g_emulator.m_psxCpu->m_psxRegs.cycle += 1;
}
Expand All @@ -266,9 +275,6 @@ void PCSX::Memory::psxMemWrite32(uint32_t mem, uint32_t value) {
} else {
p = (char *)(g_psxMemWLUT[t]);
if (p != NULL) {
if (PCSX::g_emulator.settings.get<PCSX::Emulator::SettingDebug>()) {
PCSX::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BW4);
}
*(uint32_t *)(p + (mem & 0xffff)) = SWAP_LEu32(value);
PCSX::g_emulator.m_psxCpu->Clear(mem, 1);
} else {
Expand Down

0 comments on commit cdd49f0

Please sign in to comment.