IPC: add SaveState

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-03-01 11:15:59 +01:00 committed by lightningterror
parent 047e63ee5f
commit e651147c53
2 changed files with 12 additions and 0 deletions

View File

@ -36,6 +36,7 @@
#include "Common.h"
#include "Memory.h"
#include "gui/AppSaveStates.h"
#include "System/SysThreads.h"
#include "svnrev.h"
#include "IPC.h"
@ -390,6 +391,16 @@ SocketIPC::IPCBuffer SocketIPC::ParseCommand(char* buf, char* ret_buffer, u32 bu
ret_cnt += 256;
break;
}
case MsgSaveState:
{
if (!m_vm->HasActiveMachine())
goto error;
if (!SafetyChecks(buf_cnt, 1, ret_cnt, 0, buf_size))
goto error;
StateCopy_SaveToSlot(FromArray<u8>(&buf[buf_cnt], 0));
buf_cnt += 1;
break;
}
default:
{
error:

View File

@ -92,6 +92,7 @@ protected:
MsgWrite32 = 6, /**< Write 32 bit value to memory. */
MsgWrite64 = 7, /**< Write 64 bit value to memory. */
MsgVersion = 8, /**< Returns PCSX2 version. */
MsgSaveState = 9, /**< Saves a savestate. */
MsgUnimplemented = 0xFF /**< Unimplemented IPC message. */
};