Qt: Regression fixes

This commit is contained in:
Connor McLaughlin 2022-07-22 22:51:29 +10:00
parent 7e52c01b35
commit 701780e2ef
6 changed files with 46 additions and 28 deletions

View file

@ -327,7 +327,7 @@ static const Controller::ControllerBindingInfo s_binding_info[] = {
static const SettingInfo s_settings[] = {
{SettingInfo::Type::Float, "AnalogDeadzone", TRANSLATABLE("AnalogController", "Analog Deadzone"),
TRANSLATABLE("AnalogController",
"Sets the analog stick deadzone, i.e. the fraction of the stick movement which will be ignored.s"),
"Sets the analog stick deadzone, i.e. the fraction of the stick movement which will be ignored."),
"1.00f", "0.00f", "1.00f", "0.01f"},
{SettingInfo::Type::Float, "AnalogSensitivity", TRANSLATABLE("AnalogController", "Analog Sensitivity"),
TRANSLATABLE(

View file

@ -1951,7 +1951,7 @@ void SPU::DrawDebugStateWindow()
{
static const ImVec4 active_color{1.0f, 1.0f, 1.0f, 1.0f};
static const ImVec4 inactive_color{0.4f, 0.4f, 0.4f, 1.0f};
const float framebuffer_scale = ImGui::GetIO().DisplayFramebufferScale.x;
const float framebuffer_scale = Host::GetOSDScale();
ImGui::SetNextWindowSize(ImVec2(800.0f * framebuffer_scale, 800.0f * framebuffer_scale), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("SPU State", nullptr))

View file

@ -3910,7 +3910,8 @@ bool System::LoadCheatList(const char* filename)
bool System::LoadCheatListFromGameTitle()
{
if (!IsValid() || Achievements::ChallengeModeActive())
// Called when booting, needs to test for shutdown.
if (IsShutdown() || Achievements::ChallengeModeActive())
return false;
const std::string filename(GetCheatFileName());
@ -3922,15 +3923,15 @@ bool System::LoadCheatListFromGameTitle()
bool System::LoadCheatListFromDatabase()
{
if (System::GetRunningCode().empty() || Achievements::ChallengeModeActive())
if (IsShutdown() || s_running_game_code.empty() || Achievements::ChallengeModeActive())
return false;
std::unique_ptr<CheatList> cl = std::make_unique<CheatList>();
if (!cl->LoadFromPackage(System::GetRunningCode()))
if (!cl->LoadFromPackage(s_running_game_code))
return false;
Log_InfoPrintf("Loaded %u cheats from database.", cl->GetCodeCount());
System::SetCheatList(std::move(cl));
SetCheatList(std::move(cl));
return true;
}

View file

@ -5,6 +5,7 @@
#include "settingwidgetbinder.h"
#include "util/cd_image.h"
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QPushButton>
ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsDialog* dialog, QWidget* parent)
: QWidget(parent), m_dialog(dialog)
@ -92,7 +93,7 @@ ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsDialog* dialog, QWidget* pa
tr("Automatically applies patches to disc images when they are present in the same "
"directory. Currently only PPF patches are supported with this option."));
m_ui.cpuClockSpeed->setEnabled(m_ui.enableCPUClockSpeedControl->checkState() == Qt::Checked);
m_ui.cpuClockSpeed->setEnabled(m_dialog->getEffectiveBoolValue("CPU", "OverclockEnable", false));
connect(m_ui.enableCPUClockSpeedControl, &QCheckBox::stateChanged, this,
&ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked);
@ -105,28 +106,41 @@ ConsoleSettingsWidget::~ConsoleSettingsWidget() = default;
void ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked(int state)
{
if (state == Qt::Checked && !Host::GetBaseBoolSettingValue("UI", "CPUOverclockingWarningShown", false))
if (state == Qt::Checked &&
(!m_dialog->isPerGameSettings() || !Host::GetBaseBoolSettingValue("CPU", "OverclockEnable", false)) &&
!Host::GetBaseBoolSettingValue("UI", "CPUOverclockingWarningShown", false))
{
const QString message =
tr("Enabling CPU overclocking will break games, cause bugs, reduce performance and can significantly increase "
"system requirements.\n\nBy enabling this option you are agreeing to not create any bug reports unless you "
"have confirmed the bug also occurs with overclocking disabled.\n\nThis warning will only be shown once.");
const QString yes_button = tr("Yes, I will confirm bugs without overclocking before reporting.");
const QString no_button = tr("No, take me back to safety.");
if (QMessageBox::question(QtUtils::GetRootWidget(this), tr("CPU Overclocking Warning"), message,
QMessageBox::Yes | QMessageBox::No) != 0)
QMessageBox mb(QMessageBox::Warning, tr("CPU Overclocking Warning"), message, QMessageBox::NoButton, this);
const QAbstractButton* const yes_button = mb.addButton(tr("Yes, I will confirm bugs without overclocking before reporting."), QMessageBox::YesRole);
mb.addButton(tr("No, take me back to safety."), QMessageBox::NoRole);
mb.exec();
if (mb.clickedButton() != yes_button)
{
QSignalBlocker sb(m_ui.enableCPUClockSpeedControl);
m_ui.enableCPUClockSpeedControl->setChecked(Qt::Unchecked);
if (m_dialog->isPerGameSettings())
{
m_ui.enableCPUClockSpeedControl->setCheckState(Qt::PartiallyChecked);
m_dialog->removeSettingValue("CPU", "OverclockEnable");
}
else
{
m_ui.enableCPUClockSpeedControl->setCheckState(Qt::Unchecked);
m_dialog->setBoolSettingValue("CPU", "OverclockEnable", false);
}
return;
}
Host::SetBaseBoolSettingValue("UI", "CPUOverclockingWarningShown", true);
}
m_ui.cpuClockSpeed->setEnabled(state == Qt::Checked);
m_ui.cpuClockSpeed->setEnabled(m_dialog->getEffectiveBoolValue("CPU", "OverclockEnable", false));
updateCPUClockSpeedLabel();
}

View file

@ -269,7 +269,7 @@ bool MainWindow::updateDisplay(bool fullscreen, bool render_to_main, bool surfac
m_display_widget->setFocus();
m_display_widget->setShouldHideCursor(shouldHideMouseCursor());
m_display_widget->updateRelativeMode(s_system_valid && !s_system_paused);
m_display_widget->updateRelativeMode(m_relative_mouse_mode && s_system_valid && !s_system_paused);
m_display_widget->updateCursor(s_system_valid && !s_system_paused);
QSignalBlocker blocker(m_ui.actionFullscreen);

View file

@ -414,6 +414,8 @@ void Host::DisplayLoadingScreen(const char* message, int progress_min /*= -1*/,
}
void ImGuiManager::RenderDebugWindows()
{
if (System::IsValid())
{
if (g_settings.debugging.show_gpu_state)
g_gpu->DrawDebugStateWindow();
@ -428,6 +430,7 @@ void ImGuiManager::RenderDebugWindows()
if (g_settings.debugging.show_dma_state)
g_dma.DrawDebugStateWindow();
}
}
#ifdef WITH_DISCORD_PRESENCE