summaryrefslogtreecommitdiffstats
path: root/src/yuzu/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r--src/yuzu/main.cpp76
1 files changed, 49 insertions, 27 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index c21153560..c0afb2e5f 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -126,6 +126,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "yuzu/compatibility_list.h"
#include "yuzu/configuration/config.h"
#include "yuzu/configuration/configure_dialog.h"
+#include "yuzu/configuration/configure_input_per_game.h"
#include "yuzu/debugger/console.h"
#include "yuzu/debugger/controller.h"
#include "yuzu/debugger/profiler.h"
@@ -1012,29 +1013,11 @@ void GMainWindow::InitializeWidgets() {
renderer_status_button->setObjectName(QStringLiteral("RendererStatusBarButton"));
renderer_status_button->setCheckable(true);
renderer_status_button->setFocusPolicy(Qt::NoFocus);
- connect(renderer_status_button, &QPushButton::toggled, [this](bool checked) {
- renderer_status_button->setText(checked ? tr("VULKAN") : tr("OPENGL"));
- });
- renderer_status_button->toggle();
-
+ connect(renderer_status_button, &QPushButton::clicked, this, &GMainWindow::OnToggleGraphicsAPI);
+ UpdateAPIText();
+ renderer_status_button->setCheckable(true);
renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
Settings::RendererBackend::Vulkan);
- connect(renderer_status_button, &QPushButton::clicked, [this] {
- if (emulation_running) {
- return;
- }
- if (renderer_status_button->isChecked()) {
- Settings::values.renderer_backend.SetValue(Settings::RendererBackend::Vulkan);
- } else {
- Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL);
- if (Settings::values.scaling_filter.GetValue() == Settings::ScalingFilter::Fsr) {
- Settings::values.scaling_filter.SetValue(Settings::ScalingFilter::NearestNeighbor);
- UpdateFilterText();
- }
- }
-
- system->ApplySettings();
- });
statusBar()->insertPermanentWidget(0, renderer_status_button);
statusBar()->setVisible(true);
@@ -1676,6 +1659,11 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
LOG_INFO(Frontend, "yuzu starting...");
StoreRecentFile(filename); // Put the filename on top of the list
+ // Save configurations
+ UpdateUISettings();
+ game_list->SaveInterfaceLayout();
+ config->Save();
+
u64 title_id{0};
last_filename_booted = filename;
@@ -1692,14 +1680,10 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
? Common::FS::PathToUTF8String(file_path.filename())
: fmt::format("{:016X}", title_id);
Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig);
+ system->HIDCore().ReloadInputDevices();
system->ApplySettings();
}
- // Save configurations
- UpdateUISettings();
- game_list->SaveInterfaceLayout();
- config->Save();
-
Settings::LogSettings();
if (UISettings::values.select_user_on_boot) {
@@ -2820,6 +2804,7 @@ void GMainWindow::OnStopGame() {
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
+ system->HIDCore().ReloadInputDevices();
UpdateStatusButtons();
}
@@ -2850,6 +2835,7 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex
}
void GMainWindow::OnMenuReportCompatibility() {
+#if defined(ARCHITECTURE_x86_64) && !defined(__APPLE__)
const auto& caps = Common::GetCPUCaps();
const bool has_fma = caps.fma || caps.fma4;
const auto processor_count = std::thread::hardware_concurrency();
@@ -2876,6 +2862,11 @@ void GMainWindow::OnMenuReportCompatibility() {
"> "
"Web."));
}
+#else
+ QMessageBox::critical(this, tr("Hardware requirements not met"),
+ tr("Your system does not meet the recommended hardware requirements. "
+ "Compatibility reporting has been disabled."));
+#endif
}
void GMainWindow::OpenURL(const QUrl& url) {
@@ -3253,6 +3244,18 @@ void GMainWindow::OnToggleAdaptingFilter() {
UpdateFilterText();
}
+void GMainWindow::OnToggleGraphicsAPI() {
+ auto api = Settings::values.renderer_backend.GetValue();
+ if (api == Settings::RendererBackend::OpenGL) {
+ api = Settings::RendererBackend::Vulkan;
+ } else {
+ api = Settings::RendererBackend::OpenGL;
+ }
+ Settings::values.renderer_backend.SetValue(api);
+ renderer_status_button->setChecked(api == Settings::RendererBackend::Vulkan);
+ UpdateAPIText();
+}
+
void GMainWindow::OnConfigurePerGame() {
const u64 title_id = system->GetCurrentProcessProgramID();
OpenPerGameConfiguration(title_id, current_game_path.toStdString());
@@ -3281,6 +3284,7 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file
// Do not cause the global config to write local settings into the config file
const bool is_powered_on = system->IsPoweredOn();
Settings::RestoreGlobalState(is_powered_on);
+ system->HIDCore().ReloadInputDevices();
UISettings::values.configuration_applied = false;
@@ -3573,6 +3577,21 @@ void GMainWindow::UpdateDockedButton() {
dock_status_button->setText(is_docked ? tr("DOCKED") : tr("HANDHELD"));
}
+void GMainWindow::UpdateAPIText() {
+ const auto api = Settings::values.renderer_backend.GetValue();
+ switch (api) {
+ case Settings::RendererBackend::OpenGL:
+ renderer_status_button->setText(tr("OPENGL"));
+ break;
+ case Settings::RendererBackend::Vulkan:
+ renderer_status_button->setText(tr("VULKAN"));
+ break;
+ case Settings::RendererBackend::Null:
+ renderer_status_button->setText(tr("NULL"));
+ break;
+ }
+}
+
void GMainWindow::UpdateFilterText() {
const auto filter = Settings::values.scaling_filter.GetValue();
switch (filter) {
@@ -3618,6 +3637,7 @@ void GMainWindow::UpdateAAText() {
void GMainWindow::UpdateStatusButtons() {
renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
Settings::RendererBackend::Vulkan);
+ UpdateAPIText();
UpdateGPUAccuracyButton();
UpdateDockedButton();
UpdateFilterText();
@@ -3748,6 +3768,7 @@ void GMainWindow::OnCoreError(Core::SystemResultStatus result, std::string detai
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
+ system->HIDCore().ReloadInputDevices();
UpdateStatusButtons();
}
} else {
@@ -3899,18 +3920,19 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
// Unload controllers early
controller_dialog->UnloadController();
game_list->UnloadController();
- system->HIDCore().UnloadInputDevices();
// Shutdown session if the emu thread is active...
if (emu_thread != nullptr) {
ShutdownGame();
Settings::RestoreGlobalState(system->IsPoweredOn());
+ system->HIDCore().ReloadInputDevices();
UpdateStatusButtons();
}
render_window->close();
multiplayer_state->Close();
+ system->HIDCore().UnloadInputDevices();
system->GetRoomNetwork().Shutdown();
QWidget::closeEvent(event);