From fd09be5496b742b61c0ee1babf0012d2dafa196d Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Thu, 8 Jul 2021 23:21:08 +0200 Subject: [PATCH 1/2] Settings: Eliminate ASYNC & MULTICORE Toggles and add GPU Accuracy Toggle. --- dist/qt_themes/default/style.qss | 20 +++++ dist/qt_themes/qdarkstyle/style.qss | 21 +++++ .../qdarkstyle_midnight_blue/style.qss | 21 +++++ src/yuzu/main.cpp | 82 ++++++++++--------- src/yuzu/main.h | 4 +- 5 files changed, 108 insertions(+), 40 deletions(-) diff --git a/dist/qt_themes/default/style.qss b/dist/qt_themes/default/style.qss index cee219374..9915a40ba 100644 --- a/dist/qt_themes/default/style.qss +++ b/dist/qt_themes/default/style.qss @@ -38,6 +38,26 @@ QPushButton#RendererStatusBarButton:!checked { color: #0066ff; } +QPushButton#GPUStatusBarButton { + color: #656565; + border: 1px solid transparent; + background-color: transparent; + padding: 0px 3px 0px 3px; + text-align: center; +} + +QPushButton#GPUStatusBarButton:hover { + border: 1px solid #76797C; +} + +QPushButton#GPUStatusBarButton:checked { + color: #ff8040; +} + +QPushButton#GPUStatusBarButton:!checked { + color: #40dd40; +} + QPushButton#buttonRefreshDevices { min-width: 21px; min-height: 21px; diff --git a/dist/qt_themes/qdarkstyle/style.qss b/dist/qt_themes/qdarkstyle/style.qss index 3d0ccbb9e..dac2dba86 100644 --- a/dist/qt_themes/qdarkstyle/style.qss +++ b/dist/qt_themes/qdarkstyle/style.qss @@ -1283,6 +1283,27 @@ QPushButton#RendererStatusBarButton:!checked { color: #00ccdd; } +QPushButton#GPUStatusBarButton { + min-width: 0px; + color: #656565; + border: 1px solid transparent; + background-color: transparent; + padding: 0px 3px 0px 3px; + text-align: center; +} + +QPushButton#GPUStatusBarButton:hover { + border: 1px solid #76797C; +} + +QPushButton#GPUStatusBarButton:checked { + color: #ff8040; +} + +QPushButton#GPUStatusBarButton:!checked { + color: #40dd40; +} + QPushButton#buttonRefreshDevices { min-width: 23px; min-height: 23px; diff --git a/dist/qt_themes/qdarkstyle_midnight_blue/style.qss b/dist/qt_themes/qdarkstyle_midnight_blue/style.qss index 51bec2fd7..032d05ec6 100644 --- a/dist/qt_themes/qdarkstyle_midnight_blue/style.qss +++ b/dist/qt_themes/qdarkstyle_midnight_blue/style.qss @@ -2186,6 +2186,27 @@ QPushButton#RendererStatusBarButton:!checked { color: #00ccdd; } +QPushButton#GPUStatusBarButton { + min-width: 0px; + color: #656565; + border: 1px solid transparent; + background-color: transparent; + padding: 0px 3px 0px 3px; + text-align: center; +} + +QPushButton#GPUStatusBarButton:hover { + border: 1px solid #76797C; +} + +QPushButton#GPUStatusBarButton:checked { + color: #ff8040; +} + +QPushButton#GPUStatusBarButton:!checked { + color: #40dd40; +} + QPushButton#buttonRefreshDevices { min-width: 19px; min-height: 19px; diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 5ed3b90b8..1e6f0e4a7 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -789,41 +789,28 @@ void GMainWindow::InitializeWidgets() { dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); statusBar()->insertPermanentWidget(0, dock_status_button); - // Setup ASync button - async_status_button = new QPushButton(); - async_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); - async_status_button->setFocusPolicy(Qt::NoFocus); - connect(async_status_button, &QPushButton::clicked, [&] { - if (emulation_running) { - return; + gpu_accuracy_button = new QPushButton(); + gpu_accuracy_button->setObjectName(QStringLiteral("GPUStatusBarButton")); + gpu_accuracy_button->setCheckable(true); + gpu_accuracy_button->setFocusPolicy(Qt::NoFocus); + connect(gpu_accuracy_button, &QPushButton::clicked, [this] { + switch (Settings::values.gpu_accuracy.GetValue()) { + case Settings::GPUAccuracy::High: { + Settings::values.gpu_accuracy.SetValue(Settings::GPUAccuracy::Normal); + break; + } + case Settings::GPUAccuracy::Normal: + case Settings::GPUAccuracy::Extreme: + default: { + Settings::values.gpu_accuracy.SetValue(Settings::GPUAccuracy::High); } - Settings::values.use_asynchronous_gpu_emulation.SetValue( - !Settings::values.use_asynchronous_gpu_emulation.GetValue()); - async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation.GetValue()); - Core::System::GetInstance().ApplySettings(); - }); - async_status_button->setText(tr("ASYNC")); - async_status_button->setCheckable(true); - async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation.GetValue()); - - // Setup Multicore button - multicore_status_button = new QPushButton(); - multicore_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); - multicore_status_button->setFocusPolicy(Qt::NoFocus); - connect(multicore_status_button, &QPushButton::clicked, [&] { - if (emulation_running) { - return; } - Settings::values.use_multi_core.SetValue(!Settings::values.use_multi_core.GetValue()); - multicore_status_button->setChecked(Settings::values.use_multi_core.GetValue()); - Core::System::GetInstance().ApplySettings(); - }); - multicore_status_button->setText(tr("MULTICORE")); - multicore_status_button->setCheckable(true); - multicore_status_button->setChecked(Settings::values.use_multi_core.GetValue()); - statusBar()->insertPermanentWidget(0, multicore_status_button); - statusBar()->insertPermanentWidget(0, async_status_button); + Core::System::GetInstance().ApplySettings(); + UpdateGPUAccuracyButton(); + }); + UpdateGPUAccuracyButton(); + statusBar()->insertPermanentWidget(0, gpu_accuracy_button); // Setup Renderer API button renderer_status_button = new QPushButton(); @@ -1397,8 +1384,6 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S game_list_placeholder->hide(); } status_bar_update_timer.start(500); - async_status_button->setDisabled(true); - multicore_status_button->setDisabled(true); renderer_status_button->setDisabled(true); if (UISettings::values.hide_mouse || Settings::values.mouse_panning) { @@ -1500,8 +1485,6 @@ void GMainWindow::ShutdownGame() { emu_speed_label->setVisible(false); game_fps_label->setVisible(false); emu_frametime_label->setVisible(false); - async_status_button->setEnabled(true); - multicore_status_button->setEnabled(true); renderer_status_button->setEnabled(true); emulation_running = false; @@ -2921,12 +2904,35 @@ void GMainWindow::UpdateStatusBar() { emu_frametime_label->setVisible(true); } +void GMainWindow::UpdateGPUAccuracyButton() { + switch (Settings::values.gpu_accuracy.GetValue()) { + case Settings::GPUAccuracy::Normal: { + gpu_accuracy_button->setText(tr("GPU NORMAL ")); + gpu_accuracy_button->setChecked(false); + break; + } + case Settings::GPUAccuracy::High: { + gpu_accuracy_button->setText(tr("GPU HIGH ")); + gpu_accuracy_button->setChecked(true); + break; + } + case Settings::GPUAccuracy::Extreme: { + gpu_accuracy_button->setText(tr("GPU EXTREME")); + gpu_accuracy_button->setChecked(true); + break; + } + default: { + gpu_accuracy_button->setText(tr("GPU ERROR")); + gpu_accuracy_button->setChecked(true); + } + } +} + void GMainWindow::UpdateStatusButtons() { dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); - multicore_status_button->setChecked(Settings::values.use_multi_core.GetValue()); - async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation.GetValue()); renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() == Settings::RendererBackend::Vulkan); + UpdateGPUAccuracyButton(); } void GMainWindow::UpdateUISettings() { diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 45c8310e1..15e4deab9 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -291,6 +291,7 @@ private: void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {}, std::string_view gpu_vendor = {}); void UpdateStatusBar(); + void UpdateGPUAccuracyButton(); void UpdateStatusButtons(); void UpdateUISettings(); void HideMouseCursor(); @@ -316,8 +317,7 @@ private: QLabel* emu_speed_label = nullptr; QLabel* game_fps_label = nullptr; QLabel* emu_frametime_label = nullptr; - QPushButton* async_status_button = nullptr; - QPushButton* multicore_status_button = nullptr; + QPushButton* gpu_accuracy_button = nullptr; QPushButton* renderer_status_button = nullptr; QPushButton* dock_status_button = nullptr; QTimer status_bar_update_timer; From 598d154f69b746796f1f6f11c2836a0ca2b5ea75 Mon Sep 17 00:00:00 2001 From: Fernando S Date: Fri, 9 Jul 2021 12:28:51 +0200 Subject: [PATCH 2/2] Update src/yuzu/main.cpp Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com> --- src/yuzu/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 1e6f0e4a7..d94c660b3 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2907,12 +2907,12 @@ void GMainWindow::UpdateStatusBar() { void GMainWindow::UpdateGPUAccuracyButton() { switch (Settings::values.gpu_accuracy.GetValue()) { case Settings::GPUAccuracy::Normal: { - gpu_accuracy_button->setText(tr("GPU NORMAL ")); + gpu_accuracy_button->setText(tr("GPU NORMAL")); gpu_accuracy_button->setChecked(false); break; } case Settings::GPUAccuracy::High: { - gpu_accuracy_button->setText(tr("GPU HIGH ")); + gpu_accuracy_button->setText(tr("GPU HIGH")); gpu_accuracy_button->setChecked(true); break; }