mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-04-10 19:15:14 +00:00
Using IEmulator interface instead of CModel3 directly
This commit is contained in:
parent
9baa0488e3
commit
1265c8d184
|
@ -619,7 +619,7 @@ static const int STATE_FILE_VERSION = 2; // save state file version
|
||||||
static const int NVRAM_FILE_VERSION = 0; // NVRAM file version
|
static const int NVRAM_FILE_VERSION = 0; // NVRAM file version
|
||||||
static unsigned s_saveSlot = 0; // save state slot #
|
static unsigned s_saveSlot = 0; // save state slot #
|
||||||
|
|
||||||
static void SaveState(CModel3 *Model3)
|
static void SaveState(IEmulator *Model3)
|
||||||
{
|
{
|
||||||
CBlockFile SaveState;
|
CBlockFile SaveState;
|
||||||
|
|
||||||
|
@ -643,7 +643,7 @@ static void SaveState(CModel3 *Model3)
|
||||||
DebugLog("Saved state to '%s'.\n", filePath);
|
DebugLog("Saved state to '%s'.\n", filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadState(CModel3 *Model3)
|
static void LoadState(IEmulator *Model3)
|
||||||
{
|
{
|
||||||
CBlockFile SaveState;
|
CBlockFile SaveState;
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ static void LoadState(CModel3 *Model3)
|
||||||
DebugLog("Loaded state from '%s'.\n", filePath);
|
DebugLog("Loaded state from '%s'.\n", filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SaveNVRAM(CModel3 *Model3)
|
static void SaveNVRAM(IEmulator *Model3)
|
||||||
{
|
{
|
||||||
CBlockFile NVRAM;
|
CBlockFile NVRAM;
|
||||||
|
|
||||||
|
@ -702,7 +702,7 @@ static void SaveNVRAM(CModel3 *Model3)
|
||||||
DebugLog("Saved NVRAM to '%s'.\n", filePath);
|
DebugLog("Saved NVRAM to '%s'.\n", filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadNVRAM(CModel3 *Model3)
|
static void LoadNVRAM(IEmulator *Model3)
|
||||||
{
|
{
|
||||||
CBlockFile NVRAM;
|
CBlockFile NVRAM;
|
||||||
|
|
||||||
|
@ -857,12 +857,11 @@ void EndFrameVideo()
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#ifdef SUPERMODEL_DEBUGGER
|
#ifdef SUPERMODEL_DEBUGGER
|
||||||
int Supermodel(const char *zipFile, CModel3 *Model3, CInputs *Inputs, COutputs *Outputs, Debugger::CDebugger *Debugger, CINIFile *CmdLine)
|
int Supermodel(const char *zipFile, IEmulator *Model3, CInputs *Inputs, COutputs *Outputs, Debugger::CDebugger *Debugger, CINIFile *CmdLine)
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
int Supermodel(const char *zipFile, CInputs *Inputs, COutputs *Outputs, CINIFile *CmdLine)
|
int Supermodel(const char *zipFile, IEmulator *Model3, CInputs *Inputs, COutputs *Outputs, CINIFile *CmdLine)
|
||||||
{
|
{
|
||||||
CModel3 *Model3 = new CModel3();
|
|
||||||
#endif // SUPERMODEL_DEBUGGER
|
#endif // SUPERMODEL_DEBUGGER
|
||||||
unsigned prevFPSTicks;
|
unsigned prevFPSTicks;
|
||||||
unsigned startTicks;
|
unsigned startTicks;
|
||||||
|
@ -1244,7 +1243,11 @@ int Supermodel(const char *zipFile, CInputs *Inputs, COutputs *Outputs, CINIFile
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dumpTimings && !paused)
|
if (dumpTimings && !paused)
|
||||||
Model3->DumpTimings();
|
{
|
||||||
|
CModel3 *M = dynamic_cast<CModel3 *>(Model3);
|
||||||
|
if (M)
|
||||||
|
M->DumpTimings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure all threads are paused before shutting down
|
// Make sure all threads are paused before shutting down
|
||||||
|
@ -1265,20 +1268,14 @@ int Supermodel(const char *zipFile, CInputs *Inputs, COutputs *Outputs, CINIFile
|
||||||
// Close audio
|
// Close audio
|
||||||
CloseAudio();
|
CloseAudio();
|
||||||
|
|
||||||
// Shut down
|
// Shut down renderers
|
||||||
#ifndef SUPERMODEL_DEBUGGER
|
|
||||||
delete Model3;
|
|
||||||
#endif // SUPERMODEL_DEBUGGER
|
|
||||||
delete Render2D;
|
delete Render2D;
|
||||||
delete Render3D;
|
delete Render3D;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Quit with an error
|
// Quit with an error
|
||||||
QuitError:
|
QuitError:
|
||||||
#ifndef SUPERMODEL_DEBUGGER
|
|
||||||
delete Model3;
|
|
||||||
#endif // SUPERMODEL_DEBUGGER
|
|
||||||
delete Render2D;
|
delete Render2D;
|
||||||
delete Render3D;
|
delete Render3D;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1750,13 +1747,15 @@ int main(int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create Model 3 emulator
|
||||||
|
IEmulator *Model3 = new CModel3();
|
||||||
|
|
||||||
// Create input system (default is SDL) and debugger
|
// Create input system (default is SDL) and debugger
|
||||||
CInputSystem *InputSystem = NULL;
|
CInputSystem *InputSystem = NULL;
|
||||||
CInputs *Inputs = NULL;
|
CInputs *Inputs = NULL;
|
||||||
COutputs *Outputs = NULL;
|
COutputs *Outputs = NULL;
|
||||||
int exitCode = 0;
|
int exitCode = 0;
|
||||||
#ifdef SUPERMODEL_DEBUGGER
|
#ifdef SUPERMODEL_DEBUGGER
|
||||||
CModel3 *Model3 = NULL;
|
|
||||||
Debugger::CSupermodelDebugger *Debugger = NULL;
|
Debugger::CSupermodelDebugger *Debugger = NULL;
|
||||||
#endif // SUPERMODEL_DEBUGGER
|
#endif // SUPERMODEL_DEBUGGER
|
||||||
|
|
||||||
|
@ -1839,8 +1838,6 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SUPERMODEL_DEBUGGER
|
#ifdef SUPERMODEL_DEBUGGER
|
||||||
// Create Model3
|
|
||||||
Model3 = new CModel3();
|
|
||||||
// Create Supermodel debugger unless debugging is disabled
|
// Create Supermodel debugger unless debugging is disabled
|
||||||
if (!g_Config.disableDebugger)
|
if (!g_Config.disableDebugger)
|
||||||
{
|
{
|
||||||
|
@ -1850,14 +1847,14 @@ int main(int argc, char **argv)
|
||||||
Debugger->ForceBreak(true);
|
Debugger->ForceBreak(true);
|
||||||
}
|
}
|
||||||
// Fire up Supermodel with debugger
|
// Fire up Supermodel with debugger
|
||||||
exitCode = Supermodel(argv[fileIdx],Model3,Inputs,Outputs,Debugger,&CmdLine);
|
exitCode = Supermodel(argv[fileIdx], Model3, Inputs, Outputs, Debugger, &CmdLine);
|
||||||
if (Debugger != NULL)
|
if (Debugger != NULL)
|
||||||
delete Debugger;
|
delete Debugger;
|
||||||
delete Model3;
|
|
||||||
#else
|
#else
|
||||||
// Fire up Supermodel
|
// Fire up Supermodel
|
||||||
exitCode = Supermodel(argv[fileIdx],Inputs,Outputs,&CmdLine);
|
exitCode = Supermodel(argv[fileIdx], Model3, Inputs, Outputs, &CmdLine);
|
||||||
#endif // SUPERMODEL_DEBUGGER
|
#endif // SUPERMODEL_DEBUGGER
|
||||||
|
delete Model3;
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
if (Inputs != NULL)
|
if (Inputs != NULL)
|
||||||
|
|
Loading…
Reference in a new issue