From cdd49f07fa706f6cc99a42205f09fa7523f75843 Mon Sep 17 00:00:00 2001 From: Nicolas Pixel Noble Date: Wed, 8 May 2019 21:11:32 -0700 Subject: [PATCH] More generic data breakpoints. --- src/core/psxmem.cc | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/core/psxmem.cc b/src/core/psxmem.cc index 4c9242e79e..de03e1df7b 100644 --- a/src/core/psxmem.cc +++ b/src/core/psxmem.cc @@ -110,6 +110,10 @@ uint8_t PCSX::Memory::psxMemRead8(uint32_t mem) { char *p; uint32_t t; + if (PCSX::g_emulator.settings.get()) { + 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; } @@ -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::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BR1); - } return *(uint8_t *)(p + (mem & 0xffff)); } else { PSXMEM_LOG("err lb %8.8lx\n", mem); @@ -138,6 +139,10 @@ uint16_t PCSX::Memory::psxMemRead16(uint32_t mem) { char *p; uint32_t t; + if (PCSX::g_emulator.settings.get()) { + 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; } @@ -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::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); @@ -166,6 +168,10 @@ uint32_t PCSX::Memory::psxMemRead32(uint32_t mem) { char *p; uint32_t t; + if (PCSX::g_emulator.settings.get()) { + 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; } @@ -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::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BR4); - } return SWAP_LEu32(*(uint32_t *)(p + (mem & 0xffff))); } else { if (m_writeok) { @@ -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::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BW1); + } + if (!PCSX::g_emulator.config().MemHack) { PCSX::g_emulator.m_psxCpu->m_psxRegs.cycle += 1; } @@ -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::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 { @@ -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::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BW2); + } + if (!PCSX::g_emulator.config().MemHack) { PCSX::g_emulator.m_psxCpu->m_psxRegs.cycle += 1; } @@ -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::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 { @@ -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::g_emulator.m_debug->checkBP(mem, PCSX::Debug::BW4); + } + if (!PCSX::g_emulator.config().MemHack) { PCSX::g_emulator.m_psxCpu->m_psxRegs.cycle += 1; } @@ -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::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 {