From ca07bf3366deaeeb569d988cbbff44c2a7992078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Mon, 25 May 2020 15:58:30 +0200 Subject: [PATCH] fixing compilation error and some warnings --- sources/PPU/Background.cpp | 10 +++++----- sources/PPU/Background.hpp | 3 +++ ui/ui_cpu.h | 4 ---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sources/PPU/Background.cpp b/sources/PPU/Background.cpp index 0ad3a46..d66301e 100644 --- a/sources/PPU/Background.cpp +++ b/sources/PPU/Background.cpp @@ -8,11 +8,11 @@ namespace ComSquare::PPU { Background::Background(int bpp, Vector2 backgroundSize, Vector2 characterSize, bool directColor, bool highRes, bool priority, uint16_t vramAddress, uint16_t graphicVramAddress): - _bpp(bpp), _backgroundSize(backgroundSize), _characterSize(characterSize), - _highRes(highRes), + _bpp(bpp), _directColor(directColor), + _highRes(highRes), _priority(priority), _vramAddress(vramAddress), _graphicVramAddress(graphicVramAddress) @@ -74,8 +74,8 @@ namespace ComSquare::PPU uint16_t addr = nbPalette * 0x10; for (int i = 0; i < 0xF; i++) { - palette[i] = this->cgramRead(addr); - palette[i] += this->cgramRead(addr + 1) << 8U; + palette[i] = this->cgram->read_internal(addr); + palette[i] += this->cgram->read_internal(addr + 1) << 8U; } return palette; } @@ -125,7 +125,7 @@ namespace ComSquare::PPU tileMapValue = this->vram->read_internal(vramAddress); tileMapValue += this->vram->read_internal(vramAddress + 1) << 8U; vramAddress += 2; - drawBgTile(tileMapValue, {(pos.x * this->_characterSize.x) + offset.x, (pos.y * this->_characterSize.y) + offset.y}, this->_bpp); + drawBgTile(tileMapValue, {(pos.x * this->_characterSize.x) + offset.x, (pos.y * this->_characterSize.y) + offset.y}); if (pos.x % 31 == 0 && pos.x) { pos.y++; pos.x = 0; diff --git a/sources/PPU/Background.hpp b/sources/PPU/Background.hpp index 2dab158..a042ac4 100644 --- a/sources/PPU/Background.hpp +++ b/sources/PPU/Background.hpp @@ -9,6 +9,7 @@ #include #include #include "../Models/Vector2.hpp" +#include "../Ram/Ram.hpp" namespace ComSquare::PPU { @@ -24,6 +25,8 @@ namespace ComSquare::PPU uint16_t _graphicVramAddress; std::array, 1024> _buffer; + std::shared_ptr vram; + std::shared_ptr cgram; //! @brief Draw a tile on the screen at x y pos void drawBgTile(uint16_t data, Vector2 pos); //! @brief Get a palette from the number of the palette (0 - 7) diff --git a/ui/ui_cpu.h b/ui/ui_cpu.h index 54b8db8..5bb8f98 100644 --- a/ui/ui_cpu.h +++ b/ui/ui_cpu.h @@ -1,11 +1,7 @@ /******************************************************************************** ** Form generated from reading UI file 'cpu.ui' ** -<<<<<<< HEAD ** Created by: Qt User Interface Compiler version 5.13.2 -======= -** Created by: Qt User Interface Compiler version 5.14.2 ->>>>>>> 24bcafeea3896022704904815d263f69f22e5096 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/