aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GPU3D.cpp9
-rw-r--r--src/GPU3D.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp
index ac29a1e..4787702 100644
--- a/src/GPU3D.cpp
+++ b/src/GPU3D.cpp
@@ -146,6 +146,12 @@ GPU3D::GPU3D(melonDS::NDS& nds, std::unique_ptr<Renderer3D>&& renderer) noexcept
{
}
+void GPU3D::SetCurrentRenderer(std::unique_ptr<Renderer3D>&& renderer) noexcept
+{
+ CurrentRenderer = std::move(renderer);
+ CurrentRenderer->Reset(NDS.GPU);
+}
+
void GPU3D::ResetRenderingState() noexcept
{
RenderNumPolygons = 0;
@@ -282,6 +288,9 @@ void GPU3D::Reset() noexcept
FlushAttributes = 0;
RenderXPos = 0;
+
+ if (CurrentRenderer)
+ CurrentRenderer->Reset(NDS.GPU);
}
void GPU3D::DoSavestate(Savestate* file) noexcept
diff --git a/src/GPU3D.h b/src/GPU3D.h
index 0c900c6..7c42eeb 100644
--- a/src/GPU3D.h
+++ b/src/GPU3D.h
@@ -117,7 +117,7 @@ public:
[[nodiscard]] bool IsRendererAccelerated() const noexcept;
[[nodiscard]] Renderer3D& GetCurrentRenderer() noexcept { return *CurrentRenderer; }
[[nodiscard]] const Renderer3D& GetCurrentRenderer() const noexcept { return *CurrentRenderer; }
- void SetCurrentRenderer(std::unique_ptr<Renderer3D>&& renderer) noexcept { CurrentRenderer = std::move(renderer); }
+ void SetCurrentRenderer(std::unique_ptr<Renderer3D>&& renderer) noexcept;
u8 Read8(u32 addr) noexcept;
u16 Read16(u32 addr) noexcept;