mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-11 17:28:29 +12:00
Add GameMode support for Linux build (#796)
This commit is contained in:
parent
b74ae21953
commit
1bcdb35e42
10 changed files with 467 additions and 1 deletions
|
@ -161,6 +161,11 @@ if(ENABLE_CUBEB)
|
|||
target_link_libraries(CemuGui PRIVATE cubeb::cubeb)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(ENABLE_FERAL_GAMEMODE)
|
||||
target_link_libraries(CemuGui PRIVATE gamemode)
|
||||
endif()
|
||||
endif()
|
||||
if (ENABLE_WXWIDGETS)
|
||||
# PUBLIC because wx/app.h is included in CemuApp.h
|
||||
target_link_libraries(CemuGui PUBLIC wx::base wx::core wx::gl wx::propgrid wx::xrc)
|
||||
|
|
|
@ -179,6 +179,13 @@ wxPanel* GeneralSettings2::AddGeneralPage(wxNotebook* notebook)
|
|||
m_disable_screensaver->SetToolTip(_("Prevents the system from activating the screen saver or going to sleep while running a game."));
|
||||
second_row->Add(m_disable_screensaver, 0, botflag, 5);
|
||||
|
||||
// Enable/disable feral interactive gamemode
|
||||
#if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE)
|
||||
m_feral_gamemode = new wxCheckBox(box, wxID_ANY, _("Enable Feral GameMode"));
|
||||
m_feral_gamemode->SetToolTip(_("Use FeralInteractive GameMode if installed."));
|
||||
second_row->Add(m_feral_gamemode, 0, botflag, 5);
|
||||
#endif
|
||||
|
||||
// temporary workaround because feature crashes on macOS
|
||||
#if BOOST_OS_MACOS
|
||||
m_disable_screensaver->Enable(false);
|
||||
|
@ -868,7 +875,7 @@ void GeneralSettings2::StoreConfig()
|
|||
config.fullscreen_menubar = m_fullscreen_menubar->IsChecked();
|
||||
config.check_update = m_auto_update->IsChecked();
|
||||
config.save_screenshot = m_save_screenshot->IsChecked();
|
||||
|
||||
config.feral_gamemode = m_feral_gamemode->IsChecked();
|
||||
const bool use_ps = m_permanent_storage->IsChecked();
|
||||
if(use_ps)
|
||||
{
|
||||
|
@ -1508,6 +1515,8 @@ void GeneralSettings2::ApplyConfig()
|
|||
|
||||
m_permanent_storage->SetValue(config.permanent_storage);
|
||||
m_disable_screensaver->SetValue(config.disable_screensaver);
|
||||
|
||||
m_feral_gamemode->SetValue(config.feral_gamemode);
|
||||
// temporary workaround because feature crashes on macOS
|
||||
#if BOOST_OS_MACOS
|
||||
m_disable_screensaver->SetValue(false);
|
||||
|
|
|
@ -43,6 +43,7 @@ private:
|
|||
wxCheckBox* m_auto_update, *m_save_screenshot;
|
||||
wxCheckBox* m_permanent_storage;
|
||||
wxCheckBox* m_disable_screensaver;
|
||||
wxCheckBox* m_feral_gamemode;
|
||||
wxListBox* m_game_paths;
|
||||
wxTextCtrl* m_mlc_path;
|
||||
|
||||
|
|
|
@ -61,6 +61,11 @@
|
|||
#include "gui/helpers/wxWayland.h"
|
||||
#endif
|
||||
|
||||
//GameMode support
|
||||
#if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE)
|
||||
#include "gamemode_client.h"
|
||||
#endif
|
||||
|
||||
#include "Cafe/TitleList/TitleInfo.h"
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
#include "wxHelper.h"
|
||||
|
@ -581,6 +586,23 @@ bool MainWindow::FileLoad(std::wstring fileName, wxLaunchGameEvent::INITIATED_BY
|
|||
if (ActiveSettings::FullscreenEnabled())
|
||||
SetFullScreen(true);
|
||||
|
||||
//GameMode support
|
||||
#if BOOST_OS_LINUX && defined(ENABLE_FERAL_GAMEMODE)
|
||||
if(GetConfig().feral_gamemode)
|
||||
{
|
||||
// attempt to start gamemode
|
||||
if(gamemode_request_start() < 0)
|
||||
{
|
||||
// GameMode failed to start
|
||||
cemuLog_log(LogType::Force, "Could not start GameMode");
|
||||
}
|
||||
else
|
||||
{
|
||||
cemuLog_log(LogType::Force, "GameMode has been started.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
CreateCanvas();
|
||||
CafeSystem::LaunchForegroundTitle();
|
||||
RecreateMenu();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue