gp2x->common menu migration finished, gp2x now only uses input fwk

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@692 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-05-14 13:41:48 +00:00
parent 2c60056042
commit 82abf46f3d
22 changed files with 207 additions and 1765 deletions

View file

@ -11,7 +11,6 @@
#include "../../pico/sound/ym2612.h"
#include "../gp2x/gp2x.h"
#include "../gp2x/emu.h"
#include "../gp2x/menu.h"
#include "../gp2x/code940/940shared.h"
#include "../common/helix/pub/mp3dec.h"
#include "../../pico/pico_int.h"

View file

@ -48,6 +48,12 @@ static void destroy (GtkWidget *widget, gpointer data)
gtk_main_quit ();
}
/* faking GP2X pad */
enum { GP2X_UP=0x1, GP2X_LEFT=0x4, GP2X_DOWN=0x10, GP2X_RIGHT=0x40,
GP2X_START=1<<8, GP2X_SELECT=1<<9, GP2X_L=1<<10, GP2X_R=1<<11,
GP2X_A=1<<12, GP2X_B=1<<13, GP2X_X=1<<14, GP2X_Y=1<<15,
GP2X_VOL_UP=1<<23, GP2X_VOL_DOWN=1<<22, GP2X_PUSH=1<<27 };
static gint key_press_event (GtkWidget *widget, GdkEventKey *event)
{
switch (event->hardware_keycode)
@ -334,11 +340,6 @@ void gp2x_pd_clone_buffer2(void)
}
/* joy */
unsigned long gp2x_joystick_read(int allow_usb_joy)
{
return current_keys;
}
int gp2x_touchpad_read(int *x, int *y)
{
return -1;

View file

@ -9,7 +9,6 @@
#include <linux/input.h>
#include <errno.h>
#include "../common/common.h"
#include "../common/input.h"
#include "in_evdev.h"
@ -354,29 +353,50 @@ static int in_evdev_update_keycode(void *data, int *is_down)
return -1;
}
static const struct {
short key;
short pbtn;
} key_pbtn_map[] =
{
{ KEY_UP, PBTN_UP },
{ KEY_DOWN, PBTN_DOWN },
{ KEY_LEFT, PBTN_LEFT },
{ KEY_RIGHT, PBTN_RIGHT },
{ KEY_ENTER, PBTN_MOK },
{ BTN_A, PBTN_MOK },
{ BTN_TRIGGER, PBTN_MOK },
{ KEY_ESC, PBTN_MBACK },
{ BTN_B, PBTN_MBACK },
{ BTN_THUMB, PBTN_MBACK },
{ KEY_A, PBTN_MA2 },
{ KEY_S, PBTN_MA3 },
{ KEY_BACKSLASH, PBTN_MENU },
{ KEY_MENU, PBTN_MENU },
{ KEY_LEFTBRACE, PBTN_L },
{ KEY_RIGHTBRACE, PBTN_R },
};
#define KEY_PBTN_MAP_SIZE (sizeof(key_pbtn_map) / sizeof(key_pbtn_map[0]))
static int in_evdev_menu_translate(int keycode)
{
switch (keycode) {
case KEY_UP: return PBTN_UP;
case KEY_DOWN: return PBTN_DOWN;
case KEY_LEFT: return PBTN_LEFT;
case KEY_RIGHT: return PBTN_RIGHT;
case KEY_ENTER:
case BTN_A:
case BTN_TRIGGER:
return PBTN_MOK;
case KEY_ESC:
case BTN_B:
case BTN_THUMB:
return PBTN_MBACK;
case KEY_MENU:
return PBTN_MENU;
case KEY_LEFTBRACE:
return PBTN_L;
case KEY_RIGHTBRACE:
return PBTN_R;
default: return 0;
int i;
if (keycode < 0)
{
/* menu -> kc */
keycode = -keycode;
for (i = 0; i < KEY_PBTN_MAP_SIZE; i++)
if (key_pbtn_map[i].pbtn == keycode)
return key_pbtn_map[i].key;
}
else
{
for (i = 0; i < KEY_PBTN_MAP_SIZE; i++)
if (key_pbtn_map[i].key == keycode)
return key_pbtn_map[i].pbtn;
}
return 0;
}
static int in_evdev_get_key_code(const char *key_name)
@ -421,6 +441,8 @@ static const struct {
{ BTN_Y, 6 },
{ KEY_ENTER, 7 },
{ BTN_START, 7 },
{ BTN_TL, 27 }, /* save state */
{ BTN_TR, 28 }, /* load state */
};
#define DEF_BIND_COUNT (sizeof(in_evdev_def_binds) / sizeof(in_evdev_def_binds[0]))

View file

@ -35,8 +35,6 @@
#define dprintf(x...)
// platform
#define PLAT_MAX_KEYS 32
#define PLAT_HAVE_JOY 1
#define PATH_SEP "/"
#define PATH_SEP_C '/'
#define MENU_X2 0