Qt: Fix vanishing status bar renderer info

This commit is contained in:
Stenzek 2024-04-01 00:44:57 +10:00 committed by Connor McLaughlin
parent 64b6dec56f
commit c650b4b00f
4 changed files with 47 additions and 41 deletions

View File

@ -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();

View File

@ -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"
@ -928,6 +928,7 @@ void Host::OnVMStarting()
void Host::OnVMStarted()
{
g_emu_thread->updatePerformanceMetrics(true);
emit g_emu_thread->onVMStarted();
}
@ -1001,21 +1002,6 @@ 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 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;
}
else
{
if (renderer != m_last_renderer || force)
{
@ -1023,10 +1009,18 @@ void EmuThread::updatePerformanceMetrics(bool force)
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)));
QString text;
if (iwidth == 0 || iheight == 0)
text = tr("N/A");
else
text = tr("%1x%2").arg(iwidth).arg(iheight);
QMetaObject::invokeMethod(
g_main_window->getStatusResolutionWidget(), "setText", Qt::QueuedConnection, Q_ARG(const QString&, text));
m_last_internal_width = iwidth;
m_last_internal_height = iheight;
}
@ -1046,7 +1040,6 @@ void EmuThread::updatePerformanceMetrics(bool force)
m_last_video_fps = vfps;
}
}
}
}
void Host::OnPerformanceMetricsUpdated()

View File

@ -223,7 +223,7 @@ private:
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;

View File

@ -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) !=
@ -127,7 +130,10 @@ bool GSRenderer::Merge(int field)
}
if (!tex[0] && !tex[1])
{
m_real_size = GSVector2i(0, 0);
return false;
}
s_n++;