ImGuiOverlays: Display PAL/NTSC in resolution

This commit is contained in:
Connor McLaughlin 2023-01-09 22:19:32 +10:00
parent 2c125bde8c
commit b74eb37996
2 changed files with 11 additions and 6 deletions

View File

@ -130,6 +130,9 @@ public:
return (!m_force_progressive_scan) && m_GPUSTAT.SkipDrawingToActiveField(); return (!m_force_progressive_scan) && m_GPUSTAT.SkipDrawingToActiveField();
} }
/// Returns true if we're in PAL mode, otherwise false if NTSC.
ALWAYS_INLINE bool IsInPALMode() const { return m_GPUSTAT.pal_mode; }
/// Returns the number of pending GPU ticks. /// Returns the number of pending GPU ticks.
TickCount GetPendingCRTCTicks() const; TickCount GetPendingCRTCTicks() const;
TickCount GetPendingCommandTicks() const; TickCount GetPendingCommandTicks() const;

View File

@ -3,8 +3,8 @@
#include "imgui_overlays.h" #include "imgui_overlays.h"
#include "IconsFontAwesome5.h" #include "IconsFontAwesome5.h"
#include "common/assert.h"
#include "common/align.h" #include "common/align.h"
#include "common/assert.h"
#include "common/file_system.h" #include "common/file_system.h"
#include "common/log.h" #include "common/log.h"
#include "common/string_util.h" #include "common/string_util.h"
@ -21,6 +21,7 @@
#include "fmt/chrono.h" #include "fmt/chrono.h"
#include "fmt/format.h" #include "fmt/format.h"
#include "fullscreen_ui.h" #include "fullscreen_ui.h"
#include "gsl/span"
#include "icon.h" #include "icon.h"
#include "imgui.h" #include "imgui.h"
#include "imgui_fullscreen.h" #include "imgui_fullscreen.h"
@ -28,7 +29,6 @@
#include "imgui_manager.h" #include "imgui_manager.h"
#include "input_manager.h" #include "input_manager.h"
#include "util/audio_stream.h" #include "util/audio_stream.h"
#include "gsl/span"
#include <atomic> #include <atomic>
#include <chrono> #include <chrono>
#include <cmath> #include <cmath>
@ -126,7 +126,6 @@ static std::tuple<float, float> GetMinMax(gsl::span<const float> values)
#endif #endif
} }
static bool s_save_state_selector_ui_open = false; static bool s_save_state_selector_ui_open = false;
void ImGuiManager::RenderOverlays() void ImGuiManager::RenderOverlays()
@ -233,14 +232,17 @@ void ImGuiManager::DrawPerformanceOverlay()
{ {
const auto [effective_width, effective_height] = g_gpu->GetEffectiveDisplayResolution(); const auto [effective_width, effective_height] = g_gpu->GetEffectiveDisplayResolution();
const bool interlaced = g_gpu->IsInterlacedDisplayEnabled(); const bool interlaced = g_gpu->IsInterlacedDisplayEnabled();
text.Fmt("{}x{} ({})", effective_width, effective_height, interlaced ? "interlaced" : "progressive"); const bool pal = g_gpu->IsInPALMode();
text.Fmt("{}x{} {} {}", effective_width, effective_height, pal ? "PAL" : "NTSC",
interlaced ? "Interlaced" : "Progressive");
DRAW_LINE(fixed_font, text, IM_COL32(255, 255, 255, 255)); DRAW_LINE(fixed_font, text, IM_COL32(255, 255, 255, 255));
} }
if (g_settings.display_show_cpu) if (g_settings.display_show_cpu)
{ {
text.Clear(); text.Clear();
text.AppendFmtString("{:.2f}ms | {:.2f}ms | {:.2f}ms", System::GetMinimumFrameTime(), System::GetMaximumFrameTime(), System::GetAverageFrameTime()); text.AppendFmtString("{:.2f}ms | {:.2f}ms | {:.2f}ms", System::GetMinimumFrameTime(),
System::GetMaximumFrameTime(), System::GetAverageFrameTime());
DRAW_LINE(fixed_font, text, IM_COL32(255, 255, 255, 255)); DRAW_LINE(fixed_font, text, IM_COL32(255, 255, 255, 255));
text.Clear(); text.Clear();
@ -353,7 +355,7 @@ void ImGuiManager::DrawPerformanceOverlay()
ImGuiPlotType_Lines, "##frame_times", ImGuiPlotType_Lines, "##frame_times",
[](void*, int idx) -> float { [](void*, int idx) -> float {
return System::GetFrameTimeHistory()[((System::GetFrameTimeHistoryPos() + idx) % return System::GetFrameTimeHistory()[((System::GetFrameTimeHistoryPos() + idx) %
System::NUM_FRAME_TIME_SAMPLES)]; System::NUM_FRAME_TIME_SAMPLES)];
}, },
nullptr, System::NUM_FRAME_TIME_SAMPLES, 0, nullptr, min, max, history_size); nullptr, System::NUM_FRAME_TIME_SAMPLES, 0, nullptr, min, max, history_size);