1
0
Fork 0
forked from len0rd/rockbox

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

@ -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();