mirror of https://github.com/stella-emu/stella.git
Fixed display of FPS in the TIA message window. This also fixes sound
issues, since the correct framerate is being communicated to the emulation core.
This commit is contained in:
parent
d77d2f2e61
commit
e618a6c72c
|
@ -65,6 +65,7 @@ void FrameManager::reset()
|
|||
{
|
||||
myState = State::waitForVsyncStart;
|
||||
myCurrentFrameTotalLines = myCurrentFrameFinalLines = 0;
|
||||
myFrameRate = 60.0;
|
||||
myLineInState = 0;
|
||||
myVsync = false;
|
||||
myVblank = false;
|
||||
|
@ -323,6 +324,9 @@ void FrameManager::finalizeFrame(FrameManager::State state)
|
|||
|
||||
if (myFramesInMode > Metrics::framesForModeConfirmation)
|
||||
myModeConfirmed = true;
|
||||
|
||||
myFrameRate = (myMode == TvMode::pal ? 15600.0 : 15720.0) /
|
||||
myCurrentFrameFinalLines;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -63,6 +63,8 @@ class FrameManager : public Serializable
|
|||
|
||||
uInt32 frameCount() const { return myTotalFrames; }
|
||||
|
||||
float frameRate() const { return myFrameRate; }
|
||||
|
||||
/**
|
||||
Serializable methods (see that class for more information).
|
||||
*/
|
||||
|
@ -104,6 +106,7 @@ class FrameManager : public Serializable
|
|||
uInt32 myLineInState;
|
||||
uInt32 myCurrentFrameTotalLines;
|
||||
uInt32 myCurrentFrameFinalLines;
|
||||
float myFrameRate;
|
||||
|
||||
uInt32 myTotalFrames;
|
||||
uInt32 myFramesInMode;
|
||||
|
|
|
@ -79,6 +79,10 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
|
|||
[this] () {
|
||||
mySystem->m6502().stop();
|
||||
mySystem->resetCycles();
|
||||
|
||||
// Recalculate framerate, attempting to auto-correct for scanline 'jumps'
|
||||
if(myAutoFrameEnabled)
|
||||
myConsole.setFramerate(myFrameManager.frameRate());
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -104,8 +108,8 @@ void TIA::reset()
|
|||
myCollisionMask = 0;
|
||||
myLinesSinceChange = 0;
|
||||
myCollisionUpdateRequired = false;
|
||||
myAutoFrameEnabled = false;
|
||||
myColorHBlank = 0;
|
||||
|
||||
myLastCycle = 0;
|
||||
mySubClock = 0;
|
||||
|
||||
|
@ -138,6 +142,8 @@ void TIA::frameReset()
|
|||
// Clear frame buffers
|
||||
clearBuffers();
|
||||
|
||||
myAutoFrameEnabled = (mySettings.getInt("framerate") <= 0);
|
||||
|
||||
// TODO - make use of ystart and height, maybe move to FrameManager
|
||||
}
|
||||
|
||||
|
@ -621,9 +627,9 @@ void TIA::setYStart(uInt32 ystart)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// TODO: stub
|
||||
void TIA::enableAutoFrame(bool enabled)
|
||||
{
|
||||
myAutoFrameEnabled = enabled;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -657,13 +663,6 @@ bool TIA::partialFrame() const
|
|||
return myFrameManager.isRendering();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// TODO: stub
|
||||
uInt32 TIA::startScanline() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// TODO: stub
|
||||
bool TIA::scanlinePos(uInt16& x, uInt16& y) const
|
||||
|
|
|
@ -179,14 +179,14 @@ class TIA : public Device
|
|||
Enables/disables auto-frame calculation. If enabled, the TIA
|
||||
re-adjusts the framerate at regular intervals.
|
||||
|
||||
@param mode Whether to enable or disable all auto-frame calculation
|
||||
@param enabled Whether to enable or disable all auto-frame calculation
|
||||
*/
|
||||
void enableAutoFrame(bool enabled);
|
||||
|
||||
/**
|
||||
Enables/disables color-loss for PAL modes only.
|
||||
|
||||
@param mode Whether to enable or disable PAL color-loss mode
|
||||
@param enabled Whether to enable or disable PAL color-loss mode
|
||||
*/
|
||||
void enableColorLoss(bool enabled);
|
||||
|
||||
|
@ -219,13 +219,6 @@ class TIA : public Device
|
|||
*/
|
||||
bool partialFrame() const;
|
||||
|
||||
/**
|
||||
Answers the first scanline at which drawing occured in the last frame.
|
||||
|
||||
@return The starting scanline
|
||||
*/
|
||||
uInt32 startScanline() const;
|
||||
|
||||
/**
|
||||
Answers the current position of the virtual 'electron beam' used to
|
||||
draw the TIA image. If not in partial frame mode, the position is
|
||||
|
@ -438,6 +431,9 @@ class TIA : public Device
|
|||
|
||||
double myTimestamp;
|
||||
|
||||
// Automatic framerate correction based on number of scanlines
|
||||
bool myAutoFrameEnabled;
|
||||
|
||||
// Pointer to the current and previous frame buffers
|
||||
BytePtr myCurrentFrameBuffer;
|
||||
BytePtr myPreviousFrameBuffer;
|
||||
|
|
Loading…
Reference in New Issue