Add gamepad override for each app

This commit is contained in:
Yukino Song
2025-05-19 14:22:17 +08:00
parent 98a35b81f6
commit b0871a9a5b
6 changed files with 77 additions and 19 deletions

View File

@@ -218,6 +218,16 @@ namespace proc {
display_device::revert_configuration();
});
if (!app.gamepad.empty()) {
_saved_input_config = std::make_shared<config::input_t>(config::input);
if (app.gamepad == "disabled") {
config::input.controller = false;
} else {
config::input.controller = true;
config::input.gamepad = app.gamepad;
}
}
#ifdef _WIN32
if (
config::video.headless_mode // Headless mode
@@ -671,6 +681,11 @@ namespace proc {
virtual_display = false;
allow_client_commands = false;
if (_saved_input_config) {
config::input = *_saved_input_config;
_saved_input_config.reset();
}
if (needs_refresh) {
refresh(config::stream.file_apps, false);
}
@@ -1193,6 +1208,7 @@ namespace proc {
ctx.use_app_identity = app_node.value("use-app-identity", false);
ctx.per_client_app_identity = app_node.value("per-client-app-identity", false);
ctx.allow_client_commands = app_node.value("allow-client-commands", true);
ctx.gamepad = app_node.value("gamepad", "");
// Calculate a unique application id.
auto possible_ids = calculate_app_id(name, ctx.image_path, i++);

View File

@@ -78,6 +78,7 @@ namespace proc {
std::string output;
std::string image_path;
std::string id;
std::string gamepad;
bool elevated;
bool auto_detach;
bool wait_all;
@@ -136,6 +137,7 @@ namespace proc {
boost::process::v1::environment _env;
std::shared_ptr<rtsp_stream::launch_session_t> _launch_session;
std::shared_ptr<config::input_t> _saved_input_config;
std::vector<ctx_t> _apps;
ctx_t _app;

View File

@@ -44,7 +44,6 @@ namespace rtsp_stream {
int height;
int fps;
int gcmap;
int appid;
int surround_info;
std::string surround_params;
bool enable_hdr;