Ensure the MouseCard is properly reset when the emulator restarts.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2018-02-06 16:21:35 +00:00
parent 21156bb606
commit 7a6ad9f363
2 changed files with 21 additions and 2 deletions

View file

@ -18,6 +18,7 @@
#include "ParallelPrinter.h"
#include "Video.h"
#include "SaveState.h"
#include "MouseInterface.h"
#include "linux/data.h"
#include "linux/benchmark.h"
@ -277,6 +278,7 @@ namespace
MemInitialize();
VideoInitialize();
DiskReset();
HD_Reset();
if (!options.snapshot.empty())
{
@ -293,6 +295,9 @@ namespace
{
EnterMessageLoop();
}
sg_Mouse.Uninitialize();
sg_Mouse.Reset();
MemDestroy();
}
while (g_bRestart);
@ -306,7 +311,6 @@ namespace
HD_Destroy();
PrintDestroy();
CpuDestroy();
MemDestroy();
DiskDestroy();
ImageDestroy();

View file

@ -9,6 +9,7 @@
#include "CPU.h"
#include "Frame.h"
#include "Memory.h"
#include "MouseInterface.h"
#include "ParallelPrinter.h"
#include "Video.h"
#include "SaveState.h"
@ -38,6 +39,16 @@ namespace
DiskInitialize();
}
/* In AppleWin there are 3 ways to reset the emulator
*
* 1) Hardware Change: it leaves the EnterMessageLoop() function
* 2) ResetMachineState()
* 3) CtrlReset()
*
* Here we implement something similar to 1)
*
*/
void startEmulator(QWidget * window)
{
LoadConfiguration();
@ -51,10 +62,14 @@ namespace
MemInitialize();
VideoInitialize();
DiskReset();
HD_Reset();
}
void stopEmulator()
{
sg_Mouse.Uninitialize();
sg_Mouse.Reset();
MemDestroy();
}
@ -63,9 +78,9 @@ namespace
HD_Destroy();
PrintDestroy();
CpuDestroy();
MemDestroy();
DiskDestroy();
ImageDestroy();
}
}