asyn-only dev support + in_gp2x driver

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@637 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-02-16 21:12:29 +00:00
parent 7f022a8d57
commit 13b692eb4e
9 changed files with 334 additions and 36 deletions

View file

@ -7,7 +7,7 @@ use_musashi = 1
# profile = 1
DEFINC = -I../.. -I. -D__GP2X__ -D_UNZIP_SUPPORT -DIO_STATS -DIN_EVDEV # -DBENCHMARK
DEFINC = -I../.. -I. -D__GP2X__ -D_UNZIP_SUPPORT -DIO_STATS -DIN_EVDEV -DIN_GP2X -DFAKE_IN_GP2X # -DBENCHMARK
GCC = gcc
STRIP = strip
AS = gcc
@ -28,7 +28,8 @@ LDFLAGS += `pkg-config --libs gthread-2.0`
# frontend
OBJS += platform/gp2x/main.o platform/gp2x/menu.o platform/gp2x/emu.o usbjoy.o blit.o \
in_evdev.o sndout_oss.o gp2x.o 940ctl_ym2612.o log_io.o
in_evdev.o sndout_oss.o gp2x.o 940ctl_ym2612.o log_io.o \
platform/gp2x/in_gp2x.o
# common
OBJS += platform/common/emu.o platform/common/menu.o platform/common/config.o platform/common/fonts.o \

View file

@ -21,9 +21,9 @@
#include "log_io.h"
void *gp2x_screen;
unsigned long current_keys = 0;
static int current_bpp = 8;
static int current_pal[256];
static unsigned long current_keys = 0;
static const char *verstring = "PicoDrive " VERSION;
// dummies
@ -52,9 +52,13 @@ static gint key_press_event (GtkWidget *widget, GdkEventKey *event)
{
switch (event->hardware_keycode)
{
case 111:
case 0x62: current_keys |= GP2X_UP; break;
case 116:
case 0x68: current_keys |= GP2X_DOWN; break;
case 113:
case 0x64: current_keys |= GP2X_LEFT; break;
case 114:
case 0x66: current_keys |= GP2X_RIGHT; break;
case 0x24: current_keys |= GP2X_START; break; // enter
case 0x23: current_keys |= GP2X_SELECT;break; // ]
@ -83,9 +87,13 @@ static gint key_release_event (GtkWidget *widget, GdkEventKey *event)
{
switch (event->hardware_keycode)
{
case 111:
case 0x62: current_keys &= ~GP2X_UP; break;
case 116:
case 0x68: current_keys &= ~GP2X_DOWN; break;
case 113:
case 0x64: current_keys &= ~GP2X_LEFT; break;
case 114:
case 0x66: current_keys &= ~GP2X_RIGHT; break;
case 0x24: current_keys &= ~GP2X_START; break; // enter
case 0x23: current_keys &= ~GP2X_SELECT;break; // ]

View file

@ -306,14 +306,16 @@ static int in_evdev_update_keycode(void *data, int *is_down)
rd = read(dev->fd, &ev, sizeof(ev));
if (rd < (int) sizeof(ev)) {
perror("in_evdev: error reading");
sleep(1);
return 0;
if (errno != EAGAIN) {
perror("in_evdev: error reading");
sleep(1);
}
return -1;
}
if (ev.type == EV_KEY) {
if (ev.value < 0 || ev.value > 1)
return 0;
return -1;
if (is_down != NULL)
*is_down = ev.value;
return ev.code;
@ -349,7 +351,7 @@ static int in_evdev_update_keycode(void *data, int *is_down)
}
}
return 0;
return -1;
}
static int in_evdev_menu_translate(int keycode)
@ -376,8 +378,7 @@ static int in_evdev_get_key_code(const char *key_name)
for (i = 0; i < KEY_MAX + 1; i++) {
const char *k = in_evdev_keys[i];
if (k != NULL && k[0] == key_name[0] &&
strcasecmp(k, key_name) == 0)
if (k != NULL && strcasecmp(k, key_name) == 0)
return i;
}