ipc: implement MsgGameVersion

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-03-30 09:04:33 +02:00 committed by refractionpcsx2
parent 434a06cb72
commit bc6e5213a0
5 changed files with 18 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "GS.h" // for sending game crc to mtgs
#include "Elfheader.h"
#include "DebugTools/SymbolMap.h"
#include "AppCoreThread.h"
u32 ElfCRC;
u32 ElfEntry;
@ -347,6 +348,7 @@ int GetPS2ElfName( wxString& name )
else if( parts.lvalue == L"VER" )
{
Console.WriteLn( Color_Blue, L"(SYSTEM.CNF) Software version = " + parts.rvalue );
GameInfo::gameVersion = parts.rvalue;
}
}

View File

@ -449,6 +449,19 @@ SocketIPC::IPCBuffer SocketIPC::ParseCommand(char* buf, char* ret_buffer, u32 bu
ret_cnt += 256;
break;
}
case MsgGameVersion:
{
if (!m_vm->HasActiveMachine())
goto error;
if (!SafetyChecks(buf_cnt, 0, ret_cnt, 256, buf_size))
goto error;
char version[256] = {};
sprintf(version, "%s", GameInfo::gameVersion.ToUTF8().data());
version[255] = 0x00;
memcpy(&ret_buffer[ret_cnt], version, 256);
ret_cnt += 256;
break;
}
default:
{
error:

View File

@ -102,6 +102,7 @@ protected:
MsgTitle = 0xB, /**< Returns the game title. */
MsgID = 0xC, /**< Returns the game ID. */
MsgUUID = 0xD, /**< Returns the game UUID. */
MsgGameVersion = 0xE, /**< Returns the game verion. */
MsgUnimplemented = 0xFF /**< Unimplemented IPC message. */
};

View File

@ -56,6 +56,7 @@ namespace GameInfo
wxString gameName;
wxString gameSerial;
wxString gameCRC;
wxString gameVersion;
}; // namespace GameInfo
// --------------------------------------------------------------------------------------

View File

@ -43,6 +43,7 @@ namespace GameInfo
extern wxString gameName;
extern wxString gameSerial;
extern wxString gameCRC;
extern wxString gameVersion;
}; // namespace GameInfo