Bug fix: Emulator no longer crashes when leaving full speed mode
This commit is contained in:
@@ -65,6 +65,7 @@ namespace Desktop
|
|||||||
if (_isRunning) return;
|
if (_isRunning) return;
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
_isPaused = false;
|
_isPaused = false;
|
||||||
|
bool wasHighSpeed = false;
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -102,6 +103,19 @@ namespace Desktop
|
|||||||
int elapsedTStates = (int)(_cpu.TotalTStates - tStatesBefore);
|
int elapsedTStates = (int)(_cpu.TotalTStates - tStatesBefore);
|
||||||
_tapManager.Update(elapsedTStates);
|
_tapManager.Update(elapsedTStates);
|
||||||
|
|
||||||
|
if(highSpeed)
|
||||||
|
{
|
||||||
|
wasHighSpeed = true;
|
||||||
|
}
|
||||||
|
else if (wasHighSpeed)
|
||||||
|
{
|
||||||
|
stopwatch.Restart();
|
||||||
|
fpsStopwatch.Restart();
|
||||||
|
scanlineCount = 0;
|
||||||
|
audioSampleCount = (long)(_cpu.TotalTStates / 79.365); // Snap audio to the current T-State time
|
||||||
|
wasHighSpeed = false;
|
||||||
|
}
|
||||||
|
|
||||||
//Process audio at the correct time
|
//Process audio at the correct time
|
||||||
if (!highSpeed)
|
if (!highSpeed)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user