Bug fix: Emulator now resets properly
This commit is contained in:
@@ -28,6 +28,7 @@ namespace Desktop
|
||||
public double FrameTime = 0;
|
||||
public bool highSpeed = false;
|
||||
public bool tapeLoaded = false;
|
||||
private volatile bool _pendingReset = false;
|
||||
|
||||
|
||||
public Form1()
|
||||
@@ -78,7 +79,21 @@ namespace Desktop
|
||||
long audioSampleCount = 0;
|
||||
|
||||
while (_isRunning)
|
||||
{
|
||||
{
|
||||
if (_pendingReset)
|
||||
{
|
||||
_cpu.Reset();
|
||||
_memoryBus.CrapRAMData(); // Important! If RAM has garbage, the ROM boots instantly. If it has old data, it fails the RAM check!
|
||||
|
||||
// Reset all local loop timing variables
|
||||
TotalFrameCount = 0;
|
||||
scanlineCount = 0;
|
||||
audioSampleCount = 0;
|
||||
nextScanlineTarget = TStatesPerFrame;
|
||||
stopwatch.Restart();
|
||||
|
||||
_pendingReset = false;
|
||||
}
|
||||
|
||||
if (_isPaused)
|
||||
{
|
||||
@@ -277,6 +292,7 @@ namespace Desktop
|
||||
|
||||
private void btnReset_Click(object sender, EventArgs e)
|
||||
{
|
||||
_pendingReset = true;
|
||||
_isPaused = true;
|
||||
_cpu.Reset();
|
||||
_memoryBus.CleanRAMData();
|
||||
|
||||
Reference in New Issue
Block a user