# HG changeset patch # User Michael Pavone # Date 1497502770 25200 # Node ID 6a0e3bb6981faee00111e613f1d3e365952a9bbe # Parent 19044d5e388c60b268a44acb83b6c67be69d6520 Only complain about the first missing mapping for a given gamepad so a user does not get inundated with warning modals when their gamepad lacks a mapping entry diff -r 19044d5e388c -r 6a0e3bb6981f io.c --- a/io.c Wed Jun 14 21:17:35 2017 -0700 +++ b/io.c Wed Jun 14 21:59:30 2017 -0700 @@ -1111,6 +1111,8 @@ tern_node *mousebuttons; } pad_button_state; + +static long map_warning_pad = -1; void process_pad_button(char *key, tern_val val, uint8_t valtype, void *data) { pad_button_state *state = data; @@ -1129,8 +1131,9 @@ if (hostbutton < 0) { if (hostbutton == RENDER_INVALID_NAME) { warning("%s is not a valid gamepad input name\n", key); - } else if (hostbutton == RENDER_NOT_MAPPED) { - warning("No mapping exists for input %s on gamepad %d\n", key, hostpadnum); + } else if (hostbutton == RENDER_NOT_MAPPED && hostpadnum != map_warning_pad) { + warning("No SDL 2 mapping exists for input %s on gamepad %d\n", key, hostpadnum); + map_warning_pad = hostpadnum; } return; } @@ -1187,8 +1190,9 @@ if (axis < 0) { if (axis == RENDER_INVALID_NAME) { warning("%s is not a valid gamepad input name\n", key); - } else if (axis == RENDER_NOT_MAPPED) { - warning("No mapping exists for input %s on gamepad %d\n", key, hostpadnum); + } else if (axis == RENDER_NOT_MAPPED && hostpadnum != map_warning_pad) { + warning("No SDL 2 mapping exists for input %s on gamepad %d\n", key, hostpadnum); + map_warning_pad = hostpadnum; } goto done; }