controller over bluetooth settings parameter added
This commit is contained in:
parent
eec5cadf8c
commit
778082077c
6 changed files with 14 additions and 3 deletions
|
|
@ -31,6 +31,7 @@ int main(int argc, char ** argv) {
|
||||||
.nintendo_layout = false,
|
.nintendo_layout = false,
|
||||||
.gamepad_leds_control = true,
|
.gamepad_leds_control = true,
|
||||||
.gamepad_rumble_control = true,
|
.gamepad_rumble_control = true,
|
||||||
|
.controller_bluetooth = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
load_out_config(&out_settings, configuration_file);
|
load_out_config(&out_settings, configuration_file);
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,5 @@ default_gamepad = 1;
|
||||||
rumble_on_mode_switch = true;
|
rumble_on_mode_switch = true;
|
||||||
gamepad_rumble_control = true;
|
gamepad_rumble_control = true;
|
||||||
gamepad_leds_control = true;
|
gamepad_leds_control = true;
|
||||||
m1m2_mode = 1;
|
m1m2_mode = 1;
|
||||||
|
controller_bluetooth = false;
|
||||||
|
|
@ -434,7 +434,7 @@ void *dev_out_thread_func(void *ptr) {
|
||||||
const int64_t gamepad_report_timing_us = 1250;
|
const int64_t gamepad_report_timing_us = 1250;
|
||||||
|
|
||||||
if (current_gamepad == GAMEPAD_DUALSENSE) {
|
if (current_gamepad == GAMEPAD_DUALSENSE) {
|
||||||
const int ds5_init_res = virt_dualsense_init(&controller_data.ds5, true);
|
const int ds5_init_res = virt_dualsense_init(&controller_data.ds5, dev_out_data->settings.controller_bluetooth);
|
||||||
if (ds5_init_res != 0) {
|
if (ds5_init_res != 0) {
|
||||||
fprintf(stderr, "Unable to initialize the DualSense device: %d\n", ds5_init_res);
|
fprintf(stderr, "Unable to initialize the DualSense device: %d\n", ds5_init_res);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -442,7 +442,7 @@ void *dev_out_thread_func(void *ptr) {
|
||||||
printf("DualSense initialized: fd=%d\n", current_gamepad_fd);
|
printf("DualSense initialized: fd=%d\n", current_gamepad_fd);
|
||||||
}
|
}
|
||||||
} else if (current_gamepad == GAMEPAD_DUALSHOCK) {
|
} else if (current_gamepad == GAMEPAD_DUALSHOCK) {
|
||||||
const int ds4_init_res = virt_dualshock_init(&controller_data.ds4, false);
|
const int ds4_init_res = virt_dualshock_init(&controller_data.ds4, dev_out_data->settings.controller_bluetooth);
|
||||||
if (ds4_init_res != 0) {
|
if (ds4_init_res != 0) {
|
||||||
fprintf(stderr, "Unable to initialize the DualShock device: %d\n", ds4_init_res);
|
fprintf(stderr, "Unable to initialize the DualShock device: %d\n", ds4_init_res);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,13 @@ void load_out_config(dev_out_settings_t *const out_conf, const char* const filep
|
||||||
fprintf(stderr, "gamepad_rumble_control (bool) configuration not found. Default value will be used.\n");
|
fprintf(stderr, "gamepad_rumble_control (bool) configuration not found. Default value will be used.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int controller_bluetooth;
|
||||||
|
if (config_lookup_bool(&cfg, "controller_bluetooth", &controller_bluetooth) != CONFIG_FALSE) {
|
||||||
|
out_conf->controller_bluetooth = controller_bluetooth;
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "controller_bluetooth (bool) configuration not found. Default value will be used.\n");
|
||||||
|
}
|
||||||
|
|
||||||
config_destroy(&cfg);
|
config_destroy(&cfg);
|
||||||
|
|
||||||
load_out_config_err:
|
load_out_config_err:
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ typedef struct dev_out_settings {
|
||||||
uint8_t default_gamepad;
|
uint8_t default_gamepad;
|
||||||
bool gamepad_leds_control;
|
bool gamepad_leds_control;
|
||||||
bool gamepad_rumble_control;
|
bool gamepad_rumble_control;
|
||||||
|
bool controller_bluetooth;
|
||||||
} dev_out_settings_t;
|
} dev_out_settings_t;
|
||||||
|
|
||||||
void load_out_config(dev_out_settings_t *const out_conf, const char* const filepath);
|
void load_out_config(dev_out_settings_t *const out_conf, const char* const filepath);
|
||||||
|
|
@ -17,6 +17,7 @@ int main(int argc, char ** argv) {
|
||||||
.nintendo_layout = false,
|
.nintendo_layout = false,
|
||||||
.gamepad_leds_control = true,
|
.gamepad_leds_control = true,
|
||||||
.gamepad_rumble_control = true,
|
.gamepad_rumble_control = true,
|
||||||
|
.controller_bluetooth = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
load_out_config(&out_settings, configuration_file);
|
load_out_config(&out_settings, configuration_file);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue