mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-28 00:31:38 +00:00
modif addBuffer but PPU need x and y cleanup seriously
This commit is contained in:
@@ -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++;
|
||||
}
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
+3
-4
@@ -11,6 +11,7 @@
|
||||
#include "Renderer/IRenderer.hpp"
|
||||
#include "Ram/Ram.hpp"
|
||||
#include "Models/Vector2.hpp"
|
||||
#include <algorithm>
|
||||
#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 <std::size_t DEST_SIZE_X, std::size_t DEST_SIZE_Y, std::size_t SRC_SIZE_X, std::size_t SRC_SIZE_Y>
|
||||
void add_buffer(std::array<std::array<uint32_t, DEST_SIZE_Y>, DEST_SIZE_X> &bufferDest,
|
||||
const std::array<std::array<uint32_t, SRC_SIZE_Y>, SRC_SIZE_X> &bufferSrc,
|
||||
const Vector2<int> &offset = {0, 0})
|
||||
void addBuffer(std::array<std::array<uint32_t, DEST_SIZE_Y>, DEST_SIZE_X> &bufferDest,
|
||||
const std::array<std::array<uint32_t, SRC_SIZE_Y>, 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
|
||||
|
||||
Reference in New Issue
Block a user