aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Talavera <jesse@jesse.tg>2023-12-04 11:57:51 -0500
committerGitHub <noreply@github.com>2023-12-04 17:57:51 +0100
commit2e8cca9ca18a7d4375bc1ae4be6dfedbba6c6d79 (patch)
tree6234f3f3154ce3aed02e8a1f07946c921391655c
parentbb42c8b6392e4e99634dc52137d2974781192482 (diff)
Initialize the framebuffers within the constructor (#1901)
-rw-r--r--src/GPU.cpp7
-rw-r--r--src/GPU.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/GPU.cpp b/src/GPU.cpp
index c80e311..2c140a8 100644
--- a/src/GPU.cpp
+++ b/src/GPU.cpp
@@ -75,7 +75,7 @@ GPU::GPU(melonDS::NDS& nds, std::unique_ptr<Renderer3D>&& renderer3d, std::uniqu
NDS.RegisterEventFunc(Event_LCD, LCD_FinishFrame, MemberEventFunc(GPU, FinishFrame));
NDS.RegisterEventFunc(Event_DisplayFIFO, 0, MemberEventFunc(GPU, DisplayFIFO));
- FrontBuffer = 0;
+ InitFramebuffers();
}
GPU::~GPU() noexcept
@@ -298,6 +298,11 @@ void GPU::SetRenderer3D(std::unique_ptr<Renderer3D>&& renderer) noexcept
else
GPU3D.SetCurrentRenderer(std::move(renderer));
+ InitFramebuffers();
+}
+
+void GPU::InitFramebuffers() noexcept
+{
int fbsize;
if (GPU3D.IsRendererAccelerated())
fbsize = (256*3 + 1) * 192;
diff --git a/src/GPU.h b/src/GPU.h
index 21a05d5..ee7311a 100644
--- a/src/GPU.h
+++ b/src/GPU.h
@@ -607,6 +607,7 @@ public:
private:
void ResetVRAMCache() noexcept;
void AssignFramebuffers() noexcept;
+ void InitFramebuffers() noexcept;
template<typename T>
T ReadVRAM_ABGExtPal(u32 addr) const noexcept
{