ipc: implement MsgStatus

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-03-30 09:37:29 +02:00 committed by refractionpcsx2
parent bc6e5213a0
commit 4a2482e950
2 changed files with 32 additions and 0 deletions

View File

@ -462,6 +462,27 @@ SocketIPC::IPCBuffer SocketIPC::ParseCommand(char* buf, char* ret_buffer, u32 bu
ret_cnt += 256;
break;
}
case MsgStatus:
{
if (!SafetyChecks(buf_cnt, 0, ret_cnt, 4, buf_size))
goto error;
EmuStatus status;
switch (m_vm->HasActiveMachine())
{
case true:
if (CoreThread.IsClosing())
status = Paused;
else
status = Running;
break;
case false:
status = Shutdown;
break;
}
ToArray(ret_buffer, status, ret_cnt);
ret_cnt += 4;
break;
}
default:
{
error:

View File

@ -103,9 +103,20 @@ protected:
MsgID = 0xC, /**< Returns the game ID. */
MsgUUID = 0xD, /**< Returns the game UUID. */
MsgGameVersion = 0xE, /**< Returns the game verion. */
MsgStatus = 0xF, /**< Returns the emulator status. */
MsgUnimplemented = 0xFF /**< Unimplemented IPC message. */
};
/**
* Emulator status enum.
* A list of possible emulator statuses.
*/
enum EmuStatus : uint32_t
{
Running = 0, /**< Game is running */
Paused = 1, /**< Game is paused */
Shutdown = 2 /**< Game is shutdown */
};
/**
* IPC message buffer.