forked from len0rd/rockbox
make sure plugin reset backlight setting before exit. do code polish.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24076 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
3e2aba0c3e
commit
dc010201a5
9 changed files with 73 additions and 71 deletions
|
|
@ -64,7 +64,7 @@ rockblox1d.c
|
|||
brickmania.c
|
||||
calendar.c
|
||||
maze.c
|
||||
mazezam.c
|
||||
mazezam.c
|
||||
text_editor.c
|
||||
wavview.c
|
||||
robotfindskitten.c
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ enum {
|
|||
#define BJACK_LEFT BUTTON_LEFT
|
||||
|
||||
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
||||
#define BJACK_SELECT_NAME "PLAY"
|
||||
#define BJACK_SELECT_NAME "SELECT"
|
||||
#define BJACK_STAY_NAME "REC"
|
||||
#define BJACK_RESUME_NAME "DOWN"
|
||||
#define BJACK_QUIT_NAME "POWER"
|
||||
|
|
|
|||
|
|
@ -208,20 +208,20 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
x = 2*GFX_WIDTH-x;
|
||||
sx=-sx;
|
||||
}
|
||||
|
||||
|
||||
if (x<0)
|
||||
{
|
||||
x = -x;
|
||||
sx = -sx;
|
||||
}
|
||||
|
||||
|
||||
y+=sy;
|
||||
if (y>GFX_HEIGHT)
|
||||
{
|
||||
y = 2*GFX_HEIGHT-y;
|
||||
sy=-sy;
|
||||
}
|
||||
|
||||
|
||||
if (y<0)
|
||||
{
|
||||
y = -y;
|
||||
|
|
@ -235,7 +235,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
MYLCD(update)();
|
||||
|
||||
rb->sleep(HZ/timer);
|
||||
|
||||
|
||||
button = rb->button_get(false);
|
||||
switch (button)
|
||||
{
|
||||
|
|
@ -254,7 +254,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
if (timer>20)
|
||||
timer=5;
|
||||
break;
|
||||
|
||||
|
||||
case MOSAIQUE_RESTART:
|
||||
|
||||
sx = rb->rand() % (GFX_HEIGHT/2) + 1;
|
||||
|
|
@ -278,5 +278,3 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -676,7 +676,7 @@ static void play_game()
|
|||
{
|
||||
int old_x = robot.x;
|
||||
int old_y = robot.y;
|
||||
int input = 0; /* Not sure what a reasonable initial value is */
|
||||
int input = BUTTON_NONE;
|
||||
#ifdef __PLUGINLIB_ACTIONS_H__
|
||||
const struct button_mapping *plugin_contexts[] = {generic_directions, generic_actions};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ static bool load_cellfile(const char *file, char *pgrid){
|
|||
fd = rb->open(file, O_RDONLY);
|
||||
if (fd<0)
|
||||
return false;
|
||||
|
||||
|
||||
init_grid(pgrid);
|
||||
|
||||
char c;
|
||||
|
|
@ -143,7 +143,7 @@ static bool load_cellfile(const char *file, char *pgrid){
|
|||
ymid = (GRID_H>>1) - 2;
|
||||
comment = false;
|
||||
|
||||
while (true) {
|
||||
while (true) {
|
||||
nc = rb->read(fd, &c, 1);
|
||||
if (nc <= 0)
|
||||
break;
|
||||
|
|
@ -343,7 +343,7 @@ static inline bool check_cell(unsigned char *n)
|
|||
|
||||
/* now we build the number of non-zero neighbours :-P */
|
||||
alive_cells = 8 - empty_cells;
|
||||
|
||||
|
||||
if (n[4]) {
|
||||
/* If the cell is alive, it stays alive iff it has 2 or 3 alive neighbours */
|
||||
result = (alive_cells==2 || alive_cells==3);
|
||||
|
|
@ -468,6 +468,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
int button = 0;
|
||||
int quit = 0;
|
||||
int stop = 0;
|
||||
int usb = 0;
|
||||
int pattern = 0;
|
||||
char *pgrid;
|
||||
char *pnext_grid;
|
||||
|
|
@ -488,8 +489,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
pgrid = (char *)grid_a;
|
||||
pnext_grid = (char *)grid_b;
|
||||
|
||||
init_grid(pgrid);
|
||||
|
||||
init_grid(pgrid);
|
||||
|
||||
if( parameter == NULL )
|
||||
{
|
||||
|
|
@ -544,6 +544,11 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
stop = 1;
|
||||
break;
|
||||
default:
|
||||
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
||||
stop = 1;
|
||||
quit = 1;
|
||||
usb = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
rb->yield();
|
||||
|
|
@ -562,12 +567,12 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
break;
|
||||
case ROCKLIFE_QUIT:
|
||||
/* quit plugin */
|
||||
quit=true;
|
||||
return PLUGIN_OK;
|
||||
quit = 1;
|
||||
break;
|
||||
default:
|
||||
if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
|
||||
return PLUGIN_USB_CONNECTED;
|
||||
quit = 1;
|
||||
usb = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -575,5 +580,5 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
}
|
||||
|
||||
backlight_use_settings(); /* backlight control in lib/helper.c */
|
||||
return PLUGIN_OK;
|
||||
return usb? PLUGIN_USB_CONNECTED: PLUGIN_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -482,8 +482,6 @@ int plugin_main(void)
|
|||
#endif
|
||||
case(STARFIELD_QUIT):
|
||||
case(SYS_USB_CONNECTED):
|
||||
/* Turn on backlight timeout (revert to settings) */
|
||||
backlight_use_settings(); /* backlight control in lib/helper.c*/
|
||||
return PLUGIN_OK;
|
||||
break;
|
||||
}
|
||||
|
|
@ -502,6 +500,9 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
|
||||
ret = plugin_main();
|
||||
|
||||
/* Turn on backlight timeout (revert to settings) */
|
||||
backlight_use_settings(); /* backlight control in lib/helper.c*/
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ char* _do_action(int action, char* str, int line)
|
|||
break;
|
||||
case ACTION_REMOVE:
|
||||
if (line > line_count)
|
||||
return 0;
|
||||
return NULL;
|
||||
len = rb->strlen(&buffer[c])+1;
|
||||
rb->memmove(&buffer[c],&buffer[c+len],char_count-c-len);
|
||||
char_count -= len;
|
||||
|
|
@ -225,7 +225,7 @@ enum {
|
|||
};
|
||||
int do_item_menu(int cur_sel, char* copy_buffer)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret = MENU_RET_NO_UPDATE;
|
||||
MENUITEM_STRINGLIST(menu, "Line Options", NULL,
|
||||
"Cut/Delete", "Copy",
|
||||
"Insert Above", "Insert Below",
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
/***************************************************************************
|
||||
*
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 Gilles Roux, 2003 Garrett Derner
|
||||
*
|
||||
|
|
@ -432,7 +431,6 @@ struct preferences {
|
|||
} scroll_mode;
|
||||
|
||||
int autoscroll_speed;
|
||||
|
||||
};
|
||||
|
||||
struct preferences prefs;
|
||||
|
|
@ -1226,7 +1224,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same
|
|||
int settings_fd, i;
|
||||
struct bookmark_file_data *data;
|
||||
struct bookmarked_file_info this_bookmark;
|
||||
|
||||
|
||||
/* read settings file */
|
||||
settings_fd=rb->open(SETTINGS_FILE, O_RDONLY);
|
||||
if ((settings_fd >= 0) && (rb->filesize(settings_fd) == sizeof(struct preferences)))
|
||||
|
|
@ -1271,7 +1269,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same
|
|||
file_pos = screen_pos - screen_top;
|
||||
screen_top_ptr = buffer + screen_top;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this_bookmark.file_position = file_pos;
|
||||
|
|
@ -1284,16 +1282,16 @@ static void viewer_load_settings(void) /* same name as global, but not the same
|
|||
if (i >= data->bookmarked_files_count)
|
||||
{
|
||||
if (i < MAX_BOOKMARKED_FILES)
|
||||
data->bookmarked_files_count++;
|
||||
else
|
||||
data->bookmarked_files_count++;
|
||||
else
|
||||
i = MAX_BOOKMARKED_FILES-1;
|
||||
}
|
||||
}
|
||||
|
||||
/* write bookmark file with spare slot in first position
|
||||
to be filled in by viewer_save_settings */
|
||||
settings_fd = rb->open(BOOKMARKS_FILE, O_WRONLY|O_CREAT);
|
||||
if (settings_fd >=0 )
|
||||
{
|
||||
{
|
||||
/* write count */
|
||||
rb->write (settings_fd, &data->bookmarked_files_count, sizeof(signed int));
|
||||
|
||||
|
|
@ -1336,7 +1334,7 @@ static void viewer_save_settings(void)/* same name as global, but not the same f
|
|||
rb->close(settings_fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* save the bookmark if the position has changed */
|
||||
if (file_pos + screen_top_ptr - buffer != start_position)
|
||||
{
|
||||
|
|
@ -1559,11 +1557,11 @@ enum plugin_status plugin_start(const void* file)
|
|||
}
|
||||
|
||||
viewer_load_settings(); /* load the preferences and bookmark */
|
||||
|
||||
|
||||
#if LCD_DEPTH > 1
|
||||
rb->lcd_set_backdrop(NULL);
|
||||
#endif
|
||||
|
||||
|
||||
viewer_draw(col);
|
||||
|
||||
while (!done) {
|
||||
|
|
@ -1577,7 +1575,7 @@ enum plugin_status plugin_start(const void* file)
|
|||
old_tick = *rb->current_tick;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
button = rb->button_get_w_tmo(HZ/10);
|
||||
switch (button) {
|
||||
case VIEWER_MENU:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue