X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=libpicofe.git;a=blobdiff_plain;f=input.c;h=2c34a7974fe69378edc2d32ee124271c929594aa;hp=8d2d552275fdfb35a89bb7c5207a1cfe174c3682;hb=d1453cf7e6d5d6758cc5d72c6d3af7d37156bf72;hpb=9089665ca1260c338c4239583f59de981bc80c1c diff --git a/input.c b/input.c index 8d2d552..2c34a79 100644 --- a/input.c +++ b/input.c @@ -63,7 +63,7 @@ static int *in_alloc_binds(int drv_id, int key_count) if (defbinds[i].bit == 0 && defbinds[i].btype == 0 && defbinds[i].bit == 0) break; - binds[IN_BIND_OFFS(defbinds[i].code, defbinds[i].btype)] = + binds[IN_BIND_OFFS(defbinds[i].code, defbinds[i].btype)] |= 1 << defbinds[i].bit; } @@ -247,7 +247,7 @@ void in_probe(void) for (i = 0; i < in_driver_count; i++) { in_probe_dev_id = i; - in_drivers[i].probe(); + in_drivers[i].probe(&DRV(i)); } /* get rid of devs without binds and probes */ @@ -808,7 +808,8 @@ int in_config_parse_dev(const char *name) if (in_devices[i].name == NULL) return -1; - in_devices[i].key_names = DRV(drv_id).get_key_names(&in_devices[i].key_count); + in_devices[i].key_names = DRV(drv_id).get_key_names(&DRV(drv_id), + &in_devices[i].key_count); in_devices[i].drv_id = drv_id; if (i + 1 > in_dev_count) @@ -932,7 +933,8 @@ static const char *in_def_get_key_name(int keycode) { return NULL; } if (d.f == NULL) d.f = in_def_##f /* to be called by drivers */ -int in_register_driver(const in_drv_t *drv, const struct in_default_bind *defbinds) +int in_register_driver(const in_drv_t *drv, + const struct in_default_bind *defbinds, const void *pdata) { int count_new = in_driver_count + 1; in_drv_t *new_drivers; @@ -954,7 +956,9 @@ int in_register_driver(const in_drv_t *drv, const struct in_default_bind *defbin CHECK_ADD_STUB(new_drivers[in_driver_count], menu_translate); CHECK_ADD_STUB(new_drivers[in_driver_count], get_key_code); CHECK_ADD_STUB(new_drivers[in_driver_count], get_key_name); - if (defbinds != NULL) + if (pdata) + new_drivers[in_driver_count].pdata = pdata; + if (defbinds) new_drivers[in_driver_count].defbinds = defbinds; in_drivers = new_drivers; in_driver_count = count_new;