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++);