Skip to content

Commit

Permalink
Qt: Fix vanishing status bar renderer info
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Apr 1, 2024
1 parent 64b6dec commit c650b4b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 41 deletions.
9 changes: 8 additions & 1 deletion pcsx2-qt/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,14 @@ void MainWindow::onVMStopped()
{
s_vm_valid = false;
s_vm_paused = false;
m_last_fps_status = QString();

const QString empty_string;
m_last_fps_status = empty_string;
m_status_renderer_widget->setText(empty_string);
m_status_resolution_widget->setText(empty_string);
m_status_fps_widget->setText(empty_string);
m_status_vps_widget->setText(empty_string);

updateEmulationActions(false, false, false);
updateGameDependentActions();
updateWindowTitle();
Expand Down
71 changes: 32 additions & 39 deletions pcsx2-qt/QtHost.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
// SPDX-License-Identifier: LGPL-3.0+

#include "AutoUpdaterDialog.h"
Expand Down Expand Up @@ -928,6 +928,7 @@ void Host::OnVMStarting()

void Host::OnVMStarted()
{
g_emu_thread->updatePerformanceMetrics(true);
emit g_emu_thread->onVMStarted();
}

Expand Down Expand Up @@ -1002,49 +1003,41 @@ void EmuThread::updatePerformanceMetrics(bool force)
if (iwidth != m_last_internal_width || iheight != m_last_internal_height || speed != m_last_speed || gfps != m_last_game_fps ||
vfps != m_last_video_fps || renderer != m_last_renderer || force)
{
if (iwidth == 0 && iheight == 0)
if (renderer != m_last_renderer || force)
{
// if we don't have width/height yet, we're not going to have fps either.
// and we'll probably be <100% due to compiling. so just leave it blank for now.
QString blank;
QMetaObject::invokeMethod(
g_main_window->getStatusRendererWidget(), "setText", Qt::QueuedConnection, Q_ARG(const QString&, blank));
QMetaObject::invokeMethod(
g_main_window->getStatusResolutionWidget(), "setText", Qt::QueuedConnection, Q_ARG(const QString&, blank));
QMetaObject::invokeMethod(g_main_window->getStatusFPSWidget(), "setText", Qt::QueuedConnection, Q_ARG(const QString&, blank));
QMetaObject::invokeMethod(g_main_window->getStatusVPSWidget(), "setText", Qt::QueuedConnection, Q_ARG(const QString&, blank));
return;
QMetaObject::invokeMethod(g_main_window->getStatusRendererWidget(), "setText", Qt::QueuedConnection,
Q_ARG(const QString&, QString::fromUtf8(Pcsx2Config::GSOptions::GetRendererName(renderer))));
m_last_renderer = renderer;
}
else

if (iwidth != m_last_internal_width || iheight != m_last_internal_height || force)
{
if (renderer != m_last_renderer || force)
{
QMetaObject::invokeMethod(g_main_window->getStatusRendererWidget(), "setText", Qt::QueuedConnection,
Q_ARG(const QString&, QString::fromUtf8(Pcsx2Config::GSOptions::GetRendererName(renderer))));
m_last_renderer = renderer;
}
if (iwidth != m_last_internal_width || iheight != m_last_internal_height || force)
{
QMetaObject::invokeMethod(g_main_window->getStatusResolutionWidget(), "setText", Qt::QueuedConnection,
Q_ARG(const QString&, tr("%1x%2").arg(iwidth).arg(iheight)));
m_last_internal_width = iwidth;
m_last_internal_height = iheight;
}
QString text;
if (iwidth == 0 || iheight == 0)
text = tr("N/A");
else
text = tr("%1x%2").arg(iwidth).arg(iheight);

if (gfps != m_last_game_fps || force)
{
QMetaObject::invokeMethod(g_main_window->getStatusFPSWidget(), "setText", Qt::QueuedConnection,
Q_ARG(const QString&, tr("Game: %1 FPS").arg(gfps, 0, 'f', 0)));
m_last_game_fps = gfps;
}
QMetaObject::invokeMethod(
g_main_window->getStatusResolutionWidget(), "setText", Qt::QueuedConnection, Q_ARG(const QString&, text));

if (speed != m_last_speed || vfps != m_last_video_fps || force)
{
QMetaObject::invokeMethod(g_main_window->getStatusVPSWidget(), "setText", Qt::QueuedConnection,
Q_ARG(const QString&, tr("Video: %1 FPS (%2%)").arg(vfps, 0, 'f', 0).arg(speed, 0, 'f', 0)));
m_last_speed = speed;
m_last_video_fps = vfps;
}
m_last_internal_width = iwidth;
m_last_internal_height = iheight;
}

if (gfps != m_last_game_fps || force)
{
QMetaObject::invokeMethod(g_main_window->getStatusFPSWidget(), "setText", Qt::QueuedConnection,
Q_ARG(const QString&, tr("Game: %1 FPS").arg(gfps, 0, 'f', 0)));
m_last_game_fps = gfps;
}

if (speed != m_last_speed || vfps != m_last_video_fps || force)
{
QMetaObject::invokeMethod(g_main_window->getStatusVPSWidget(), "setText", Qt::QueuedConnection,
Q_ARG(const QString&, tr("Video: %1 FPS (%2%)").arg(vfps, 0, 'f', 0).arg(speed, 0, 'f', 0)));
m_last_speed = speed;
m_last_video_fps = vfps;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pcsx2-qt/QtHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private Q_SLOTS:
float m_last_video_fps = 0.0f;
int m_last_internal_width = 0;
int m_last_internal_height = 0;
GSRendererType m_last_renderer = GSRendererType::Null;
GSRendererType m_last_renderer = GSRendererType::Auto;
};

extern EmuThread* g_emu_thread;
Expand Down
6 changes: 6 additions & 0 deletions pcsx2/GS/Renderers/Common/GSRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ bool GSRenderer::Merge(int field)
PCRTCDisplays.CheckSameSource();

if (!PCRTCDisplays.PCRTCDisplays[0].enabled && !PCRTCDisplays.PCRTCDisplays[1].enabled)
{
m_real_size = GSVector2i(0, 0);
return false;
}

// Need to do this here, if the user has Anti-Blur enabled, these offsets can get wiped out/changed.
const bool game_deinterlacing = (m_regs->DISP[0].DISPFB.DBY != PCRTCDisplays.PCRTCDisplays[0].prevFramebufferReg.DBY) !=
Expand Down Expand Up @@ -127,7 +130,10 @@ bool GSRenderer::Merge(int field)
}

if (!tex[0] && !tex[1])
{
m_real_size = GSVector2i(0, 0);
return false;
}

s_n++;

Expand Down

0 comments on commit c650b4b

Please sign in to comment.