summaryrefslogtreecommitdiff
path: root/src/yuzu_cmd
diff options
context:
space:
mode:
authorGravatar xcfrg2023-07-16 18:45:33 -0400
committerGravatar flodavid2023-11-25 19:30:29 +0100
commitdfa56765d6d869a317ec46dcf3a8f4f35b146382 (patch)
tree827c46ada3f60e9bdef93c25a26319f00377d15f /src/yuzu_cmd
parentMerge pull request #11889 from t895/ini-lib (diff)
downloadyuzu-dfa56765d6d869a317ec46dcf3a8f4f35b146382.tar.gz
yuzu-dfa56765d6d869a317ec46dcf3a8f4f35b146382.tar.xz
yuzu-dfa56765d6d869a317ec46dcf3a8f4f35b146382.zip
yuzu: integrate gamemode support on linux
Diffstat (limited to 'src/yuzu_cmd')
-rw-r--r--src/yuzu_cmd/CMakeLists.txt1
-rw-r--r--src/yuzu_cmd/yuzu.cpp24
2 files changed, 25 insertions, 0 deletions
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt
index fbeba8813..002f3e841 100644
--- a/src/yuzu_cmd/CMakeLists.txt
+++ b/src/yuzu_cmd/CMakeLists.txt
@@ -44,6 +44,7 @@ target_link_libraries(yuzu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers)
44 44
45if(UNIX AND NOT APPLE) 45if(UNIX AND NOT APPLE)
46 install(TARGETS yuzu-cmd) 46 install(TARGETS yuzu-cmd)
47 target_link_libraries(yuzu-cmd PRIVATE gamemode)
47endif() 48endif()
48 49
49if(WIN32) 50if(WIN32)
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 0416d5951..1c3a1809b 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -63,6 +63,10 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
63} 63}
64#endif 64#endif
65 65
66#ifdef __linux__
67#include <gamemode_client.h>
68#endif
69
66static void PrintHelp(const char* argv0) { 70static void PrintHelp(const char* argv0) {
67 std::cout << "Usage: " << argv0 71 std::cout << "Usage: " << argv0
68 << " [options] <filename>\n" 72 << " [options] <filename>\n"
@@ -425,6 +429,16 @@ int main(int argc, char** argv) {
425 exit(0); 429 exit(0);
426 }); 430 });
427 431
432#ifdef __linux__
433 if (Settings::values.disable_gamemode) {
434 if (gamemode_request_start() < 0) {
435 LOG_WARNING(Frontend, "Failed to start gamemode: {}", gamemode_error_string());
436 } else {
437 LOG_INFO(Frontend, "Started gamemode");
438 }
439 }
440#endif
441
428 void(system.Run()); 442 void(system.Run());
429 if (system.DebuggerEnabled()) { 443 if (system.DebuggerEnabled()) {
430 system.InitializeDebugger(); 444 system.InitializeDebugger();
@@ -436,6 +450,16 @@ int main(int argc, char** argv) {
436 void(system.Pause()); 450 void(system.Pause());
437 system.ShutdownMainProcess(); 451 system.ShutdownMainProcess();
438 452
453#ifdef __linux__
454 if (Settings::values.disable_gamemode) {
455 if (gamemode_request_end() < 0) {
456 LOG_WARNING(Frontend, "Failed to stop gamemode: {}", gamemode_error_string());
457 } else {
458 LOG_INFO(Frontend, "Stopped gamemode");
459 }
460 }
461#endif
462
439 detached_tasks.WaitForAllTasks(); 463 detached_tasks.WaitForAllTasks();
440 return 0; 464 return 0;
441} 465}