fixing compilation

This commit is contained in:
Clément Le Bihan
2020-05-14 18:21:21 +02:00
parent 98692d31a0
commit c3a24f0238
6 changed files with 57 additions and 6 deletions
+5 -2
View File
@@ -98,7 +98,8 @@ add_executable(unit_tests
tests/CPU/Math/testOthersMath.cpp
tests/testRectangleMemory.cpp
tests/CPU/Math/testCMP.cpp
)
sources/PPU/Backgrounds.cpp
sources/PPU/Background.cpp sources/PPU/Background.hpp)
# include criterion & coverage
target_link_libraries(unit_tests criterion -lgcov)
@@ -212,7 +213,9 @@ add_executable(ComSquare
sources/Models/Components.hpp
sources/Debugger/CGramDebug.cpp
sources/Debugger/CGramDebug.hpp
sources/Models/Vector2.hpp sources/PPU/Backgrounds.cpp)
sources/Models/Vector2.hpp
sources/PPU/Backgrounds.cpp
sources/PPU/Background.cpp sources/PPU/Background.hpp)
target_compile_definitions(ComSquare PUBLIC DEBUGGER_ENABLED)
+28
View File
@@ -0,0 +1,28 @@
//
// Created by cbihan on 5/14/20.
//
#include "Background.hpp"
namespace PPU
{
/*void PPU::renderBackground(int bgNumber, Vector2<int> characterSize, int bpp, bool priority)
{
int nbBgHeight = (this->_registers._bgsc[bgNumber - 1].tilemapVerticalMirroring) ? 2 : 1;
int nbBgWidth = (this->_registers._bgsc[bgNumber - 1].tilemapHorizontalMirroring) ? 2 : 1;
uint16_t vramAddress = this->_registers._bgsc[bgNumber - 1].tilemapAddress << 1U;
Vector2<int> offset(0, 0);
for (int i = 0; i < 4; i++) {
if (!(i == 1 && nbBgWidth == 1) && !(i > 1 && nbBgHeight == 1)) {
drawBasicTileMap(vramAddress, bgNumber, bpp, characterSize, offset);
}
vramAddress+= 0x800;
offset.x += 32 * characterSize.x;
if (i == 2) {
offset.x = 0;
offset.y += 32 * characterSize.y;
}
}
}*/
}
+22
View File
@@ -0,0 +1,22 @@
//
// Created by cbihan on 5/14/20.
//
#ifndef COMSQUARE_BACKGROUND_HPP
#define COMSQUARE_BACKGROUND_HPP
#include <stdint-gcc.h>
#include <array>
#include "../Models/Vector2.hpp"
class Background {
int width;
int height;
int bpp;
bool directColor;
bool highRes;
std::array<std::array<uint16_t, 1024>, 1024> buffer;
};
#endif //COMSQUARE_BACKGROUND_HPP
+1
View File
@@ -15,6 +15,7 @@ namespace ComSquare::PPU
{
void PPU::renderBackground(int bgNumber, Vector2<int> characterSize, int bpp, bool priority)
{
(void)priority;
int nbBgHeight = (this->_registers._bgsc[bgNumber - 1].tilemapVerticalMirroring) ? 2 : 1;
int nbBgWidth = (this->_registers._bgsc[bgNumber - 1].tilemapHorizontalMirroring) ? 2 : 1;
uint16_t vramAddress = this->_registers._bgsc[bgNumber - 1].tilemapAddress << 1U;
+1 -1
View File
@@ -260,7 +260,7 @@ namespace ComSquare::PPU
this->_renderer.putPixel(x, y, pixelTmp);
}
}
renderBackground(1, {8, 8}, 4, false);
this->renderBackground(1, {8, 8}, 4, false);
this->_renderer.drawScreen();
}
-3
View File
@@ -17,11 +17,8 @@
//#define max4BitTiles 2048
//#define max8BitTiles 1024
namespace ComSquare::PPU
{
enum ppuRegisters {
//! @brief INIDISP Register (F-blank and Brightness)
inidisp = 0x00,