From e5fbde350f997a78399e8d646204f746e8a3d285 Mon Sep 17 00:00:00 2001
From: Anonymus Raccoon
Date: Sat, 28 Mar 2020 14:58:30 +0100
Subject: [PATCH] Solving compilation issues
---
CMakeLists.txt | 2 +-
.../{cgramDebug.cpp => CGramDebug.cpp} | 31 +++++++++----------
.../{cgramDebug.hpp => CGramDebug.hpp} | 26 +++++++---------
sources/SNES.cpp | 4 +--
sources/SNES.hpp | 4 +--
5 files changed, 31 insertions(+), 36 deletions(-)
rename sources/Debugger/{cgramDebug.cpp => CGramDebug.cpp} (62%)
rename sources/Debugger/{cgramDebug.hpp => CGramDebug.hpp} (84%)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d5d68c..0edbfec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -200,7 +200,7 @@ add_executable(ComSquare
sources/Debugger/MemoryBusDebug.cpp
sources/Debugger/MemoryBusDebug.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)
diff --git a/sources/Debugger/cgramDebug.cpp b/sources/Debugger/CGramDebug.cpp
similarity index 62%
rename from sources/Debugger/cgramDebug.cpp
rename to sources/Debugger/CGramDebug.cpp
index 835fc1e..a32ea1a 100644
--- a/sources/Debugger/cgramDebug.cpp
+++ b/sources/Debugger/CGramDebug.cpp
@@ -2,7 +2,7 @@
// Created by cbihan on 3/27/20.
//
-#include "cgramDebug.hpp"
+#include "CGramDebug.hpp"
#include "../SNES.hpp"
#include
#include "../Utility/Utility.hpp"
@@ -11,11 +11,11 @@
namespace ComSquare::Debugger
{
- cgramDebug::cgramDebug(SNES &snes, ComSquare::PPU::PPU &ppu)
- : _window(new ClosableWindow(*this, &cgramDebug::disableViewer)),
+ CGramDebug::CGramDebug(SNES &snes, ComSquare::PPU::PPU &ppu)
+ : _window(new ClosableWindow(*this, &CGramDebug::disableViewer)),
_snes(snes),
_ui(),
- _model(),
+ _model(ppu),
_ppu(ppu)
{
this->_window->setContextMenuPolicy(Qt::NoContextMenu);
@@ -27,38 +27,40 @@ namespace ComSquare::Debugger
this->_window->show();
}
- void cgramDebug::disableViewer()
+ void CGramDebug::disableViewer()
{
this->_snes.disableCgramDebugging();
}
- void cgramDebug::focus()
+ void CGramDebug::focus()
{
this->_window->activateWindow();
}
- bool cgramDebug::isDebugger()
+ bool CGramDebug::isDebugger()
{
return true;
}
- uint16_t cgramDebug::read(uint8_t addr)
+ uint16_t CGramDebug::read(uint8_t 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;
}
-int cgramModel::columnCount(const QModelIndex &) const
+int CGramModel::columnCount(const QModelIndex &) const
{
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)
return Qt::AlignCenter;
@@ -67,9 +69,4 @@ QVariant cgramModel::data(const QModelIndex &index, int role) const
this->_ppu.cgramRead(0);
if (role != Qt::DisplayRole)
return QVariant();
-}
-
-void cgramModel::ppu(const ComSquare::PPU::PPU &ppu)
-{
- this->_ppu = ppu;
-}
+}
\ No newline at end of file
diff --git a/sources/Debugger/cgramDebug.hpp b/sources/Debugger/CGramDebug.hpp
similarity index 84%
rename from sources/Debugger/cgramDebug.hpp
rename to sources/Debugger/CGramDebug.hpp
index e3f342c..3629795 100644
--- a/sources/Debugger/cgramDebug.hpp
+++ b/sources/Debugger/CGramDebug.hpp
@@ -59,7 +59,7 @@
//! @brief The qt model that bind the logs to the view.
-class cgramModel : public QAbstractTableModel
+class CGramModel : public QAbstractTableModel
{
Q_OBJECT
private:
@@ -70,13 +70,11 @@ public:
const int column = 16;
//! @brief The number of rows
const int rows = 16;
- cgramModel() = default;
- cgramModel(const cgramModel &) = delete;
- const cgramModel &operator=(const cgramModel &) = delete;
- ~cgramModel() override = default;
+ explicit CGramModel(ComSquare::PPU::PPU &ppu);
+ CGramModel(const CGramModel &) = delete;
+ const CGramModel &operator=(const CGramModel &) = delete;
+ ~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.
int rowCount(const QModelIndex &parent) const override;
//! @brief The number of column the table has.
@@ -89,26 +87,26 @@ public:
namespace ComSquare::Debugger
{
//! @brief window that allow the user to view all data going through the memory bus.
- class cgramDebug {
+ class CGramDebug {
private:
//! @brief The QT window for this debugger.
- ClosableWindow *_window;
+ ClosableWindow *_window;
//! @brief A reference to the snes (to disable the debugger).
SNES &_snes;
//! @brief A widget that contain the whole UI.
Ui::CgramView _ui;
//! @brief The Log visualizer model for QT.
- cgramModel _model;
+ CGramModel _model;
//! @brief A reference to the ppu
ComSquare::PPU::PPU &_ppu;
public:
//! @brief Called when the window is closed. Turn off the debugger.
void disableViewer();
public:
- explicit cgramDebug(SNES &snes, ComSquare::PPU::PPU &ppu);
- cgramDebug(const cgramDebug &) = delete;
- cgramDebug &operator=(const cgramDebug &) = delete;
- ~cgramDebug() = default;
+ explicit CGramDebug(SNES &snes, ComSquare::PPU::PPU &ppu);
+ CGramDebug(const CGramDebug &) = delete;
+ CGramDebug &operator=(const CGramDebug &) = delete;
+ ~CGramDebug() = default;
//! @brief Read data at the CGRAM address send it to the debugger.
//! @param addr The address to read from.
diff --git a/sources/SNES.cpp b/sources/SNES.cpp
index bdeac42..88e796d 100644
--- a/sources/SNES.cpp
+++ b/sources/SNES.cpp
@@ -9,7 +9,7 @@
#include "Debugger/CPUDebug.hpp"
#include "Debugger/APUDebug.hpp"
#include "Debugger/MemoryBusDebug.hpp"
-#include "Debugger/cgramDebug.hpp"
+#include "Debugger/CGramDebug.hpp"
#endif
@@ -134,7 +134,7 @@ namespace ComSquare
if (this->_cgramViewer)
this->_cgramViewer->focus();
else
- this->_cgramViewer = std::make_unique(*this, *this->ppu);
+ this->_cgramViewer = std::make_unique(*this, *this->ppu);
#endif
}
diff --git a/sources/SNES.hpp b/sources/SNES.hpp
index 825367a..19dcbb4 100644
--- a/sources/SNES.hpp
+++ b/sources/SNES.hpp
@@ -15,7 +15,7 @@
#ifdef DEBUGGER_ENABLED
#include "Debugger/MemoryViewer.hpp"
#include "Debugger/HeaderViewer.hpp"
-#include "Debugger/cgramDebug.hpp"
+#include "Debugger/CGramDebug.hpp"
#endif
@@ -30,7 +30,7 @@ namespace ComSquare
//! @brief The window that allow the user to view the cartridge's header.
std::unique_ptr _headerViewer;
//! @brief The window that allow the user to view the CGRAM.
- std::unique_ptr _cgramViewer;
+ std::unique_ptr _cgramViewer;
#endif
//! @brief The memory bus that map addresses to components.
std::shared_ptr _bus;