cgram debugger getting logs

This commit is contained in:
Clément Le Bihan
2020-03-28 16:33:13 +01:00
parent e5fbde350f
commit d36b7fab1a
3 changed files with 28 additions and 6 deletions

View File

@@ -5,6 +5,7 @@
#include "CGramDebug.hpp" #include "CGramDebug.hpp"
#include "../SNES.hpp" #include "../SNES.hpp"
#include <QColor> #include <QColor>
#include <iostream>
#include "../Utility/Utility.hpp" #include "../Utility/Utility.hpp"
#include "../Exceptions/InvalidAction.hpp" #include "../Exceptions/InvalidAction.hpp"
#include "../Exceptions/InvalidAddress.hpp" #include "../Exceptions/InvalidAddress.hpp"
@@ -23,6 +24,7 @@ namespace ComSquare::Debugger
this->_window->setAttribute(Qt::WA_DeleteOnClose); this->_window->setAttribute(Qt::WA_DeleteOnClose);
this->_ui.setupUi(this->_window); this->_ui.setupUi(this->_window);
this->_ui.cgram_view->setModel(&this->_model);
this->_window->show(); this->_window->show();
} }
@@ -62,11 +64,29 @@ int CGramModel::columnCount(const QModelIndex &) const
QVariant CGramModel::data(const QModelIndex &index, int role) const QVariant CGramModel::data(const QModelIndex &index, int role) const
{ {
if (role == Qt::TextAlignmentRole) u_int16_t addressValue;
return Qt::AlignCenter; uint8_t red;
if (role == Qt::BackgroundRole) uint8_t green;
return 1; uint8_t blue;
this->_ppu.cgramRead(0); //std::cout << "test1" << std::endl;
//if (role == Qt::TextAlignmentRole)
// return Qt::AlignCenter;
//std::cout << "test2" << std::endl;
//if (role == Qt::BackgroundRole) {
// std::cout << "test" << std::endl;
// return 1;
//}
//std::cout << "test3" << std::endl;
if (role != Qt::DisplayRole) if (role != Qt::DisplayRole)
return QVariant(); return QVariant();
addressValue = this->_ppu.cgramRead(index.column() * 16 + index.row());
blue = (addressValue & 0x7D00U) >> 10U;
green = (addressValue & 0x03E0U) >> 5U;
red = (addressValue & 0x001FU);
red = (red * 255U / 31U) << 24U;
green = (green * 255U / 31U) << 16U;
blue = (blue * 255U / 31U) << 8U;
return QColor(red, green,blue,255);
} }

View File

@@ -83,7 +83,6 @@ public:
QVariant data(const QModelIndex &index, int role) const override; QVariant data(const QModelIndex &index, int role) const override;
}; };
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.

View File

@@ -49,6 +49,9 @@
<attribute name="horizontalHeaderVisible"> <attribute name="horizontalHeaderVisible">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">