Debugger: Event Viewer - Fixed PPU display when running line by line

This commit is contained in:
Sour 2019-10-18 19:34:55 -04:00
parent 024e9cdaf3
commit a4f4b526ef
3 changed files with 17 additions and 2 deletions

View file

@ -168,7 +168,16 @@ uint32_t EventManager::TakeEventSnapshot(EventViewerDisplayOptions options)
_overscanMode = _ppu->GetState().OverscanMode;
_useHighResOutput = _ppu->IsHighResOutput();
memcpy(_ppuBuffer, _ppu->GetScreenBuffer(), (_useHighResOutput ? (512 * 478) : (256*239)) * sizeof(uint16_t));
if(scanline >= _ppu->GetNmiScanline() || scanline == 0) {
memcpy(_ppuBuffer, _ppu->GetScreenBuffer(), (_useHighResOutput ? (512 * 478) : (256*239)) * sizeof(uint16_t));
} else {
uint16_t adjustedScanline = scanline + (_overscanMode ? 0 : 7);
uint32_t size = _useHighResOutput ? (512 * 478) : (256 * 239);
uint32_t offset = _useHighResOutput ? (512 * adjustedScanline * 2) : (256 * adjustedScanline);
memcpy(_ppuBuffer, _ppu->GetScreenBuffer(), offset * sizeof(uint16_t));
memcpy(_ppuBuffer+offset, _ppu->GetPreviousScreenBuffer()+offset, (size - offset) * sizeof(uint16_t));
}
_snapshot = _debugEvents;
_snapshotScanline = _ppu->GetRealScanline();

View file

@ -391,6 +391,7 @@ bool Ppu::ProcessEndOfScanline(uint16_t hClock)
RenderScanline();
if(_scanline == 0) {
_currentBuffer = _currentBuffer == _outputBuffers[0] ? _outputBuffers[1] : _outputBuffers[0];
_mosaicScanlineCounter = _state.MosaicEnabled ? _state.MosaicSize + 1 : 0;
if(!_skipRender) {
//If we're not skipping this frame, reset the high resolution flag
@ -1525,7 +1526,6 @@ void Ppu::SendFrame()
_console->GetVideoDecoder()->UpdateFrameSync(_currentBuffer, width, height, _frameCount, isRewinding);
} else {
_console->GetVideoDecoder()->UpdateFrame(_currentBuffer, width, height, _frameCount);
_currentBuffer = _currentBuffer == _outputBuffers[0] ? _outputBuffers[1] : _outputBuffers[0];
}
_frameSkipTimer.Reset();
#endif
@ -1542,6 +1542,11 @@ uint16_t* Ppu::GetScreenBuffer()
return _currentBuffer;
}
uint16_t* Ppu::GetPreviousScreenBuffer()
{
return _currentBuffer == _outputBuffers[0] ? _outputBuffers[1] : _outputBuffers[0];
}
uint8_t* Ppu::GetVideoRam()
{
return (uint8_t*)_vram;

View file

@ -228,6 +228,7 @@ public:
bool IsHighResOutput();
uint16_t* GetScreenBuffer();
uint16_t* GetPreviousScreenBuffer();
uint8_t* GetVideoRam();
uint8_t* GetCgRam();
uint8_t* GetSpriteRam();