Allow the user to disable gamepad rumble and leds control
This commit is contained in:
parent
646ed984de
commit
566d89df29
6 changed files with 29 additions and 3 deletions
|
|
@ -110,6 +110,8 @@ int main(int argc, char ** argv) {
|
|||
.settings = {
|
||||
.default_gamepad = 0,
|
||||
.nintendo_layout = false,
|
||||
.gamepad_leds_control = true,
|
||||
.gamepad_rumble_control = true,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,4 +2,6 @@ enable_qam = true;
|
|||
ff_gain = 255;
|
||||
nintendo_layout = false;
|
||||
default_gamepad = 1;
|
||||
rumble_on_mode_switch = true;
|
||||
rumble_on_mode_switch = true;
|
||||
gamepad_rumble_control = true;
|
||||
gamepad_leds_control = true;
|
||||
|
|
@ -581,7 +581,9 @@ void *dev_out_thread_func(void *ptr) {
|
|||
}
|
||||
};
|
||||
|
||||
out_msgs[out_msgs_count++] = msg;
|
||||
if (dev_out_data->settings.gamepad_leds_control) {
|
||||
out_msgs[out_msgs_count++] = msg;
|
||||
}
|
||||
}
|
||||
|
||||
if (current_motors_events_count != prev_motors_events_count) {
|
||||
|
|
@ -595,7 +597,9 @@ void *dev_out_thread_func(void *ptr) {
|
|||
}
|
||||
};
|
||||
|
||||
out_msgs[out_msgs_count++] = msg;
|
||||
if (dev_out_data->settings.gamepad_rumble_control) {
|
||||
out_msgs[out_msgs_count++] = msg;
|
||||
}
|
||||
}
|
||||
|
||||
// send out game-generated events to sockets
|
||||
|
|
|
|||
14
settings.c
14
settings.c
|
|
@ -67,6 +67,20 @@ void load_out_config(dev_out_settings_t *const out_conf, const char* const filep
|
|||
fprintf(stderr, "default_gamepad (int) configuration not found. Default value will be used.\n");
|
||||
}
|
||||
|
||||
int gamepad_leds_control;
|
||||
if (config_lookup_bool(&cfg, "gamepad_leds_control", &gamepad_leds_control) != CONFIG_FALSE) {
|
||||
out_conf->gamepad_leds_control = gamepad_leds_control;
|
||||
} else {
|
||||
fprintf(stderr, "gamepad_leds_control (bool) configuration not found. Default value will be used.\n");
|
||||
}
|
||||
|
||||
int gamepad_rumble_control;
|
||||
if (config_lookup_bool(&cfg, "gamepad_rumble_control", &gamepad_rumble_control) != CONFIG_FALSE) {
|
||||
out_conf->gamepad_rumble_control = gamepad_rumble_control;
|
||||
} else {
|
||||
fprintf(stderr, "gamepad_rumble_control (bool) configuration not found. Default value will be used.\n");
|
||||
}
|
||||
|
||||
config_destroy(&cfg);
|
||||
|
||||
load_out_config_err:
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ void load_in_config(dev_in_settings_t *const out_conf, const char* const filepat
|
|||
typedef struct dev_out_settings {
|
||||
bool nintendo_layout;
|
||||
uint8_t default_gamepad;
|
||||
bool gamepad_leds_control;
|
||||
bool gamepad_rumble_control;
|
||||
} dev_out_settings_t;
|
||||
|
||||
void load_out_config(dev_out_settings_t *const out_conf, const char* const filepath);
|
||||
|
|
@ -45,6 +45,8 @@ int main(int argc, char ** argv) {
|
|||
.settings = {
|
||||
.default_gamepad = 0,
|
||||
.nintendo_layout = false,
|
||||
.gamepad_leds_control = true,
|
||||
.gamepad_rumble_control = true,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue