From 7fc2871faa9ed4bc219164fb2c40deaffcf1d349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Sat, 28 Mar 2020 19:34:51 +0100 Subject: [PATCH] fixed the updateInfoTile --- sources/Debugger/CGramDebug.cpp | 7 +++++-- ui/cgramView.ui | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sources/Debugger/CGramDebug.cpp b/sources/Debugger/CGramDebug.cpp index 16a6050..d2923a7 100644 --- a/sources/Debugger/CGramDebug.cpp +++ b/sources/Debugger/CGramDebug.cpp @@ -52,17 +52,20 @@ namespace ComSquare::Debugger void CGramDebug::updateInfoTile(uint8_t addr) { uint16_t cgramValue = this->_ppu.cgramRead(addr); - std::cout << "val " << cgramValue << std::endl; uint8_t blue = (cgramValue & 0x7D00U) >> 10U; uint8_t green = (cgramValue & 0x03E0U) >> 5U; uint8_t red = (cgramValue & 0x001FU); + uint24_t hexColorValue = 0; this->_ui.indexLineEdit->setText(std::to_string(addr).c_str()); this->_ui.valueLineEdit->setText(std::to_string(cgramValue).c_str()); this->_ui.rLineEdit->setText(std::to_string(red).c_str()); this->_ui.gLineEdit->setText(std::to_string(green).c_str()); this->_ui.bLineEdit->setText(std::to_string(blue).c_str()); - this->_ui.hexLineEdit->setText(Utility::to_hex(cgramValue).c_str()); + hexColorValue += (red * 255U / 31U) << 16U; + hexColorValue += (green * 255U / 31U) << 8U; + hexColorValue += (blue * 255U / 31U); + this->_ui.hexLineEdit->setText(Utility::to_hex(hexColorValue).c_str()); } } diff --git a/ui/cgramView.ui b/ui/cgramView.ui index efefb37..64a7c21 100644 --- a/ui/cgramView.ui +++ b/ui/cgramView.ui @@ -103,7 +103,7 @@ - 70 + 75 16777215 @@ -129,7 +129,7 @@ - 70 + 75 16777215 @@ -155,7 +155,7 @@ - 70 + 75 16777215 @@ -181,7 +181,7 @@ - 70 + 75 16777215 @@ -207,7 +207,7 @@ - 70 + 75 16777215 @@ -233,7 +233,7 @@ - 70 + 75 16777215