summaryrefslogtreecommitdiff
path: root/src/yuzu/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r--src/yuzu/main.cpp341
1 files changed, 198 insertions, 143 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index be8933c5c..e172d2ff4 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"
@@ -104,6 +104,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "input_common/main.h"
#include "util/overlay_dialog.h"
#include "video_core/gpu.h"
+#include "video_core/renderer_base.h"
#include "video_core/shader_notify.h"
#include "yuzu/about_dialog.h"
#include "yuzu/bootmanager.h"
@@ -155,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. "
@@ -176,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);
@@ -194,10 +197,10 @@ static void RemoveCachedContents() {
const auto offline_legal_information = cache_dir / "offline_web_applet_legal_information";
const auto offline_system_data = cache_dir / "offline_web_applet_system_data";
- void(Common::FS::RemoveDirRecursively(offline_fonts));
- void(Common::FS::RemoveDirRecursively(offline_manual));
- void(Common::FS::RemoveDirRecursively(offline_legal_information));
- void(Common::FS::RemoveDirRecursively(offline_system_data));
+ Common::FS::RemoveDirRecursively(offline_fonts);
+ Common::FS::RemoveDirRecursively(offline_manual);
+ Common::FS::RemoveDirRecursively(offline_legal_information);
+ Common::FS::RemoveDirRecursively(offline_system_data);
}
GMainWindow::GMainWindow()
@@ -215,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();
@@ -236,7 +239,8 @@ GMainWindow::GMainWindow()
const auto build_id = std::string(Common::g_build_id);
const auto yuzu_build = fmt::format("yuzu Development Build | {}-{}", branch_name, description);
- const auto override_build = fmt::format(std::string(Common::g_title_bar_format_idle), build_id);
+ const auto override_build =
+ fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id);
const auto yuzu_build_version = override_build.empty() ? yuzu_build : override_build;
LOG_INFO(Frontend, "yuzu Version: {}", yuzu_build_version);
@@ -785,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;
}
- 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;
+ case Settings::GPUAccuracy::Normal:
+ case Settings::GPUAccuracy::Extreme:
+ default: {
+ Settings::values.gpu_accuracy.SetValue(Settings::GPUAccuracy::High);
}
- 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();
@@ -981,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();
}
@@ -1025,7 +1016,11 @@ void GMainWindow::InitializeHotkeys() {
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this),
&QShortcut::activated, this,
[] { Settings::values.audio_muted = !Settings::values.audio_muted; });
-
+ connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Framerate Limit"), this),
+ &QShortcut::activated, this, [] {
+ Settings::values.disable_fps_limit.SetValue(
+ !Settings::values.disable_fps_limit.GetValue());
+ });
connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Toggle Mouse Panning"), this),
&QShortcut::activated, this, [&] {
Settings::values.mouse_panning = !Settings::values.mouse_panning;
@@ -1054,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();
}
@@ -1212,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();
@@ -1235,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 "
@@ -1321,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
@@ -1331,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) {
@@ -1345,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();
@@ -1356,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
@@ -1387,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) {
@@ -1417,8 +1416,14 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S
title_name = Common::FS::PathToUTF8String(
std::filesystem::path{filename.toStdU16String()}.filename());
}
+ const bool is_64bit = system.Kernel().CurrentProcess()->Is64BitProcess();
+ 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);
- UpdateWindowTitle(title_name, title_version);
+ const auto gpu_vendor = system.GPU().Renderer().GetDeviceVendor();
+ UpdateWindowTitle(title_name, title_version, gpu_vendor);
loading_screen->Prepare(system.GetAppLoader());
loading_screen->show();
@@ -1486,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;
@@ -1529,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,
@@ -1634,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) {
@@ -1739,8 +1722,8 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT
RemoveAddOnContent(program_id, entry_type);
break;
}
- void(Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
- "game_list"));
+ Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
+ "game_list");
game_list->PopulateAsync(UISettings::values.game_dirs);
}
@@ -1805,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:
@@ -1820,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);
@@ -1829,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 {
@@ -1849,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 =
@@ -1872,7 +1890,8 @@ void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& g
}
}
-void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_path) {
+void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_path,
+ DumpRomFSTarget target) {
const auto failed = [this] {
QMessageBox::warning(this, tr("RomFS Extraction Failed!"),
tr("There was an error copying the RomFS files or the user "
@@ -1900,7 +1919,10 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
return;
}
- const auto dump_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::DumpDir);
+ const auto dump_dir =
+ target == DumpRomFSTarget::Normal
+ ? Common::FS::GetYuzuPath(Common::FS::YuzuPath::DumpDir)
+ : Common::FS::GetYuzuPath(Common::FS::YuzuPath::SDMCDir) / "atmosphere" / "contents";
const auto romfs_dir = fmt::format("{:016X}/romfs", *romfs_title_id);
const auto path = Common::FS::PathToUTF8String(dump_dir / romfs_dir);
@@ -1910,7 +1932,8 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
if (*romfs_title_id == program_id) {
const u64 ivfc_offset = loader->ReadRomFSIVFCOffset();
const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), installed};
- romfs = pm.PatchRomFS(file, ivfc_offset, FileSys::ContentRecordType::Program);
+ romfs =
+ pm.PatchRomFS(file, ivfc_offset, FileSys::ContentRecordType::Program, nullptr, false);
} else {
romfs = installed.GetEntry(*romfs_title_id, FileSys::ContentRecordType::Data)->GetRomFS();
}
@@ -2209,8 +2232,8 @@ void GMainWindow::OnMenuInstallToNAND() {
: tr("%n file(s) failed to install\n", "", failed_files.size()));
QMessageBox::information(this, tr("Install Results"), install_results);
- void(Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
- "game_list"));
+ Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
+ "game_list");
game_list->PopulateAsync(UISettings::values.game_dirs);
ui.action_Install_File_NAND->setEnabled(true);
}
@@ -2426,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) {
@@ -2438,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 {
@@ -2603,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,
@@ -2660,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();
@@ -2797,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);
@@ -2817,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();
}
@@ -2842,25 +2867,27 @@ void GMainWindow::MigrateConfigFiles() {
LOG_INFO(Frontend, "Migrating config file from {} to {}", origin, destination);
if (!Common::FS::RenameFile(origin, destination)) {
// Delete the old config file if one already exists in the new location.
- void(Common::FS::RemoveFile(origin));
+ Common::FS::RemoveFile(origin);
}
}
}
-void GMainWindow::UpdateWindowTitle(const std::string& title_name,
- const std::string& title_version) {
+void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_view title_version,
+ std::string_view gpu_vendor) {
const auto branch_name = std::string(Common::g_scm_branch);
const auto description = std::string(Common::g_scm_desc);
const auto build_id = std::string(Common::g_build_id);
const auto yuzu_title = fmt::format("yuzu | {}-{}", branch_name, description);
- const auto override_title = fmt::format(std::string(Common::g_title_bar_format_idle), build_id);
+ const auto override_title =
+ fmt::format(fmt::runtime(std::string(Common::g_title_bar_format_idle)), build_id);
const auto window_title = override_title.empty() ? yuzu_title : override_title;
if (title_name.empty()) {
setWindowTitle(QString::fromStdString(window_title));
} else {
- const auto run_title = fmt::format("{} | {} | {}", window_title, title_name, title_version);
+ const auto run_title =
+ fmt::format("{} | {} | {} | {}", window_title, title_name, title_version, gpu_vendor);
setWindowTitle(QString::fromStdString(run_title));
}
}
@@ -2871,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());
@@ -2898,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() {
@@ -3036,9 +3091,9 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
const auto keys_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::KeysDir);
- void(Common::FS::RemoveFile(keys_dir / "prod.keys_autogenerated"));
- void(Common::FS::RemoveFile(keys_dir / "console.keys_autogenerated"));
- void(Common::FS::RemoveFile(keys_dir / "title.keys_autogenerated"));
+ Common::FS::RemoveFile(keys_dir / "prod.keys_autogenerated");
+ Common::FS::RemoveFile(keys_dir / "console.keys_autogenerated");
+ Common::FS::RemoveFile(keys_dir / "title.keys_autogenerated");
}
Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance();