Bug fix: Emulator now resets properly
This commit is contained in:
@@ -28,6 +28,7 @@ namespace Desktop
|
|||||||
public double FrameTime = 0;
|
public double FrameTime = 0;
|
||||||
public bool highSpeed = false;
|
public bool highSpeed = false;
|
||||||
public bool tapeLoaded = false;
|
public bool tapeLoaded = false;
|
||||||
|
private volatile bool _pendingReset = false;
|
||||||
|
|
||||||
|
|
||||||
public Form1()
|
public Form1()
|
||||||
@@ -79,6 +80,20 @@ namespace Desktop
|
|||||||
|
|
||||||
while (_isRunning)
|
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)
|
if (_isPaused)
|
||||||
{
|
{
|
||||||
@@ -277,6 +292,7 @@ namespace Desktop
|
|||||||
|
|
||||||
private void btnReset_Click(object sender, EventArgs e)
|
private void btnReset_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
_pendingReset = true;
|
||||||
_isPaused = true;
|
_isPaused = true;
|
||||||
_cpu.Reset();
|
_cpu.Reset();
|
||||||
_memoryBus.CleanRAMData();
|
_memoryBus.CleanRAMData();
|
||||||
|
|||||||
Reference in New Issue
Block a user