Solving compilation issues

This commit is contained in:
Anonymus Raccoon
2020-03-28 14:58:30 +01:00
parent 618c708df6
commit e5fbde350f
5 changed files with 31 additions and 36 deletions
+1 -1
View File
@@ -200,7 +200,7 @@ add_executable(ComSquare
sources/Debugger/MemoryBusDebug.cpp sources/Debugger/MemoryBusDebug.cpp
sources/Debugger/MemoryBusDebug.hpp sources/Debugger/MemoryBusDebug.hpp
sources/Debugger/ClosableWindow.hpp sources/Debugger/ClosableWindow.hpp
sources/Models/Components.hpp sources/Debugger/cgramDebug.cpp sources/Debugger/cgramDebug.hpp) sources/Models/Components.hpp sources/Debugger/CGramDebug.cpp sources/Debugger/CGramDebug.hpp)
target_compile_definitions(ComSquare PUBLIC DEBUGGER_ENABLED) target_compile_definitions(ComSquare PUBLIC DEBUGGER_ENABLED)
@@ -2,7 +2,7 @@
// Created by cbihan on 3/27/20. // Created by cbihan on 3/27/20.
// //
#include "cgramDebug.hpp" #include "CGramDebug.hpp"
#include "../SNES.hpp" #include "../SNES.hpp"
#include <QColor> #include <QColor>
#include "../Utility/Utility.hpp" #include "../Utility/Utility.hpp"
@@ -11,11 +11,11 @@
namespace ComSquare::Debugger namespace ComSquare::Debugger
{ {
cgramDebug::cgramDebug(SNES &snes, ComSquare::PPU::PPU &ppu) CGramDebug::CGramDebug(SNES &snes, ComSquare::PPU::PPU &ppu)
: _window(new ClosableWindow<cgramDebug>(*this, &cgramDebug::disableViewer)), : _window(new ClosableWindow<CGramDebug>(*this, &CGramDebug::disableViewer)),
_snes(snes), _snes(snes),
_ui(), _ui(),
_model(), _model(ppu),
_ppu(ppu) _ppu(ppu)
{ {
this->_window->setContextMenuPolicy(Qt::NoContextMenu); this->_window->setContextMenuPolicy(Qt::NoContextMenu);
@@ -27,38 +27,40 @@ namespace ComSquare::Debugger
this->_window->show(); this->_window->show();
} }
void cgramDebug::disableViewer() void CGramDebug::disableViewer()
{ {
this->_snes.disableCgramDebugging(); this->_snes.disableCgramDebugging();
} }
void cgramDebug::focus() void CGramDebug::focus()
{ {
this->_window->activateWindow(); this->_window->activateWindow();
} }
bool cgramDebug::isDebugger() bool CGramDebug::isDebugger()
{ {
return true; return true;
} }
uint16_t cgramDebug::read(uint8_t addr) uint16_t CGramDebug::read(uint8_t addr)
{ {
return this->_ppu.cgramRead(addr); return this->_ppu.cgramRead(addr);
} }
} }
int cgramModel::rowCount(const QModelIndex &) const CGramModel::CGramModel(ComSquare::PPU::PPU &ppu) : _ppu(ppu) {}
int CGramModel::rowCount(const QModelIndex &) const
{ {
return this->rows; return this->rows;
} }
int cgramModel::columnCount(const QModelIndex &) const int CGramModel::columnCount(const QModelIndex &) const
{ {
return this->column; return this->column;
} }
QVariant cgramModel::data(const QModelIndex &index, int role) const QVariant CGramModel::data(const QModelIndex &index, int role) const
{ {
if (role == Qt::TextAlignmentRole) if (role == Qt::TextAlignmentRole)
return Qt::AlignCenter; return Qt::AlignCenter;
@@ -67,9 +69,4 @@ QVariant cgramModel::data(const QModelIndex &index, int role) const
this->_ppu.cgramRead(0); this->_ppu.cgramRead(0);
if (role != Qt::DisplayRole) if (role != Qt::DisplayRole)
return QVariant(); return QVariant();
} }
void cgramModel::ppu(const ComSquare::PPU::PPU &ppu)
{
this->_ppu = ppu;
}
@@ -59,7 +59,7 @@
//! @brief The qt model that bind the logs to the view. //! @brief The qt model that bind the logs to the view.
class cgramModel : public QAbstractTableModel class CGramModel : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT
private: private:
@@ -70,13 +70,11 @@ public:
const int column = 16; const int column = 16;
//! @brief The number of rows //! @brief The number of rows
const int rows = 16; const int rows = 16;
cgramModel() = default; explicit CGramModel(ComSquare::PPU::PPU &ppu);
cgramModel(const cgramModel &) = delete; CGramModel(const CGramModel &) = delete;
const cgramModel &operator=(const cgramModel &) = delete; const CGramModel &operator=(const CGramModel &) = delete;
~cgramModel() override = default; ~CGramModel() override = default;
//! @brief set the reference to the ppu
void ppu(const ComSquare::PPU::PPU &ppu);
//! @brief The number of row the table has. //! @brief The number of row the table has.
int rowCount(const QModelIndex &parent) const override; int rowCount(const QModelIndex &parent) const override;
//! @brief The number of column the table has. //! @brief The number of column the table has.
@@ -89,26 +87,26 @@ public:
namespace ComSquare::Debugger namespace ComSquare::Debugger
{ {
//! @brief window that allow the user to view all data going through the memory bus. //! @brief window that allow the user to view all data going through the memory bus.
class cgramDebug { class CGramDebug {
private: private:
//! @brief The QT window for this debugger. //! @brief The QT window for this debugger.
ClosableWindow<cgramDebug> *_window; ClosableWindow<CGramDebug> *_window;
//! @brief A reference to the snes (to disable the debugger). //! @brief A reference to the snes (to disable the debugger).
SNES &_snes; SNES &_snes;
//! @brief A widget that contain the whole UI. //! @brief A widget that contain the whole UI.
Ui::CgramView _ui; Ui::CgramView _ui;
//! @brief The Log visualizer model for QT. //! @brief The Log visualizer model for QT.
cgramModel _model; CGramModel _model;
//! @brief A reference to the ppu //! @brief A reference to the ppu
ComSquare::PPU::PPU &_ppu; ComSquare::PPU::PPU &_ppu;
public: public:
//! @brief Called when the window is closed. Turn off the debugger. //! @brief Called when the window is closed. Turn off the debugger.
void disableViewer(); void disableViewer();
public: public:
explicit cgramDebug(SNES &snes, ComSquare::PPU::PPU &ppu); explicit CGramDebug(SNES &snes, ComSquare::PPU::PPU &ppu);
cgramDebug(const cgramDebug &) = delete; CGramDebug(const CGramDebug &) = delete;
cgramDebug &operator=(const cgramDebug &) = delete; CGramDebug &operator=(const CGramDebug &) = delete;
~cgramDebug() = default; ~CGramDebug() = default;
//! @brief Read data at the CGRAM address send it to the debugger. //! @brief Read data at the CGRAM address send it to the debugger.
//! @param addr The address to read from. //! @param addr The address to read from.
+2 -2
View File
@@ -9,7 +9,7 @@
#include "Debugger/CPUDebug.hpp" #include "Debugger/CPUDebug.hpp"
#include "Debugger/APUDebug.hpp" #include "Debugger/APUDebug.hpp"
#include "Debugger/MemoryBusDebug.hpp" #include "Debugger/MemoryBusDebug.hpp"
#include "Debugger/cgramDebug.hpp" #include "Debugger/CGramDebug.hpp"
#endif #endif
@@ -134,7 +134,7 @@ namespace ComSquare
if (this->_cgramViewer) if (this->_cgramViewer)
this->_cgramViewer->focus(); this->_cgramViewer->focus();
else else
this->_cgramViewer = std::make_unique<Debugger::cgramDebug>(*this, *this->ppu); this->_cgramViewer = std::make_unique<Debugger::CGramDebug>(*this, *this->ppu);
#endif #endif
} }
+2 -2
View File
@@ -15,7 +15,7 @@
#ifdef DEBUGGER_ENABLED #ifdef DEBUGGER_ENABLED
#include "Debugger/MemoryViewer.hpp" #include "Debugger/MemoryViewer.hpp"
#include "Debugger/HeaderViewer.hpp" #include "Debugger/HeaderViewer.hpp"
#include "Debugger/cgramDebug.hpp" #include "Debugger/CGramDebug.hpp"
#endif #endif
@@ -30,7 +30,7 @@ namespace ComSquare
//! @brief The window that allow the user to view the cartridge's header. //! @brief The window that allow the user to view the cartridge's header.
std::unique_ptr<Debugger::HeaderViewer> _headerViewer; std::unique_ptr<Debugger::HeaderViewer> _headerViewer;
//! @brief The window that allow the user to view the CGRAM. //! @brief The window that allow the user to view the CGRAM.
std::unique_ptr<Debugger::cgramDebug> _cgramViewer; std::unique_ptr<Debugger::CGramDebug> _cgramViewer;
#endif #endif
//! @brief The memory bus that map addresses to components. //! @brief The memory bus that map addresses to components.
std::shared_ptr<Memory::MemoryBus> _bus; std::shared_ptr<Memory::MemoryBus> _bus;