notaz.gp2x.de
/
libpicofe.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
revive pandora and win32 builds, rm gp2x dep for linux, lots of refactoring
[libpicofe.git]
/
common
/
input.c
diff --git
a/common/input.c
b/common/input.c
index
e3cf071
..
0ec3fc8
100644
(file)
--- a/
common/input.c
+++ b/
common/input.c
@@
-4,8
+4,10
@@
#include "input.h"
#include "plat.h"
#include "input.h"
#include "plat.h"
+#include "lprintf.h"
#include "../linux/in_evdev.h"
#include "../gp2x/in_gp2x.h"
#include "../linux/in_evdev.h"
#include "../gp2x/in_gp2x.h"
+#include "../win32/in_vk.h"
typedef struct
{
typedef struct
{
@@
-89,7
+91,7
@@
void in_register(const char *nname, int drv_id, int drv_fd_hnd, void *drv_data,
for (i = 0; i < IN_MAX_DEVS; i++)
if (!in_devices[i].probed) break;
if (i >= IN_MAX_DEVS) {
for (i = 0; i < IN_MAX_DEVS; i++)
if (!in_devices[i].probed) break;
if (i >= IN_MAX_DEVS) {
- printf("input: too many devices, can't add %s\n", name);
+
l
printf("input: too many devices, can't add %s\n", name);
return;
}
in_free(&in_devices[i]);
return;
}
in_free(&in_devices[i]);
@@
-111,7
+113,7
@@
void in_register(const char *nname, int drv_id, int drv_fd_hnd, void *drv_data,
if (i + 1 > in_dev_count)
in_dev_count = i + 1;
if (i + 1 > in_dev_count)
in_dev_count = i + 1;
- printf("input: new device #%d \"%s\"\n", i, name);
+
l
printf("input: new device #%d \"%s\"\n", i, name);
update:
in_devices[i].probed = 1;
in_devices[i].does_combos = combos;
update:
in_devices[i].probed = 1;
in_devices[i].does_combos = combos;
@@
-226,7
+228,7
@@
void in_probe(void)
}
if (in_have_async_devs)
}
if (in_have_async_devs)
- printf("input: async-only devices detected..\n");
+
l
printf("input: async-only devices detected..\n");
}
/* async update */
}
/* async update */
@@
-237,6
+239,7
@@
int in_update(int *result)
for (i = 0; i < in_dev_count; i++) {
in_dev_t *dev = &in_devices[i];
if (dev->probed && dev->binds != NULL) {
for (i = 0; i < in_dev_count; i++) {
in_dev_t *dev = &in_devices[i];
if (dev->probed && dev->binds != NULL) {
+ // FIXME: this is stupid, make it indirect
switch (dev->drv_id) {
#ifdef IN_EVDEV
case IN_DRVID_EVDEV:
switch (dev->drv_id) {
#ifdef IN_EVDEV
case IN_DRVID_EVDEV:
@@
-248,6
+251,9
@@
int in_update(int *result)
ret |= in_gp2x_update(dev->drv_data, dev->binds, result);
break;
#endif
ret |= in_gp2x_update(dev->drv_data, dev->binds, result);
break;
#endif
+ case IN_DRVID_VK:
+ ret |= in_vk_update(dev->drv_data, dev->binds, result);
+ break;
}
}
}
}
}
}
@@
-337,7
+343,7
@@
int in_update_keycode(int *dev_id_out, int *is_down_out, int timeout_ms)
if (count == 0) {
/* don't deadlock, fail */
if (count == 0) {
/* don't deadlock, fail */
- printf("input: failed to find devices to read\n");
+
l
printf("input: failed to find devices to read\n");
exit(1);
}
exit(1);
}
@@
-599,7
+605,7
@@
int in_config_parse_dev(const char *name)
}
if (drv_id < 0) {
}
if (drv_id < 0) {
- printf("input: missing driver for %s\n", name);
+
l
printf("input: missing driver for %s\n", name);
return -1;
}
return -1;
}
@@
-617,7
+623,7
@@
int in_config_parse_dev(const char *name)
for (i = 0; i < IN_MAX_DEVS; i++)
if (in_devices[i].name == NULL) break;
if (i >= IN_MAX_DEVS) {
for (i = 0; i < IN_MAX_DEVS; i++)
if (in_devices[i].name == NULL) break;
if (i >= IN_MAX_DEVS) {
- printf("input: too many devices, can't add %s\n", name);
+
l
printf("input: too many devices, can't add %s\n", name);
return -1;
}
}
return -1;
}
}
@@
-696,7
+702,7
@@
int in_config_bind_key(int dev_id, const char *key, int acts, int bind_type)
}
if (kc < 0 || kc >= dev->key_count) {
}
if (kc < 0 || kc >= dev->key_count) {
- printf("input: bad key: %s\n", key);
+
l
printf("input: bad key: %s\n", key);
return -1;
}
return -1;
}
@@
-757,12
+763,12
@@
void in_debug_dump(void)
{
int i;
{
int i;
- printf("# drv probed binds name\n");
+
l
printf("# drv probed binds name\n");
for (i = 0; i < IN_MAX_DEVS; i++) {
in_dev_t *d = &in_devices[i];
if (!d->probed && d->name == NULL && d->binds == NULL)
continue;
for (i = 0; i < IN_MAX_DEVS; i++) {
in_dev_t *d = &in_devices[i];
if (!d->probed && d->name == NULL && d->binds == NULL)
continue;
- printf("%d %3d %6c %5c %s\n", i, d->drv_id, d->probed ? 'y' : 'n',
+
l
printf("%d %3d %6c %5c %s\n", i, d->drv_id, d->probed ? 'y' : 'n',
d->binds ? 'y' : 'n', d->name);
}
}
d->binds ? 'y' : 'n', d->name);
}
}
@@
-808,6
+814,7
@@
void in_init(void)
#ifdef IN_EVDEV
in_evdev_init(&in_drivers[IN_DRVID_EVDEV]);
#endif
#ifdef IN_EVDEV
in_evdev_init(&in_drivers[IN_DRVID_EVDEV]);
#endif
+ in_vk_init(&in_drivers[IN_DRVID_VK]);
}
#if 0
}
#if 0
@@
-824,12
+831,12
@@
int main(void)
while (1) {
int dev = 0, down;
ret = in_update_keycode(&dev, &down);
while (1) {
int dev = 0, down;
ret = in_update_keycode(&dev, &down);
- printf("#%i: %i %i (%s)\n", dev, down, ret, in_get_key_name(dev, ret));
+
l
printf("#%i: %i %i (%s)\n", dev, down, ret, in_get_key_name(dev, ret));
}
#else
while (1) {
ret = in_menu_wait_any();
}
#else
while (1) {
ret = in_menu_wait_any();
- printf("%08x\n", ret);
+
l
printf("%08x\n", ret);
}
#endif
}
#endif