Merge pull request #281 from unknownbrackets/savestates

Savestate tweaks (gzip, Windows cli/UI cleanup)
This commit is contained in:
Henrik Rydgård 2012-12-29 00:47:09 -08:00
commit ec080eb2b6
4 changed files with 19 additions and 1 deletions

View file

@ -86,6 +86,8 @@ struct FPL : public KernelObject
virtual void DoState(PointerWrap &p)
{
p.Do(nf);
if (p.mode == p.MODE_READ)
blocks = new bool[nf.numBlocks];
p.DoArray(blocks, nf.numBlocks);
p.Do(address);
p.DoMarker("FPL");

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

@ -661,6 +661,8 @@ namespace MainWindow
enable = g_State.bEmuThreadStarted ? MF_GRAYED : MF_ENABLED;
EnableMenuItem(menu,ID_FILE_LOAD,enable);
EnableMenuItem(menu,ID_FILE_SAVESTATE,!enable);
EnableMenuItem(menu,ID_FILE_LOADSTATE,!enable);
EnableMenuItem(menu,ID_CPU_DYNAREC,enable);
EnableMenuItem(menu,ID_CPU_INTERPRETER,enable);
EnableMenuItem(menu,ID_CPU_FASTINTERPRETER,enable);

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;