S#10387 - Rework pluginlib actions

It changes pluginlib actions to contain only a single and simple context (and
other one for remote directional buttons),
consisting of 7(9) buttons: up/down/left/right, select OR short select and long
select, exit and cancel (plus 2 for scrollwheel targets).
This ensures contexts don't clash with other contexts and simplifies them, at
the expense of reduced versatility. However, the versatility made it largely unusable
due to the great number of targets.
This should allow for using pluginlib actions safely for the most simple plugins (e.g. almost all demos).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26202 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2010-05-20 17:41:28 +00:00
parent 97365803d3
commit 20e9d56ba5
18 changed files with 477 additions and 860 deletions

View file

@ -24,8 +24,7 @@
PLUGIN_HEADER
const struct button_mapping *plugin_contexts[] = {generic_directions,
generic_actions};
const struct button_mapping *plugin_contexts[] = { pla_main_ctx };
static int current = 0;
static bool tomorrow = false;
@ -33,7 +32,8 @@ static int alarm[2] = {0, 0}, maxval[2] = {24, 60}, prev_tick = 3600 * 24;
static bool quit = false, usb = false, waiting = false, done = false;
static inline int get_button(void) {
return pluginlib_getaction(HZ/2, plugin_contexts, 2);
return pluginlib_getaction(HZ/2, plugin_contexts,
ARRAYLEN(plugin_contexts));
}
int rem_seconds(void) {
@ -125,7 +125,7 @@ enum plugin_status plugin_start(const void* parameter)
while(!quit) {
button = get_button();
if (button == PLA_QUIT)
if (button == PLA_EXIT || PLA_CANCEL)
quit = true;
FOR_NB_SCREENS(i) {
@ -157,7 +157,8 @@ enum plugin_status plugin_start(const void* parameter)
current = (current + 1) % 2;
break;
case PLA_FIRE: {
case PLA_SELECT:
case PLA_SELECT_REPEAT: {
if (rem_seconds() < 0)
tomorrow = true;

View file

@ -66,28 +66,41 @@ enum {
/* keyboard layouts */
#if (CONFIG_KEYPAD != SANSA_E200_PAD) && \
(CONFIG_KEYPAD != SANSA_FUZE_PAD)
#ifdef HAVE_SCROLLWHEEL
/* sansas use the wheel instead of left/right if available */
#define BUBBLES_LEFT PLA_SCROLL_BACK
#define BUBBLES_LEFT_REP PLA_SCROLL_BACK_REPEAT
#define BUBBLES_RIGHT PLA_SCROLL_FWD
#define BUBBLES_RIGHT_REP PLA_SCROLL_FWD_REPEAT
#else
#define BUBBLES_LEFT PLA_LEFT
#define BUBBLES_LEFT_REP PLA_LEFT_REPEAT
#define BUBBLES_RIGHT PLA_RIGHT
#define BUBBLES_RIGHT_REP PLA_RIGHT_REPEAT
#define ANGLE_STEP 4
#define ANGLE_STEP_REP 4
#else
#define BUBBLES_LEFT PLA_UP
#define BUBBLES_LEFT_REP PLA_UP_REPEAT
#define BUBBLES_RIGHT PLA_DOWN
#define BUBBLES_RIGHT_REP PLA_DOWN_REPEAT
#define ANGLE_STEP 2
#define ANGLE_STEP_REP 4
#endif
#define BUBBLES_QUIT1 PLA_QUIT
#define BUBBLES_QUIT2 PLA_MENU
#define BUBBLES_PAUSE PLA_START
#define BUBBLES_FIRE PLA_FIRE
#define ANGLE_STEP 2
#define ANGLE_STEP_REP 4
#define BUBBLES_QUIT1 PLA_EXIT
#define BUBBLES_QUIT2 PLA_CANCEL
/* these are better off shooting with up */
#if (CONFIG_KEYPAD == SAMSUNG_YH_PAD) \
|| (CONFIG_KEYPAD == ONDIO_PAD) \
|| (CONFIG_KEYPAD == IRIVER_H10_PAD)
#define SHOOT_WITH_UP
#endif
#ifdef SHOOT_WITH_UP
#define BUBBLES_FIRE PLA_UP
#define BUBBLES_FIRE_REPEAT PLA_UP_REPEAT
#define BUBBLES_PAUSE PLA_SELECT
#else
#define BUBBLES_FIRE PLA_SELECT
#define BUBBLES_FIRE_REPEAT PLA_SELECT_REPEAT
#define BUBBLES_PAUSE PLA_UP
#endif
/* external bitmaps */
#ifdef HAVE_LCD_COLOR
@ -2294,16 +2307,15 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock,
int buttonres;
long start;
const struct button_mapping *plugin_contexts[]
#if (CONFIG_KEYPAD == SANSA_E200_PAD) || \
(CONFIG_KEYPAD == SANSA_FUZE_PAD)
= {generic_directions,generic_actions};
#else
= {generic_left_right_fire,generic_actions};
= { pla_main_ctx,
#ifdef HAVE_REMOTE_LCD
pla_remote_ctx,
#endif
};
if (timeout < 0)
timeout = 0;
button = pluginlib_getaction(timeout,plugin_contexts,2);
button = pluginlib_getaction(timeout,plugin_contexts,ARRAYLEN(plugin_contexts));
#if defined(HAS_BUTTON_HOLD) && !defined(HAVE_REMOTE_LCD_AS_MAIN)
/* FIXME: Should probably check remote hold here */
if (rb->button_hold())
@ -2324,6 +2336,7 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock,
break;
case BUBBLES_FIRE: /* fire the shot */
case BUBBLES_FIRE_REPEAT:
if(!animblock) {
bb->elapsedlvl += bb->elapsedshot;
bb->elapsedshot = 0;
@ -2338,7 +2351,9 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock,
case BUBBLES_PAUSE: /* pause the game */
start = *rb->current_tick;
rb->splash(0, "Paused");
while(pluginlib_getaction(TIMEOUT_BLOCK,plugin_contexts,2)
while(pluginlib_getaction(TIMEOUT_BLOCK,plugin_contexts,
ARRAYLEN(plugin_contexts))
!= BUBBLES_PAUSE);
bb->startedshot += *rb->current_tick-start;
bubbles_drawboard(bb);

View file

@ -34,27 +34,24 @@ PLUGIN_HEADER
/* Keymaps */
const struct button_mapping* plugin_contexts[]={
generic_actions,
generic_increase_decrease,
generic_directions,
#if NB_SCREENS == 2
remote_directions
pla_main_ctx,
#ifdef HAVE_REMOTE_LCD
pla_remote_ctx,
#endif
};
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
#define ACTION_COUNTER_TOGGLE PLA_FIRE
#define ACTION_COUNTER_RESET PLA_FIRE_REPEAT
#define ACTION_MENU PLA_MENU
#define ACTION_EXIT PLA_QUIT
#define ACTION_MODE_NEXT PLA_RIGHT
#define ACTION_MODE_NEXT_REPEAT PLA_RIGHT_REPEAT
#define ACTION_MODE_PREV PLA_LEFT
#define ACTION_MODE_PREV_REPEAT PLA_LEFT_REPEAT
#define ACTION_SKIN_NEXT PLA_INC
#define ACTION_SKIN_NEXT_REPEAT PLA_INC_REPEAT
#define ACTION_SKIN_PREV PLA_DEC
#define ACTION_SKIN_PREV_REPEAT PLA_DEC_REPEAT
#define ACTION_COUNTER_TOGGLE PLA_SELECT
#define ACTION_COUNTER_RESET PLA_SELECT_REPEAT
#define ACTION_MENU PLA_CANCEL
#define ACTION_MODE_NEXT PLA_RIGHT
#define ACTION_MODE_NEXT_REPEAT PLA_RIGHT_REPEAT
#define ACTION_MODE_PREV PLA_LEFT
#define ACTION_MODE_PREV_REPEAT PLA_LEFT_REPEAT
#define ACTION_SKIN_NEXT PLA_UP
#define ACTION_SKIN_NEXT_REPEAT PLA_UP_REPEAT
#define ACTION_SKIN_PREV PLA_DOWN
#define ACTION_SKIN_PREV_REPEAT PLA_DOWN_REPEAT
/**************************
* Cleanup on plugin return
@ -176,11 +173,6 @@ enum plugin_status plugin_start(const void* parameter){
clock_draw_restore_colors();
exit_clock=main_menu();
break;
case ACTION_EXIT:
exit_clock=true;
break;
default:
if(rb->default_event_handler_ex(button, cleanup, NULL)
== SYS_USB_CONNECTED)

View file

@ -31,8 +31,12 @@ PLUGIN_HEADER
#define MAX_COLORS_COUNT 8
#define MAX_GUESSES_COUNT 10
const struct button_mapping *plugin_contexts[] =
{generic_directions, generic_actions};
const struct button_mapping *plugin_contexts[] = {
pla_main_ctx,
#ifdef HAVE_REMOTE_LCD
pla_remote_ctx,
#endif
};
/*
* Screen structure:
@ -427,14 +431,14 @@ enum plugin_status plugin_start(const void* parameter) {
draw_board(guess, piece);
button = get_button();
if (button == PLA_FIRE || button == PLA_START)
if (button == PLA_SELECT)
break;
switch (button) {
/* Exit */
case PLA_QUIT:
case PLA_MENU:
case PLA_EXIT:
case PLA_CANCEL:
resume = true;
main_menu();
break;
@ -452,6 +456,10 @@ enum plugin_status plugin_start(const void* parameter) {
break;
/* Next color */
#ifdef HAVE_SCROLLWHEEL
case PLA_SCROLL_FWD:
case PLA_SCROLL_FWD_REPEAT:
#endif
case PLA_DOWN:
case PLA_DOWN_REPEAT:
guesses[guess].pieces[piece] =
@ -460,6 +468,10 @@ enum plugin_status plugin_start(const void* parameter) {
break;
/* Previous color */
#ifdef HAVE_SCROLLWHEEL
case PLA_SCROLL_BACK:
case PLA_SCROLL_BACK_REPEAT:
#endif
case PLA_UP:
case PLA_UP_REPEAT:
guesses[guess].pieces[piece] =

View file

@ -37,26 +37,33 @@ PLUGIN_HEADER
#define MIN_POLYGONS 1
/* Key assignement */
#define DEMYSTIFY_QUIT PLA_QUIT
#define DEMYSTIFY_QUIT PLA_CANCEL
#define DEMYSTIFY_INCREASE_SPEED PLA_RIGHT
#define DEMYSTIFY_DECREASE_SPEED PLA_LEFT
#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_RIGHT_REPEAT
#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_LEFT_REPEAT
#ifdef HAVE_SCROLLWHEEL
#define DEMYSTIFY_ADD_POLYGON PLA_UP
#define DEMYSTIFY_REMOVE_POLYGON PLA_DOWN
#define DEMYSTIFY_ADD_POLYGON_REPEAT PLA_UP_REPEAT
#define DEMYSTIFY_REMOVE_POLYGON_REPEAT PLA_DOWN_REPEAT
#define DEMYSTIFY_INCREASE_SPEED PLA_SCROLL_FWD
#define DEMYSTIFY_DECREASE_SPEED PLA_SCROLL_BACK
#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_SCROLL_FWD_REPEAT
#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_SCROLL_BACK_REPEAT
#else
#define DEMYSTIFY_INCREASE_SPEED PLA_RIGHT
#define DEMYSTIFY_DECREASE_SPEED PLA_LEFT
#define DEMYSTIFY_INCREASE_SPEED_REPEAT PLA_RIGHT_REPEAT
#define DEMYSTIFY_DECREASE_SPEED_REPEAT PLA_LEFT_REPEAT
#endif
#define DEMYSTIFY_ADD_POLYGON PLA_UP
#define DEMYSTIFY_REMOVE_POLYGON PLA_DOWN
#define DEMYSTIFY_ADD_POLYGON_REPEAT PLA_UP_REPEAT
#define DEMYSTIFY_REMOVE_POLYGON_REPEAT PLA_DOWN_REPEAT
const struct button_mapping *plugin_contexts[]
= {generic_directions, generic_actions,
= {pla_main_ctx,
#if defined(HAVE_REMOTE_LCD)
remote_directions
pla_remote_ctx,
#endif
};
#define NB_ACTION_CONTEXTS \
sizeof(plugin_contexts)/sizeof(struct button_mapping*)
#ifdef HAVE_LCD_COLOR
struct line_color
{
@ -383,7 +390,7 @@ int plugin_main(void)
else
rb->sleep(sleep_time);
action = pluginlib_getaction(TIMEOUT_NOBLOCK,
plugin_contexts, NB_ACTION_CONTEXTS);
plugin_contexts, ARRAYLEN(plugin_contexts));
switch(action)
{
case DEMYSTIFY_QUIT:

View file

@ -28,13 +28,13 @@
#define INITIAL_NB_DICES 1
#define INITIAL_NB_SIDES 2 /* corresponds to 6 sides in the array */
#define DICE_QUIT PLA_QUIT
#define DICE_ROLL PLA_START
#define DICE_QUIT PLA_CANCEL
#define DICE_ROLL PLA_SELECT
#define CFG_FILE "dice.cfg"
const struct button_mapping* plugin_contexts[]={generic_actions};
const struct button_mapping* plugin_contexts[]={pla_main_ctx};
struct dices
{
@ -94,7 +94,7 @@ enum plugin_status plugin_start(const void* parameter) {
dice_print( &dice, rb->screens[i] );
while(true) {
action = pluginlib_getaction(TIMEOUT_BLOCK,
plugin_contexts, 1);
plugin_contexts, ARRAYLEN(plugin_contexts));
switch(action) {
case DICE_ROLL:
dice_roll(&dice);

View file

@ -51,20 +51,27 @@ GREY_INFO_STRUCT
/* Key assignement */
const struct button_mapping* plugin_contexts[]= {
generic_increase_decrease,
generic_directions,
pla_main_ctx,
#if defined(HAVE_REMOTE_LCD)
remote_directions,
pla_remote_ctx,
#endif
generic_actions
};
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
#define FIRE_QUIT PLA_QUIT
#define FIRE_SWITCH_FLAMES_TYPE PLA_LEFT
#define FIRE_SWITCH_FLAMES_MOVING PLA_RIGHT
#define FIRE_INCREASE_MULT PLA_INC
#define FIRE_DECREASE_MULT PLA_DEC
#define FIRE_QUIT PLA_CANCEL
#define FIRE_SWITCH_FLAMES_TYPE PLA_LEFT
#define FIRE_SWITCH_FLAMES_MOVING PLA_RIGHT
#ifdef HAVE_SCROLLWHEEL
#define FIRE_INCREASE_MULT PLA_SCROLL_FWD
#define FIRE_INCREASE_MULT_REP PLA_SCROLL_FWD_REPEAT
#define FIRE_DECREASE_MULT PLA_SCROLL_BACK
#define FIRE_DECREASE_MULT_REP PLA_SCROLL_BACK_REPEAT
#else
#define FIRE_INCREASE_MULT PLA_UP
#define FIRE_INCREASE_MULT_REP PLA_UP_REPEAT
#define FIRE_DECREASE_MULT PLA_DOWN
#define FIRE_DECREASE_MULT_REP PLA_DOWN_REPEAT
#endif
#define MIN_FLAME_VALUE 0
#define COOL_MAX (440/LCD_HEIGHT+2)
@ -319,7 +326,8 @@ int main(void)
fire_draw(&fire);
rb->yield();
action = pluginlib_getaction(0, plugin_contexts, PLA_ARRAY_COUNT);
action = pluginlib_getaction(0, plugin_contexts,
ARRAYLEN(plugin_contexts));
switch(action){
case FIRE_QUIT:

View file

@ -112,7 +112,7 @@ zchar menu(void)
}
}
const struct button_mapping* plugin_contexts[]={generic_actions};
const struct button_mapping* plugin_contexts[]={pla_main_ctx};
void wait_for_key()
{
@ -126,11 +126,11 @@ void wait_for_key()
plugin_contexts, 1);
switch (action)
{
case PLA_QUIT:
case PLA_EXIT:
hot_key_quit();
break;
case PLA_FIRE:
case PLA_SELECT:
return;
}
}
@ -154,24 +154,24 @@ zchar do_input(int timeout, bool show_cursor)
for (;;)
{
action = pluginlib_getaction(timeout,
plugin_contexts, 1);
action = pluginlib_getaction(timeout, plugin_contexts,
ARRAYLEN(plugin_contexts));
switch (action)
{
case PLA_QUIT:
case PLA_EXIT:
return ZC_HKEY_QUIT;
case PLA_MENU:
case PLA_CANCEL:
menu_ret = menu();
if (menu_ret != ZC_BAD)
return menu_ret;
timeout_at = *rb->current_tick + timeout;
break;
case PLA_FIRE:
case PLA_SELECT:
return ZC_RETURN;
case PLA_START:
case PLA_SELECT_REPEAT:
return ZC_BAD;
default:

View file

@ -25,7 +25,7 @@
PLUGIN_HEADER
const struct button_mapping* plugin_contexts[]={generic_actions};
const struct button_mapping* plugin_contexts[]={pla_main_ctx};
#define NB_PICTURES 9
#define NB_SLOTS 3
@ -313,12 +313,12 @@ enum plugin_status plugin_start(const void* parameter)
while (true)
{
action = pluginlib_getaction(TIMEOUT_BLOCK,
plugin_contexts, 1);
plugin_contexts, ARRAYLEN(plugin_contexts));
switch ( action )
{
case PLA_QUIT:
case PLA_CANCEL:
return PLUGIN_OK;
case PLA_FIRE:
case PLA_SELECT:
jackpot_play_turn(&game);
break;

View file

@ -25,7 +25,8 @@
#include "pluginlib_actions.h"
#if defined(HAVE_REMOTE_LCD)
const struct button_mapping remote_directions[] =
/* remote directions */
const struct button_mapping pla_remote_ctx[] =
{
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
(CONFIG_KEYPAD == IRIVER_H300_PAD)
@ -68,35 +69,34 @@ const struct button_mapping remote_directions[] =
{ PLA_DOWN_REPEAT, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
{ PLA_UP, BUTTON_UP, BUTTON_NONE},
{ PLA_DOWN, BUTTON_DOWN, BUTTON_NONE},
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_UP_REPEAT, BUTTON_UP|BUTTON_REW, BUTTON_NONE},
{ PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REW, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REW, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REW, BUTTON_NONE},
#else
#error pluginlib_actions: Unsupported remote keypad
#error pluginlib_actions: No remote directions
#endif
{CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE}
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_PLUGIN),
};
#endif /* HAVE_REMOTE_LCD */
const struct button_mapping generic_directions[] =
/* these were taken from the bubbles plugin, so may need tweaking */
const struct button_mapping pla_main_ctx[] =
{
/* Touchscreens */
#ifdef HAVE_TOUCHSCREEN
{ PLA_UP, BUTTON_TOPMIDDLE, BUTTON_NONE},
{ PLA_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE},
{ PLA_LEFT, BUTTON_MIDLEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE},
{ PLA_UP_REPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_DOWN_REPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_CANCEL, BUTTON_BOTTOMRIGHT, BUTTON_NONE},
{ PLA_SELECT, BUTTON_CENTER, BUTTON_NONE},
{ PLA_SELECT_REL, BUTTON_CENTER|BUTTON_REL, BUTTON_NONE},
{ PLA_SELECT_REPEAT, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_UP, BUTTON_TOPMIDDLE, BUTTON_NONE},
{ PLA_DOWN, BUTTON_BOTTOMMIDDLE, BUTTON_NONE},
{ PLA_LEFT, BUTTON_MIDLEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE},
{ PLA_UP_REPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_DOWN_REPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE},
#endif
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \
/* Directions */
#if ((CONFIG_KEYPAD == IRIVER_H100_PAD) \
|| (CONFIG_KEYPAD == IRIVER_H300_PAD) \
|| (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \
|| (CONFIG_KEYPAD == GIGABEAT_PAD) \
@ -110,86 +110,67 @@ const struct button_mapping generic_directions[] =
|| (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) \
|| (CONFIG_KEYPAD == SANSA_CLIP_PAD) \
|| (CONFIG_KEYPAD == CREATIVEZVM_PAD) \
|| (CONFIG_KEYPAD == SANSA_M200_PAD)
{ PLA_UP, BUTTON_UP, BUTTON_NONE},
{ PLA_DOWN, BUTTON_DOWN, BUTTON_NONE},
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_UP_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
|| (CONFIG_KEYPAD == SANSA_M200_PAD)\
|| (CONFIG_KEYPAD == SANSA_E200_PAD) \
|| (CONFIG_KEYPAD == SANSA_FUZE_PAD) \
|| (CONFIG_KEYPAD == SAMSUNG_YH_PAD))
{ PLA_UP, BUTTON_UP, BUTTON_NONE },
{ PLA_DOWN, BUTTON_DOWN, BUTTON_NONE },
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
{ PLA_UP_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
/* now the bad ones that don't have standard names for the directional
* buttons */
#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
|| (CONFIG_KEYPAD == IPOD_3G_PAD) \
|| (CONFIG_KEYPAD == IPOD_4G_PAD) \
|| (CONFIG_KEYPAD == SANSA_E200_PAD) \
|| (CONFIG_KEYPAD == SANSA_FUZE_PAD)
{ PLA_UP, BUTTON_SCROLL_BACK, BUTTON_NONE},
{ PLA_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE},
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_UP_REPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_DOWN_REPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == PLAYER_PAD
{PLA_UP, BUTTON_STOP, BUTTON_NONE},
{PLA_DOWN, BUTTON_PLAY, BUTTON_NONE},
{PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{PLA_UP_REPEAT, BUTTON_STOP|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DOWN_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
{PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
|| (CONFIG_KEYPAD == IPOD_3G_PAD) \
|| (CONFIG_KEYPAD == IPOD_4G_PAD)
{ PLA_UP, BUTTON_MENU, BUTTON_NONE },
( PLA_DOWN, BUTTON_PLAY, BUTTON_NONE },
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
{ PLA_UP_REPEAT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_DOWN_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
#elif (CONFIG_KEYPAD == PLAYER_PAD)
{ PLA_UP, BUTTON_PLAY, BUTTON_NONE },
{ PLA_DOWN, BUTTON_STOP, BUTTON_NONE },
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
{ PLA_UP_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_DOWN_REPEAT, BUTTON_STOP|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
{ PLA_UP, BUTTON_SCROLL_UP, BUTTON_NONE},
{ PLA_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE},
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_UP_REPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_DOWN_REPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == MROBE500_PAD)
#elif (CONFIG_KEYPAD == COWON_D2_PAD)
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
{ PLA_UP, BUTTON_RC_VOL_UP, BUTTON_NONE},
{ PLA_DOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE},
{ PLA_LEFT, BUTTON_RC_REW, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RC_FF, BUTTON_NONE},
{ PLA_UP_REPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_DOWN_REPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
{ PLA_UP, BUTTON_STOP, BUTTON_NONE},
{ PLA_DOWN, BUTTON_PLAY, BUTTON_NONE},
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_UP_REPEAT, BUTTON_STOP|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_DOWN_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
{ PLA_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
{ PLA_UP_REPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_DOWN_REPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
#elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
{ PLA_UP, BUTTON_UP, BUTTON_NONE},
{ PLA_DOWN, BUTTON_DOWN, BUTTON_NONE},
{ PLA_LEFT, BUTTON_PREV, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_NEXT, BUTTON_NONE},
{ PLA_UP_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == ONDAVX747_PAD) /* Touchscreen target */
#elif (CONFIG_KEYPAD == ONDAVX777_PAD) /* Touchscreen target */
#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
{ PLA_UP, BUTTON_UP, BUTTON_NONE},
{ PLA_DOWN, BUTTON_DOWN, BUTTON_NONE},
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_UP_REPEAT, BUTTON_UP|BUTTON_REW, BUTTON_NONE},
{ PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REW, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REW, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REW, BUTTON_NONE},
{ PLA_UP, BUTTON_UP, BUTTON_NONE },
{ PLA_DOWN, BUTTON_DOWN, BUTTON_NONE },
{ PLA_LEFT, BUTTON_PREV, BUTTON_NONE },
{ PLA_RIGHT, BUTTON_NEXT, BUTTON_NONE },
{ PLA_UP_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
{ PLA_UP, BUTTON_STOP, BUTTON_NONE },
{ PLA_DOWN, BUTTON_PLAY, BUTTON_NONE },
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
{ PLA_UP_REPEAT, BUTTON_STOP|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_DOWN_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
{ PLA_UP, BUTTON_UP, BUTTON_NONE},
{ PLA_DOWN, BUTTON_DOWN, BUTTON_NONE},
@ -210,448 +191,172 @@ const struct button_mapping generic_directions[] =
{ PLA_RIGHT_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
#else
#error pluginlib_actions: Unsupported keypad
#ifndef HAVE_TOUCHSCREEN
#error pluginlib_actions: No directions defined
#endif
{CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE}
};
const struct button_mapping generic_left_right_fire[] =
{
#ifdef HAVE_TOUCHSCREEN
{ PLA_LEFT, BUTTON_MIDLEFT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_MIDRIGHT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_CENTER, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_NONE},
#endif
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \
|| (CONFIG_KEYPAD == IRIVER_H300_PAD) \
|| (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \
|| (CONFIG_KEYPAD == GIGABEAT_PAD) \
|| (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \
|| (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
|| (CONFIG_KEYPAD == MROBE100_PAD) \
|| (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) \
|| (CONFIG_KEYPAD == SANSA_CLIP_PAD) \
|| (CONFIG_KEYPAD == SANSA_M200_PAD)
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_NONE},
#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
|| (CONFIG_KEYPAD == IPOD_3G_PAD) \
|| (CONFIG_KEYPAD == IPOD_4G_PAD)
{ PLA_LEFT, BUTTON_SCROLL_BACK, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_SCROLL_FWD, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_NONE},
#elif CONFIG_KEYPAD == ONDIO_PAD
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_UP, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == PLAYER_PAD
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_ON, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_ON|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == RECORDER_PAD
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_PLAY, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == SANSA_C200_PAD) \
|| (CONFIG_KEYPAD == ARCHOS_AV300_PAD)
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_NONE},
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) \
|| (CONFIG_KEYPAD == SANSA_FUZE_PAD)
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_NONE},
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_REW, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == MROBE500_PAD)
{ PLA_LEFT, BUTTON_RC_REW, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RC_FF, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_RC_HEART, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_RC_HEART|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == COWON_D2_PAD)
{ PLA_LEFT, BUTTON_MINUS, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_PLUS, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_MENU, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
{ PLA_LEFT, BUTTON_RC_REW, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RC_FF, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_RC_MODE, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_MENU, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == CREATIVEZVM_PAD)
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
{ PLA_LEFT, BUTTON_PREV, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_NEXT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_PLAY, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == ONDAVX747_PAD) /* Touchscreen target */
#elif (CONFIG_KEYPAD == ONDAVX777_PAD) /* Touchscreen target */
#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REW, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REW, BUTTON_NONE},
{ PLA_FIRE, BUTTON_UP, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_UP|BUTTON_REW, BUTTON_NONE},
#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
{ PLA_LEFT, BUTTON_PREV, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_NEXT, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_OK, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_OK|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
{ PLA_LEFT, BUTTON_VOL_DOWN, BUTTON_NONE},
{ PLA_RIGHT, BUTTON_VOL_UP, BUTTON_NONE},
{ PLA_LEFT_REPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_RIGHT_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
{ PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{ PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#else
#error pluginlib_actions: Unsupported keypad
/* Scrollwheels */
#ifdef HAVE_SCROLLWHEEL
{ PLA_SCROLL_BACK, BUTTON_SCROLL_BACK, BUTTON_NONE },
{ PLA_SCROLL_FWD, BUTTON_SCROLL_FWD, BUTTON_NONE },
{ PLA_SCROLL_BACK_REPEAT,BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_SCROLL_FWD_REPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
#endif
{CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE}
};
/* these were taken from the bubbles plugin, so may need tweaking */
const struct button_mapping generic_actions[] =
{
#ifdef HAVE_TOUCHSCREEN
{PLA_QUIT, BUTTON_BOTTOMRIGHT, BUTTON_NONE},
{PLA_START, BUTTON_CENTER, BUTTON_NONE},
{PLA_MENU, BUTTON_TOPLEFT, BUTTON_NONE},
{PLA_FIRE, BUTTON_BOTTOMMIDDLE, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE},
#endif
/* Actions */
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
{PLA_QUIT, BUTTON_OFF, BUTTON_NONE},
{PLA_QUIT, BUTTON_RC_STOP, BUTTON_NONE},
{PLA_START, BUTTON_ON, BUTTON_NONE},
{PLA_START, BUTTON_RC_ON, BUTTON_NONE},
{PLA_MENU, BUTTON_MODE, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE, BUTTON_RC_MENU, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_RC_MENU|BUTTON_REPEAT, BUTTON_NONE},
{PLA_CANCEL, BUTTON_OFF, BUTTON_NONE },
{PLA_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
{PLA_EXIT, BUTTON_ON, BUTTON_NONE },
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE },
{PLA_SELECT, BUTTON_RC_ON, BUTTON_NONE },
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{PLA_SELECT_REL, BUTTON_RC_ON|BUTTON_REL, BUTTON_RC_ON },
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
{PLA_SELECT_REPEAT, BUTTON_RC_ON|BUTTON_REPEAT, BUTTON_NONE },
#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
|| (CONFIG_KEYPAD == IPOD_3G_PAD) \
|| (CONFIG_KEYPAD == IPOD_4G_PAD)
{PLA_QUIT, BUTTON_MENU|BUTTON_SELECT, BUTTON_NONE},
{PLA_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
{PLA_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_PLAY, BUTTON_NONE},
{PLA_START, BUTTON_RC_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_REC, BUTTON_NONE},
{PLA_MENU, BUTTON_RC_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE, BUTTON_RC_MODE, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == GIGABEAT_PAD
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_A, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
{PLA_QUIT, BUTTON_BACK, BUTTON_NONE},
{PLA_START, BUTTON_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == RECORDER_PAD
{PLA_QUIT, BUTTON_OFF, BUTTON_NONE},
{PLA_START, BUTTON_ON, BUTTON_NONE},
{PLA_MENU, BUTTON_F1, BUTTON_NONE},
{PLA_FIRE, BUTTON_PLAY, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == ARCHOS_AV300_PAD
{PLA_QUIT, BUTTON_OFF, BUTTON_NONE},
{PLA_START, BUTTON_ON, BUTTON_NONE},
{PLA_MENU, BUTTON_F1, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == ONDIO_PAD
{PLA_QUIT, BUTTON_OFF, BUTTON_NONE},
{PLA_START, BUTTON_MENU, BUTTON_NONE},
{PLA_MENU, BUTTON_DOWN, BUTTON_NONE},
{PLA_FIRE, BUTTON_UP, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == PLAYER_PAD
{PLA_QUIT, BUTTON_STOP|BUTTON_REPEAT, BUTTON_NONE},
{PLA_START, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_ON, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_ON|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == SANSA_E200_PAD || \
CONFIG_KEYPAD == SANSA_C200_PAD || \
CONFIG_KEYPAD == SANSA_CLIP_PAD || \
CONFIG_KEYPAD == SANSA_M200_PAD
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_UP, BUTTON_NONE},
{PLA_MENU, BUTTON_DOWN, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == SANSA_FUZE_PAD
{PLA_QUIT, (BUTTON_HOME|BUTTON_REPEAT), BUTTON_NONE},
{PLA_START, BUTTON_UP, BUTTON_NONE},
{PLA_MENU, BUTTON_DOWN, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_FF, BUTTON_NONE},
{PLA_FIRE, BUTTON_REW, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
{PLA_QUIT, BUTTON_EQ, BUTTON_NONE},
{PLA_START, BUTTON_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_MODE, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == MROBE500_PAD)
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_RC_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_RC_MODE, BUTTON_NONE},
{PLA_FIRE, BUTTON_RC_HEART, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_RC_HEART|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == MROBE100_PAD
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == COWON_D2_PAD)
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_MINUS, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_PLUS, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
{PLA_QUIT, BUTTON_RC_REC, BUTTON_NONE},
{PLA_START, BUTTON_RC_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_RC_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_RC_MODE, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_RIGHT, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_PLAY, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_VOLUP, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == CREATIVEZVM_PAD)
{PLA_QUIT, BUTTON_BACK, BUTTON_NONE},
{PLA_START, BUTTON_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_VIEW, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == ONDAVX747_PAD)
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_VOL_DOWN, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_VOL_UP, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == ONDAVX777_PAD)
{PLA_QUIT, BUTTON_POWER, BUTTON_NONE},
{PLA_START, BUTTON_VOL_DOWN, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_VOL_UP, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
{PLA_QUIT, BUTTON_REW, BUTTON_NONE},
{PLA_START, BUTTON_FFWD, BUTTON_NONE},
{PLA_MENU, BUTTON_PLAY, BUTTON_NONE},
{PLA_FIRE, BUTTON_UP, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_UP|BUTTON_REW, BUTTON_NONE},
#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
{PLA_QUIT, BUTTON_REC, BUTTON_NONE},
{PLA_START, BUTTON_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_MENU, BUTTON_NONE},
{PLA_FIRE, BUTTON_OK, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_OK|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
{PLA_QUIT, (BUTTON_REC|BUTTON_PLAY), BUTTON_NONE},
{PLA_START, BUTTON_PLAY, BUTTON_NONE},
{PLA_MENU, BUTTON_REC, BUTTON_NONE},
{PLA_FIRE, BUTTON_SELECT, BUTTON_NONE},
{PLA_FIRE_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#else
#error pluginlib_actions: Unsupported keypad
#endif
{CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE}
};
const struct button_mapping generic_increase_decrease[] =
{
#ifdef HAVE_TOUCHSCREEN
{PLA_INC, BUTTON_TOPMIDDLE, BUTTON_NONE},
{PLA_DEC, BUTTON_BOTTOMMIDDLE, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE},
#endif
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) \
|| (CONFIG_KEYPAD == IRIVER_H300_PAD) \
|| (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \
|| (CONFIG_KEYPAD == GIGABEAT_PAD) \
|| (CONFIG_KEYPAD == RECORDER_PAD) \
|| (CONFIG_KEYPAD == ARCHOS_AV300_PAD) \
|| (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \
|| (CONFIG_KEYPAD == ONDIO_PAD) \
|| (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
|| (CONFIG_KEYPAD == MROBE100_PAD) \
|| (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) \
|| (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) \
|| (CONFIG_KEYPAD == SANSA_CLIP_PAD) \
|| (CONFIG_KEYPAD == CREATIVEZVM_PAD) \
|| (CONFIG_KEYPAD == SANSA_M200_PAD)
{PLA_INC, BUTTON_UP, BUTTON_NONE},
{PLA_DEC, BUTTON_DOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == SANSA_C200_PAD)
{PLA_INC, BUTTON_VOL_UP, BUTTON_NONE},
{PLA_DEC, BUTTON_VOL_DOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
|| (CONFIG_KEYPAD == IPOD_3G_PAD) \
|| (CONFIG_KEYPAD == IPOD_4G_PAD) \
|| (CONFIG_KEYPAD == SANSA_E200_PAD) \
|| (CONFIG_KEYPAD == SANSA_FUZE_PAD)
{PLA_INC, BUTTON_SCROLL_FWD, BUTTON_NONE},
{PLA_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == PLAYER_PAD
{PLA_INC, BUTTON_STOP, BUTTON_NONE},
{PLA_DEC, BUTTON_PLAY, BUTTON_NONE},
{PLA_CANCEL, BUTTON_MENU|BUTTON_SELECT, BUTTON_NONE },
{PLA_EXIT, BUTTON_PLAY|BUTTON_SELECT, BUTTON_NONE },
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE },
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
{PLA_CANCEL, BUTTON_POWER, BUTTON_NONE },
{PLA_EXIT, BUTTON_PLAY|BUTTON_SELECT, BUTTON_NONE },
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE },
{PLA_SELECT, BUTTON_RC_MODE, BUTTON_NONE },
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{PLA_SELECT_REL, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE },
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
{PLA_SELECT_REPEAT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE },
#elif (CONFIG_KEYPAD == GIGABEAT_PAD \
|| CONFIG_KEYPAD == SANSA_E200_PAD \
|| CONFIG_KEYPAD == SANSA_C200_PAD \
|| CONFIG_KEYPAD == SANSA_CLIP_PAD \
|| CONFIG_KEYPAD == SANSA_M200_PAD \
|| CONFIG_KEYPAD == MROBE100_PAD \
|| CONFIG_KEYPAD == PHILIPS_SA9200_PAD \
|| CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)
{PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
{PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
{PLA_CANCEL, BUTTON_BACK, BUTTON_NONE},
{PLA_EXIT, BUTTON_MENU, BUTTON_NONE},
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == RECORDER_PAD)
{PLA_CANCEL, BUTTON_ON, BUTTON_NONE},
{PLA_EXIT, BUTTON_OFF, BUTTON_NONE},
{PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
{PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == ARCHOS_AV300_PAD)
{PLA_CANCEL, BUTTON_OFF|BUTTON_REL, BUTTON_OFF},
{PLA_EXIT, BUTTON_OFF|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == ONDIO_PAD)
{PLA_CANCEL, BUTTON_OFF|BUTTON_REL, BUTTON_OFF},
{PLA_EXIT, BUTTON_OFF|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_MENU, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU},
{PLA_SELECT_REPEAT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == PLAYER_PAD)
{PLA_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU},
{PLA_EXIT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_ON, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_ON|BUTTON_REL, BUTTON_ON},
{PLA_SELECT_REPEAT, BUTTON_ON|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
{PLA_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME},
{PLA_EXIT, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
{PLA_INC, BUTTON_SCROLL_UP, BUTTON_NONE},
{PLA_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
{PLA_CANCEL, BUTTON_PREV, BUTTON_NONE},
{PLA_EXIT, BUTTON_POWER, BUTTON_NONE},
{PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
{PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
{PLA_CANCEL, BUTTON_EQ|BUTOTN_REL, BUTTON_EQ},
{PLA_EXIT, BUTTON_EQ|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == MROBE500_PAD)
{PLA_INC, BUTTON_RC_PLAY, BUTTON_NONE},
{PLA_DEC, BUTTON_RC_DOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
{PLA_INC, BUTTON_RC_VOL_UP, BUTTON_NONE},
{PLA_DEC, BUTTON_RC_VOL_DOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == COWON_D2_PAD
{PLA_INC, BUTTON_PLUS, BUTTON_NONE},
{PLA_DEC, BUTTON_MINUS, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == IAUDIO67_PAD
{PLA_INC, BUTTON_VOLUP, BUTTON_NONE},
{PLA_DEC, BUTTON_VOLDOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == ONDAVX747_PAD
{PLA_INC, BUTTON_VOL_UP, BUTTON_NONE},
{PLA_DEC, BUTTON_VOL_DOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == ONDAVX777_PAD
{PLA_INC, BUTTON_VOL_UP, BUTTON_NONE},
{PLA_DEC, BUTTON_VOL_DOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
{PLA_INC, BUTTON_UP, BUTTON_NONE},
{PLA_DEC, BUTTON_DOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_UP|BUTTON_REW, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_DOWN|BUTTON_REW, BUTTON_NONE},
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
{PLA_INC, BUTTON_UP, BUTTON_NONE},
{PLA_DEC, BUTTON_DOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_UP, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_DOWN, BUTTON_NONE},
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
{PLA_INC, BUTTON_VOL_UP, BUTTON_NONE},
{PLA_DEC, BUTTON_VOL_DOWN, BUTTON_NONE},
{PLA_INC_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
{PLA_DEC_REPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
{PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
{PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_RC_HEART, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_RC_HEART|BUTTON_REL, BUTTON_RC_HEART},
{PLA_SELECT_REPEAT, BUTTON_RC_HEART|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == COWON_D2_PAD)
{PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
{PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_MINUS, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_MINUS|BUTTON_REL, BUTTON_MINUS},
{PLA_SELECT_REPEAT, BUTTON_MINUS|BUTTON_MINUS, BUTTON_NONE},
#elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
{PLA_CANCEL, BUTTON_RC_REC|BUTTON_REL, BUTTON_RC_REC},
{PLA_EXIT, BUTTON_RC_REC|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_RC_MODE, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_RC_MODE|BUTTON_REL, BUTTON_RC_MODE},
{PLA_SELECT_REPEAT, BUTTON_RC_MODE|BUTTON_REPEAT, BUTTON_NONE},
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
{PLA_EXIT, BUTTON_POWER, BUTTON_NONE},
{PLA_CANCE BUTTON_MENU, BUTTON_NONE},
{PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
{PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
{PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
{PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
{PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT BUTTON_NONE},
#elif (CONFIG_KEYPAD == CREATIVEZVM_PAD)
{PLA_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK},
{PLA_EXIT, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == ONDAVX747_PAD)
{PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
{PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
{PLA_SELECT, BUTTON_VOL_UP, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_VOL_UP|BUTTON_REL, BUTTON_VOL_UP},
{PLA_SELECT_REPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
{PLA_CANCEL, BUTTON_REW, BUTTON_NONE},
{PLA_EXIT, BUTTON_FFWD, BUTTON_NONE},
{PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
{PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
{PLA_CANCEL, BUTTON_MENU, BUTTON_NONE},
{PLA_EXIT, BUTTON_REC, BUTTON_NONE},
{PLA_SELECT, BUTTON_OK, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_OK|BUTTON_REL, BUTTON_OK },
{PLA_SELECT_REPEAT, BUTTON_OK|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
{PLA_CANCEL, BUTTON_REC, BUTTON_NONE},
{PLA_EXIT, (BUTTON_REC|BUTTON_PLAY), BUTTON_NONE},
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#else
#error pluginlib_actions: Unsupported keypad
#error pluginlib_actions: No actions defined
#endif
{CONTEXT_PLUGIN,BUTTON_NONE,BUTTON_NONE}
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_PLUGIN),
};
static struct button_mapping **plugin_context_order;

View file

@ -38,27 +38,26 @@ enum {
PLA_LEFT_REPEAT,
PLA_RIGHT_REPEAT,
PLA_INC,
PLA_DEC,
PLA_INC_REPEAT,
PLA_DEC_REPEAT,
PLA_CANCEL,
PLA_EXIT,
PLA_SELECT,
PLA_SELECT_REL,
PLA_SELECT_REPEAT,
PLA_QUIT,
PLA_START,
PLA_MENU,
PLA_FIRE,
PLA_FIRE_REPEAT,
#ifdef HAVE_SCROLLWHEEL
PLA_SCROLL_FWD,
PLA_SCROLL_FWD_REPEAT,
PLA_SCROLL_BACK,
PLA_SCROLL_BACK_REPEAT,
#endif
LAST_PLUGINLIB_ACTION
};
#if defined(HAVE_REMOTE_LCD)
extern const struct button_mapping remote_directions[];
extern const struct button_mapping pla_remote_ctx[];
#endif
extern const struct button_mapping generic_directions[];
extern const struct button_mapping generic_left_right_fire[];
extern const struct button_mapping generic_actions[];
extern const struct button_mapping generic_increase_decrease[];
extern const struct button_mapping pla_main_ctx[];
int pluginlib_getaction(int timeout,
const struct button_mapping *plugin_contexts[],

View file

@ -37,56 +37,35 @@ PLUGIN_HEADER
/* key assignments */
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
# define MAZE_NEW (BUTTON_SELECT | BUTTON_REPEAT)
# define MAZE_NEW_PRE BUTTON_SELECT
# define MAZE_QUIT (BUTTON_SELECT | BUTTON_MENU)
# define MAZE_SOLVE (BUTTON_SELECT | BUTTON_PLAY)
# define MAZE_RIGHT BUTTON_RIGHT
# define MAZE_LEFT BUTTON_LEFT
# define MAZE_UP BUTTON_MENU
# define MAZE_DOWN BUTTON_PLAY
#elif (CONFIG_KEYPAD == IPOD_3G_PAD)
# define MAZE_NEW (BUTTON_SELECT | BUTTON_REPEAT)
# define MAZE_NEW_PRE BUTTON_SELECT
# define MAZE_QUIT BUTTON_MENU
# define MAZE_SOLVE (BUTTON_SELECT | BUTTON_PLAY)
# define MAZE_RIGHT BUTTON_RIGHT
# define MAZE_LEFT BUTTON_LEFT
# define MAZE_UP BUTTON_SCROLL_BACK
# define MAZE_DOWN BUTTON_SCROLL_FWD
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
# define MAZE_NEW (BUTTON_SELECT | BUTTON_REPEAT)
# define MAZE_QUIT (BUTTON_HOME | BUTTON_REPEAT)
# define MAZE_SOLVE BUTTON_SELECT
# define MAZE_RIGHT BUTTON_RIGHT
# define MAZE_LEFT BUTTON_LEFT
# define MAZE_UP BUTTON_UP
# define MAZE_DOWN BUTTON_DOWN
#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
# define MAZE_NEW (BUTTON_SELECT | BUTTON_REPEAT)
# define MAZE_QUIT BUTTON_POWER
# define MAZE_SOLVE BUTTON_SELECT
# define MAZE_RIGHT BUTTON_RIGHT
# define MAZE_LEFT BUTTON_LEFT
# define MAZE_UP BUTTON_UP
# define MAZE_DOWN BUTTON_DOWN
#if (CONFIG_KEYPAD == IPOD_3G_PAD)
# define MAZE_NEW (BUTTON_SELECT | BUTTON_REPEAT)
# define MAZE_NEW_PRE BUTTON_SELECT
# define MAZE_QUIT BUTTON_MENU
# define MAZE_SOLVE (BUTTON_SELECT | BUTTON_PLAY)
# define MAZE_RIGHT BUTTON_RIGHT
# define MAZE_RIGHT_REPEAT BUTTON_RIGHT|BUTTON_REPEAT
# define MAZE_LEFT BUTTON_LEFT
# define MAZE_LEFT_REPEAT BUTTON_LEFT|BUTTON_REPEAT
# define MAZE_UP BUTTON_SCROLL_BACK
# define MAZE_UP_REPEAT BUTTON_SCROLL_BACK|BUTTON_REPEAT
# define MAZE_DOWN BUTTON_SCROLL_FWD
# define MAZE_DOWN_REPEAT BUTTON_SCROLL_FWD|BUTTON_REPEAT
#else
# include "lib/pluginlib_actions.h"
# define MAZE_NEW PLA_START
# define MAZE_QUIT PLA_QUIT
# define MAZE_SOLVE PLA_FIRE
# define MAZE_RIGHT PLA_RIGHT
# define MAZE_LEFT PLA_LEFT
# define MAZE_UP PLA_UP
# define MAZE_DOWN PLA_DOWN
# define MAZE_NEW PLA_SELECT_REPEAT
# define MAZE_QUIT PLA_CANCEL
# define MAZE_SOLVE PLA_SELECT_REL
# define MAZE_RIGHT PLA_RIGHT
# define MAZE_RIGHT_REPEAT PLA_RIGHT_REPEAT
# define MAZE_LEFT PLA_LEFT
# define MAZE_LEFT_REPEAT PLA_LEFT_REPEAT
# define MAZE_UP PLA_UP
# define MAZE_UP_REPEAT PLA_UP_REPEAT
# define MAZE_DOWN PLA_DOWN
# define MAZE_DOWN_REPEAT PLA_DOWN_REPEAT
static const struct button_mapping *plugin_contexts[]
= {generic_directions, generic_actions};
= {pla_main_ctx};
#endif
@ -546,7 +525,8 @@ enum plugin_status plugin_start(const void* parameter)
while(!quit) {
#ifdef __PLUGINLIB_ACTIONS_H__
button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, 2);
button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts,
ARRAYLEN(plugin_contexts));
#else
button = rb->button_get(true);
#endif
@ -567,25 +547,25 @@ enum plugin_status plugin_start(const void* parameter)
maze_draw(&maze, rb->screens[i]);
break;
case MAZE_UP:
case (MAZE_UP|BUTTON_REPEAT):
case MAZE_UP_REPEAT:
maze_move_player_up(&maze);
FOR_NB_SCREENS(i)
maze_draw(&maze, rb->screens[i]);
break;
case MAZE_RIGHT:
case (MAZE_RIGHT|BUTTON_REPEAT):
case MAZE_RIGHT_REPEAT:
maze_move_player_right(&maze);
FOR_NB_SCREENS(i)
maze_draw(&maze, rb->screens[i]);
break;
case MAZE_DOWN:
case (MAZE_DOWN|BUTTON_REPEAT):
case MAZE_DOWN_REPEAT:
maze_move_player_down(&maze);
FOR_NB_SCREENS(i)
maze_draw(&maze, rb->screens[i]);
break;
case MAZE_LEFT:
case (MAZE_LEFT|BUTTON_REPEAT):
case MAZE_LEFT_REPEAT:
maze_move_player_left(&maze);
FOR_NB_SCREENS(i)
maze_draw(&maze, rb->screens[i]);

View file

@ -27,19 +27,7 @@
/* Include standard plugin macro */
PLUGIN_HEADER
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
# define MAZEZAM_MENU (BUTTON_SELECT | BUTTON_MENU)
# define MAZEZAM_RIGHT BUTTON_RIGHT
# define MAZEZAM_LEFT BUTTON_LEFT
# define MAZEZAM_UP BUTTON_MENU
# define MAZEZAM_DOWN BUTTON_PLAY
# define MAZEZAM_RIGHT_REPEAT (BUTTON_RIGHT|BUTTON_REPEAT)
# define MAZEZAM_LEFT_REPEAT (BUTTON_LEFT|BUTTON_REPEAT)
# define MAZEZAM_UP_REPEAT (BUTTON_MENU|BUTTON_REPEAT)
# define MAZEZAM_DOWN_REPEAT (BUTTON_PLAY|BUTTON_REPEAT)
#elif (CONFIG_KEYPAD == IPOD_3G_PAD)
#if (CONFIG_KEYPAD == IPOD_3G_PAD)
# define MAZEZAM_MENU BUTTON_MENU
# define MAZEZAM_RIGHT BUTTON_RIGHT
# define MAZEZAM_LEFT BUTTON_LEFT
@ -50,32 +38,9 @@ PLUGIN_HEADER
# define MAZEZAM_UP_REPEAT (BUTTON_SCROLL_BACK|BUTTON_REPEAT)
# define MAZEZAM_DOWN_REPEAT (BUTTON_SCROLL_FWD|BUTTON_REPEAT)
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
# define MAZEZAM_MENU (BUTTON_HOME | BUTTON_REPEAT)
# define MAZEZAM_RIGHT BUTTON_RIGHT
# define MAZEZAM_LEFT BUTTON_LEFT
# define MAZEZAM_UP BUTTON_UP
# define MAZEZAM_DOWN BUTTON_DOWN
# define MAZEZAM_RIGHT_REPEAT (BUTTON_RIGHT|BUTTON_REPEAT)
# define MAZEZAM_LEFT_REPEAT (BUTTON_LEFT|BUTTON_REPEAT)
# define MAZEZAM_UP_REPEAT (BUTTON_UP|BUTTON_REPEAT)
# define MAZEZAM_DOWN_REPEAT (BUTTON_DOWN|BUTTON_REPEAT)
#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
# define MAZEZAM_MENU BUTTON_POWER
# define MAZEZAM_SOLVE BUTTON_SELECT
# define MAZEZAM_RIGHT BUTTON_RIGHT
# define MAZEZAM_LEFT BUTTON_LEFT
# define MAZEZAM_UP BUTTON_UP
# define MAZEZAM_DOWN BUTTON_DOWN
# define MAZEZAM_RIGHT_REPEAT (BUTTON_RIGHT|BUTTON_REPEAT)
# define MAZEZAM_LEFT_REPEAT (BUTTON_LEFT|BUTTON_REPEAT)
# define MAZEZAM_UP_REPEAT (BUTTON_UP|BUTTON_REPEAT)
# define MAZEZAM_DOWN_REPEAT (BUTTON_DOWN|BUTTON_REPEAT)
#else
# include "lib/pluginlib_actions.h"
# define MAZEZAM_MENU PLA_QUIT
# define MAZEZAM_MENU PLA_CANCEL
# define MAZEZAM_RIGHT PLA_RIGHT
# define MAZEZAM_LEFT PLA_LEFT
# define MAZEZAM_UP PLA_UP
@ -85,7 +50,7 @@ PLUGIN_HEADER
# define MAZEZAM_UP_REPEAT PLA_UP_REPEAT
# define MAZEZAM_DOWN_REPEAT PLA_DOWN_REPEAT
const struct button_mapping *plugin_contexts[]
= {generic_directions, generic_actions};
= { pla_main_ctx };
#endif
/* All the text is here */
@ -586,7 +551,8 @@ static void level_loop(struct level_info* li, short* shift, short *x, short *y)
draw_level(li, shift, *x, *y);
rb->lcd_update();
#ifdef __PLUGINLIB_ACTIONS_H__
button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, 2);
button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts,
ARRAYLEN(plugin_contexts));
#else
button = rb->button_get(true);
#endif

View file

@ -608,62 +608,56 @@ static signed short sound[] = {
};
#endif
#define METRONOME_QUIT PLA_QUIT
#define METRONOME_VOL_UP PLA_INC
#define METRONOME_VOL_DOWN PLA_DEC
#define METRONOME_VOL_UP_REP PLA_INC_REPEAT
#define METRONOME_VOL_DOWN_REP PLA_DEC_REPEAT
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) \
|| (CONFIG_KEYPAD == SANSA_E200_PAD) || (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
#define MET_SYNC
#endif
#define METRONOME_QUIT PLA_EXIT
#ifdef HAVE_SCROLLWHEEL
#define METRONOME_VOL_UP PLA_SCROLL_FWD
#define METRONOME_VOL_UP_REP PLA_SCROLL_FWD_REPEAT
#define METRONOME_VOL_DOWN PLA_SCROLL_BACK
#define METRONOME_VOL_DOWN_REP PLA_SCROLL_BACK_REPEAT
#else
#define METRONOME_VOL_UP PLA_UP
#define METRONOME_VOL_DOWN PLA_DOWN
#define METRONOME_VOL_UP_REP PLA_UP_REPEAT
#define METRONOME_VOL_DOWN_REP PLA_DOWN_REPEAT
#endif
#define METRONOME_LEFT PLA_LEFT
#define METRONOME_RIGHT PLA_RIGHT
#define METRONOME_LEFT_REP PLA_LEFT_REPEAT
#define METRONOME_RIGHT_REP PLA_RIGHT_REPEAT
#define METRONOME_TAP PLA_SELECT_REL
#define METRONOME_PAUSE PLA_CANCEL
#define METRONOME_PLAY PLA_SELECT_REPEAT
#if defined(MET_SYNC)
enum {
METRONOME_PLAY_TAP = LAST_PLUGINLIB_ACTION+1,
#if CONFIG_KEYPAD == ONDIO_PAD
METRONOME_PAUSE,
#endif /* ONDIO_PAD */
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
METRONOME_SYNC
METRONOME_SYNC = LAST_PLUGINLIB_ACTION+1,
};
#endif /* IRIVER_H100_PAD||IRIVER_H300_PAD */
};
#if CONFIG_KEYPAD == ONDIO_PAD
#define METRONOME_TAP PLA_START
#define METRONOME_MSG_START "start: mode"
#define METRONOME_MSG_STOP "pause: hold mode"
static const struct button_mapping ondio_action[] =
{
{METRONOME_PLAY_TAP, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
{METRONOME_PAUSE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_PLUGIN)
};
#else /* !ONDIO_PAD */
#define METRONOME_TAP PLA_FIRE
#define METRONOME_PLAYPAUSE PLA_START
#define METRONOME_MSG_START "press play"
#define METRONOME_MSG_STOP "press pause"
#define METRONOME_MSG_START "start: press select"
#define METRONOME_MSG_STOP "start: hold select"
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
#define MET_SYNC
#ifdef MET_SYNC
static const struct button_mapping iriver_syncaction[] =
{
{METRONOME_SYNC, BUTTON_REC, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_PLUGIN)
};
#endif /* IRIVER_H100_PAD||IRIVER_H300_PAD */
#endif /* #if CONFIG_KEYPAD == ONDIO_PAD */
const struct button_mapping *plugin_contexts[] =
{
generic_increase_decrease,
generic_directions,
#if CONFIG_KEYPAD == ONDIO_PAD
ondio_action,
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
pla_main_ctx,
#if defined(MET_SYNC)
iriver_syncaction,
#endif
generic_actions
};
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
@ -890,6 +884,7 @@ void tap(void)
enum plugin_status plugin_start(const void* parameter)
{
int button;
static int last_button = BUTTON_NONE;
enum plugin_status status;
(void)parameter;
@ -918,7 +913,7 @@ enum plugin_status plugin_start(const void* parameter)
while (true){
reset_tap = true;
#if CONFIG_CODEC == SWCODEC
button = pluginlib_getaction(1,plugin_contexts,PLA_ARRAY_COUNT);
button = pluginlib_getaction(TIMEOUT_NOBLOCK,plugin_contexts,PLA_ARRAY_COUNT);
if (need_to_play)
{
need_to_play = false;
@ -936,35 +931,25 @@ enum plugin_status plugin_start(const void* parameter)
status = PLUGIN_OK;
goto metronome_exit;
#if CONFIG_KEYPAD == ONDIO_PAD
case METRONOME_PLAY_TAP:
if(sound_paused) {
case METRONOME_PAUSE:
if(!sound_paused)
{
sound_paused = true;
draw_display();
}
break;
case METRONOME_PLAY:
if(sound_paused)
{
sound_paused = false;
calc_period();
draw_display();
}
else
break;
case METRONOME_TAP:
if (last_button != METRONOME_PLAY)
tap();
break;
case METRONOME_PAUSE:
if(!sound_paused) {
sound_paused = true;
draw_display();
}
break;
#else
case METRONOME_PLAYPAUSE:
if(sound_paused)
sound_paused = false;
else
sound_paused = true;
calc_period();
draw_display();
break;
#endif /* ONDIO_PAD */
case METRONOME_VOL_UP:
case METRONOME_VOL_UP_REP:
change_volume(1);
@ -989,12 +974,6 @@ enum plugin_status plugin_start(const void* parameter)
change_bpm(1);
break;
#ifdef METRONOME_TAP
case METRONOME_TAP:
tap();
break;
#endif
#ifdef MET_SYNC
case METRONOME_SYNC:
minitick = period;
@ -1012,6 +991,8 @@ enum plugin_status plugin_start(const void* parameter)
break;
}
if (button)
last_button = button;
if (reset_tap) {
tap_count = 0;
}

View file

@ -413,11 +413,9 @@ void save_settings(void)
/* Keymaps */
const struct button_mapping* plugin_contexts[]={
generic_actions,
generic_increase_decrease,
generic_directions,
pla_main_ctx,
#if NB_SCREENS == 2
remote_directions
pla_remote_ctx,
#endif
};
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
@ -1040,11 +1038,11 @@ void record_and_get_pitch(void)
switch(button)
{
case PLA_QUIT:
case PLA_EXIT:
quit=true;
break;
case PLA_MENU:
case PLA_CANCEL:
rb->pcm_stop_recording();
quit = main_menu() != 0;
if(!quit)

View file

@ -469,47 +469,7 @@ static char* messages[] =
#define RFK_VERSION "v1.4142135.406"
/* Button definitions stolen from maze.c */
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
# undef __PLUGINLIB_ACTIONS_H__
# define RFK_QUIT (BUTTON_SELECT | BUTTON_MENU)
# define RFK_RIGHT BUTTON_RIGHT
# define RFK_LEFT BUTTON_LEFT
# define RFK_UP BUTTON_MENU
# define RFK_DOWN BUTTON_PLAY
# define RFK_RRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
# define RFK_RLEFT (BUTTON_LEFT | BUTTON_REPEAT)
# define RFK_RUP (BUTTON_MENU | BUTTON_REPEAT)
# define RFK_RDOWN (BUTTON_PLAY | BUTTON_REPEAT)
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
# undef __PLUGINLIB_ACTIONS_H__
# define RFK_QUIT (BUTTON_HOME|BUTTON_REPEAT)
# define RFK_RIGHT BUTTON_RIGHT
# define RFK_LEFT BUTTON_LEFT
# define RFK_UP BUTTON_UP
# define RFK_DOWN BUTTON_DOWN
# define RFK_RRIGHT (BUTTON_RIGHT | BUTTON_REPEAT)
# define RFK_RLEFT (BUTTON_LEFT | BUTTON_REPEAT)
# define RFK_RUP (BUTTON_UP | BUTTON_REPEAT)
# define RFK_RDOWN (BUTTON_DOWN | BUTTON_REPEAT)
#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
# undef __PLUGINLIB_ACTIONS_H__
# define RFK_QUIT (BUTTON_REC|BUTTON_REPEAT)
# define RFK_RIGHT BUTTON_RIGHT
# define RFK_LEFT BUTTON_LEFT
# define RFK_UP BUTTON_UP
# define RFK_DOWN BUTTON_DOWN
# define RFK_RRIGHT (BUTTON_PLAY | BUTTON_RIGHT)
# define RFK_RLEFT (BUTTON_PLAY | BUTTON_LEFT)
# define RFK_RUP (BUTTON_PLAY | BUTTON_UP)
# define RFK_RDOWN (BUTTON_PLAY | BUTTON_DOWN)
#else
# define RFK_QUIT PLA_QUIT
# define RFK_QUIT PLA_CANCEL
# define RFK_RIGHT PLA_RIGHT
# define RFK_LEFT PLA_LEFT
# define RFK_UP PLA_UP
@ -519,7 +479,6 @@ static char* messages[] =
# define RFK_RUP PLA_UP_REPEAT
# define RFK_RDOWN PLA_DOWN_REPEAT
#endif
/*Constants for our internal representation of the screen.*/
#define EMPTY -1
#define ROBOT 0
@ -677,9 +636,7 @@ static void play_game()
int old_x = robot.x;
int old_y = robot.y;
int input = BUTTON_NONE;
#ifdef __PLUGINLIB_ACTIONS_H__
const struct button_mapping *plugin_contexts[] = {generic_directions, generic_actions};
#endif
const struct button_mapping *plugin_contexts[] = {pla_main_ctx};
while (input != RFK_QUIT && exit_rfk == false)
{
@ -700,11 +657,8 @@ static void play_game()
old_x = robot.x;
old_y = robot.y;
}
#ifdef __PLUGINLIB_ACTIONS_H__
input = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, 2);
#else
input = rb->button_get(true);
#endif
input = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts,
ARRAYLEN(plugin_contexts));
}
message("Bye!");
refresh();

View file

@ -66,11 +66,11 @@
PLUGIN_HEADER
#define ROCKLIFE_PLAY_PAUSE PLA_FIRE
#define ROCKLIFE_PLAY_PAUSE PLA_SELECT
#define ROCKLIFE_INIT PLA_DOWN
#define ROCKLIFE_NEXT PLA_RIGHT
#define ROCKLIFE_NEXT_REP PLA_RIGHT_REPEAT
#define ROCKLIFE_QUIT PLA_QUIT
#define ROCKLIFE_QUIT PLA_CANCEL
#define ROCKLIFE_STATUS PLA_LEFT
#define PATTERN_RANDOM 0
@ -80,7 +80,7 @@ PLUGIN_HEADER
#define PATTERN_GLIDER_GUN 4
const struct button_mapping *plugin_contexts[]
= {generic_directions, generic_actions};
= {pla_main_ctx};
#define GRID_W LCD_WIDTH
#define GRID_H LCD_HEIGHT
@ -512,7 +512,7 @@ enum plugin_status plugin_start(const void* parameter)
show_grid(pgrid);
while(!quit) {
button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, 2);
button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts, ARRAYLEN(plugin_contexts));
switch(button) {
case ROCKLIFE_NEXT:
case ROCKLIFE_NEXT_REP:
@ -537,7 +537,7 @@ enum plugin_status plugin_start(const void* parameter)
/* show new generation */
rb->yield();
show_grid(pgrid);
button = pluginlib_getaction(0, plugin_contexts, 2);
button = pluginlib_getaction(0, plugin_contexts, ARRAYLEN(plugin_contexts));
switch(button) {
case ROCKLIFE_PLAY_PAUSE:
case ROCKLIFE_QUIT:

View file

@ -33,7 +33,6 @@ PLUGIN_HEADER
const struct button_mapping *plugin_contexts[]
= {generic_actions, generic_directions};
#define NB_ACTION_CONTEXTS sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
/* Key assignement */
#define SIZE_INCREASE PLA_UP
@ -46,8 +45,8 @@ const struct button_mapping *plugin_contexts[]
#define WIDTH_DECREASE PLA_LEFT
#define WIDTH_DECREASE_REPEAT PLA_LEFT_REPEAT
#define BUTTON_QUIT PLA_QUIT
#define CHANGE_MODE PLA_MENU
#define BUTTON_QUIT PLA_CANCEL
#define CHANGE_MODE PLA_SELECT
#define MAX_OUTPUT_WIDTH LCD_WIDTH
#define MAX_OUTPUT_HEIGHT LCD_HEIGHT
@ -110,8 +109,8 @@ enum plugin_status plugin_start(const void* parameter)
output_bmp.height);
rb->lcd_update();
button = pluginlib_getaction(HZ,
plugin_contexts, NB_ACTION_CONTEXTS);
button = pluginlib_getaction(HZ, plugin_contexts,
ARRAYLEN(plugin_contexts));
switch (button) {
case BUTTON_QUIT:
return PLUGIN_OK;