diff options
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 91 |
1 files changed, 74 insertions, 17 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 59e56633a..4081af391 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -15,6 +15,7 @@ #endif // VFS includes must be before glad as they will conflict with Windows file api, which uses defines. +#include "applets/qt_amiibo_settings.h" #include "applets/qt_controller.h" #include "applets/qt_error.h" #include "applets/qt_profile_select.h" @@ -26,6 +27,7 @@ #include "configuration/configure_tas.h" #include "core/file_sys/vfs.h" #include "core/file_sys/vfs_real.h" +#include "core/frontend/applets/cabinet.h" #include "core/frontend/applets/controller.h" #include "core/frontend/applets/general_frontend.h" #include "core/frontend/applets/mii_edit.h" @@ -342,6 +344,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(); @@ -360,7 +363,11 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan } } LOG_INFO(Frontend, "Host CPU: {}", cpu_string); + if (std::optional<int> processor_core = Common::GetProcessorCount()) { + LOG_INFO(Frontend, "Host CPU Cores: {}", *processor_core); + } #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}); @@ -543,6 +550,11 @@ void GMainWindow::RegisterMetaTypes() { // Register applet types + // Cabinet Applet + qRegisterMetaType<Core::Frontend::CabinetParameters>("Core::Frontend::CabinetParameters"); + qRegisterMetaType<std::shared_ptr<Service::NFP::NfpDevice>>( + "std::shared_ptr<Service::NFP::NfpDevice>"); + // Controller Applet qRegisterMetaType<Core::Frontend::ControllerParameters>("Core::Frontend::ControllerParameters"); @@ -564,6 +576,21 @@ void GMainWindow::RegisterMetaTypes() { qRegisterMetaType<Core::SystemResultStatus>("Core::SystemResultStatus"); } +void GMainWindow::AmiiboSettingsShowDialog(const Core::Frontend::CabinetParameters& parameters, + std::shared_ptr<Service::NFP::NfpDevice> nfp_device) { + QtAmiiboSettingsDialog dialog(this, parameters, input_subsystem.get(), nfp_device); + + dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | + Qt::WindowTitleHint | Qt::WindowSystemMenuHint); + dialog.setWindowModality(Qt::WindowModal); + if (dialog.exec() == QDialog::Rejected) { + emit AmiiboSettingsFinished(false, {}); + return; + } + + emit AmiiboSettingsFinished(true, dialog.GetName()); +} + void GMainWindow::ControllerSelectorReconfigureControllers( const Core::Frontend::ControllerParameters& parameters) { QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get(), *system); @@ -1541,6 +1568,7 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p system->SetFilesystem(vfs); system->SetAppletFrontendSet({ + std::make_unique<QtAmiiboSettings>(*this), // Amiibo Settings std::make_unique<QtControllerSelector>(*this), // Controller Selector std::make_unique<QtErrorDisplay>(*this), // Error Display nullptr, // Mii Editor @@ -1951,6 +1979,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target } default: UNIMPLEMENTED(); + break; } const QString qpath = QString::fromStdString(Common::FS::PathToUTF8String(path)); @@ -2018,38 +2047,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 +2098,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 +2108,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 +2123,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 +2146,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; } @@ -2803,6 +2844,20 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex } void GMainWindow::OnMenuReportCompatibility() { + const auto& caps = Common::GetCPUCaps(); + const bool has_fma = caps.fma || caps.fma4; + const auto processor_count = std::thread::hardware_concurrency(); + const bool has_4threads = processor_count == 0 || processor_count >= 4; + const bool has_8gb_ram = Common::GetMemInfo().TotalPhysicalMemory >= 8_GiB; + const bool has_broken_vulkan = UISettings::values.has_broken_vulkan; + + if (!has_fma || !has_4threads || !has_8gb_ram || has_broken_vulkan) { + QMessageBox::critical(this, tr("Hardware requirements not met"), + tr("Your system does not meet the recommended hardware requirements. " + "Compatibility reporting has been disabled.")); + return; + } + if (!Settings::values.yuzu_token.GetValue().empty() && !Settings::values.yuzu_username.GetValue().empty()) { CompatDB compatdb{system->TelemetrySession(), this}; @@ -3168,6 +3223,7 @@ void GMainWindow::OnToggleGpuAccuracy() { case Settings::GPUAccuracy::Extreme: default: { Settings::values.gpu_accuracy.SetValue(Settings::GPUAccuracy::High); + break; } } @@ -3500,6 +3556,7 @@ void GMainWindow::UpdateGPUAccuracyButton() { default: { gpu_accuracy_button->setText(tr("GPU ERROR")); gpu_accuracy_button->setChecked(true); + break; } } } |