diff options
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 292 |
1 files changed, 165 insertions, 127 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f462cd072..9544f0fb0 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -11,11 +11,11 @@ #endif // VFS includes must be before glad as they will conflict with Windows file api, which uses defines. -#include "applets/controller.h" -#include "applets/error.h" -#include "applets/profile_select.h" -#include "applets/software_keyboard.h" -#include "applets/web_browser.h" +#include "applets/qt_controller.h" +#include "applets/qt_error.h" +#include "applets/qt_profile_select.h" +#include "applets/qt_software_keyboard.h" +#include "applets/qt_web_browser.h" #include "common/nvidia_flags.h" #include "configuration/configure_input.h" #include "configuration/configure_per_game.h" @@ -156,11 +156,13 @@ enum class CalloutFlag : uint32_t { }; void GMainWindow::ShowTelemetryCallout() { - if (UISettings::values.callout_flags & static_cast<uint32_t>(CalloutFlag::Telemetry)) { + if (UISettings::values.callout_flags.GetValue() & + static_cast<uint32_t>(CalloutFlag::Telemetry)) { return; } - UISettings::values.callout_flags |= static_cast<uint32_t>(CalloutFlag::Telemetry); + UISettings::values.callout_flags = + UISettings::values.callout_flags.GetValue() | static_cast<uint32_t>(CalloutFlag::Telemetry); const QString telemetry_message = tr("<a href='https://yuzu-emu.org/help/feature/telemetry/'>Anonymous " "data is collected</a> to help improve yuzu. " @@ -177,7 +179,7 @@ static void InitializeLogging() { using namespace Common; Log::Filter log_filter; - log_filter.ParseFilterString(Settings::values.log_filter); + log_filter.ParseFilterString(Settings::values.log_filter.GetValue()); Log::SetGlobalFilter(log_filter); const auto log_dir = FS::GetYuzuPath(FS::YuzuPath::LogDir); @@ -216,7 +218,7 @@ GMainWindow::GMainWindow() default_theme_paths = QIcon::themeSearchPaths(); UpdateUITheme(); - SetDiscordEnabled(UISettings::values.enable_discord_presence); + SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue()); discord_rpc->Update(); RegisterMetaTypes(); @@ -787,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(); + UpdateGPUAccuracyButton(); }); - 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); + UpdateGPUAccuracyButton(); + statusBar()->insertPermanentWidget(0, gpu_accuracy_button); // Setup Renderer API button renderer_status_button = new QPushButton(); @@ -983,23 +972,23 @@ void GMainWindow::InitializeHotkeys() { }); connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Speed Limit"), this), &QShortcut::activated, this, [&] { - Settings::values.use_frame_limit.SetValue( - !Settings::values.use_frame_limit.GetValue()); + Settings::values.use_speed_limit.SetValue( + !Settings::values.use_speed_limit.GetValue()); UpdateStatusBar(); }); constexpr u16 SPEED_LIMIT_STEP = 5; connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Increase Speed Limit"), this), &QShortcut::activated, this, [&] { - if (Settings::values.frame_limit.GetValue() < 9999 - SPEED_LIMIT_STEP) { - Settings::values.frame_limit.SetValue(SPEED_LIMIT_STEP + - Settings::values.frame_limit.GetValue()); + if (Settings::values.speed_limit.GetValue() < 9999 - SPEED_LIMIT_STEP) { + Settings::values.speed_limit.SetValue(SPEED_LIMIT_STEP + + Settings::values.speed_limit.GetValue()); UpdateStatusBar(); } }); connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Decrease Speed Limit"), this), &QShortcut::activated, this, [&] { - if (Settings::values.frame_limit.GetValue() > SPEED_LIMIT_STEP) { - Settings::values.frame_limit.SetValue(Settings::values.frame_limit.GetValue() - + if (Settings::values.speed_limit.GetValue() > SPEED_LIMIT_STEP) { + Settings::values.speed_limit.SetValue(Settings::values.speed_limit.GetValue() - SPEED_LIMIT_STEP); UpdateStatusBar(); } @@ -1060,23 +1049,24 @@ void GMainWindow::RestoreUIState() { render_window->restoreGeometry(UISettings::values.renderwindow_geometry); #if MICROPROFILE_ENABLED microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry); - microProfileDialog->setVisible(UISettings::values.microprofile_visible); + microProfileDialog->setVisible(UISettings::values.microprofile_visible.GetValue()); #endif game_list->LoadInterfaceLayout(); - ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode); + ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode.GetValue()); ToggleWindowMode(); - ui.action_Fullscreen->setChecked(UISettings::values.fullscreen); + ui.action_Fullscreen->setChecked(UISettings::values.fullscreen.GetValue()); - ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar); + ui.action_Display_Dock_Widget_Headers->setChecked( + UISettings::values.display_titlebar.GetValue()); OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); - ui.action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar); + ui.action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue()); game_list->SetFilterVisible(ui.action_Show_Filter_Bar->isChecked()); - ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar); + ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar.GetValue()); statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); Debugger::ToggleConsole(); } @@ -1218,7 +1208,7 @@ void GMainWindow::AllowOSSleep() { #endif } -bool GMainWindow::LoadROM(const QString& filename, std::size_t program_index) { +bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t program_index) { // Shutdown previous session if the emu thread is still active... if (emu_thread != nullptr) ShutdownGame(); @@ -1241,15 +1231,16 @@ bool GMainWindow::LoadROM(const QString& filename, std::size_t program_index) { }); const Core::System::ResultStatus result{ - system.Load(*render_window, filename.toStdString(), program_index)}; + system.Load(*render_window, filename.toStdString(), program_id, program_index)}; - const auto drd_callout = - (UISettings::values.callout_flags & static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0; + const auto drd_callout = (UISettings::values.callout_flags.GetValue() & + static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0; if (result == Core::System::ResultStatus::Success && system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory && drd_callout) { - UISettings::values.callout_flags |= static_cast<u32>(CalloutFlag::DRDDeprecation); + UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() | + static_cast<u32>(CalloutFlag::DRDDeprecation); QMessageBox::warning( this, tr("Warning Outdated Game Format"), tr("You are using the deconstructed ROM directory format for this game, which is an " @@ -1327,7 +1318,8 @@ void GMainWindow::SelectAndSetCurrentUser() { Settings::values.current_user = dialog.GetIndex(); } -void GMainWindow::BootGame(const QString& filename, std::size_t program_index, StartGameType type) { +void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t program_index, + StartGameType type) { LOG_INFO(Frontend, "yuzu starting..."); StoreRecentFile(filename); // Put the filename on top of the list @@ -1337,7 +1329,7 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S auto& system = Core::System::GetInstance(); const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); - const auto loader = Loader::GetLoader(system, v_file, program_index); + const auto loader = Loader::GetLoader(system, v_file, program_id, program_index); if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success && type == StartGameType::Normal) { @@ -1351,6 +1343,9 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S ConfigureVibration::SetAllVibrationDevices(); + // Disable fps limit toggle when booting a new title + Settings::values.disable_fps_limit.SetValue(false); + // Save configurations UpdateUISettings(); game_list->SaveInterfaceLayout(); @@ -1362,7 +1357,7 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S SelectAndSetCurrentUser(); } - if (!LoadROM(filename, program_index)) + if (!LoadROM(filename, program_id, program_index)) return; // Create and start the emulation thread @@ -1393,8 +1388,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) { @@ -1424,8 +1417,10 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S std::filesystem::path{filename.toStdU16String()}.filename()); } const bool is_64bit = system.Kernel().CurrentProcess()->Is64BitProcess(); - const auto instruction_set_suffix = is_64bit ? " (64-bit)" : " (32-bit)"; - title_name += instruction_set_suffix; + const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)"); + title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit") + .arg(QString::fromStdString(title_name), instruction_set_suffix) + .toStdString(); LOG_INFO(Frontend, "Booting game: {:016X} | {} | {}", title_id, title_name, title_version); const auto gpu_vendor = system.GPU().Renderer().GetDeviceVendor(); UpdateWindowTitle(title_name, title_version, gpu_vendor); @@ -1496,8 +1491,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; @@ -1539,8 +1532,8 @@ void GMainWindow::UpdateRecentFiles() { ui.menu_recent_files->setEnabled(num_recent_files != 0); } -void GMainWindow::OnGameListLoadFile(QString game_path) { - BootGame(game_path); +void GMainWindow::OnGameListLoadFile(QString game_path, u64 program_id) { + BootGame(game_path, program_id); } void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target, @@ -1644,35 +1637,15 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) { const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir); - const auto transferable_shader_cache_folder_path = shader_cache_dir / "opengl" / "transferable"; - const auto transferable_shader_cache_file_path = - transferable_shader_cache_folder_path / fmt::format("{:016X}.bin", program_id); - - if (!Common::FS::Exists(transferable_shader_cache_file_path)) { + const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)}; + if (!Common::FS::CreateDirs(shader_cache_folder_path)) { QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"), - tr("A shader cache for this title does not exist.")); + tr("Filed to create the shader cache directory for this title.")); return; } - - const auto qt_shader_cache_folder_path = - QString::fromStdString(Common::FS::PathToUTF8String(transferable_shader_cache_folder_path)); - const auto qt_shader_cache_file_path = - QString::fromStdString(Common::FS::PathToUTF8String(transferable_shader_cache_file_path)); - - // Windows supports opening a folder with selecting a specified file in explorer. On every other - // OS we just open the transferable shader cache folder without preselecting the transferable - // shader cache file for the selected game. -#if defined(Q_OS_WIN) - const QString explorer = QStringLiteral("explorer"); - QStringList param; - if (!QFileInfo(qt_shader_cache_file_path).isDir()) { - param << QStringLiteral("/select,"); - } - param << QDir::toNativeSeparators(qt_shader_cache_file_path); - QProcess::startDetached(explorer, param); -#else - QDesktopServices::openUrl(QUrl::fromLocalFile(qt_shader_cache_folder_path)); -#endif + const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)}; + const auto qt_shader_cache_path = QString::fromStdString(shader_path_string); + QDesktopServices::openUrl(QUrl::fromLocalFile(qt_shader_cache_path)); } static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) { @@ -1815,8 +1788,12 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ const std::string& game_path) { const QString question = [this, target] { switch (target) { - case GameListRemoveTarget::ShaderCache: - return tr("Delete Transferable Shader Cache?"); + case GameListRemoveTarget::GlShaderCache: + return tr("Delete OpenGL Transferable Shader Cache?"); + case GameListRemoveTarget::VkShaderCache: + return tr("Delete Vulkan Transferable Shader Cache?"); + case GameListRemoveTarget::AllShaderCache: + return tr("Delete All Transferable Shader Caches?"); case GameListRemoveTarget::CustomConfiguration: return tr("Remove Custom Game Configuration?"); default: @@ -1830,8 +1807,12 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ } switch (target) { - case GameListRemoveTarget::ShaderCache: - RemoveTransferableShaderCache(program_id); + case GameListRemoveTarget::GlShaderCache: + case GameListRemoveTarget::VkShaderCache: + RemoveTransferableShaderCache(program_id, target); + break; + case GameListRemoveTarget::AllShaderCache: + RemoveAllTransferableShaderCaches(program_id); break; case GameListRemoveTarget::CustomConfiguration: RemoveCustomConfiguration(program_id, game_path); @@ -1839,18 +1820,27 @@ void GMainWindow::OnGameListRemoveFile(u64 program_id, GameListRemoveTarget targ } } -void GMainWindow::RemoveTransferableShaderCache(u64 program_id) { +void GMainWindow::RemoveTransferableShaderCache(u64 program_id, GameListRemoveTarget target) { + const auto target_file_name = [target] { + switch (target) { + case GameListRemoveTarget::GlShaderCache: + return "opengl.bin"; + case GameListRemoveTarget::VkShaderCache: + return "vulkan.bin"; + default: + return ""; + } + }(); const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir); - const auto transferable_shader_cache_file_path = - shader_cache_dir / "opengl" / "transferable" / fmt::format("{:016X}.bin", program_id); + const auto shader_cache_folder_path = shader_cache_dir / fmt::format("{:016x}", program_id); + const auto target_file = shader_cache_folder_path / target_file_name; - if (!Common::FS::Exists(transferable_shader_cache_file_path)) { + if (!Common::FS::Exists(target_file)) { QMessageBox::warning(this, tr("Error Removing Transferable Shader Cache"), tr("A shader cache for this title does not exist.")); return; } - - if (Common::FS::RemoveFile(transferable_shader_cache_file_path)) { + if (Common::FS::RemoveFile(target_file)) { QMessageBox::information(this, tr("Successfully Removed"), tr("Successfully removed the transferable shader cache.")); } else { @@ -1859,6 +1849,24 @@ void GMainWindow::RemoveTransferableShaderCache(u64 program_id) { } } +void GMainWindow::RemoveAllTransferableShaderCaches(u64 program_id) { + const auto shader_cache_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ShaderDir); + const auto program_shader_cache_dir = shader_cache_dir / fmt::format("{:016x}", program_id); + + if (!Common::FS::Exists(program_shader_cache_dir)) { + QMessageBox::warning(this, tr("Error Removing Transferable Shader Caches"), + tr("A shader cache for this title does not exist.")); + return; + } + if (Common::FS::RemoveDirRecursively(program_shader_cache_dir)) { + QMessageBox::information(this, tr("Successfully Removed"), + tr("Successfully removed the transferable shader caches.")); + } else { + QMessageBox::warning(this, tr("Error Removing Transferable Shader Caches"), + tr("Failed to remove the transferable shader cache directory.")); + } +} + void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& game_path) { const auto file_path = std::filesystem::path(Common::FS::ToU8String(game_path)); const auto config_file_name = @@ -2441,7 +2449,7 @@ void GMainWindow::OnLoadComplete() { void GMainWindow::OnExecuteProgram(std::size_t program_index) { ShutdownGame(); - BootGame(last_filename_booted, program_index); + BootGame(last_filename_booted, 0, program_index); } void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { @@ -2453,7 +2461,8 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex } void GMainWindow::OnMenuReportCompatibility() { - if (!Settings::values.yuzu_token.empty() && !Settings::values.yuzu_username.empty()) { + if (!Settings::values.yuzu_token.GetValue().empty() && + !Settings::values.yuzu_username.GetValue().empty()) { CompatDB compatdb{this}; compatdb.exec(); } else { @@ -2504,7 +2513,7 @@ void GMainWindow::ShowFullscreen() { ui.menubar->hide(); statusBar()->hide(); - if (Settings::values.fullscreen_mode.GetValue() == 1) { + if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { showFullScreen(); return; } @@ -2519,7 +2528,7 @@ void GMainWindow::ShowFullscreen() { } else { UISettings::values.renderwindow_geometry = render_window->saveGeometry(); - if (Settings::values.fullscreen_mode.GetValue() == 1) { + if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { render_window->showFullScreen(); return; } @@ -2536,7 +2545,7 @@ void GMainWindow::ShowFullscreen() { void GMainWindow::HideFullscreen() { if (ui.action_Single_Window_Mode->isChecked()) { - if (Settings::values.fullscreen_mode.GetValue() == 1) { + if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { showNormal(); restoreGeometry(UISettings::values.geometry); } else { @@ -2550,7 +2559,7 @@ void GMainWindow::HideFullscreen() { statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); ui.menubar->show(); } else { - if (Settings::values.fullscreen_mode.GetValue() == 1) { + if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { render_window->showNormal(); render_window->restoreGeometry(UISettings::values.renderwindow_geometry); } else { @@ -2618,7 +2627,7 @@ void GMainWindow::ResetWindowSize1080() { void GMainWindow::OnConfigure() { const auto old_theme = UISettings::values.theme; - const bool old_discord_presence = UISettings::values.enable_discord_presence; + const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this, @@ -2675,8 +2684,8 @@ void GMainWindow::OnConfigure() { if (UISettings::values.theme != old_theme) { UpdateUITheme(); } - if (UISettings::values.enable_discord_presence != old_discord_presence) { - SetDiscordEnabled(UISettings::values.enable_discord_presence); + if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) { + SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue()); } emit UpdateThemedIcons(); @@ -2812,7 +2821,7 @@ void GMainWindow::OnCaptureScreenshot() { QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); const auto date = QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd_hh-mm-ss-zzz")); - QString filename = QStringLiteral("%1%2_%3.png") + QString filename = QStringLiteral("%1/%2_%3.png") .arg(screenshot_path) .arg(title_id, 16, 16, QLatin1Char{'0'}) .arg(date); @@ -2832,7 +2841,8 @@ void GMainWindow::OnCaptureScreenshot() { } } #endif - render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor, filename); + render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor.GetValue(), + filename); OnStartGame(); } @@ -2888,26 +2898,31 @@ void GMainWindow::UpdateStatusBar() { return; } - auto results = Core::System::GetInstance().GetAndResetPerfStats(); - auto& shader_notify = Core::System::GetInstance().GPU().ShaderNotify(); - const auto shaders_building = shader_notify.GetShadersBuilding(); + auto& system = Core::System::GetInstance(); + auto results = system.GetAndResetPerfStats(); + auto& shader_notify = system.GPU().ShaderNotify(); + const int shaders_building = shader_notify.ShadersBuilding(); - if (shaders_building != 0) { - shader_building_label->setText( - tr("Building: %n shader(s)", "", static_cast<int>(shaders_building))); + if (shaders_building > 0) { + shader_building_label->setText(tr("Building: %n shader(s)", "", shaders_building)); shader_building_label->setVisible(true); } else { shader_building_label->setVisible(false); } - if (Settings::values.use_frame_limit.GetValue()) { + if (Settings::values.use_speed_limit.GetValue()) { emu_speed_label->setText(tr("Speed: %1% / %2%") .arg(results.emulation_speed * 100.0, 0, 'f', 0) - .arg(Settings::values.frame_limit.GetValue())); + .arg(Settings::values.speed_limit.GetValue())); } else { emu_speed_label->setText(tr("Speed: %1%").arg(results.emulation_speed * 100.0, 0, 'f', 0)); } - game_fps_label->setText(tr("Game: %1 FPS").arg(results.average_game_fps, 0, 'f', 0)); + if (Settings::values.disable_fps_limit) { + game_fps_label->setText( + tr("Game: %1 FPS (Unlocked)").arg(results.average_game_fps, 0, 'f', 0)); + } else { + game_fps_label->setText(tr("Game: %1 FPS").arg(results.average_game_fps, 0, 'f', 0)); + } emu_frametime_label->setText(tr("Frame: %1 ms").arg(results.frametime * 1000.0, 0, 'f', 2)); emu_speed_label->setVisible(!Settings::values.use_multi_core.GetValue()); @@ -2915,12 +2930,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() { |