Add an option to show the active title in the title

This can be useful for figuring out at a glance what title is running,
along with its game ID / title ID.
This commit is contained in:
Léo Lam 2017-05-15 11:17:51 +02:00
parent 2f5f9be9ac
commit cfc0cc1453
3 changed files with 46 additions and 21 deletions

View File

@ -32,6 +32,7 @@
#include "Core/PatchEngine.h" #include "Core/PatchEngine.h"
#include "Core/PowerPC/PPCSymbolDB.h" #include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "Core/TitleDatabase.h"
#include "VideoCommon/HiresTextures.h" #include "VideoCommon/HiresTextures.h"
#include "DiscIO/Enums.h" #include "DiscIO/Enums.h"
@ -162,6 +163,7 @@ void SConfig::SaveInterfaceSettings(IniFile& ini)
interface->Set("ShowLogWindow", m_InterfaceLogWindow); interface->Set("ShowLogWindow", m_InterfaceLogWindow);
interface->Set("ShowLogConfigWindow", m_InterfaceLogConfigWindow); interface->Set("ShowLogConfigWindow", m_InterfaceLogConfigWindow);
interface->Set("ExtendedFPSInfo", m_InterfaceExtendedFPSInfo); interface->Set("ExtendedFPSInfo", m_InterfaceExtendedFPSInfo);
interface->Set("ShowActiveTitle", m_show_active_title);
interface->Set("ThemeName", theme_name); interface->Set("ThemeName", theme_name);
interface->Set("PauseOnFocusLost", m_PauseOnFocusLost); interface->Set("PauseOnFocusLost", m_PauseOnFocusLost);
interface->Set("DisableTooltips", m_DisableTooltips); interface->Set("DisableTooltips", m_DisableTooltips);
@ -468,6 +470,7 @@ void SConfig::LoadInterfaceSettings(IniFile& ini)
interface->Get("ShowLogWindow", &m_InterfaceLogWindow, false); interface->Get("ShowLogWindow", &m_InterfaceLogWindow, false);
interface->Get("ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false); interface->Get("ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false);
interface->Get("ExtendedFPSInfo", &m_InterfaceExtendedFPSInfo, false); interface->Get("ExtendedFPSInfo", &m_InterfaceExtendedFPSInfo, false);
interface->Get("ShowActiveTitle", &m_show_active_title, true);
interface->Get("ThemeName", &theme_name, DEFAULT_THEME_DIR); interface->Get("ThemeName", &theme_name, DEFAULT_THEME_DIR);
interface->Get("PauseOnFocusLost", &m_PauseOnFocusLost, false); interface->Get("PauseOnFocusLost", &m_PauseOnFocusLost, false);
interface->Get("DisableTooltips", &m_DisableTooltips, false); interface->Get("DisableTooltips", &m_DisableTooltips, false);
@ -712,7 +715,7 @@ void SConfig::LoadSettingsFromSysconf()
void SConfig::ResetRunningGameMetadata() void SConfig::ResetRunningGameMetadata()
{ {
SetRunningGameMetadata("00000000", 0, 0); SetRunningGameMetadata("00000000", 0, 0, Core::TitleDatabase::TitleType::Other);
} }
void SConfig::SetRunningGameMetadata(const DiscIO::IVolume& volume, void SConfig::SetRunningGameMetadata(const DiscIO::IVolume& volume,
@ -720,7 +723,8 @@ void SConfig::SetRunningGameMetadata(const DiscIO::IVolume& volume,
{ {
u64 title_id = 0; u64 title_id = 0;
volume.GetTitleID(&title_id, partition); volume.GetTitleID(&title_id, partition);
SetRunningGameMetadata(volume.GetGameID(partition), title_id, volume.GetRevision(partition)); SetRunningGameMetadata(volume.GetGameID(partition), title_id, volume.GetRevision(partition),
Core::TitleDatabase::TitleType::Other);
} }
void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd) void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd)
@ -734,20 +738,31 @@ void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd)
if (!DVDInterface::UpdateRunningGameMetadata(tmd_title_id)) if (!DVDInterface::UpdateRunningGameMetadata(tmd_title_id))
{ {
// If not launching a disc game, just read everything from the TMD. // If not launching a disc game, just read everything from the TMD.
SetRunningGameMetadata(tmd.GetGameID(), tmd_title_id, tmd.GetTitleVersion()); SetRunningGameMetadata(tmd.GetGameID(), tmd_title_id, tmd.GetTitleVersion(),
Core::TitleDatabase::TitleType::Channel);
} }
} }
void SConfig::SetRunningGameMetadata(const std::string& game_id, u64 title_id, u16 revision) void SConfig::SetRunningGameMetadata(const std::string& game_id, u64 title_id, u16 revision,
Core::TitleDatabase::TitleType type)
{ {
const bool was_changed = m_game_id != game_id || m_title_id != title_id || m_revision != revision; const bool was_changed = m_game_id != game_id || m_title_id != title_id || m_revision != revision;
m_game_id = game_id; m_game_id = game_id;
m_title_id = title_id; m_title_id = title_id;
m_revision = revision; m_revision = revision;
if (was_changed) if (!was_changed)
return;
if (game_id == "00000000")
{ {
NOTICE_LOG(BOOT, "Game ID set to %s", game_id.c_str()); m_title_description.clear();
return;
}
const Core::TitleDatabase title_database;
m_title_description = title_database.Describe(m_game_id, type);
NOTICE_LOG(CORE, "Active title: %s", m_title_description.c_str());
if (Core::IsRunning()) if (Core::IsRunning())
{ {
@ -759,7 +774,6 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, u64 title_id, u
HiresTexture::Update(); HiresTexture::Update();
DolphinAnalytics::Instance()->ReportGameStart(); DolphinAnalytics::Instance()->ReportGameStart();
} }
}
} }
void SConfig::LoadDefaults() void SConfig::LoadDefaults()

