diff --git a/sources/PPU/Background.cpp b/sources/PPU/Background.cpp index 443c755..e7c3dd2 100644 --- a/sources/PPU/Background.cpp +++ b/sources/PPU/Background.cpp @@ -92,6 +92,7 @@ namespace ComSquare::PPU Utils::VFlipArray(this->_tileBuffer, {this->_characterNbPixels.x, this->_characterNbPixels.y}); for (int i = 0; i < this->_characterNbPixels.y; i++) { for (int j = 0; j < this->_characterNbPixels.x; j++) { + //std::copy(this->_tileBuffer.begin(), this->_tileBuffer.begin() + this->_characterNbPixels.x, this->buffer[pos.x].begin() ) this->buffer[pos.x][pos.y] = this->_tileBuffer[i][j]; pos.x++; } diff --git a/sources/PPU/PPU.cpp b/sources/PPU/PPU.cpp index b6fe012..703b8f5 100644 --- a/sources/PPU/PPU.cpp +++ b/sources/PPU/PPU.cpp @@ -36,7 +36,7 @@ namespace ComSquare::PPU { this->_registers._isLowByte = true; - //Utils::Debug::populateEnvironment(*this, 0); + Utils::Debug::populateEnvironment(*this, 0); } uint8_t PPU::read(uint24_t addr) @@ -310,8 +310,8 @@ namespace ComSquare::PPU (void)cycles; this->renderMainAndSubScreen(); - this->add_buffer(this->_screen, this->_subScreen); - this->add_buffer(this->_screen, this->_mainScreen); + this->addBuffer(this->_screen, this->_subScreen); + this->addBuffer(this->_screen, this->_mainScreen); //this->_backgrounds[2].renderBackground(); //add_buffer(this->_screen, this->_backgrounds[2].buffer); for (unsigned long i = 0; i < this->_screen.size(); i++) { @@ -656,9 +656,9 @@ namespace ComSquare::PPU void PPU::addToMainSubScreen(Background &bg) { if (this->_registers._t[0].raw & (1U << (bg.getBgNumber() - 1U))) - this->add_buffer(this->_mainScreen, bg.buffer); + this->addBuffer(this->_mainScreen, bg.buffer); if (this->_registers._t[1].raw & (1U << (bg.getBgNumber() - 1U))) - this->add_buffer(this->_subScreen, bg.buffer); + this->addBuffer(this->_subScreen, bg.buffer); } int PPU::getBgMode() const diff --git a/sources/PPU/PPU.hpp b/sources/PPU/PPU.hpp index 6bf913b..2a42e7d 100644 --- a/sources/PPU/PPU.hpp +++ b/sources/PPU/PPU.hpp @@ -11,6 +11,7 @@ #include "Renderer/IRenderer.hpp" #include "Ram/Ram.hpp" #include "Models/Vector2.hpp" +#include #include "Background.hpp" #include "PPUUtils.hpp" #include "Debugger/TileViewer/RAMTileRenderer.hpp" @@ -625,11 +626,9 @@ namespace ComSquare::PPU void renderMainAndSubScreen(); //! @brief Add a bg buffer to another buffer template - void add_buffer(std::array, DEST_SIZE_X> &bufferDest, - const std::array, SRC_SIZE_X> &bufferSrc, - const Vector2 &offset = {0, 0}) + void addBuffer(std::array, DEST_SIZE_X> &bufferDest, + const std::array, SRC_SIZE_X> &bufferSrc) { - // TODO use std::ranges for (unsigned long i = 0; i < bufferSrc.size(); i++) { for (unsigned long j = 0; j < bufferSrc[i].size(); j++) { if (bufferSrc[i][j] > 0xFF) // 0xFF correspond to a black pixel with full brightness