diff options
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 74 |
1 files changed, 44 insertions, 30 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index ccae2b828..d95915016 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -9,7 +9,7 @@ #ifdef __APPLE__ #include <unistd.h> // for chdir #endif -#ifdef __linux__ +#ifdef __unix__ #include <csignal> #include <sys/socket.h> #endif @@ -275,7 +275,7 @@ static void OverrideWindowsFont() { #endif bool GMainWindow::CheckDarkMode() { -#ifdef __linux__ +#ifdef __unix__ const QPalette test_palette(qApp->palette()); const QColor text_color = test_palette.color(QPalette::Active, QPalette::Text); const QColor window_color = test_palette.color(QPalette::Active, QPalette::Window); @@ -283,7 +283,7 @@ bool GMainWindow::CheckDarkMode() { #else // TODO: Windows return false; -#endif // __linux__ +#endif // __unix__ } GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan) @@ -291,7 +291,7 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, config{std::move(config_)}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, provider{std::make_unique<FileSys::ManualContentProvider>()} { -#ifdef __linux__ +#ifdef __unix__ SetupSigInterrupts(); #endif system->Initialize(); @@ -342,6 +342,7 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan 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; + const auto processor_count = std::thread::hardware_concurrency(); LOG_INFO(Frontend, "yuzu Version: {}", yuzu_build_version); LogRuntimes(); @@ -361,6 +362,7 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan } LOG_INFO(Frontend, "Host CPU: {}", cpu_string); #endif + LOG_INFO(Frontend, "Host CPU Threads: {}", processor_count); LOG_INFO(Frontend, "Host OS: {}", PrettyProductName().toStdString()); LOG_INFO(Frontend, "Host RAM: {:.2f} GiB", Common::GetMemInfo().TotalPhysicalMemory / f64{1_GiB}); @@ -509,7 +511,7 @@ GMainWindow::~GMainWindow() { delete render_window; } -#ifdef __linux__ +#ifdef __unix__ ::close(sig_interrupt_fds[0]); ::close(sig_interrupt_fds[1]); #endif @@ -1379,7 +1381,7 @@ void GMainWindow::OnDisplayTitleBars(bool show) { } void GMainWindow::SetupPrepareForSleep() { -#ifdef __linux__ +#ifdef __unix__ auto bus = QDBusConnection::systemBus(); if (bus.isConnected()) { const bool success = bus.connect( @@ -1393,7 +1395,7 @@ void GMainWindow::SetupPrepareForSleep() { } else { LOG_WARNING(Frontend, "QDBusConnection system bus is not connected"); } -#endif // __linux__ +#endif // __unix__ } void GMainWindow::OnPrepareForSleep(bool prepare_sleep) { @@ -1415,7 +1417,7 @@ void GMainWindow::OnPrepareForSleep(bool prepare_sleep) { } } -#ifdef __linux__ +#ifdef __unix__ static std::optional<QDBusObjectPath> HoldWakeLockLinux(u32 window_id = 0) { if (!QDBusConnection::sessionBus().isConnected()) { return {}; @@ -1500,14 +1502,14 @@ void GMainWindow::OnSigInterruptNotifierActivated() { emit SigInterrupt(); } -#endif // __linux__ +#endif // __unix__ void GMainWindow::PreventOSSleep() { #ifdef _WIN32 SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); #elif defined(HAVE_SDL2) SDL_DisableScreenSaver(); -#ifdef __linux__ +#ifdef __unix__ auto reply = HoldWakeLockLinux(winId()); if (reply) { wake_lock = std::move(reply.value()); @@ -1521,7 +1523,7 @@ void GMainWindow::AllowOSSleep() { SetThreadExecutionState(ES_CONTINUOUS); #elif defined(HAVE_SDL2) SDL_EnableScreenSaver(); -#ifdef __linux__ +#ifdef __unix__ if (!wake_lock.path().isEmpty()) { ReleaseWakeLockLinux(wake_lock); } @@ -2018,38 +2020,50 @@ static bool RomFSRawCopy(QProgressDialog& dialog, const FileSys::VirtualDir& src return true; } +QString GMainWindow::GetGameListErrorRemoving(InstalledEntryType type) const { + switch (type) { + case InstalledEntryType::Game: + return tr("Error Removing Contents"); + case InstalledEntryType::Update: + return tr("Error Removing Update"); + case InstalledEntryType::AddOnContent: + return tr("Error Removing DLC"); + default: + return QStringLiteral("Error Removing <Invalid Type>"); + } +} void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryType type) { - const QString entry_type = [type] { + const QString entry_question = [type] { switch (type) { case InstalledEntryType::Game: - return tr("Contents"); + return tr("Remove Installed Game Contents?"); case InstalledEntryType::Update: - return tr("Update"); + return tr("Remove Installed Game Update?"); case InstalledEntryType::AddOnContent: - return tr("DLC"); + return tr("Remove Installed Game DLC?"); default: - return QString{}; + return QStringLiteral("Remove Installed Game <Invalid Type>?"); } }(); - if (QMessageBox::question( - this, tr("Remove Entry"), tr("Remove Installed Game %1?").arg(entry_type), - QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) { + if (QMessageBox::question(this, tr("Remove Entry"), entry_question, + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No) != QMessageBox::Yes) { return; } switch (type) { case InstalledEntryType::Game: - RemoveBaseContent(program_id, entry_type); + RemoveBaseContent(program_id, type); [[fallthrough]]; case InstalledEntryType::Update: - RemoveUpdateContent(program_id, entry_type); + RemoveUpdateContent(program_id, type); if (type != InstalledEntryType::Game) { break; } [[fallthrough]]; case InstalledEntryType::AddOnContent: - RemoveAddOnContent(program_id, entry_type); + RemoveAddOnContent(program_id, type); break; } Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / @@ -2057,7 +2071,7 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT game_list->PopulateAsync(UISettings::values.game_dirs); } -void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { +void GMainWindow::RemoveBaseContent(u64 program_id, InstalledEntryType type) { const auto& fs_controller = system->GetFileSystemController(); const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); @@ -2067,12 +2081,12 @@ void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { tr("Successfully removed the installed base game.")); } else { QMessageBox::warning( - this, tr("Error Removing %1").arg(entry_type), + this, GetGameListErrorRemoving(type), tr("The base game is not installed in the NAND and cannot be removed.")); } } -void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) { +void GMainWindow::RemoveUpdateContent(u64 program_id, InstalledEntryType type) { const auto update_id = program_id | 0x800; const auto& fs_controller = system->GetFileSystemController(); const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || @@ -2082,12 +2096,12 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) QMessageBox::information(this, tr("Successfully Removed"), tr("Successfully removed the installed update.")); } else { - QMessageBox::warning(this, tr("Error Removing %1").arg(entry_type), + QMessageBox::warning(this, GetGameListErrorRemoving(type), tr("There is no update installed for this title.")); } } -void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) { +void GMainWindow::RemoveAddOnContent(u64 program_id, InstalledEntryType type) { u32 count{}; const auto& fs_controller = system->GetFileSystemController(); const auto dlc_entries = system->GetContentProvider().ListEntriesFilter( @@ -2105,7 +2119,7 @@ void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) } if (count == 0) { - QMessageBox::warning(this, tr("Error Removing %1").arg(entry_type), + QMessageBox::warning(this, GetGameListErrorRemoving(type), tr("There are no DLC installed for this title.")); return; } @@ -4084,7 +4098,7 @@ void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { } void GMainWindow::changeEvent(QEvent* event) { -#ifdef __linux__ +#ifdef __unix__ // PaletteChange event appears to only reach so far into the GUI, explicitly asking to // UpdateUITheme is a decent work around if (event->type() == QEvent::PaletteChange) { @@ -4099,7 +4113,7 @@ void GMainWindow::changeEvent(QEvent* event) { } last_window_color = window_color; } -#endif // __linux__ +#endif // __unix__ QWidget::changeEvent(event); } |