View File

@ -14,6 +14,7 @@
#include "Common/NonCopyable.h" #include "Common/NonCopyable.h"
#include "Core/HW/EXI/EXI_Device.h" #include "Core/HW/EXI/EXI_Device.h"
#include "Core/HW/SI/SI_Device.h" #include "Core/HW/SI/SI_Device.h"
#include "Core/TitleDatabase.h"
namespace DiscIO namespace DiscIO
{ {
@ -221,6 +222,7 @@ struct SConfig : NonCopyable
std::string m_perfDir; std::string m_perfDir;
const std::string& GetGameID() const { return m_game_id; } const std::string& GetGameID() const { return m_game_id; }
const std::string& GetTitleDescription() const { return m_title_description; }
u64 GetTitleID() const { return m_title_id; } u64 GetTitleID() const { return m_title_id; }
u16 GetRevision() const { return m_revision; } u16 GetRevision() const { return m_revision; }
void ResetRunningGameMetadata(); void ResetRunningGameMetadata();
@ -265,6 +267,7 @@ struct SConfig : NonCopyable
bool m_InterfaceLogWindow; bool m_InterfaceLogWindow;
bool m_InterfaceLogConfigWindow; bool m_InterfaceLogConfigWindow;
bool m_InterfaceExtendedFPSInfo; bool m_InterfaceExtendedFPSInfo;
bool m_show_active_title = false;
bool m_ListDrives; bool m_ListDrives;
bool m_ListWad; bool m_ListWad;
@ -383,12 +386,14 @@ private:
void LoadBluetoothPassthroughSettings(IniFile& ini); void LoadBluetoothPassthroughSettings(IniFile& ini);
void LoadUSBPassthroughSettings(IniFile& ini); void LoadUSBPassthroughSettings(IniFile& ini);
void SetRunningGameMetadata(const std::string& game_id, u64 title_id, u16 revision); void SetRunningGameMetadata(const std::string& game_id, u64 title_id, u16 revision,
Core::TitleDatabase::TitleType type);
bool SetRegion(DiscIO::Region region, std::string* directory_name); bool SetRegion(DiscIO::Region region, std::string* directory_name);
static SConfig* m_Instance; static SConfig* m_Instance;
std::string m_game_id; std::string m_game_id;
std::string m_title_description;
u64 m_title_id; u64 m_title_id;
u16 m_revision; u16 m_revision;
}; };

View File

@ -906,8 +906,14 @@ void UpdateTitle()
SystemTimers::GetTicksPerSecond() / 1000000, TicksPercentage); SystemTimers::GetTicksPerSecond() / 1000000, TicksPercentage);
} }
} }
// This is our final "frame counter" string
std::string SMessage = StringFromFormat("%s | %s", SSettings.c_str(), SFPS.c_str()); std::string message = StringFromFormat("%s | %s", SSettings.c_str(), SFPS.c_str());
if (SConfig::GetInstance().m_show_active_title)
{
const std::string& title = SConfig::GetInstance().GetTitleDescription();
if (!title.empty())
message += " | " + title;
}
// Update the audio timestretcher with the current speed // Update the audio timestretcher with the current speed
if (g_sound_stream) if (g_sound_stream)
@ -916,7 +922,7 @@ void UpdateTitle()
pMixer->UpdateSpeed((float)Speed / 100); pMixer->UpdateSpeed((float)Speed / 100);
} }
Host_UpdateTitle(SMessage); Host_UpdateTitle(message);
} }
void Shutdown() void Shutdown()