X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=input.c;h=8d2d552275fdfb35a89bb7c5207a1cfe174c3682;hb=17def48f1f0eeedb1f97f9392c0f5c82cb838e65;hp=39d678397e804911297346f8673832eb4ef6e2e6;hpb=a86e9a3e58f55bf49d99dfd5e5d6413e17149593;p=libpicofe.git diff --git a/input.c b/input.c index 39d6783..8d2d552 100644 --- a/input.c +++ b/input.c @@ -5,6 +5,7 @@ * (at your option): * - GNU GPL, version 2 or later. * - GNU LGPL, version 2.1 or later. + * - MAME license. * See the COPYING file in the top-level directory. */ @@ -16,10 +17,6 @@ #include "plat.h" #include "lprintf.h" -#ifdef IN_GP2X -#error needs update: in_gp2x_init in_gp2x_update -#include "../gp2x/in_gp2x.h" -#endif #ifdef IN_VK #error needs update: in_vk_init in_vk_update #include "../win32/in_vk.h" @@ -63,7 +60,8 @@ static int *in_alloc_binds(int drv_id, int key_count) defbinds = DRV(drv_id).defbinds; if (defbinds != NULL) { for (i = 0; ; i++) { - if (defbinds[i].bit == 0 && defbinds[i].code == 0) + if (defbinds[i].bit == 0 && defbinds[i].btype == 0 + && defbinds[i].bit == 0) break; binds[IN_BIND_OFFS(defbinds[i].code, defbinds[i].btype)] = 1 << defbinds[i].bit; @@ -430,6 +428,7 @@ finish: int in_menu_wait_any(char *charcode, int timeout_ms) { int keys_old = menu_key_state; + int ret; while (1) { @@ -445,7 +444,9 @@ int in_menu_wait_any(char *charcode, int timeout_ms) } } - return menu_key_state; + ret = menu_key_state; + menu_key_state &= ~PBTN_CHAR; + return ret; } /* wait for menu input, do autorepeat */ @@ -517,6 +518,9 @@ int in_get_config(int dev_id, int what, void *val) case IN_CFG_KEY_NAMES: return -1; /* not implemented */ default: + if (!dev->probed) + return -1; + return DRV(dev->drv_id).get_config(dev->drv_data, what, ival); } @@ -530,9 +534,12 @@ static int in_set_blocking(int is_blocking) /* have_async_devs means we will have to do all reads async anyway.. */ if (!in_have_async_devs) { for (i = 0; i < in_dev_count; i++) { - if (in_devices[i].probed) - DRV(in_devices[i].drv_id).set_config(in_devices[i].drv_data, - IN_CFG_BLOCKING, is_blocking); + if (!in_devices[i].probed) + continue; + + DRV(in_devices[i].drv_id).set_config( + in_devices[i].drv_data, IN_CFG_BLOCKING, + is_blocking); } } @@ -879,7 +886,7 @@ void in_clean_binds(void) int ret, count, *binds, *def_binds; in_dev_t *dev = &in_devices[i]; - if (dev->binds == NULL || dev->drv_data == NULL) + if (dev->binds == NULL || !dev->probed) continue; count = dev->key_count;