diff --git a/Core/EventManager.cpp b/Core/EventManager.cpp index 5be0198..e2b807e 100644 --- a/Core/EventManager.cpp +++ b/Core/EventManager.cpp @@ -268,7 +268,7 @@ void EventManager::GetDisplayBuffer(uint32_t *buffer, uint32_t bufferSize, Event { auto lock = _lock.AcquireSafe(); - if(bufferSize < _scanlineCount * 2 * EventManager::ScanlineWidth * 4) { + if(_snapshotScanline < 0 || bufferSize < _scanlineCount * 2 * EventManager::ScanlineWidth * 4) { return; } diff --git a/Core/GbDmaController.h b/Core/GbDmaController.h index 0613237..0b02cf0 100644 --- a/Core/GbDmaController.h +++ b/Core/GbDmaController.h @@ -6,7 +6,7 @@ class GbMemoryManager; class GbPpu; -class GbDmaController : public ISerializable +class GbDmaController final : public ISerializable { private: GbDmaControllerState _state; @@ -17,6 +17,7 @@ private: public: GbDmaController(GbMemoryManager* memoryManager, GbPpu* ppu); + void Exec(); bool IsOamDmaRunning(); diff --git a/Core/GbEventManager.cpp b/Core/GbEventManager.cpp index b701e8e..aad38ad 100644 --- a/Core/GbEventManager.cpp +++ b/Core/GbEventManager.cpp @@ -118,7 +118,7 @@ void GbEventManager::FilterEvents(EventViewerDisplayOptions& options) showEvent = isWrite ? options.ShowPpuRegisterBgScrollWrites : options.ShowPpuRegisterReads; } else if(reg >= 0x8000 && reg <= 0x9FFF) { showEvent = isWrite ? options.ShowPpuRegisterVramWrites : options.ShowPpuRegisterReads; - } else if(reg >= 0xFF47 && reg <= 0xFF49 || (reg >= 0xFF68 && reg <= 0xFF6B)) { + } else if((reg >= 0xFF47 && reg <= 0xFF49) || (reg >= 0xFF68 && reg <= 0xFF6B)) { showEvent = isWrite ? options.ShowPpuRegisterCgramWrites : options.ShowPpuRegisterReads; } else if(reg >= 0xFF4A && reg <= 0xFF4B) { showEvent = isWrite ? options.ShowPpuRegisterWindowWrites : options.ShowPpuRegisterReads; @@ -155,7 +155,7 @@ void GbEventManager::DrawEvent(DebugEventInfo& evt, bool drawBackground, uint32_ color = isWrite ? options.PpuRegisterWriteBgScrollColor : ppuReadColor; } else if(reg >= 0x8000 && reg <= 0x9FFF) { color = isWrite ? options.PpuRegisterWriteVramColor : ppuReadColor; - } else if(reg >= 0xFF47 && reg <= 0xFF49 || (reg >= 0xFF68 && reg <= 0xFF6B)) { + } else if((reg >= 0xFF47 && reg <= 0xFF49) || (reg >= 0xFF68 && reg <= 0xFF6B)) { color = isWrite ? options.PpuRegisterWriteCgramColor : ppuReadColor; } else if(reg >= 0xFF4A && reg <= 0xFF4B) { color = isWrite ? options.PpuRegisterWriteWindowColor : ppuReadColor; @@ -222,7 +222,7 @@ void GbEventManager::GetDisplayBuffer(uint32_t* buffer, uint32_t bufferSize, Eve { auto lock = _lock.AcquireSafe(); - if(bufferSize < _scanlineCount * 2 * GbEventManager::ScanlineWidth * 4) { + if(_snapshotScanline < 0 || bufferSize < _scanlineCount * 2 * GbEventManager::ScanlineWidth * 4) { return; } diff --git a/Core/GbEventManager.h b/Core/GbEventManager.h index 0ecc107..29ea6f2 100644 --- a/Core/GbEventManager.h +++ b/Core/GbEventManager.h @@ -27,7 +27,7 @@ private: vector _sentEvents; vector _snapshot; - uint16_t _snapshotScanline = 0; + int16_t _snapshotScanline = -1; uint16_t _snapshotCycle = 0; SimpleLock _lock;