From 336cfd8ab43654c5db488c4a52e47c82efae4ac8 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Fri, 12 Jan 2024 16:06:03 -0700 Subject: [PATCH] Reset memory to zeros --- src/vendor/libqboy/gbgpu.h | 1 - src/vendor/libqboy/z80mmu.cpp | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/vendor/libqboy/gbgpu.h b/src/vendor/libqboy/gbgpu.h index 4a3bfec..e76f4af 100644 --- a/src/vendor/libqboy/gbgpu.h +++ b/src/vendor/libqboy/gbgpu.h @@ -3,7 +3,6 @@ #include "libqboy_global.h" #include "z80mmu.h" -#include const int _GBGPU_W = 160; const int _GBGPU_H = 144; diff --git a/src/vendor/libqboy/z80mmu.cpp b/src/vendor/libqboy/z80mmu.cpp index 330b584..34a555b 100644 --- a/src/vendor/libqboy/z80mmu.cpp +++ b/src/vendor/libqboy/z80mmu.cpp @@ -5,6 +5,10 @@ z80mmu::z80mmu() { mbc = 0; + wram.resize(0x2000, 0); + vram.resize(0x2000, 0); + voam.resize(0xA0, 0); + zram.resize(0x100, 0); reset(); } @@ -13,10 +17,10 @@ z80mmu::~z80mmu() { } void z80mmu::reset() { - wram.resize(0x2000, 0); - vram.resize(0x2000, 0); - voam.resize(0xA0, 0); - zram.resize(0x100, 0); + std::fill(wram.begin(), wram.end(), 0); + std::fill(vram.begin(), vram.end(), 0); + std::fill(voam.begin(), voam.end(), 0); + std::fill(zram.begin(), zram.end(), 0); if (mbc != 0) delete mbc; mbc = 0;