diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-06-14 21:59:30 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-06-14 21:59:30 -0700 |
commit | fd0dfe77e0c947e63026c944b94675018834351b (patch) | |
tree | fb3a4b9d4d87ae1e8f1d38a225e771258b273894 | |
parent | a6f9ef4895c707007a2c6bfaa253e74fd4e93f44 (diff) |
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
-rw-r--r-- | io.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1111,6 +1111,8 @@ typedef struct { 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 @@ void process_pad_button(char *key, tern_val val, uint8_t valtype, void *data) 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 @@ void process_pad_axis(char *key, tern_val val, uint8_t valtype, void *data) 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; } |