Fix buggy blanking of line 0.

This commit is contained in:
Christian Speckner 2017-06-14 12:37:57 +02:00
parent 861778f627
commit cf55f5d413
4 changed files with 27 additions and 6 deletions

View File

@ -67,11 +67,13 @@ FrameManager::FrameManager()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameManager::setHandlers(
FrameManager::callback frameStartCallback,
FrameManager::callback frameCompleteCallback
FrameManager::callback frameCompleteCallback,
FrameManager::callback renderingStartCallback
)
{
myOnFrameStart = frameStartCallback;
myOnFrameComplete = frameCompleteCallback;
myOnRenderingStart = renderingStartCallback;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -199,6 +201,7 @@ void FrameManager::setState(FrameManager::State state)
break;
case State::frame:
if (myOnRenderingStart) myOnRenderingStart();
myVsyncLines = 0;
myY = 0;
break;

View File

@ -39,7 +39,11 @@ class FrameManager : public Serializable
static uInt8 initialGarbageFrames();
void setHandlers(callback frameStartCallback, callback frameCompletionCallback);
void setHandlers(
callback frameStartCallback,
callback frameCompletionCallback,
callback renderingStartCallback
);
void reset();
@ -136,6 +140,7 @@ class FrameManager : public Serializable
callback myOnFrameStart;
callback myOnFrameComplete;
callback myOnRenderingStart;
VblankManager myVblankManager;

View File

@ -82,6 +82,9 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
},
[this] () {
onFrameComplete();
},
[this] () {
onRenderingStart();
}
);
@ -123,6 +126,7 @@ void TIA::reset()
myLastCycle = 0;
mySubClock = 0;
myXDelta = 0;
myXAtRenderingStart = 0;
memset(myShadowRegisters, 0, 64);
@ -986,10 +990,7 @@ void TIA::updateEmulation()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::onFrameStart()
{
const Int32 x = myHctr - 68;
if (x > 0)
memset(myFramebuffer.get(), 0, x);
myXAtRenderingStart = 0;
for (uInt8 i = 0; i < 4; i++)
updatePaddle(i);
@ -1014,12 +1015,21 @@ void TIA::onFrameStart()
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::onRenderingStart()
{
myXAtRenderingStart = myHctr > 68 ? myHctr - 68 : 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::onFrameComplete()
{
mySystem->m6502().stop();
mySystem->resetCycles();
if (myXAtRenderingStart > 0)
memset(myFramebuffer.get(), 0, myXAtRenderingStart);
// Blank out any extra lines not drawn this frame
const uInt32 missingScanlines = myFrameManager.missingScanlines();
if (missingScanlines > 0)

View File

@ -396,6 +396,8 @@ class TIA : public Device
void onFrameStart();
void onRenderingStart();
void onFrameComplete();
void onHalt();
@ -477,6 +479,7 @@ class TIA : public Device
Int32 myHblankCtr;
Int32 myHctr;
uInt32 myXDelta;
uInt32 myXAtRenderingStart;
bool myCollisionUpdateRequired;
uInt32 myCollisionMask;