Mercurial > repos > blastem
diff bindings.c @ 2314:59fd8aa352e2
Apply binding changes after a config change in UI
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 30 Mar 2023 23:20:12 -0700 |
parents | 62f316b76e9a |
children | e836cf11783b |
line wrap: on
line diff
--- a/bindings.c Thu Mar 30 20:20:25 2023 -0700 +++ b/bindings.c Thu Mar 30 23:20:12 2023 -0700 @@ -1177,8 +1177,10 @@ tern_foreach(mice, process_mouse, buttonmaps); } tern_node * speed_nodes = tern_find_path(config, "clocks\0speeds\0", TVAL_NODE).ptrval; + free(speeds); speeds = malloc(sizeof(uint32_t)); speeds[0] = 100; + num_speeds = 1; process_speeds(speed_nodes, NULL); for (int i = 0; i < num_speeds; i++) { @@ -1189,6 +1191,17 @@ } } +void update_pad_bindings(void) +{ + for (int i = 0; i < MAX_JOYSTICKS; i++) + { + if (joysticks[i].num_buttons || joysticks[i].num_axes || joysticks[i].num_dpads) { + reset_joystick_bindings(i); + handle_joy_added(i); + } + } +} + void bindings_set_mouse_mode(uint8_t mode) { mouse_mode = mode;