Initialize the framebuffers within the constructor (#1901)

This commit is contained in:
Jesse Talavera 2023-12-04 11:57:51 -05:00 committed by GitHub
parent bb42c8b639
commit 2e8cca9ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -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;

View File

@ -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
{