aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpineappleEA <pineaea@gmail.com>2021-10-20 01:37:33 +0200
committerpineappleEA <pineaea@gmail.com>2021-10-20 01:37:33 +0200
commitfe662edf4a89ab76b1b362ffb9fcd5a5910db477 (patch)
tree636255059533480e34a509d6b36bd1dc773c0ca8
parent6a02e7140f93b51fb2fe866f1450928aa64da4cb (diff)
early-access version 2149EA-2149
-rwxr-xr-xREADME.md2
-rwxr-xr-xsrc/common/settings.h1
-rwxr-xr-xsrc/yuzu/CMakeLists.txt10
-rwxr-xr-xsrc/yuzu/configuration/config.cpp2
-rwxr-xr-xsrc/yuzu/configuration/configure_general.cpp3
-rwxr-xr-xsrc/yuzu/configuration/configure_general.ui7
-rwxr-xr-xsrc/yuzu/configuration/configure_tas.ui4
-rwxr-xr-xsrc/yuzu/main.cpp154
-rwxr-xr-xsrc/yuzu/main.h5
-rwxr-xr-xsrc/yuzu_cmd/config.cpp1
-rwxr-xr-xsrc/yuzu_cmd/default_ini.h4
-rwxr-xr-xsrc/yuzu_cmd/emu_window/emu_window_sdl2.cpp3
12 files changed, 92 insertions, 104 deletions
diff --git a/README.md b/README.md
index fd1b3119f..25e2274a2 100755
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
1yuzu emulator early access 1yuzu emulator early access
2============= 2=============
3 3
4This is the source code for early-access 2148. 4This is the source code for early-access 2149.
5 5
6## Legal Notice 6## Legal Notice
7 7
diff --git a/src/common/settings.h b/src/common/settings.h
index 9ff4cf85d..1e5e99aec 100755
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -565,6 +565,7 @@ struct Values {
565 // Miscellaneous 565 // Miscellaneous
566 BasicSetting<std::string> log_filter{"*:Info", "log_filter"}; 566 BasicSetting<std::string> log_filter{"*:Info", "log_filter"};
567 BasicSetting<bool> use_dev_keys{false, "use_dev_keys"}; 567 BasicSetting<bool> use_dev_keys{false, "use_dev_keys"};
568 BasicSetting<bool> disable_screen_saver{true, "disable_screen_saver"};
568 569
569 // Network 570 // Network
570 BasicSetting<std::string> network_interface{std::string(), "network_interface"}; 571 BasicSetting<std::string> network_interface{std::string(), "network_interface"};
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 4f42aa9d1..d62fd566f 100755
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -285,11 +285,6 @@ if (USE_DISCORD_PRESENCE)
285 target_compile_definitions(yuzu PRIVATE -DUSE_DISCORD_PRESENCE) 285 target_compile_definitions(yuzu PRIVATE -DUSE_DISCORD_PRESENCE)
286endif() 286endif()
287 287
288if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
289 find_package(Qt5 ${QT_VERSION} REQUIRED COMPONENTS DBus ${QT_PREFIX_HINT} ${YUZU_QT_NO_CMAKE_SYSTEM_PATH} REQUIRED)
290 target_link_libraries(yuzu PRIVATE Qt5::DBus)
291endif()
292
293if (YUZU_USE_QT_WEB_ENGINE) 288if (YUZU_USE_QT_WEB_ENGINE)
294 target_link_libraries(yuzu PRIVATE Qt5::WebEngineCore Qt5::WebEngineWidgets) 289 target_link_libraries(yuzu PRIVATE Qt5::WebEngineCore Qt5::WebEngineWidgets)
295 target_compile_definitions(yuzu PRIVATE -DYUZU_USE_QT_WEB_ENGINE) 290 target_compile_definitions(yuzu PRIVATE -DYUZU_USE_QT_WEB_ENGINE)
@@ -304,6 +299,11 @@ if (YUZU_USE_BUNDLED_QT)
304 copy_yuzu_Qt5_deps(yuzu) 299 copy_yuzu_Qt5_deps(yuzu)
305endif() 300endif()
306 301
302if (ENABLE_SDL2)
303 target_link_libraries(yuzu PRIVATE SDL2)
304 target_compile_definitions(yuzu PRIVATE HAVE_SDL2)
305endif()
306
307if (MSVC) 307if (MSVC)
308 include(CopyYuzuSDLDeps) 308 include(CopyYuzuSDLDeps)
309 include(CopyYuzuFFmpegDeps) 309 include(CopyYuzuFFmpegDeps)
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index faea5dda1..c152e4ea1 100755
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -738,6 +738,7 @@ void Config::ReadMiscellaneousValues() {
738 738
739 ReadBasicSetting(Settings::values.log_filter); 739 ReadBasicSetting(Settings::values.log_filter);
740 ReadBasicSetting(Settings::values.use_dev_keys); 740 ReadBasicSetting(Settings::values.use_dev_keys);
741 ReadBasicSetting(Settings::values.disable_screen_saver);
741 742
742 qt_config->endGroup(); 743 qt_config->endGroup();
743} 744}
@@ -1296,6 +1297,7 @@ void Config::SaveMiscellaneousValues() {
1296 1297
1297 WriteBasicSetting(Settings::values.log_filter); 1298 WriteBasicSetting(Settings::values.log_filter);
1298 WriteBasicSetting(Settings::values.use_dev_keys); 1299 WriteBasicSetting(Settings::values.use_dev_keys);
1300 WriteBasicSetting(Settings::values.disable_screen_saver);
1299 1301
1300 qt_config->endGroup(); 1302 qt_config->endGroup();
1301} 1303}
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp
index 7af3ea97e..544f78ab0 100755
--- a/src/yuzu/configuration/configure_general.cpp
+++ b/src/yuzu/configuration/configure_general.cpp
@@ -44,6 +44,7 @@ void ConfigureGeneral::SetConfiguration() {
44 ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot.GetValue()); 44 ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot.GetValue());
45 ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background.GetValue()); 45 ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background.GetValue());
46 ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue()); 46 ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue());
47 ui->toggle_screen_saver->setChecked(Settings::values.disable_screen_saver.GetValue());
47 48
48 ui->toggle_speed_limit->setChecked(Settings::values.use_speed_limit.GetValue()); 49 ui->toggle_speed_limit->setChecked(Settings::values.use_speed_limit.GetValue());
49 ui->speed_limit->setValue(Settings::values.speed_limit.GetValue()); 50 ui->speed_limit->setValue(Settings::values.speed_limit.GetValue());
@@ -88,6 +89,7 @@ void ConfigureGeneral::ApplyConfiguration() {
88 UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); 89 UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked();
89 UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked(); 90 UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked();
90 UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked(); 91 UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked();
92 Settings::values.disable_screen_saver = ui->toggle_screen_saver->isChecked();
91 93
92 Settings::values.fps_cap.SetValue(ui->fps_cap->value()); 94 Settings::values.fps_cap.SetValue(ui->fps_cap->value());
93 95
@@ -136,6 +138,7 @@ void ConfigureGeneral::SetupPerGameUI() {
136 ui->toggle_user_on_boot->setVisible(false); 138 ui->toggle_user_on_boot->setVisible(false);
137 ui->toggle_background_pause->setVisible(false); 139 ui->toggle_background_pause->setVisible(false);
138 ui->toggle_hide_mouse->setVisible(false); 140 ui->toggle_hide_mouse->setVisible(false);
141 ui->toggle_screen_saver->setVisible(false);
139 142
140 ui->button_reset_defaults->setVisible(false); 143 ui->button_reset_defaults->setVisible(false);
141 144
diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui
index f9f0e3ebf..3c54d57d8 100755
--- a/src/yuzu/configuration/configure_general.ui
+++ b/src/yuzu/configuration/configure_general.ui
@@ -119,6 +119,13 @@
119 </property> 119 </property>
120 </widget> 120 </widget>
121 </item> 121 </item>
122 <item>
123 <widget class="QCheckBox" name="toggle_screen_saver">
124 <property name="text">
125 <string>Disable screen saver while in game</string>
126 </property>
127 </widget>
128 </item>
122 </layout> 129 </layout>
123 </item> 130 </item>
124 </layout> 131 </layout>
diff --git a/src/yuzu/configuration/configure_tas.ui b/src/yuzu/configuration/configure_tas.ui
index 6caa19031..7d44895c4 100755
--- a/src/yuzu/configuration/configure_tas.ui
+++ b/src/yuzu/configuration/configure_tas.ui
@@ -14,14 +14,14 @@
14 <item row="0" column="0" colspan="4"> 14 <item row="0" column="0" colspan="4">
15 <widget class="QLabel" name="label_1"> 15 <widget class="QLabel" name="label_1">
16 <property name="text"> 16 <property name="text">
17 <string>Reads controller input from scripts in the same format as TAS-nx scripts.&lt;br/&gt;For a more detailed explanation please consult the FAQ on the yuzu website.</string> 17 <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Reads controller input from scripts in the same format as TAS-nx scripts.&lt;br/&gt;For a more detailed explanation, please consult the &lt;a href=&quot;https://yuzu-emu.org/help/feature/tas/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#039be5;&quot;&gt;help page&lt;/span&gt;&lt;/a&gt; on the yuzu website.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
18 </property> 18 </property>
19 </widget> 19 </widget>
20 </item> 20 </item>
21 <item row="1" column="0" colspan="4"> 21 <item row="1" column="0" colspan="4">
22 <widget class="QLabel" name="label_2"> 22 <widget class="QLabel" name="label_2">
23 <property name="text"> 23 <property name="text">
24 <string>To check which hotkeys control the playback/recording, please refer to the Hotkey settings (General -&gt; Hotkeys).</string> 24 <string>To check which hotkeys control the playback/recording, please refer to the Hotkey settings (Configure -&gt; General -&gt; Hotkeys).</string>
25 </property> 25 </property>
26 <property name="wordWrap"> 26 <property name="wordWrap">
27 <bool>true</bool> 27 <bool>true</bool>
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index dfc014d34..4ef0317bc 100755
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -48,12 +48,6 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
48 48
49#define QT_NO_OPENGL 49#define QT_NO_OPENGL
50#include <QClipboard> 50#include <QClipboard>
51#ifdef __linux__
52#include <QDBusConnection>
53#include <QDBusError>
54#include <QDBusInterface>
55#include <QDBusReply>
56#endif
57#include <QDesktopServices> 51#include <QDesktopServices>
58#include <QDesktopWidget> 52#include <QDesktopWidget>
59#include <QDialogButtonBox> 53#include <QDialogButtonBox>
@@ -72,6 +66,10 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
72#include <QUrl> 66#include <QUrl>
73#include <QtConcurrent/QtConcurrent> 67#include <QtConcurrent/QtConcurrent>
74 68
69#ifdef HAVE_SDL2
70#include <SDL.h> // For SDL ScreenSaver functions
71#endif
72
75#include <fmt/format.h> 73#include <fmt/format.h>
76#include "common/detached_tasks.h" 74#include "common/detached_tasks.h"
77#include "common/fs/fs.h" 75#include "common/fs/fs.h"
@@ -1094,20 +1092,23 @@ void GMainWindow::RestoreUIState() {
1094} 1092}
1095 1093
1096void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) { 1094void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
1097 if (!UISettings::values.pause_when_in_background) {
1098 return;
1099 }
1100 if (state != Qt::ApplicationHidden && state != Qt::ApplicationInactive && 1095 if (state != Qt::ApplicationHidden && state != Qt::ApplicationInactive &&
1101 state != Qt::ApplicationActive) { 1096 state != Qt::ApplicationActive) {
1102 LOG_DEBUG(Frontend, "ApplicationState unusual flag: {} ", state); 1097 LOG_DEBUG(Frontend, "ApplicationState unusual flag: {} ", state);
1103 } 1098 }
1104 if (ui->action_Pause->isEnabled() && 1099 if (state & (Qt::ApplicationHidden | Qt::ApplicationInactive)) {
1105 (state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) { 1100 if (UISettings::values.pause_when_in_background && ui->action_Pause->isEnabled()) {
1106 auto_paused = true; 1101 auto_paused = true;
1107 OnPauseGame(); 1102 OnPauseGame();
1108 } else if (ui->action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) { 1103 }
1109 auto_paused = false; 1104 AllowOSSleep();
1110 OnStartGame(); 1105 } else if (state == Qt::ApplicationActive) {
1106 if (UISettings::values.pause_when_in_background && ui->action_Start->isEnabled() &&
1107 auto_paused) {
1108 auto_paused = false;
1109 OnStartGame();
1110 }
1111 PreventOSSleep();
1111 } 1112 }
1112} 1113}
1113 1114
@@ -1227,74 +1228,20 @@ void GMainWindow::OnDisplayTitleBars(bool show) {
1227} 1228}
1228 1229
1229void GMainWindow::PreventOSSleep() { 1230void GMainWindow::PreventOSSleep() {
1231 if (Settings::values.disable_screen_saver) {
1230#ifdef _WIN32 1232#ifdef _WIN32
1231 SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); 1233 SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
1232#elif defined(__linux__) 1234#elif defined(HAVE_SDL2)
1233 QDBusConnection bus = QDBusConnection::sessionBus(); 1235 SDL_DisableScreenSaver();
1234 if (bus.isConnected()) {
1235 // Specs: https://specifications.freedesktop.org/idle-inhibit-spec/0.1/re01.html
1236 const QString service = QStringLiteral("org.freedesktop.ScreenSaver");
1237 const QString path = QStringLiteral("/org/freedesktop/ScreenSaver");
1238
1239 QDBusInterface screen_saver_interface(service, path, service, bus, this);
1240 if (screen_saver_interface.isValid()) {
1241 const QString method = QStringLiteral("Inhibit");
1242 const QString application_name = QStringLiteral("org.yuzu-emu.Yuzu");
1243 const QString reason_for_inhibit = QStringLiteral("Playing a game");
1244
1245 QDBusReply<uint32_t> reply =
1246 screen_saver_interface.call(method, application_name, reason_for_inhibit);
1247
1248 if (reply.isValid()) {
1249 screensaver_dbus_cookie = reply.value();
1250 screensaver_inhibited = true;
1251
1252 LOG_INFO(Frontend, "Screen saver disabled successfully (cookie: {})",
1253 screensaver_dbus_cookie);
1254 } else {
1255 QDBusError error = reply.error();
1256 LOG_ERROR(Frontend, "Could not disable screen saver: {} {}",
1257 error.message().toStdString(), error.name().toStdString());
1258 }
1259 }
1260 }
1261#endif 1236#endif
1237 }
1262} 1238}
1263 1239
1264void GMainWindow::AllowOSSleep() { 1240void GMainWindow::AllowOSSleep() {
1265#ifdef _WIN32 1241#ifdef _WIN32
1266 SetThreadExecutionState(ES_CONTINUOUS); 1242 SetThreadExecutionState(ES_CONTINUOUS);
1267#elif defined(__linux__) 1243#elif defined(HAVE_SDL2)
1268 if (!screensaver_inhibited) { 1244 SDL_EnableScreenSaver();
1269 LOG_WARNING(Frontend, "Screen saver already enabled.");
1270 return;
1271 }
1272
1273 QDBusConnection bus = QDBusConnection::sessionBus();
1274 if (bus.isConnected()) {
1275 // Specs: https://specifications.freedesktop.org/idle-inhibit-spec/0.1/re01.html
1276 const QString service = QStringLiteral("org.freedesktop.ScreenSaver");
1277 const QString path = QStringLiteral("/org/freedesktop/ScreenSaver");
1278
1279 QDBusInterface screen_saver_interface(service, path, service, bus, this);
1280 if (screen_saver_interface.isValid()) {
1281 const QString method = QStringLiteral("UnInhibit");
1282
1283 QDBusReply<void> reply = screen_saver_interface.call(method, screensaver_dbus_cookie);
1284
1285 if (reply.isValid()) {
1286 LOG_INFO(Frontend, "Screen saver enabled successfully (cookie: {})",
1287 screensaver_dbus_cookie);
1288
1289 screensaver_dbus_cookie = 0;
1290 screensaver_inhibited = false;
1291 } else {
1292 QDBusError error = reply.error();
1293 LOG_ERROR(Frontend, "Could not disable screen saver: {} {}",
1294 error.message().toStdString(), error.name().toStdString());
1295 }
1296 }
1297 }
1298#endif 1245#endif
1299} 1246}
1300 1247
@@ -1332,10 +1279,12 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
1332 static_cast<u32>(CalloutFlag::DRDDeprecation); 1279 static_cast<u32>(CalloutFlag::DRDDeprecation);
1333 QMessageBox::warning( 1280 QMessageBox::warning(
1334 this, tr("Warning Outdated Game Format"), 1281 this, tr("Warning Outdated Game Format"),
1335 tr("You are using the deconstructed ROM directory format for this game, which is an " 1282 tr("You are using the deconstructed ROM directory format for this game, which is "
1283 "an "
1336 "outdated format that has been superseded by others such as NCA, NAX, XCI, or " 1284 "outdated format that has been superseded by others such as NCA, NAX, XCI, or "
1337 "NSP. Deconstructed ROM directories lack icons, metadata, and update " 1285 "NSP. Deconstructed ROM directories lack icons, metadata, and update "
1338 "support.<br><br>For an explanation of the various Switch formats yuzu supports, <a " 1286 "support.<br><br>For an explanation of the various Switch formats yuzu "
1287 "supports, <a "
1339 "href='https://yuzu-emu.org/wiki/overview-of-switch-game-formats'>check out our " 1288 "href='https://yuzu-emu.org/wiki/overview-of-switch-game-formats'>check out our "
1340 "wiki</a>. This message will not be shown again.")); 1289 "wiki</a>. This message will not be shown again."));
1341 } 1290 }
@@ -1353,7 +1302,9 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
1353 tr("yuzu has encountered an error while running the video core, please see the " 1302 tr("yuzu has encountered an error while running the video core, please see the "
1354 "log for more details." 1303 "log for more details."
1355 "For more information on accessing the log, please see the following page: " 1304 "For more information on accessing the log, please see the following page: "
1356 "<a href='https://community.citra-emu.org/t/how-to-upload-the-log-file/296'>How " 1305 "<a "
1306 "href='https://community.citra-emu.org/t/how-to-upload-the-log-file/"
1307 "296'>How "
1357 "to " 1308 "to "
1358 "Upload the Log File</a>." 1309 "Upload the Log File</a>."
1359 "Ensure that you have the latest graphics drivers for your GPU.")); 1310 "Ensure that you have the latest graphics drivers for your GPU."));
@@ -1371,7 +1322,8 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
1371 tr("Error while loading ROM! %1", "%1 signifies a numeric error code.") 1322 tr("Error while loading ROM! %1", "%1 signifies a numeric error code.")
1372 .arg(QString::fromStdString(error_code)); 1323 .arg(QString::fromStdString(error_code));
1373 const auto description = 1324 const auto description =
1374 tr("%1<br>Please follow <a href='https://yuzu-emu.org/help/quickstart/'>the " 1325 tr("%1<br>Please follow <a "
1326 "href='https://yuzu-emu.org/help/quickstart/'>the "
1375 "yuzu quickstart guide</a> to redump your files.<br>You can refer " 1327 "yuzu quickstart guide</a> to redump your files.<br>You can refer "
1376 "to the yuzu wiki</a> or the yuzu Discord</a> for help.", 1328 "to the yuzu wiki</a> or the yuzu Discord</a> for help.",
1377 "%1 signifies an error string.") 1329 "%1 signifies an error string.")
@@ -1445,6 +1397,14 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1445 SelectAndSetCurrentUser(); 1397 SelectAndSetCurrentUser();
1446 } 1398 }
1447 1399
1400#if defined(HAVE_SDL2) && !defined(_WIN32)
1401 SDL_InitSubSystem(SDL_INIT_VIDEO);
1402 // SDL disables the screen saver by default, and setting the hint
1403 // SDL_HINT_VIDEO_ALLOW_SCREENSAVER doesn't seem to work, so we just enable the screen saver
1404 // for now.
1405 SDL_EnableScreenSaver();
1406#endif
1407
1448 if (!LoadROM(filename, program_id, program_index)) 1408 if (!LoadROM(filename, program_id, program_index))
1449 return; 1409 return;
1450 1410
@@ -1462,8 +1422,8 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1462 1422
1463 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); 1423 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
1464 connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); 1424 connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity);
1465 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views 1425 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our
1466 // before the CPU continues 1426 // views before the CPU continues
1467 connect(emu_thread.get(), &EmuThread::DebugModeEntered, waitTreeWidget, 1427 connect(emu_thread.get(), &EmuThread::DebugModeEntered, waitTreeWidget,
1468 &WaitTreeWidget::OnDebugModeEntered, Qt::BlockingQueuedConnection); 1428 &WaitTreeWidget::OnDebugModeEntered, Qt::BlockingQueuedConnection);
1469 connect(emu_thread.get(), &EmuThread::DebugModeLeft, waitTreeWidget, 1429 connect(emu_thread.get(), &EmuThread::DebugModeLeft, waitTreeWidget,
@@ -1537,6 +1497,10 @@ void GMainWindow::ShutdownGame() {
1537 1497
1538 AllowOSSleep(); 1498 AllowOSSleep();
1539 1499
1500#if defined(HAVE_SDL2) && !defined(_WIN32)
1501 SDL_QuitSubSystem(SDL_INIT_VIDEO);
1502#endif
1503
1540 discord_rpc->Pause(); 1504 discord_rpc->Pause();
1541 emu_thread->RequestStop(); 1505 emu_thread->RequestStop();
1542 1506
@@ -2047,7 +2011,8 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
2047 const QStringList selections{tr("Full"), tr("Skeleton")}; 2011 const QStringList selections{tr("Full"), tr("Skeleton")};
2048 const auto res = QInputDialog::getItem( 2012 const auto res = QInputDialog::getItem(
2049 this, tr("Select RomFS Dump Mode"), 2013 this, tr("Select RomFS Dump Mode"),
2050 tr("Please select the how you would like the RomFS dumped.<br>Full will copy all of the " 2014 tr("Please select the how you would like the RomFS dumped.<br>Full will copy all of "
2015 "the "
2051 "files into the new directory while <br>skeleton will only create the directory " 2016 "files into the new directory while <br>skeleton will only create the directory "
2052 "structure."), 2017 "structure."),
2053 selections, 0, false, &ok); 2018 selections, 0, false, &ok);
@@ -2309,7 +2274,8 @@ void GMainWindow::OnMenuInstallToNAND() {
2309 if (detected_base_install) { 2274 if (detected_base_install) {
2310 QMessageBox::warning( 2275 QMessageBox::warning(
2311 this, tr("Install Results"), 2276 this, tr("Install Results"),
2312 tr("To avoid possible conflicts, we discourage users from installing base games to the " 2277 tr("To avoid possible conflicts, we discourage users from installing base games to "
2278 "the "
2313 "NAND.\nPlease, only use this feature to install updates and DLC.")); 2279 "NAND.\nPlease, only use this feature to install updates and DLC."));
2314 } 2280 }
2315 2281
@@ -2721,13 +2687,13 @@ void GMainWindow::OnConfigure() {
2721 const auto result = configure_dialog.exec(); 2687 const auto result = configure_dialog.exec();
2722 if (result != QDialog::Accepted && !UISettings::values.configuration_applied && 2688 if (result != QDialog::Accepted && !UISettings::values.configuration_applied &&
2723 !UISettings::values.reset_to_defaults) { 2689 !UISettings::values.reset_to_defaults) {
2724 // Runs if the user hit Cancel or closed the window, and did not ever press the Apply button 2690 // Runs if the user hit Cancel or closed the window, and did not ever press the Apply
2725 // or `Reset to Defaults` button 2691 // button or `Reset to Defaults` button
2726 return; 2692 return;
2727 } else if (result == QDialog::Accepted) { 2693 } else if (result == QDialog::Accepted) {
2728 // Only apply new changes if user hit Okay 2694 // Only apply new changes if user hit Okay
2729 // This is here to avoid applying changes if the user hit Apply, made some changes, then hit 2695 // This is here to avoid applying changes if the user hit Apply, made some changes, then
2730 // Cancel 2696 // hit Cancel
2731 configure_dialog.ApplyConfiguration(); 2697 configure_dialog.ApplyConfiguration();
2732 } else if (UISettings::values.reset_to_defaults) { 2698 } else if (UISettings::values.reset_to_defaults) {
2733 LOG_INFO(Frontend, "Resetting all settings to defaults"); 2699 LOG_INFO(Frontend, "Resetting all settings to defaults");
@@ -2743,8 +2709,8 @@ void GMainWindow::OnConfigure() {
2743 LOG_WARNING(Frontend, "Failed to remove game metadata cache files"); 2709 LOG_WARNING(Frontend, "Failed to remove game metadata cache files");
2744 } 2710 }
2745 2711
2746 // Explicitly save the game directories, since reinitializing config does not explicitly do 2712 // Explicitly save the game directories, since reinitializing config does not explicitly
2747 // so. 2713 // do so.
2748 QVector<UISettings::GameDir> old_game_dirs = std::move(UISettings::values.game_dirs); 2714 QVector<UISettings::GameDir> old_game_dirs = std::move(UISettings::values.game_dirs);
2749 QVector<u64> old_favorited_ids = std::move(UISettings::values.favorited_ids); 2715 QVector<u64> old_favorited_ids = std::move(UISettings::values.favorited_ids);
2750 2716
@@ -2791,6 +2757,12 @@ void GMainWindow::OnConfigure() {
2791 render_window->setAttribute(Qt::WA_Hover, false); 2757 render_window->setAttribute(Qt::WA_Hover, false);
2792 } 2758 }
2793 2759
2760 if (emulation_running) {
2761 PreventOSSleep();
2762 } else {
2763 AllowOSSleep();
2764 }
2765
2794 if (UISettings::values.hide_mouse) { 2766 if (UISettings::values.hide_mouse) {
2795 mouse_hide_timer.start(); 2767 mouse_hide_timer.start();
2796 } 2768 }
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 1d2741d25..aed15a0a0 100755
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -348,11 +348,6 @@ private:
348 bool auto_paused = false; 348 bool auto_paused = false;
349 QTimer mouse_hide_timer; 349 QTimer mouse_hide_timer;
350 350
351#ifdef __linux__
352 bool screensaver_inhibited = false;
353 uint32_t screensaver_dbus_cookie;
354#endif
355
356 // FS 351 // FS
357 std::shared_ptr<FileSys::VfsFilesystem> vfs; 352 std::shared_ptr<FileSys::VfsFilesystem> vfs;
358 std::unique_ptr<FileSys::ManualContentProvider> provider; 353 std::unique_ptr<FileSys::ManualContentProvider> provider;
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index 0b8fde691..4bac2ca8a 100755
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -482,6 +482,7 @@ void Config::ReadValues() {
482 Settings::values.log_filter = 482 Settings::values.log_filter =
483 sdl2_config->Get("Miscellaneous", Settings::values.log_filter.GetLabel(), "*:Trace"); 483 sdl2_config->Get("Miscellaneous", Settings::values.log_filter.GetLabel(), "*:Trace");
484 ReadSetting("Miscellaneous", Settings::values.use_dev_keys); 484 ReadSetting("Miscellaneous", Settings::values.use_dev_keys);
485 ReadSetting("Miscellaneous", Settings::values.disable_screen_saver);
485 486
486 // Debugging 487 // Debugging
487 Settings::values.record_frame_times = 488 Settings::values.record_frame_times =
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h
index 339dca766..5208cb5e4 100755
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -391,6 +391,10 @@ log_filter = *:Trace
391# 0 (default): Disabled, 1: Enabled 391# 0 (default): Disabled, 1: Enabled
392use_dev_keys = 392use_dev_keys =
393 393
394# Disables the screensaver while yuzu is in session.
395# 1 (defualt): Yes, 0 : No
396disable_screen_saver =
397
394[Debugging] 398[Debugging]
395# Record frame time data, can be found in the log directory. Boolean value 399# Record frame time data, can be found in the log directory. Boolean value
396record_frame_times = 400record_frame_times =
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
index 87fce0c23..c8bc1eb79 100755
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
@@ -22,6 +22,9 @@ EmuWindow_SDL2::EmuWindow_SDL2(InputCommon::InputSubsystem* input_subsystem_, Co
22 LOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting..."); 22 LOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting...");
23 exit(1); 23 exit(1);
24 } 24 }
25 if (!Settings::values.disable_screen_saver) {
26 SDL_EnableScreenSaver();
27 }
25 input_subsystem->Initialize(); 28 input_subsystem->Initialize();
26 SDL_SetMainReady(); 29 SDL_SetMainReady();
27} 30}