mirror of https://github.com/stella-emu/stella.git
Fix artifacts due to varying frame height and doublebuffering.
Duplicate myLastFrameHeight and swap the values
This commit is contained in:
parent
146d0afe4f
commit
75bd732525
|
@ -116,7 +116,7 @@ void TIA::reset()
|
|||
myLastCycle = 0;
|
||||
mySubClock = 0;
|
||||
myXDelta = 0;
|
||||
myLastFrameHeight = 0;
|
||||
myLastFrameHeight[0] = myLastFrameHeight[1] = 0;
|
||||
|
||||
myBackground.reset();
|
||||
myPlayfield.reset();
|
||||
|
@ -889,10 +889,20 @@ void TIA::updateEmulation()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIA::onFrameStart()
|
||||
void TIA::swapBuffers()
|
||||
{
|
||||
myCurrentFrameBuffer.swap(myPreviousFrameBuffer);
|
||||
|
||||
uInt32 tmp = myLastFrameHeight[0];
|
||||
myLastFrameHeight[0] = myLastFrameHeight[1];
|
||||
myLastFrameHeight[1] = tmp;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIA::onFrameStart()
|
||||
{
|
||||
swapBuffers();
|
||||
|
||||
for (uInt8 i = 0; i < 4; i++)
|
||||
updatePaddle(i);
|
||||
}
|
||||
|
@ -903,12 +913,12 @@ void TIA::onFrameComplete()
|
|||
mySystem->m6502().stop();
|
||||
mySystem->resetCycles();
|
||||
|
||||
Int32 missingScanlines = myLastFrameHeight - myFrameManager.getY();
|
||||
Int32 missingScanlines = myLastFrameHeight[0] - myFrameManager.getY();
|
||||
|
||||
if (missingScanlines > 0)
|
||||
memset(myCurrentFrameBuffer.get() + 160 * myFrameManager.getY(), 0, missingScanlines * 160);
|
||||
|
||||
myLastFrameHeight = myFrameManager.getY();
|
||||
myLastFrameHeight[0] = myFrameManager.getY();
|
||||
|
||||
// Recalculate framerate, attempting to auto-correct for scanline 'jumps'
|
||||
if(myAutoFrameEnabled)
|
||||
|
|
|
@ -383,6 +383,8 @@ class TIA : public Device
|
|||
|
||||
uInt8 resxCounter();
|
||||
|
||||
void swapBuffers();
|
||||
|
||||
/**
|
||||
Get the result of the specified collision register.
|
||||
*/
|
||||
|
@ -441,7 +443,7 @@ class TIA : public Device
|
|||
// Pointer to the current and previous frame buffers
|
||||
BytePtr myCurrentFrameBuffer;
|
||||
BytePtr myPreviousFrameBuffer;
|
||||
uInt32 myLastFrameHeight;
|
||||
uInt32 myLastFrameHeight[2];
|
||||
|
||||
Background myBackground;
|
||||
Playfield myPlayfield;
|
||||
|
|
Loading…
Reference in New Issue