Add a command line option to load a state.

For debugging.
This commit is contained in:
Unknown W. Brackets 2012-12-28 17:23:05 -08:00
parent f9133c1a56
commit 14ef840dd3
2 changed files with 15 additions and 1 deletions

View File

@ -87,7 +87,7 @@ namespace SaveState
// Don't actually run it until next CoreTiming::Advance().
// It's possible there might be a duplicate but it won't hurt us.
if (Core_IsStepping())
if (Core_IsStepping() && __KernelIsRunning())
{
// Warning: this may run on a different thread.
Process(0, 0);
@ -122,6 +122,12 @@ namespace SaveState
void Process(u64 userdata, int cyclesLate)
{
if (!__KernelIsRunning())
{
ERROR_LOG(COMMON, "Savestate failure: Unable to load without kernel, this should never happen.");
return;
}
std::vector<Operation> operations = Flush();
SaveStart state;

View File

@ -21,6 +21,7 @@
#include "file/zip_read.h"
#include "../Core/Config.h"
#include "../Core/SaveState.h"
#include "EmuThread.h"
#include "LogManager.h"
@ -53,6 +54,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
const char *fileToStart = NULL;
const char *fileToLog = NULL;
const char *stateToLoad = NULL;
bool hideLog = true;
bool autoRun = true;
@ -93,6 +95,10 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
fileToLog = __argv[++i];
if (!strncmp(__argv[i], "--log=", strlen("--log=")) && strlen(__argv[i]) > strlen("--log="))
fileToLog = __argv[i] + strlen("--log=");
if (!strcmp(__argv[i], "--state") && i < __argc - 1)
stateToLoad = __argv[++i];
if (!strncmp(__argv[i], "--state=", strlen("--state=")) && strlen(__argv[i]) > strlen("--state="))
stateToLoad = __argv[i] + strlen("--state=");
break;
}
}
@ -158,6 +164,8 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
if (autoRun)
MainWindow::SetNextState(CORE_RUNNING);
if (fileToStart != NULL && stateToLoad != NULL)
SaveState::Load(stateToLoad);
//so.. we're at the message pump of the GUI thread
MSG msg;