forked from len0rd/rockbox
add playback control to more menu of plugins.
although it doesn't make much sense for some plugins like dice as the menu is only shown when you start that plugin. change star plugin to go back to menu when exit game instead of closing plugin so that above change makes useful. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22171 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
eac0a5b840
commit
e2e7ecf350
9 changed files with 106 additions and 57 deletions
|
@ -24,6 +24,7 @@
|
||||||
#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
|
#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
|
||||||
|
|
||||||
#include <timefuncs.h>
|
#include <timefuncs.h>
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -620,7 +621,8 @@ static bool edit_memo(int change, struct shown *shown)
|
||||||
MENUITEM_STRINGLIST(edit_menu, "Edit menu", edit_menu_cb,
|
MENUITEM_STRINGLIST(edit_menu, "Edit menu", edit_menu_cb,
|
||||||
"Remove", "Edit",
|
"Remove", "Edit",
|
||||||
"New Weekly", "New Monthly",
|
"New Weekly", "New Monthly",
|
||||||
"New Yearly", "New One off");
|
"New Yearly", "New One off",
|
||||||
|
"Playback Control");
|
||||||
|
|
||||||
while (!exit)
|
while (!exit)
|
||||||
{
|
{
|
||||||
|
@ -652,6 +654,10 @@ static bool edit_memo(int change, struct shown *shown)
|
||||||
add_memo(shown,3);
|
add_memo(shown,3);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
case 6: /* playback control */
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
case GO_TO_PREVIOUS:
|
case GO_TO_PREVIOUS:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -524,7 +525,8 @@ static int run_timer(int nr)
|
||||||
{
|
{
|
||||||
MENUITEM_STRINGLIST(menu, "Menu", NULL,
|
MENUITEM_STRINGLIST(menu, "Menu", NULL,
|
||||||
"Delete player", "Restart round",
|
"Delete player", "Restart round",
|
||||||
"Set round time", "Set total time");
|
"Set round time", "Set total time",
|
||||||
|
"Playback Control");
|
||||||
|
|
||||||
int val, res;
|
int val, res;
|
||||||
switch(rb->do_menu(&menu, NULL, NULL, false))
|
switch(rb->do_menu(&menu, NULL, NULL, false))
|
||||||
|
@ -544,8 +546,7 @@ static int run_timer(int nr)
|
||||||
/* set round time */
|
/* set round time */
|
||||||
val=(max_ticks-ticks)/HZ;
|
val=(max_ticks-ticks)/HZ;
|
||||||
res=chessclock_set_int("Round time",
|
res=chessclock_set_int("Round time",
|
||||||
&val,
|
&val, 10, 0, MAX_TIME,
|
||||||
10, 0, MAX_TIME,
|
|
||||||
FLAGS_SET_INT_SECONDS);
|
FLAGS_SET_INT_SECONDS);
|
||||||
if (res==CHCL_USB) {
|
if (res==CHCL_USB) {
|
||||||
retval = CHCL_USB;
|
retval = CHCL_USB;
|
||||||
|
@ -569,6 +570,9 @@ static int run_timer(int nr)
|
||||||
timer_holder[nr].total_time=val;
|
timer_holder[nr].total_time=val;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
case MENU_ATTACHED_USB:
|
case MENU_ATTACHED_USB:
|
||||||
retval = CHCL_USB;
|
retval = CHCL_USB;
|
||||||
done=true;
|
done=true;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "lib/pluginlib_actions.h"
|
#include "lib/pluginlib_actions.h"
|
||||||
#include "lib/configfile.h"
|
#include "lib/configfile.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
#define MAX_DICES 12
|
#define MAX_DICES 12
|
||||||
#define INITIAL_NB_DICES 1
|
#define INITIAL_NB_DICES 1
|
||||||
|
@ -171,8 +172,10 @@ bool dice_menu(struct dices * dice) {
|
||||||
int selection;
|
int selection;
|
||||||
bool menu_quit = false, result = false;
|
bool menu_quit = false, result = false;
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu,"Dice Menu",NULL,"Roll Dice","Number of Dice",
|
MENUITEM_STRINGLIST(menu, "Dice Menu", NULL,
|
||||||
"Number of Sides","Quit");
|
"Roll Dice",
|
||||||
|
"Number of Dice", "Number of Sides",
|
||||||
|
"Playback Control", "Quit");
|
||||||
|
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
|
@ -194,6 +197,10 @@ bool dice_menu(struct dices * dice) {
|
||||||
dice->nb_sides=nb_sides_values[sides_index];
|
dice->nb_sides=nb_sides_values[sides_index];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
menu_quit = true;
|
menu_quit = true;
|
||||||
result = false;
|
result = false;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
#include "lib/md5.h"
|
#include "lib/md5.h"
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -30,7 +31,6 @@ PLUGIN_HEADER
|
||||||
/* The header begins with the unencrypted salt (4 bytes) padded with 4 bytes of
|
/* The header begins with the unencrypted salt (4 bytes) padded with 4 bytes of
|
||||||
zeroes. After that comes the encrypted hash of the master password (16 bytes) */
|
zeroes. After that comes the encrypted hash of the master password (16 bytes) */
|
||||||
|
|
||||||
|
|
||||||
#define HEADER_LEN 24
|
#define HEADER_LEN 24
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -106,9 +106,10 @@ static void decrypt(uint32_t* v, uint32_t* k)
|
||||||
|
|
||||||
static int context_item_cb(int action, const struct menu_item_ex *this_item)
|
static int context_item_cb(int action, const struct menu_item_ex *this_item)
|
||||||
{
|
{
|
||||||
|
int i = (intptr_t)this_item;
|
||||||
if (action == ACTION_REQUEST_MENUITEM
|
if (action == ACTION_REQUEST_MENUITEM
|
||||||
&& pw_list.num_entries == 0
|
&& pw_list.num_entries == 0
|
||||||
&& ((intptr_t)this_item) != 0)
|
&& (i != 0 && i != 5))
|
||||||
{
|
{
|
||||||
return ACTION_EXIT_MENUITEM;
|
return ACTION_EXIT_MENUITEM;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +119,8 @@ static int context_item_cb(int action, const struct menu_item_ex *this_item)
|
||||||
MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb,
|
MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb,
|
||||||
"Add entry",
|
"Add entry",
|
||||||
"Edit title", "Edit user name", "Edit password",
|
"Edit title", "Edit user name", "Edit password",
|
||||||
"Delete entry")
|
"Delete entry",
|
||||||
|
"Playback Control");
|
||||||
|
|
||||||
static char * kb_list_cb(int selected_item, void *data,
|
static char * kb_list_cb(int selected_item, void *data,
|
||||||
char *buffer, size_t buffer_len)
|
char *buffer, size_t buffer_len)
|
||||||
|
@ -289,6 +291,9 @@ static void context_menu(int selected_item)
|
||||||
case 4:
|
case 4:
|
||||||
delete_entry(selected_item);
|
delete_entry(selected_item);
|
||||||
return;
|
return;
|
||||||
|
case 5:
|
||||||
|
playback_control(NULL);
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
|
@ -610,8 +615,9 @@ static int main_menu(void)
|
||||||
int selection, result, ret;
|
int selection, result, ret;
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu,"Keybox", NULL, "Enter Keybox",
|
MENUITEM_STRINGLIST(menu, "Keybox", NULL,
|
||||||
"Reset Keybox", "Exit");
|
"Enter Keybox", "Reset Keybox",
|
||||||
|
"Playback Control", "Exit");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
result = rb->do_menu(&menu, &selection, NULL, false);
|
result = rb->do_menu(&menu, &selection, NULL, false);
|
||||||
|
@ -625,6 +631,9 @@ static int main_menu(void)
|
||||||
reset();
|
reset();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -888,6 +888,7 @@ static void main_menu(void)
|
||||||
MENUITEM_STRINGLIST(menu,MAZEZAM_TEXT_MAIN_MENU,main_menu_cb,
|
MENUITEM_STRINGLIST(menu,MAZEZAM_TEXT_MAIN_MENU,main_menu_cb,
|
||||||
MAZEZAM_TEXT_CONTINUE,
|
MAZEZAM_TEXT_CONTINUE,
|
||||||
MAZEZAM_TEXT_PLAY_NEW_GAME,
|
MAZEZAM_TEXT_PLAY_NEW_GAME,
|
||||||
|
MAZEZAM_TEXT_AUDIO_PLAYBACK,
|
||||||
MAZEZAM_TEXT_QUIT);
|
MAZEZAM_TEXT_QUIT);
|
||||||
|
|
||||||
while (state >= STATE_IN_APPLICATION) {
|
while (state >= STATE_IN_APPLICATION) {
|
||||||
|
@ -906,6 +907,10 @@ static void main_menu(void)
|
||||||
game_loop(&r_data);
|
game_loop(&r_data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 2: /* Audio playback */
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_ATTACHED_USB:
|
case MENU_ATTACHED_USB:
|
||||||
state = STATE_USB_CONNECTED;
|
state = STATE_USB_CONNECTED;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "pacbox.h"
|
#include "pacbox.h"
|
||||||
#include "pacbox_lcd.h"
|
#include "pacbox_lcd.h"
|
||||||
#include "lib/configfile.h"
|
#include "lib/configfile.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
PLUGIN_IRAM_DECLARE
|
PLUGIN_IRAM_DECLARE
|
||||||
|
@ -174,7 +175,8 @@ static bool pacbox_menu(void)
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu, "Pacbox Menu", NULL,
|
MENUITEM_STRINGLIST(menu, "Pacbox Menu", NULL,
|
||||||
"Difficulty", "Pacmen Per Game", "Bonus Life",
|
"Difficulty", "Pacmen Per Game", "Bonus Life",
|
||||||
"Ghost Names", "Display FPS", "Restart", "Quit");
|
"Ghost Names", "Display FPS",
|
||||||
|
"Playback Control", "Restart", "Quit");
|
||||||
|
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
||||||
|
@ -223,7 +225,10 @@ static bool pacbox_menu(void)
|
||||||
rb->set_option("Display FPS",&settings.showfps,INT,
|
rb->set_option("Display FPS",&settings.showfps,INT,
|
||||||
noyes, 2, NULL);
|
noyes, 2, NULL);
|
||||||
break;
|
break;
|
||||||
case 5: /* Restart */
|
case 5: /* playback control */
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
case 6: /* Restart */
|
||||||
need_restart=true;
|
need_restart=true;
|
||||||
menu_quit=1;
|
menu_quit=1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "lib/pluginlib_bmp.h"
|
#include "lib/pluginlib_bmp.h"
|
||||||
#include "lib/rgb_hsv.h"
|
#include "lib/rgb_hsv.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -533,6 +534,7 @@ enum {
|
||||||
MAIN_MENU_NEW, MAIN_MENU_LOAD, MAIN_MENU_SAVE,
|
MAIN_MENU_NEW, MAIN_MENU_LOAD, MAIN_MENU_SAVE,
|
||||||
MAIN_MENU_BRUSH_SIZE, MAIN_MENU_BRUSH_SPEED, MAIN_MENU_COLOR,
|
MAIN_MENU_BRUSH_SIZE, MAIN_MENU_BRUSH_SPEED, MAIN_MENU_COLOR,
|
||||||
MAIN_MENU_GRID_SIZE,
|
MAIN_MENU_GRID_SIZE,
|
||||||
|
MAIN_MENU_PLAYBACK_CONTROL,
|
||||||
MAIN_MENU_EXIT,
|
MAIN_MENU_EXIT,
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
|
@ -551,7 +553,8 @@ enum {
|
||||||
MENUITEM_STRINGLIST(main_menu, "RockPaint", NULL,
|
MENUITEM_STRINGLIST(main_menu, "RockPaint", NULL,
|
||||||
"Resume", "New", "Load", "Save",
|
"Resume", "New", "Load", "Save",
|
||||||
"Brush Size", "Brush Speed",
|
"Brush Size", "Brush Speed",
|
||||||
"Choose Color", "Grid Size", "Exit");
|
"Choose Color", "Grid Size",
|
||||||
|
"Playback Control", "Exit");
|
||||||
MENUITEM_STRINGLIST(size_menu, "Choose Size", NULL,
|
MENUITEM_STRINGLIST(size_menu, "Choose Size", NULL,
|
||||||
"1x", "2x","4x", "8x");
|
"1x", "2x","4x", "8x");
|
||||||
MENUITEM_STRINGLIST(speed_menu, "Choose Speed", NULL,
|
MENUITEM_STRINGLIST(speed_menu, "Choose Speed", NULL,
|
||||||
|
@ -2527,6 +2530,10 @@ static void goto_menu(void)
|
||||||
gridsize = gridsize_list[multi];
|
gridsize = gridsize_list[multi];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MAIN_MENU_PLAYBACK_CONTROL:
|
||||||
|
playback_control( NULL );
|
||||||
|
break;
|
||||||
|
|
||||||
case MAIN_MENU_EXIT:
|
case MAIN_MENU_EXIT:
|
||||||
restore_screen();
|
restore_screen();
|
||||||
quit=true;
|
quit=true;
|
||||||
|
|
|
@ -34,6 +34,7 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left;
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -447,8 +448,9 @@ void game_init(void) {
|
||||||
score=0;
|
score=0;
|
||||||
board[11][7]=1;
|
board[11][7]=1;
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu,"Snake Menu",NULL,"Start New Game","Starting Level",
|
MENUITEM_STRINGLIST(menu, "Snake Menu", NULL,
|
||||||
"Quit");
|
"Start New Game", "Starting Level",
|
||||||
|
"Playback Control", "Quit");
|
||||||
|
|
||||||
while (!menu_quit) {
|
while (!menu_quit) {
|
||||||
switch(rb->do_menu(&menu, &selection, NULL, false))
|
switch(rb->do_menu(&menu, &selection, NULL, false))
|
||||||
|
@ -462,6 +464,10 @@ void game_init(void) {
|
||||||
1, 1, 9, NULL );
|
1, 1, 9, NULL );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dead=1; /* quit program */
|
dead=1; /* quit program */
|
||||||
menu_quit = true;
|
menu_quit = true;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "lib/display_text.h"
|
#include "lib/display_text.h"
|
||||||
|
#include "lib/playback_control.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
|
@ -424,8 +425,6 @@ static char board[STAR_HEIGHT][STAR_WIDTH];
|
||||||
#define STAR 3
|
#define STAR 3
|
||||||
#define BALL 4
|
#define BALL 4
|
||||||
|
|
||||||
#define MENU_START 0
|
|
||||||
|
|
||||||
/* char font size */
|
/* char font size */
|
||||||
static int char_width = -1;
|
static int char_width = -1;
|
||||||
static int char_height = -1;
|
static int char_height = -1;
|
||||||
|
@ -1051,18 +1050,21 @@ static int star_menu(void)
|
||||||
{
|
{
|
||||||
int selection, level=1;
|
int selection, level=1;
|
||||||
bool menu_quit = false;
|
bool menu_quit = false;
|
||||||
/* get the size of char */
|
|
||||||
rb->lcd_getstringsize("a", &char_width, &char_height);
|
|
||||||
|
|
||||||
MENUITEM_STRINGLIST(menu,"Star Menu",NULL,"Start Game","Choose Level",
|
MENUITEM_STRINGLIST(menu, "Star Menu", NULL,
|
||||||
"Help", "Quit");
|
"Start Game","Choose Level",
|
||||||
|
"Help", "Playback Control", "Quit");
|
||||||
|
|
||||||
while(!menu_quit)
|
while(!menu_quit)
|
||||||
{
|
{
|
||||||
switch(rb->do_menu(&menu, &selection, NULL, false))
|
switch(rb->do_menu(&menu, &selection, NULL, false))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
menu_quit = true;
|
/* use system font and get the size of char */
|
||||||
|
rb->lcd_setfont(FONT_SYSFIXED);
|
||||||
|
rb->lcd_getstringsize("a", &char_width, &char_height);
|
||||||
|
star_run_game(level-1);
|
||||||
|
rb->lcd_setfont(FONT_UI);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
rb->set_int("Level", "", UNIT_INT, &level,
|
rb->set_int("Level", "", UNIT_INT, &level,
|
||||||
|
@ -1072,19 +1074,17 @@ static int star_menu(void)
|
||||||
if(star_help())
|
if(star_help())
|
||||||
usb_detected = true;
|
usb_detected = true;
|
||||||
break;
|
break;
|
||||||
default:
|
case 3:
|
||||||
|
playback_control(NULL);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
menu_quit = true;
|
menu_quit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(usb_detected)
|
||||||
|
return PLUGIN_USB_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selection == MENU_START)
|
|
||||||
{
|
|
||||||
rb->lcd_setfont(FONT_SYSFIXED);
|
|
||||||
rb->lcd_getstringsize("a", &char_width, &char_height);
|
|
||||||
level--;
|
|
||||||
star_run_game(level);
|
|
||||||
}
|
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue