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.cpp68
1 files changed, 41 insertions, 27 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 5f6cdc0c6..9275cba53 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -92,7 +92,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "core/file_sys/romfs.h"
#include "core/file_sys/savedata_factory.h"
#include "core/file_sys/submission_package.h"
-#include "core/hle/kernel/process.h"
+#include "core/hle/kernel/k_process.h"
#include "core/hle/service/am/am.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/nfp/nfp.h"
@@ -241,14 +241,15 @@ GMainWindow::GMainWindow()
ConnectMenuEvents();
ConnectWidgetEvents();
+ 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 fmt = std::string(Common::g_title_bar_format_idle);
- const auto yuzu_build_version =
- fmt::format(fmt.empty() ? "yuzu Development Build" : fmt, std::string{}, std::string{},
- std::string{}, std::string{}, std::string{}, build_id);
- LOG_INFO(Frontend, "yuzu Version: {} | {}-{}", yuzu_build_version, Common::g_scm_branch,
- Common::g_scm_desc);
+ 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 yuzu_build_version = override_build.empty() ? yuzu_build : override_build;
+
+ LOG_INFO(Frontend, "yuzu Version: {}", yuzu_build_version);
#ifdef ARCHITECTURE_x86_64
const auto& caps = Common::GetCPUCaps();
std::string cpu_string = caps.cpu_string;
@@ -349,7 +350,7 @@ GMainWindow::GMainWindow()
continue;
}
- Settings::values.current_user = selected_user;
+ Settings::values.current_user = static_cast<s32>(selected_user);
continue;
}
@@ -574,8 +575,8 @@ void GMainWindow::SoftwareKeyboardExit() {
software_keyboard = nullptr;
}
-void GMainWindow::WebBrowserOpenWebPage(std::string_view main_url, std::string_view additional_args,
- bool is_local) {
+void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
+ const std::string& additional_args, bool is_local) {
#ifdef YUZU_USE_QT_WEB_ENGINE
if (disable_web_applet) {
@@ -596,13 +597,15 @@ void GMainWindow::WebBrowserOpenWebPage(std::string_view main_url, std::string_v
loading_progress.setRange(0, 3);
loading_progress.setValue(0);
- if (is_local && !Common::FS::Exists(std::string(main_url))) {
+ if (is_local && !Common::FS::Exists(main_url)) {
loading_progress.show();
auto future = QtConcurrent::run([this] { emit WebBrowserExtractOfflineRomFS(); });
while (!future.isFinished()) {
QCoreApplication::processEvents();
+
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}
@@ -1375,7 +1378,7 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index) {
game_list->hide();
game_list_placeholder->hide();
}
- status_bar_update_timer.start(2000);
+ status_bar_update_timer.start(500);
async_status_button->setDisabled(true);
multicore_status_button->setDisabled(true);
renderer_status_button->setDisabled(true);
@@ -2099,6 +2102,7 @@ void GMainWindow::OnMenuInstallToNAND() {
QStringList new_files{}; // Newly installed files that do not yet exist in the NAND
QStringList overwritten_files{}; // Files that overwrote those existing in the NAND
QStringList failed_files{}; // Files that failed to install due to errors
+ bool detected_base_install{}; // Whether a base game was attempted to be installed
ui.action_Install_File_NAND->setEnabled(false);
@@ -2124,6 +2128,7 @@ void GMainWindow::OnMenuInstallToNAND() {
while (!future.isFinished()) {
QCoreApplication::processEvents();
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
result = future.result();
@@ -2144,6 +2149,10 @@ void GMainWindow::OnMenuInstallToNAND() {
case InstallResult::Failure:
failed_files.append(QFileInfo(file).fileName());
break;
+ case InstallResult::BaseInstallAttempted:
+ failed_files.append(QFileInfo(file).fileName());
+ detected_base_install = true;
+ break;
}
--remaining;
@@ -2151,6 +2160,13 @@ void GMainWindow::OnMenuInstallToNAND() {
install_progress->close();
+ if (detected_base_install) {
+ QMessageBox::warning(
+ this, tr("Install Results"),
+ tr("To avoid possible conflicts, we discourage users from installing base games to the "
+ "NAND.\nPlease, only use this feature to install updates and DLC."));
+ }
+
const QString install_results =
(new_files.isEmpty() ? QString{}
: tr("%n file(s) were newly installed\n", "", new_files.size())) +
@@ -2212,11 +2228,14 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
const auto res =
Core::System::GetInstance().GetFileSystemController().GetUserNANDContents()->InstallEntry(
*nsp, true, qt_raw_copy);
- if (res == FileSys::InstallResult::Success) {
+ switch (res) {
+ case FileSys::InstallResult::Success:
return InstallResult::Success;
- } else if (res == FileSys::InstallResult::OverwriteExisting) {
+ case FileSys::InstallResult::OverwriteExisting:
return InstallResult::Overwrite;
- } else {
+ case FileSys::InstallResult::ErrorBaseInstall:
+ return InstallResult::BaseInstallAttempted;
+ default:
return InstallResult::Failure;
}
}
@@ -2749,24 +2768,19 @@ void GMainWindow::MigrateConfigFiles() {
void GMainWindow::UpdateWindowTitle(const std::string& title_name,
const std::string& title_version) {
- const auto full_name = std::string(Common::g_build_fullname);
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 date =
- QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd")).toStdString();
+ 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 window_title = override_title.empty() ? yuzu_title : override_title;
if (title_name.empty()) {
- const auto fmt = std::string(Common::g_title_bar_format_idle);
- setWindowTitle(QString::fromStdString(fmt::format(fmt.empty() ? "yuzu {0}| {1}-{2}" : fmt,
- full_name, branch_name, description,
- std::string{}, date, build_id)));
+ setWindowTitle(QString::fromStdString(window_title));
} else {
- const auto fmt = std::string(Common::g_title_bar_format_running);
- setWindowTitle(QString::fromStdString(
- fmt::format(fmt.empty() ? "yuzu {0}| {3} | {6} | {1}-{2}" : fmt, full_name, branch_name,
- description, title_name, date, build_id, title_version)));
+ const auto run_title = fmt::format("{} | {} | {}", window_title, title_name, title_version);
+ setWindowTitle(QString::fromStdString(run_title));
}
}
@@ -2795,7 +2809,7 @@ void GMainWindow::UpdateStatusBar() {
} 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.game_fps, 0, 'f', 0));
+ 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());