Core: Remove FPS, VPS and speed percentage from window title

This commit is contained in:
Simonx22 2023-01-21 00:44:25 +01:00
parent 8d477c65c9
commit df6f070a55
6 changed files with 14 additions and 76 deletions

View File

@ -386,7 +386,6 @@ const Info<ShowCursor> MAIN_SHOW_CURSOR{{System::Main, "Interface", "CursorVisib
ShowCursor::OnMovement};
const Info<bool> MAIN_LOCK_CURSOR{{System::Main, "Interface", "LockCursor"}, false};
const Info<std::string> MAIN_INTERFACE_LANGUAGE{{System::Main, "Interface", "LanguageCode"}, ""};
const Info<bool> MAIN_EXTENDED_FPS_INFO{{System::Main, "Interface", "ExtendedFPSInfo"}, false};
const Info<bool> MAIN_SHOW_ACTIVE_TITLE{{System::Main, "Interface", "ShowActiveTitle"}, true};
const Info<bool> MAIN_USE_BUILT_IN_TITLE_DATABASE{
{System::Main, "Interface", "UseBuiltinTitleDatabase"}, true};

View File

@ -237,7 +237,6 @@ extern const Info<ShowCursor> MAIN_SHOW_CURSOR;
extern const Info<bool> MAIN_LOCK_CURSOR;
extern const Info<std::string> MAIN_INTERFACE_LANGUAGE;
extern const Info<bool> MAIN_EXTENDED_FPS_INFO;
extern const Info<bool> MAIN_SHOW_ACTIVE_TITLE;
extern const Info<bool> MAIN_USE_BUILT_IN_TITLE_DATABASE;
extern const Info<std::string> MAIN_THEME_NAME;

View File

@ -12,6 +12,8 @@
#include <string_view>
#include <variant>
#include <Core/Core.h>
#include <fmt/format.h>
#include "AudioCommon/AudioCommon.h"
@ -177,6 +179,10 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri
m_title_description = title_database.Describe(m_gametdb_id, language);
NOTICE_LOG_FMT(CORE, "Active title: {}", m_title_description);
Host_TitleChanged();
if (Core::IsRunning())
{
Core::UpdateTitle();
}
Config::AddLayer(ConfigLoaders::GenerateGlobalGameConfigLoader(game_id, revision));
Config::AddLayer(ConfigLoaders::GenerateLocalGameConfigLoader(game_id, revision));

View File

@ -99,9 +99,6 @@ namespace Core
static bool s_wants_determinism;
// Declarations and definitions
static Common::Timer s_timer;
static u64 s_timer_offset;
static bool s_is_stopping = false;
static bool s_hardware_initialized = false;
static bool s_is_started = false;
@ -612,6 +609,8 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
PowerPC::SetMode(PowerPC::CoreMode::Interpreter);
}
UpdateTitle();
// ENTER THE VIDEO THREAD LOOP
if (system.IsDualCoreMode())
{
@ -661,16 +660,11 @@ void SetState(State state)
CPU::EnableStepping(true); // Break
Wiimote::Pause();
ResetRumble();
s_timer_offset = s_timer.ElapsedMs();
break;
case State::Running:
{
CPU::EnableStepping(false);
Wiimote::Resume();
// Restart timer, accounting for time that had elapsed between previous s_timer.Start() and
// emulator pause
s_timer.StartWithOffset(s_timer_offset);
s_timer_offset = 0;
break;
}
default:
@ -840,21 +834,6 @@ void RunOnCPUThread(std::function<void()> function, bool wait_for_completion)
}
}
// Display FPS info
// This should only be called from VI
void VideoThrottle()
{
g_perf_metrics.CountVBlank();
// Update info per second
u64 elapsed_ms = s_timer.ElapsedMs();
if ((elapsed_ms >= 500) || s_frame_step)
{
s_timer.Start();
UpdateTitle();
}
}
// --- Callbacks for backends / engine ---
// Called from Renderer::Swap (GPU thread) when a new (non-duplicate)
@ -890,58 +869,13 @@ void Callback_NewField()
void UpdateTitle()
{
const double FPS = g_perf_metrics.GetFPS();
const double VPS = g_perf_metrics.GetVPS();
const double Speed = 100.0 * g_perf_metrics.GetSpeed();
// Settings are shown the same for both extended and summary info
const std::string SSettings = fmt::format(
"{} {} | {} | {}", PowerPC::GetCPUName(),
Core::System::GetInstance().IsDualCoreMode() ? "DC" : "SC", g_video_backend->GetDisplayName(),
Config::Get(Config::MAIN_DSP_HLE) ? "HLE" : "LLE");
std::string SFPS;
if (Movie::IsPlayingInput())
{
SFPS = fmt::format("Input: {}/{} - VI: {}/{} - FPS: {:.0f} - VPS: {:.0f} - {:.0f}%",
Movie::GetCurrentInputCount(), Movie::GetTotalInputCount(),
Movie::GetCurrentFrame(), Movie::GetTotalFrames(), FPS, VPS, Speed);
}
else if (Movie::IsRecordingInput())
{
SFPS = fmt::format("Input: {} - VI: {} - FPS: {:.0f} - VPS: {:.0f} - {:.0f}%",
Movie::GetCurrentInputCount(), Movie::GetCurrentFrame(), FPS, VPS, Speed);
}
else
{
SFPS = fmt::format("FPS: {:.0f} - VPS: {:.0f} - {:.0f}%", FPS, VPS, Speed);
if (Config::Get(Config::MAIN_EXTENDED_FPS_INFO))
{
// Use extended or summary information. The summary information does not print the ticks data,
// that's more of a debugging interest, it can always be optional of course if someone is
// interested.
static u64 ticks = 0;
static u64 idleTicks = 0;
auto& core_timing = Core::System::GetInstance().GetCoreTiming();
u64 newTicks = core_timing.GetTicks();
u64 newIdleTicks = core_timing.GetIdleTicks();
u64 diff = (newTicks - ticks) / 1000000;
u64 idleDiff = (newIdleTicks - idleTicks) / 1000000;
ticks = newTicks;
idleTicks = newIdleTicks;
float TicksPercentage =
(float)diff / (float)(SystemTimers::GetTicksPerSecond() / 1000000) * 100;
SFPS += fmt::format(" | CPU: ~{} MHz [Real: {} + IdleSkip: {}] / {} MHz (~{:3.0f}%)", diff,
diff - idleDiff, idleDiff, SystemTimers::GetTicksPerSecond() / 1000000,
TicksPercentage);
}
}
std::string message = fmt::format("{} | {} | {}", Common::GetScmRevStr(), SSettings, SFPS);
std::string message = fmt::format("{} | {}", Common::GetScmRevStr(), SSettings);
if (Config::Get(Config::MAIN_SHOW_ACTIVE_TITLE))
{
const std::string& title = SConfig::GetInstance().GetTitleDescription();

View File

@ -124,10 +124,6 @@ void DisplayMessage(std::string message, int time_in_ms);
void FrameUpdateOnCPUThread();
void OnFrameEnd();
void VideoThrottle();
void UpdateTitle();
// Run a function as the CPU thread.
//
// If called from the Host thread, the CPU thread is paused and the current thread temporarily
@ -171,4 +167,6 @@ void DoFrameStep();
void UpdateInputGate(bool require_focus, bool require_full_focus = false);
void UpdateTitle();
} // namespace Core

View File

@ -13,6 +13,8 @@
#include "Common/Config/Config.h"
#include "Common/Logging/Log.h"
#include "VideoCommon/PerformanceMetrics.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/SYSCONFSettings.h"
@ -872,7 +874,7 @@ static void EndField(FieldType field, u64 ticks)
if (!Config::Get(Config::GFX_HACK_EARLY_XFB_OUTPUT))
OutputField(field, ticks);
Core::VideoThrottle();
g_perf_metrics.CountVBlank();
Core::OnFrameEnd();
}