Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Source/Core/Core/Config/MainSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Core/Config/MainSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions Source/Core/Core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <string_view>
#include <variant>

#include <Core/Core.h>

#include <fmt/format.h>

#include "AudioCommon/AudioCommon.h"
Expand Down Expand Up @@ -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));
Expand Down
72 changes: 3 additions & 69 deletions Source/Core/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -890,58 +869,13 @@ void Callback_NewField()

void UpdateTitle()
Simonx22 marked this conversation as resolved.
Show resolved Hide resolved
{
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();
Expand Down
6 changes: 2 additions & 4 deletions Source/Core/Core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -171,4 +167,6 @@ void DoFrameStep();

void UpdateInputGate(bool require_focus, bool require_full_focus = false);

void UpdateTitle();

} // namespace Core
4 changes: 3 additions & 1 deletion Source/Core/Core/HW/VideoInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
}

Expand Down