yuzu-cmd: intergrate gamemode support
This commit is contained in:
parent
9dffe7b495
commit
832b12d4b0
5 changed files with 31 additions and 0 deletions
|
@ -584,6 +584,7 @@ struct Values {
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
Setting<std::string> log_filter{"*:Info", "log_filter"};
|
Setting<std::string> log_filter{"*:Info", "log_filter"};
|
||||||
Setting<bool> use_dev_keys{false, "use_dev_keys"};
|
Setting<bool> use_dev_keys{false, "use_dev_keys"};
|
||||||
|
Setting<bool> use_gamemode{false, "use_gamemode"};
|
||||||
|
|
||||||
// Network
|
// Network
|
||||||
Setting<std::string> network_interface{std::string(), "network_interface"};
|
Setting<std::string> network_interface{std::string(), "network_interface"};
|
||||||
|
|
|
@ -45,6 +45,7 @@ target_link_libraries(yuzu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS yuzu-cmd)
|
install(TARGETS yuzu-cmd)
|
||||||
|
target_link_libraries(yuzu-cmd PRIVATE gamemode)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|
|
@ -336,6 +336,7 @@ void Config::ReadValues() {
|
||||||
Settings::values.log_filter =
|
Settings::values.log_filter =
|
||||||
sdl2_config->Get("Miscellaneous", Settings::values.log_filter.GetLabel(), "*:Trace");
|
sdl2_config->Get("Miscellaneous", Settings::values.log_filter.GetLabel(), "*:Trace");
|
||||||
ReadSetting("Miscellaneous", Settings::values.use_dev_keys);
|
ReadSetting("Miscellaneous", Settings::values.use_dev_keys);
|
||||||
|
ReadSetting("Miscellaneous", Settings::values.use_gamemode);
|
||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
Settings::values.record_frame_times =
|
Settings::values.record_frame_times =
|
||||||
|
|
|
@ -498,6 +498,10 @@ log_filter = *:Trace
|
||||||
# 0 (default): Disabled, 1: Enabled
|
# 0 (default): Disabled, 1: Enabled
|
||||||
use_dev_keys =
|
use_dev_keys =
|
||||||
|
|
||||||
|
# Use gamemode
|
||||||
|
# 0 (default): Disabled, 1: Enabled
|
||||||
|
use_gamemode =
|
||||||
|
|
||||||
[Debugging]
|
[Debugging]
|
||||||
# Record frame time data, can be found in the log directory. Boolean value
|
# Record frame time data, can be found in the log directory. Boolean value
|
||||||
record_frame_times =
|
record_frame_times =
|
||||||
|
|
|
@ -62,6 +62,10 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <gamemode_client.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static void PrintHelp(const char* argv0) {
|
static void PrintHelp(const char* argv0) {
|
||||||
std::cout << "Usage: " << argv0
|
std::cout << "Usage: " << argv0
|
||||||
<< " [options] <filename>\n"
|
<< " [options] <filename>\n"
|
||||||
|
@ -422,6 +426,16 @@ int main(int argc, char** argv) {
|
||||||
exit(0);
|
exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
if (Settings::values.use_gamemode) {
|
||||||
|
if (gamemode_request_start() < 0) {
|
||||||
|
LOG_WARNING(Frontend, "Failed to start gamemode: {}", gamemode_error_string());
|
||||||
|
} else {
|
||||||
|
LOG_INFO(Frontend, "Started gamemode");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void(system.Run());
|
void(system.Run());
|
||||||
if (system.DebuggerEnabled()) {
|
if (system.DebuggerEnabled()) {
|
||||||
system.InitializeDebugger();
|
system.InitializeDebugger();
|
||||||
|
@ -433,6 +447,16 @@ int main(int argc, char** argv) {
|
||||||
void(system.Pause());
|
void(system.Pause());
|
||||||
system.ShutdownMainProcess();
|
system.ShutdownMainProcess();
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
if (Settings::values.use_gamemode) {
|
||||||
|
if (gamemode_request_end() < 0) {
|
||||||
|
LOG_WARNING(Frontend, "Failed to stop gamemode: {}", gamemode_error_string());
|
||||||
|
} else {
|
||||||
|
LOG_INFO(Frontend, "Stopped gamemode");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
detached_tasks.WaitForAllTasks();
|
detached_tasks.WaitForAllTasks();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue