Add support to load the state from a snapshot file.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
0ee3225026
commit
8515b20327
6 changed files with 31 additions and 13 deletions
|
@ -27,6 +27,7 @@ namespace
|
|||
{
|
||||
std::string disk1;
|
||||
std::string disk2;
|
||||
std::string snapshot;
|
||||
bool run;
|
||||
};
|
||||
|
||||
|
@ -42,6 +43,11 @@ namespace
|
|||
("d2,2", po::value<std::string>(), "Mount disk image in second drive");
|
||||
desc.add(diskDesc);
|
||||
|
||||
po::options_description snapshotDesc("Snapshot");
|
||||
snapshotDesc.add_options()
|
||||
("load-state,ls", po::value<std::string>(), "Load snapshot from file");
|
||||
desc.add(snapshotDesc);
|
||||
|
||||
po::variables_map vm;
|
||||
try
|
||||
{
|
||||
|
@ -63,6 +69,11 @@ namespace
|
|||
options.disk2 = vm["d2"].as<std::string>();
|
||||
}
|
||||
|
||||
if (vm.count("load-state"))
|
||||
{
|
||||
options.snapshot = vm["load-state"].as<std::string>();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (const po::error& e)
|
||||
|
@ -211,6 +222,11 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
if (!options.snapshot.empty())
|
||||
{
|
||||
boot = true;
|
||||
}
|
||||
|
||||
if (boot)
|
||||
{
|
||||
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
||||
|
@ -220,6 +236,13 @@ namespace
|
|||
MemInitialize();
|
||||
VideoInitialize();
|
||||
DiskReset();
|
||||
|
||||
if (!options.snapshot.empty())
|
||||
{
|
||||
Snapshot_SetFilename(options.snapshot.c_str());
|
||||
Snapshot_LoadState();
|
||||
}
|
||||
|
||||
EnterMessageLoop();
|
||||
}
|
||||
while (g_bRestart);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "Memory.h"
|
||||
#include "Keyboard.h"
|
||||
#include "NTSC.h"
|
||||
#include "Log.h"
|
||||
|
||||
static bool bVideoScannerNTSC = true; // NTSC video scanning (or PAL)
|
||||
|
||||
|
@ -125,24 +126,24 @@ void CMouseInterface::SetVBlank(bool bVBL)
|
|||
BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser,
|
||||
LPTSTR buffer, DWORD chars)
|
||||
{
|
||||
std::cerr << "RegLoadString: " << section << " - " << key << std::endl;
|
||||
LogFileOutput("RegLoadString: %s - %s\n", section, key);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD *value)
|
||||
{
|
||||
std::cerr << "RegLoadValue: " << section << " - " << key << std::endl;
|
||||
LogFileOutput("RegLoadValue: %s - %s\n", section, key);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPCTSTR buffer)
|
||||
{
|
||||
std::cerr << "RegSaveString: " << section << " - " << key << " = " << buffer << std::endl;
|
||||
LogFileOutput("RegSaveString: %s - %s = %s\n", section, key, buffer);
|
||||
}
|
||||
|
||||
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value)
|
||||
{
|
||||
std::cerr << "RegSaveValue: " << section << " - " << key << " = " << value << std::endl;
|
||||
LogFileOutput("RegSaveValue: %s - %s = %d\n", section, key, value);
|
||||
}
|
||||
|
||||
// Joystick
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
void VideoReinitialize() { }
|
||||
void KeybLoadSnapshot(YamlLoadHelper&) { }
|
||||
std::string GetSnapshotCardName() { }
|
||||
std::string GetSnapshotCardName() { return ""; }
|
||||
bool CMouseInterface::LoadSnapshot(YamlLoadHelper&, unsigned int, unsigned int) { return true; }
|
||||
void SpkrLoadSnapshot(YamlLoadHelper&) { }
|
||||
void KeybReset() { }
|
||||
|
@ -18,7 +18,7 @@ void JoySaveSnapshot(YamlSaveHelper&) { }
|
|||
void VideoResetState() { }
|
||||
void JoyLoadSnapshot(YamlLoadHelper&) { }
|
||||
void MB_LoadSnapshot(YamlLoadHelper&, unsigned int, unsigned int) { }
|
||||
std::string CMouseInterface::GetSnapshotCardName() { }
|
||||
std::string CMouseInterface::GetSnapshotCardName() { return ""; }
|
||||
void SetLoadedSaveStateFlag(bool) { }
|
||||
void KeybSaveSnapshot(YamlSaveHelper&) { }
|
||||
void CMouseInterface::Reset() { }
|
||||
|
|
|
@ -247,6 +247,7 @@ typedef struct tagPOINT
|
|||
#define _vsntprintf vsnprintf
|
||||
#define wsprintf sprintf
|
||||
#define _strdup strdup
|
||||
#define _strtoui64 strtoull
|
||||
|
||||
typedef void * HINSTANCE;
|
||||
typedef int HRESULT;
|
||||
|
|
|
@ -244,11 +244,6 @@ DWORD GetCurrentDirectory(DWORD length, char * buffer)
|
|||
}
|
||||
}
|
||||
|
||||
UINT64 _strtoui64(const char * str, void *, int)
|
||||
{
|
||||
return boost::lexical_cast<UINT64>(str);
|
||||
}
|
||||
|
||||
void GetLocalTime(SYSTEMTIME *t)
|
||||
{
|
||||
timespec ts;
|
||||
|
|
|
@ -120,8 +120,6 @@ BYTE * LockResource(HGLOBAL);
|
|||
DWORD timeGetTime();
|
||||
DWORD GetCurrentDirectory(DWORD, char *);
|
||||
|
||||
UINT64 _strtoui64(const char *, void *, int);
|
||||
|
||||
void GetLocalTime(SYSTEMTIME *t);
|
||||
|
||||
BOOL GetOpenFileName(LPOPENFILENAME lpofn);
|
||||
|
|
Loading…
Add table
Reference in a new issue