mirror of https://github.com/PCSX2/pcsx2.git
IPC: add GetTitle
This commit is contained in:
parent
5153d9a198
commit
0dee88e805
|
@ -37,6 +37,7 @@
|
|||
#include "Common.h"
|
||||
#include "Memory.h"
|
||||
#include "gui/AppSaveStates.h"
|
||||
#include "gui/AppCoreThread.h"
|
||||
#include "System/SysThreads.h"
|
||||
#include "svnrev.h"
|
||||
#include "IPC.h"
|
||||
|
@ -411,6 +412,19 @@ SocketIPC::IPCBuffer SocketIPC::ParseCommand(char* buf, char* ret_buffer, u32 bu
|
|||
buf_cnt += 1;
|
||||
break;
|
||||
}
|
||||
case MsgTitle:
|
||||
{
|
||||
if (!m_vm->HasActiveMachine())
|
||||
goto error;
|
||||
if (!SafetyChecks(buf_cnt, 0, ret_cnt, 256, buf_size))
|
||||
goto error;
|
||||
char title[256] = {};
|
||||
sprintf(title, "%s", GameInfo::gameName);
|
||||
title[255] = 0x00;
|
||||
memcpy(&ret_buffer[ret_cnt], title, 256);
|
||||
ret_cnt += 256;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
error:
|
||||
|
|
|
@ -94,6 +94,7 @@ protected:
|
|||
MsgVersion = 8, /**< Returns PCSX2 version. */
|
||||
MsgSaveState = 9, /**< Saves a savestate. */
|
||||
MsgLoadState = 0xA, /**< Loads a savestate. */
|
||||
MsgTitle = 0xB, /**< Returns the game title. */
|
||||
MsgUnimplemented = 0xFF /**< Unimplemented IPC message. */
|
||||
};
|
||||
|
||||
|
|
|
@ -50,6 +50,12 @@ __aligned16 AppCoreThread CoreThread;
|
|||
|
||||
typedef void (AppCoreThread::*FnPtr_CoreThreadMethod)();
|
||||
|
||||
|
||||
namespace GameInfo
|
||||
{
|
||||
wxString gameName;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// SysExecEvent_InvokeCoreThreadMethod
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
@ -308,7 +314,7 @@ static int loadGameSettings(Pcsx2Config& dest, const GameDatabaseSchema::GameEnt
|
|||
{
|
||||
// Legacy note - speedhacks are setup in the GameDB as integer values, but
|
||||
// are effectively booleans like the gamefixes
|
||||
bool mode = game.speedHacks.at(key) ? 1: 0;
|
||||
bool mode = game.speedHacks.at(key) ? 1 : 0;
|
||||
dest.Speedhacks.Set(id, mode);
|
||||
PatchesCon->WriteLn(L"(GameDB) Setting Speedhack '" + key + "' to [mode=%d]", mode);
|
||||
gf++;
|
||||
|
@ -412,7 +418,6 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup)
|
|||
wxString gameCheats;
|
||||
wxString gameWsHacks;
|
||||
|
||||
wxString gameName;
|
||||
wxString gameCompat;
|
||||
wxString gameMemCardFilter;
|
||||
|
||||
|
@ -442,8 +447,8 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup)
|
|||
GameDatabaseSchema::GameEntry game = GameDB->findGame(std::string(curGameKey));
|
||||
if (game.isValid)
|
||||
{
|
||||
gameName = game.name;
|
||||
gameName += L" (" + game.region + L")";
|
||||
GameInfo::gameName = game.name;
|
||||
GameInfo::gameName += L" (" + game.region + L")";
|
||||
gameCompat = L" [Status = " + compatToStringWX(game.compat) + L"]";
|
||||
gameMemCardFilter = game.memcardFiltersAsString();
|
||||
}
|
||||
|
@ -466,13 +471,13 @@ static void _ApplySettings(const Pcsx2Config& src, Pcsx2Config& fixup)
|
|||
else
|
||||
sioSetGameSerial(curGameKey);
|
||||
|
||||
if (gameName.IsEmpty() && gameSerial.IsEmpty() && gameCRC.IsEmpty())
|
||||
if (GameInfo::gameName.IsEmpty() && 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
|
||||
// the BIos isn't loaded until after initial calls to ApplySettings.
|
||||
|
||||
gameName = L"Booting PS2 BIOS... ";
|
||||
GameInfo::gameName = L"Booting PS2 BIOS... ";
|
||||
}
|
||||
|
||||
//Till the end of this function, entry CRC will be 00000000
|
||||
|
@ -507,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 = gameName + gameSerial;
|
||||
wxString consoleTitle = GameInfo::gameName + gameSerial;
|
||||
consoleTitle += L" [" + gameCRC.MakeUpper() + L"]" + gameCompat + gameFixes + gamePatch + gameCheats + gameWsHacks;
|
||||
if (ingame)
|
||||
Console.SetTitle(consoleTitle);
|
||||
|
|
|
@ -38,6 +38,11 @@ enum ScopedCoreResumeType
|
|||
, ScopedCore_SkipResume
|
||||
};
|
||||
|
||||
namespace GameInfo
|
||||
{
|
||||
extern wxString gameName;
|
||||
};
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// BaseSysExecEvent_ScopedCore
|
||||
|
|
Loading…
Reference in New Issue