Bug fix: Emulator no longer crashes when leaving full speed mode

This commit is contained in:
2026-04-24 13:24:30 +01:00
parent a8271d30a2
commit ed7c94dacc

View File

@@ -65,6 +65,7 @@ namespace Desktop
if (_isRunning) return;
_isRunning = true;
_isPaused = false;
bool wasHighSpeed = false;
Task.Run(() =>
{
try
@@ -102,6 +103,19 @@ namespace Desktop
int elapsedTStates = (int)(_cpu.TotalTStates - tStatesBefore);
_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
if (!highSpeed)
{