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[] = { static const SettingInfo s_settings[] = {
{SettingInfo::Type::Float, "AnalogDeadzone", TRANSLATABLE("AnalogController", "Analog Deadzone"), {SettingInfo::Type::Float, "AnalogDeadzone", TRANSLATABLE("AnalogController", "Analog Deadzone"),
TRANSLATABLE("AnalogController", 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"}, "1.00f", "0.00f", "1.00f", "0.01f"},
{SettingInfo::Type::Float, "AnalogSensitivity", TRANSLATABLE("AnalogController", "Analog Sensitivity"), {SettingInfo::Type::Float, "AnalogSensitivity", TRANSLATABLE("AnalogController", "Analog Sensitivity"),
TRANSLATABLE( 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 active_color{1.0f, 1.0f, 1.0f, 1.0f};
static const ImVec4 inactive_color{0.4f, 0.4f, 0.4f, 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); ImGui::SetNextWindowSize(ImVec2(800.0f * framebuffer_scale, 800.0f * framebuffer_scale), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("SPU State", nullptr)) if (!ImGui::Begin("SPU State", nullptr))

View File

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

View File

@ -5,6 +5,7 @@
#include "settingwidgetbinder.h" #include "settingwidgetbinder.h"
#include "util/cd_image.h" #include "util/cd_image.h"
#include <QtWidgets/QMessageBox> #include <QtWidgets/QMessageBox>
#include <QtWidgets/QPushButton>
ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsDialog* dialog, QWidget* parent) ConsoleSettingsWidget::ConsoleSettingsWidget(SettingsDialog* dialog, QWidget* parent)
: QWidget(parent), m_dialog(dialog) : 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 " tr("Automatically applies patches to disc images when they are present in the same "
"directory. Currently only PPF patches are supported with this option.")); "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, connect(m_ui.enableCPUClockSpeedControl, &QCheckBox::stateChanged, this,
&ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked); &ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked);
@ -105,28 +106,41 @@ ConsoleSettingsWidget::~ConsoleSettingsWidget() = default;
void ConsoleSettingsWidget::onEnableCPUClockSpeedControlChecked(int state) 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 = const QString message =
tr("Enabling CPU overclocking will break games, cause bugs, reduce performance and can significantly increase " 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 " "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."); "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 mb(QMessageBox::Warning, tr("CPU Overclocking Warning"), message, QMessageBox::NoButton, this);
QMessageBox::Yes | QMessageBox::No) != 0) 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); QSignalBlocker sb(m_ui.enableCPUClockSpeedControl);
m_ui.enableCPUClockSpeedControl->setChecked(Qt::Unchecked); if (m_dialog->isPerGameSettings())
m_dialog->setBoolSettingValue("CPU", "OverclockEnable", false); {
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; return;
} }
Host::SetBaseBoolSettingValue("UI", "CPUOverclockingWarningShown", true); Host::SetBaseBoolSettingValue("UI", "CPUOverclockingWarningShown", true);
} }
m_ui.cpuClockSpeed->setEnabled(state == Qt::Checked); m_ui.cpuClockSpeed->setEnabled(m_dialog->getEffectiveBoolValue("CPU", "OverclockEnable", false));
updateCPUClockSpeedLabel(); 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->setFocus();
m_display_widget->setShouldHideCursor(shouldHideMouseCursor()); 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); m_display_widget->updateCursor(s_system_valid && !s_system_paused);
QSignalBlocker blocker(m_ui.actionFullscreen); QSignalBlocker blocker(m_ui.actionFullscreen);

View File

@ -415,18 +415,21 @@ void Host::DisplayLoadingScreen(const char* message, int progress_min /*= -1*/,
void ImGuiManager::RenderDebugWindows() void ImGuiManager::RenderDebugWindows()
{ {
if (g_settings.debugging.show_gpu_state) if (System::IsValid())
g_gpu->DrawDebugStateWindow(); {
if (g_settings.debugging.show_cdrom_state) if (g_settings.debugging.show_gpu_state)
g_cdrom.DrawDebugWindow(); g_gpu->DrawDebugStateWindow();
if (g_settings.debugging.show_timers_state) if (g_settings.debugging.show_cdrom_state)
g_timers.DrawDebugStateWindow(); g_cdrom.DrawDebugWindow();
if (g_settings.debugging.show_spu_state) if (g_settings.debugging.show_timers_state)
g_spu.DrawDebugStateWindow(); g_timers.DrawDebugStateWindow();
if (g_settings.debugging.show_mdec_state) if (g_settings.debugging.show_spu_state)
g_mdec.DrawDebugStateWindow(); g_spu.DrawDebugStateWindow();
if (g_settings.debugging.show_dma_state) if (g_settings.debugging.show_mdec_state)
g_dma.DrawDebugStateWindow(); g_mdec.DrawDebugStateWindow();
if (g_settings.debugging.show_dma_state)
g_dma.DrawDebugStateWindow();
}
} }
#ifdef WITH_DISCORD_PRESENCE #ifdef WITH_DISCORD_PRESENCE