Linux: Fixed crash when opening event viewer

(+ fixed some compilation warnings)
This commit is contained in:
Sour 2020-06-02 20:05:21 -04:00
parent 79197dfe49
commit 1689ea4d3f
4 changed files with 7 additions and 6 deletions

View file

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

View file

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

View file

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

View file

@ -27,7 +27,7 @@ private:
vector<DebugEventInfo> _sentEvents;
vector<DebugEventInfo> _snapshot;
uint16_t _snapshotScanline = 0;
int16_t _snapshotScanline = -1;
uint16_t _snapshotCycle = 0;
SimpleLock _lock;