diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 41bc778c90..6b0c20fa81 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -686,6 +686,7 @@ void AppConfig::LoadSave( IniInterface& ini ) BaseFilenames .LoadSave( ini ); GSWindow .LoadSave( ini ); Framerate .LoadSave( ini ); + Templates .LoadSave( ini ); ini.Flush(); } @@ -928,6 +929,34 @@ void AppConfig::FramerateOptions::LoadSave( IniInterface& ini ) IniEntry( SkipOnTurbo ); } +AppConfig::UiTemplateOptions::UiTemplateOptions() +{ + LimiterUnlimited = L"-unlimited"; + LimiterTurbo = L"-turbo"; + LimiterSlowmo = L"-slowmo"; + LimiterNormal = L""; + OutputFrame = L"frame"; + OutputField = L"field"; + OutputProgressive = L"p"; + OutputInterlaced = L"i"; + TitleTemplate = L"Slot: ${slot} | Speed${limiter}: ${speed} (${vfps}) | ${cpuusage} | ${omodef}-${omodei} | ${gsdx}"; +} + +void AppConfig::UiTemplateOptions::LoadSave(IniInterface& ini) +{ + ScopedIniGroup path(ini, L"UiTemplates"); + + IniEntry(LimiterUnlimited); + IniEntry(LimiterTurbo); + IniEntry(LimiterSlowmo); + IniEntry(LimiterNormal); + IniEntry(OutputFrame); + IniEntry(OutputField); + IniEntry(OutputProgressive); + IniEntry(OutputInterlaced); + IniEntry(TitleTemplate); +} + int AppConfig::GetMaxPresetIndex() { return 5; diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index 260a76b164..9b01b9a35b 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -241,6 +241,21 @@ public: void SanityCheck(); }; + struct UiTemplateOptions { + UiTemplateOptions(); + void LoadSave(IniInterface& conf); + + wxString LimiterUnlimited; + wxString LimiterTurbo; + wxString LimiterSlowmo; + wxString LimiterNormal; + wxString OutputFrame; + wxString OutputField; + wxString OutputProgressive; + wxString OutputInterlaced; + wxString TitleTemplate; + }; + public: wxPoint MainGuiPosition; @@ -311,6 +326,7 @@ public: FilenameOptions BaseFilenames; GSWindowOptions GSWindow; FramerateOptions Framerate; + UiTemplateOptions Templates; // PCSX2-core emulation options, which are passed to the emu core prior to initiating // an emulation session. Note these are the options saved into the GUI ini file and diff --git a/pcsx2/gui/FrameForGS.cpp b/pcsx2/gui/FrameForGS.cpp index 3f528d3ece..08bccfb0b0 100644 --- a/pcsx2/gui/FrameForGS.cpp +++ b/pcsx2/gui/FrameForGS.cpp @@ -555,6 +555,7 @@ void GSFrame::OnUpdateTitle( wxTimerEvent& evt ) // an intermediate white screen appears too which leads to a very annoying flickering. if (IsFullScreen()) return; #endif + AppConfig::UiTemplateOptions& templates = g_Conf->Templates; double fps = wxGetApp().FpsManager.GetFramerate(); // The "not PAL" case covers both Region_NTSC and Region_NTSC_PROGRESSIVE @@ -564,15 +565,15 @@ void GSFrame::OnUpdateTitle( wxTimerEvent& evt ) gsDest[0] = 0; // No need to set whole array to NULL. GSgetTitleInfo2( gsDest, sizeof(gsDest) ); - const wxChar* limiterStr = L"-unlimited"; + const wxChar* limiterStr = templates.LimiterUnlimited; if( g_Conf->EmuOptions.GS.FrameLimitEnable ) { switch( g_LimiterMode ) { - case Limit_Nominal: limiterStr = L""; break; - case Limit_Turbo: limiterStr = L"-turbo"; break; - case Limit_Slomo: limiterStr = L"-slowmo"; break; + case Limit_Nominal: limiterStr = templates.LimiterNormal; break; + case Limit_Turbo: limiterStr = templates.LimiterTurbo; break; + case Limit_Slomo: limiterStr = templates.LimiterSlowmo; break; } } @@ -580,7 +581,7 @@ void GSFrame::OnUpdateTitle( wxTimerEvent& evt ) if (m_CpuUsage.IsImplemented()) { m_CpuUsage.UpdateStats(); - cpuUsage.Write(L" | EE: %3d%%", m_CpuUsage.GetEEcorePct()); + cpuUsage.Write(L"EE: %3d%%", m_CpuUsage.GetEEcorePct()); cpuUsage.Write(L" | GS: %3d%%", m_CpuUsage.GetGsPct()); if (THREAD_VU1) @@ -590,15 +591,20 @@ void GSFrame::OnUpdateTitle( wxTimerEvent& evt ) } const u64& smode2 = *(u64*)PS2GS_BASE(GS_SMODE2); + wxString omodef = (smode2 & 2) ? templates.OutputFrame : templates.OutputField; + wxString omodei = (smode2 & 1) ? templates.OutputInterlaced : templates.OutputProgressive; - SetTitle( pxsFmt( L"Slot %d | Speed%ls: %3d%% (%.02f)%ls | %ls-%ls | %s", - States_GetCurrentSlot(), - limiterStr, lround(per), fps, - cpuUsage.c_str(), - (smode2 & 2) ? L"frame" : L"field", - (smode2 & 1) ? L"i" : L"p", - WX_STR(fromUTF8(gsDest))) - ); + wxString title = templates.TitleTemplate; + title.Replace(L"${slot}", pxsFmt(L"%d", States_GetCurrentSlot())); + title.Replace(L"${limiter}", limiterStr); + title.Replace(L"${speed}", pxsFmt(L"%3d%%", lround(per))); + title.Replace(L"${vfps}", pxsFmt(L"%.02f", fps)); + title.Replace(L"${cpuusage}", cpuUsage); + title.Replace(L"${omodef}", omodef); + title.Replace(L"${omodei}", omodei); + title.Replace(L"${gsdx}", fromUTF8(gsDest)); + + SetTitle(title); } void GSFrame::OnActivate( wxActivateEvent& evt )