diff options
| author | lizzie <lizzie@eden-emu.dev> | 2025-12-07 07:13:43 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-12-07 07:13:43 +0100 |
| commit | 83332316aa382e11e6af79b8432520ff4c9950b6 (patch) | |
| tree | 73c025c0deb6bd7095e908fecba15b1cf65120d0 /src/yuzu/main_window.cpp | |
| parent | 3141019fcd01f7b8da310c1a1fb233866fe7cf93 (diff) | |
[gamemode] Make available on other platforms (#353)
Signed-off-by: lizzie <lizzie@eden-emu.dev>
Co-authored-by: crueter <crueter@eden-emu.dev>
Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/353
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/yuzu/main_window.cpp')
| -rw-r--r-- | src/yuzu/main_window.cpp | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index d0ece67028..32f15156f7 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -164,9 +164,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #endif -#ifdef __linux__ -#include "common/linux/gamemode.h" -#endif +#include "qt_common/gamemode.h" #ifdef _WIN32 #include "core/core_timing.h" @@ -423,9 +421,7 @@ MainWindow::MainWindow(bool has_broken_vulkan) SetupSigInterrupts(); #endif -#ifdef __linux__ - SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); -#endif + SetGamemodeEnabled(UISettings::values.enable_gamemode.GetValue()); UISettings::RestoreWindowState(config); @@ -2198,10 +2194,7 @@ void MainWindow::OnEmulationStopped() { emulation_running = false; discord_rpc->Update(); - -#ifdef __linux__ - Common::Linux::StopGamemode(); -#endif + Common::FeralGamemode::Stop(); // The emulation is stopped, so closing the window or not does not matter anymore disconnect(render_window, &GRenderWindow::Closed, this, &MainWindow::OnStopGame); @@ -3072,10 +3065,7 @@ void MainWindow::OnStartGame() { play_time_manager->Start(); discord_rpc->Update(); - -#ifdef __linux__ - Common::Linux::StartGamemode(); -#endif + Common::FeralGamemode::Start(); } void MainWindow::OnRestartGame() { @@ -3096,10 +3086,7 @@ void MainWindow::OnPauseGame() { play_time_manager->Stop(); UpdateMenuState(); AllowOSSleep(); - -#ifdef __linux__ - Common::Linux::StopGamemode(); -#endif + Common::FeralGamemode::Stop(); } void MainWindow::OnPauseContinueGame() { @@ -3384,11 +3371,9 @@ void MainWindow::OnConfigure() { const auto old_theme = UISettings::values.theme; const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); const auto old_language_index = Settings::values.language_index.GetValue(); -#ifdef __linux__ - const bool old_gamemode = Settings::values.enable_gamemode.GetValue(); -#endif + const bool old_gamemode = UISettings::values.enable_gamemode.GetValue(); #ifdef __unix__ - const bool old_force_x11 = Settings::values.gui_force_x11.GetValue(); + const bool old_force_x11 = UISettings::values.gui_force_x11.GetValue(); #endif Settings::SetConfiguringGlobal(true); @@ -3449,14 +3434,12 @@ void MainWindow::OnConfigure() { if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) { SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue()); } -#ifdef __linux__ - if (Settings::values.enable_gamemode.GetValue() != old_gamemode) { - SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); + if (UISettings::values.enable_gamemode.GetValue() != old_gamemode) { + SetGamemodeEnabled(UISettings::values.enable_gamemode.GetValue()); } -#endif #ifdef __unix__ - if (Settings::values.gui_force_x11.GetValue() != old_force_x11) { - GraphicsBackend::SetForceX11(Settings::values.gui_force_x11.GetValue()); + if (UISettings::values.gui_force_x11.GetValue() != old_force_x11) { + GraphicsBackend::SetForceX11(UISettings::values.gui_force_x11.GetValue()); } #endif @@ -4403,7 +4386,7 @@ void MainWindow::OnCheckGraphicsBackend() { if (!isWayland) return; - const bool currently_hidden = Settings::values.gui_hide_backend_warning.GetValue(); + const bool currently_hidden = UISettings::values.gui_hide_backend_warning.GetValue(); if (currently_hidden) return; @@ -4426,11 +4409,11 @@ void MainWindow::OnCheckGraphicsBackend() { const bool hide = cb->isChecked(); if (hide != currently_hidden) { - Settings::values.gui_hide_backend_warning.SetValue(hide); + UISettings::values.gui_hide_backend_warning.SetValue(hide); } if (msgbox.clickedButton() == okButton) { - Settings::values.gui_force_x11.SetValue(true); + UISettings::values.gui_force_x11.SetValue(true); GraphicsBackend::SetForceX11(true); QMessageBox::information(this, tr("Restart Required"), @@ -4760,13 +4743,14 @@ void MainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { discord_rpc->Update(); } -#ifdef __linux__ void MainWindow::SetGamemodeEnabled(bool state) { if (emulation_running) { - Common::Linux::SetGamemodeState(state); + if (state) + Common::FeralGamemode::Start(); + else + Common::FeralGamemode::Stop(); } } -#endif void MainWindow::changeEvent(QEvent* event) { #ifdef __unix__ |
