Starting to reenable debuggers

This commit is contained in:
Zoe Roux
2021-07-04 22:57:58 +02:00
parent 814729cda7
commit 15fde029a7
29 changed files with 1014 additions and 1168 deletions
+69 -79
View File
@@ -4,12 +4,6 @@
#include "SNES.hpp"
#include <ios>
#ifdef DEBUGGER_ENABLED
#include "Debugger/APUDebug.hpp"
#include "Debugger/CPU/CPUDebug.hpp"
#include "Debugger/MemoryBusDebug.hpp"
#include "Debugger/TileViewer/TileViewer.hpp"
#endif
namespace ComSquare
{
@@ -61,28 +55,24 @@ namespace ComSquare
void SNES::enableCPUDebuggingWithError(const DebuggableError &exception)
{
this->enableCPUDebugging(true);
auto cpuDebug = std::static_pointer_cast<Debugger::CPUDebug>(this->cpu);
cpuDebug->showError(exception);
// this->enableCPUDebugging(true);
// this->_cpuDebugger->showError(exception);
}
void SNES::enableCPUDebugging(bool pause)
{
if (this->cpu->isDebugger()) {
auto cpuDebug = std::static_pointer_cast<Debugger::CPUDebug>(this->cpu);
cpuDebug->focus();
if (pause)
cpuDebug->pause(true);
} else {
this->cpu = std::make_shared<Debugger::CPUDebug>(*this->cpu, *this);
this->bus.mapComponents(*this);
}
// if (!this->_cpuDebugger.has_value())
// this->_cpuDebugger.emplace(this->cpu, *this);
// else {
// this->_cpuDebugger->focus();
// if (pause)
// this->_cpuDebugger->pause(true);
// }
}
void SNES::disableCPUDebugging()
{
this->cpu = std::make_shared<CPU::CPU>(*this->cpu);
this->bus.mapComponents(*this);
// this->_cpuDebugger = std::nullopt;
}
void SNES::enableRamViewer()
@@ -90,7 +80,7 @@ namespace ComSquare
if (this->_ramViewer)
this->_ramViewer->focus();
else
this->_ramViewer.emplace(*this, *this->bus);
this->_ramViewer.emplace(*this, this->bus);
}
void SNES::disableRamViewer()
@@ -111,57 +101,57 @@ namespace ComSquare
this->_headerViewer = std::nullopt;
}
void SNES::enableAPUDebugging()
{
if (this->apu->isDebugger())
std::static_pointer_cast<Debugger::APUDebug>(this->apu)->focus();
else {
this->apu = std::make_shared<Debugger::APUDebug>(*this->apu, *this);
this->bus.mapComponents(*this);
}
}
// void SNES::enableAPUDebugging()
// {
// if (this->apu->isDebugger())
// std::static_pointer_cast<Debugger::APUDebug>(this->apu)->focus();
// else {
// this->apu = std::make_shared<Debugger::APUDebug>(*this->apu, *this);
// this->bus.mapComponents(*this);
// }
// }
//
// void SNES::disableAPUDebugging()
// {
// this->apu = std::make_shared<APU::APU>(*this->apu);
// this->bus.mapComponents(*this);
// }
//
// void SNES::enableMemoryBusDebugging()
// {
// if (this->bus.isDebugger())
// std::static_pointer_cast<Debugger::MemoryBusDebug>(this->bus)->focus();
// else {
// this->bus = std::make_shared<Debugger::MemoryBusDebug>(*this, *this->bus);
// this->cpu->setMemoryBus(this->bus);
// }
// }
//
// void SNES::disableMemoryBusDebugging()
// {
// this->bus = std::make_shared<Memory::MemoryBus>(*this->bus);
// this->cpu->setMemoryBus(this->bus);
// }
//
// void SNES::enableCgramDebugging()
// {
// if (this->_cgramViewer)
// this->_cgramViewer->focus();
// else
// this->_cgramViewer.emplace(*this, *this->ppu);
// }
//
// void SNES::disableCgramDebugging()
// {
// this->_cgramViewer = std::nullopt;
// }
void SNES::disableAPUDebugging()
{
this->apu = std::make_shared<APU::APU>(*this->apu);
this->bus.mapComponents(*this);
}
void SNES::enableMemoryBusDebugging()
{
if (this->bus.isDebugger())
std::static_pointer_cast<Debugger::MemoryBusDebug>(this->bus)->focus();
else {
this->bus = std::make_shared<Debugger::MemoryBusDebug>(*this, *this->bus);
this->cpu->setMemoryBus(this->bus);
}
}
void SNES::disableMemoryBusDebugging()
{
this->bus = std::make_shared<Memory::MemoryBus>(*this->bus);
this->cpu->setMemoryBus(this->bus);
}
void SNES::enableCgramDebugging()
{
if (this->_cgramViewer)
this->_cgramViewer->focus();
else
this->_cgramViewer.emplace(*this, *this->ppu);
}
void SNES::disableCgramDebugging()
{
this->_cgramViewer = std::nullopt;
}
void SNES::disableRegisterDebugging()
void SNES::disableRegisterViewer()
{
this->_registerViewer = std::nullopt;
}
void SNES::enableRegisterDebugging()
void SNES::enableRegisterViewer()
{
if (this->_registerViewer)
this->_registerViewer->focus();
@@ -169,18 +159,18 @@ namespace ComSquare
this->_registerViewer.emplace(*this);
}
void SNES::disableTileViewerDebugging()
{
this->_tileViewer = std::nullopt;
}
void SNES::enableTileViewerDebugging()
{
if (this->_tileViewer)
this->_tileViewer->focus();
else
this->_tileViewer.emplace(*this, *this->ppu);
}
// void SNES::disableTileViewerDebugging()
// {
// this->_tileViewer = std::nullopt;
// }
//
// void SNES::enableTileViewerDebugging()
// {
// if (this->_tileViewer)
// this->_tileViewer->focus();
// else
// this->_tileViewer.emplace(*this, *this->ppu);
// }
#endif
}// namespace ComSquare