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.cpp52
1 files changed, 29 insertions, 23 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 9bd0db10a..b7bb43348 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -77,6 +77,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "common/fs/fs.h"
#include "common/fs/fs_paths.h"
#include "common/fs/path_util.h"
+#include "common/literals.h"
#include "common/logging/backend.h"
#include "common/logging/filter.h"
#include "common/logging/log.h"
@@ -134,6 +135,8 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "yuzu/main.h"
#include "yuzu/uisettings.h"
+using namespace Common::Literals;
+
#ifdef USE_DISCORD_PRESENCE
#include "yuzu/discord_impl.h"
#endif
@@ -259,10 +262,9 @@ GMainWindow::GMainWindow()
LOG_INFO(Frontend, "Host CPU: {}", cpu_string);
#endif
LOG_INFO(Frontend, "Host OS: {}", QSysInfo::prettyProductName().toStdString());
- LOG_INFO(Frontend, "Host RAM: {:.2f} GB",
- Common::GetMemInfo().TotalPhysicalMemory / 1024.0f / 1024 / 1024);
- LOG_INFO(Frontend, "Host Swap: {:.2f} GB",
- Common::GetMemInfo().TotalSwapMemory / 1024.0f / 1024 / 1024);
+ LOG_INFO(Frontend, "Host RAM: {:.2f} GiB",
+ Common::GetMemInfo().TotalPhysicalMemory / f64{1_GiB});
+ LOG_INFO(Frontend, "Host Swap: {:.2f} GiB", Common::GetMemInfo().TotalSwapMemory / f64{1_GiB});
UpdateWindowTitle();
show();
@@ -449,7 +451,7 @@ void GMainWindow::ControllerSelectorReconfigureControllers(
}
void GMainWindow::ProfileSelectorSelectProfile() {
- QtProfileSelectionDialog dialog(this);
+ QtProfileSelectionDialog dialog(system->HIDCore(), this);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint |
Qt::WindowTitleHint | Qt::WindowSystemMenuHint |
Qt::WindowCloseButtonHint);
@@ -1082,14 +1084,15 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
state != Qt::ApplicationActive) {
LOG_DEBUG(Frontend, "ApplicationState unusual flag: {} ", state);
}
- if (ui->action_Pause->isEnabled() &&
- (state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
- auto_paused = true;
- OnPauseGame();
- } else if (emulation_running && !emu_thread->IsRunning() && auto_paused &&
- state == Qt::ApplicationActive) {
- auto_paused = false;
- OnStartGame();
+ if (emulation_running) {
+ if (emu_thread->IsRunning() &&
+ (state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
+ auto_paused = true;
+ OnPauseGame();
+ } else if (!emu_thread->IsRunning() && auto_paused && state == Qt::ApplicationActive) {
+ auto_paused = false;
+ OnStartGame();
+ }
}
}
@@ -1301,16 +1304,13 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
case Core::SystemResultStatus::ErrorVideoCore:
QMessageBox::critical(
this, tr("An error occurred initializing the video core."),
- tr("yuzu has encountered an error while running the video core, please see the "
- "log for more details."
+ tr("yuzu has encountered an error while running the video core. "
+ "This is usually caused by outdated GPU drivers, including integrated ones. "
+ "Please see the log for more details. "
"For more information on accessing the log, please see the following page: "
- "<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>How "
- "to "
- "Upload the Log File</a>."
- "Ensure that you have the latest graphics drivers for your GPU."));
-
+ "<a href='https://yuzu-emu.org/help/reference/log-files/'>"
+ "How to Upload the Log File</a>. "));
break;
-
default:
if (result > Core::SystemResultStatus::ErrorLoader) {
const u16 loader_id = static_cast<u16>(Core::SystemResultStatus::ErrorLoader);
@@ -1346,7 +1346,7 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
}
void GMainWindow::SelectAndSetCurrentUser() {
- QtProfileSelectionDialog dialog(this);
+ QtProfileSelectionDialog dialog(system->HIDCore(), this);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
dialog.setWindowModality(Qt::WindowModal);
@@ -1516,6 +1516,9 @@ void GMainWindow::ShutdownGame() {
input_subsystem->GetTas()->Stop();
OnTasStateChanged();
+ // Enable all controllers
+ system->HIDCore().SetSupportedStyleTag({Core::HID::NpadStyleSet::All});
+
render_window->removeEventFilter(render_window);
render_window->setAttribute(Qt::WA_Hover, false);
@@ -1608,7 +1611,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
if (has_user_save) {
// User save data
const auto select_profile = [this] {
- QtProfileSelectionDialog dialog(this);
+ QtProfileSelectionDialog dialog(system->HIDCore(), this);
dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
dialog.setWindowModality(Qt::WindowModal);
@@ -3376,7 +3379,10 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
UpdateUISettings();
game_list->SaveInterfaceLayout();
hotkey_registry.SaveHotkeys();
+
+ // Unload controllers early
controller_dialog->UnloadController();
+ game_list->UnloadController();
system->HIDCore().UnloadInputDevices();
// Shutdown session if the emu thread is active...