IPC: add GetGameID

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2021-03-01 18:37:47 +01:00 committed by lightningterror
parent 593e44ca54
commit 30024767ea
4 changed files with 21 additions and 6 deletions

View File

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

View File

@ -95,6 +95,7 @@ protected:
MsgSaveState = 9, /**< Saves a savestate. */
MsgLoadState = 0xA, /**< Loads a savestate. */
MsgTitle = 0xB, /**< Returns the game title. */
MsgID = 0xC, /**< Returns the game ID. */
MsgUnimplemented = 0xFF /**< Unimplemented IPC message. */
};

View File

@ -54,7 +54,8 @@ typedef void (AppCoreThread::*FnPtr_CoreThreadMethod)();
namespace GameInfo
{
wxString gameName;
};
wxString gameSerial;
}; // namespace GameInfo
// --------------------------------------------------------------------------------------
// SysExecEvent_InvokeCoreThreadMethod
@ -412,7 +413,6 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup)
}
wxString gameCRC;
wxString gameSerial;
wxString gamePatch;
wxString gameFixes;
wxString gameCheats;
@ -429,7 +429,7 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup)
if (ingame)
gameCRC.Printf(L"%8.8x", ElfCRC);
if (ingame && !DiscSerial.IsEmpty())
gameSerial = L" [" + DiscSerial + L"]";
GameInfo::gameSerial = L" [" + DiscSerial + L"]";
const wxString newGameKey(ingame ? SysGetDiscID() : SysGetBiosDiscID());
const bool verbose(newGameKey != curGameKey && ingame);
@ -471,7 +471,7 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup)
else
sioSetGameSerial(curGameKey);
if (GameInfo::gameName.IsEmpty() && gameSerial.IsEmpty() && gameCRC.IsEmpty())
if (GameInfo::gameName.IsEmpty() && GameInfo::gameSerial.IsEmpty() && gameCRC.IsEmpty())
{
// if all these conditions are met, it should mean that we're currently running BIOS code.
// Chances are the BiosChecksum value is still zero or out of date, however -- because
@ -512,7 +512,7 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup)
// When we're booting, the bios loader will set a a title which would be more interesting than this
// to most users - with region, version, etc, so don't overwrite it with patch info. That's OK. Those
// users which want to know the status of the patches at the bios can check the console content.
wxString consoleTitle = GameInfo::gameName + gameSerial;
wxString consoleTitle = GameInfo::gameName + GameInfo::gameSerial;
consoleTitle += L" [" + gameCRC.MakeUpper() + L"]" + gameCompat + gameFixes + gamePatch + gameCheats + gameWsHacks;
if (ingame)
Console.SetTitle(consoleTitle);

View File

@ -41,7 +41,8 @@ enum ScopedCoreResumeType
namespace GameInfo
{
extern wxString gameName;
};
extern wxString gameSerial;
}; // namespace GameInfo
// --------------------------------------------------------------------------------------