mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Remove the wrapper around the wrapper (wps_data_load) and handle loading hardcoded wps in case of a broken file directly in wps.c.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22146 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
04be8dd7fe
commit
218b31272e
3 changed files with 55 additions and 61 deletions
|
@ -37,11 +37,11 @@ bool gui_wps_display(struct gui_wps *gwps);
|
||||||
/* Do a update_type update of the skinned screen */
|
/* Do a update_type update of the skinned screen */
|
||||||
bool skin_update(struct gui_wps *gwps, unsigned int update_type);
|
bool skin_update(struct gui_wps *gwps, unsigned int update_type);
|
||||||
|
|
||||||
/* to setup up the wps-data from a format-buffer (isfile = false)
|
/*
|
||||||
from a (wps-)file (isfile = true)
|
* setup up the skin-data from a format-buffer (isfile = false)
|
||||||
if buf == NULL it will load the hardcoded default
|
* or from a skinfile (isfile = true)
|
||||||
*/
|
*/
|
||||||
void skin_data_load(struct wps_data *wps_data,
|
bool skin_data_load(struct wps_data *wps_data,
|
||||||
struct screen *display,
|
struct screen *display,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
bool isfile);
|
bool isfile);
|
||||||
|
|
|
@ -1666,7 +1666,7 @@ static bool load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir)
|
||||||
|
|
||||||
/* to setup up the wps-data from a format-buffer (isfile = false)
|
/* to setup up the wps-data from a format-buffer (isfile = false)
|
||||||
from a (wps-)file (isfile = true)*/
|
from a (wps-)file (isfile = true)*/
|
||||||
static bool _skin_data_load(struct wps_data *wps_data,
|
bool skin_data_load(struct wps_data *wps_data,
|
||||||
struct screen *display,
|
struct screen *display,
|
||||||
const char *buf,
|
const char *buf,
|
||||||
bool isfile)
|
bool isfile)
|
||||||
|
@ -1815,54 +1815,6 @@ static bool _skin_data_load(struct wps_data *wps_data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void skin_data_load(struct wps_data *wps_data,
|
|
||||||
struct screen *display,
|
|
||||||
const char *buf,
|
|
||||||
bool isfile)
|
|
||||||
{
|
|
||||||
bool loaded_ok = buf && _skin_data_load(wps_data, display, buf, isfile);
|
|
||||||
if (!loaded_ok) /* load the hardcoded default */
|
|
||||||
{
|
|
||||||
/* set the default wps for the main-screen */
|
|
||||||
if(display->screen_type == SCREEN_MAIN)
|
|
||||||
{
|
|
||||||
#if LCD_DEPTH > 1
|
|
||||||
unload_wps_backdrop();
|
|
||||||
#endif
|
|
||||||
_skin_data_load(wps_data,
|
|
||||||
display,
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
|
||||||
"%s%?ia<%ia|%?d2<%d2|(root)>>\n"
|
|
||||||
"%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n"
|
|
||||||
"\n"
|
|
||||||
"%al%pc/%pt%ar[%pp:%pe]\n"
|
|
||||||
"%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
|
|
||||||
"%pb\n"
|
|
||||||
"%pm\n", false);
|
|
||||||
#else
|
|
||||||
"%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
|
|
||||||
"%pc%?ps<*|/>%pt\n", false);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
|
||||||
/* set the default wps for the remote-screen */
|
|
||||||
else if(display->screen_type == SCREEN_REMOTE)
|
|
||||||
{
|
|
||||||
#if LCD_REMOTE_DEPTH > 1
|
|
||||||
unload_remote_wps_backdrop();
|
|
||||||
#endif
|
|
||||||
_skin_data_load(wps_data,
|
|
||||||
display,
|
|
||||||
"%s%?ia<%ia|%?d2<%d2|(root)>>\n"
|
|
||||||
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
|
||||||
"%al%pc/%pt%ar[%pp:%pe]\n"
|
|
||||||
"%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
|
|
||||||
"%pb\n", false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int wps_subline_index(struct wps_data *data, int line, int subline)
|
int wps_subline_index(struct wps_data *data, int line, int subline)
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,6 +73,11 @@
|
||||||
/* in milliseconds */
|
/* in milliseconds */
|
||||||
#define DEFAULT_SKIP_TRESH 3000ul
|
#define DEFAULT_SKIP_TRESH 3000ul
|
||||||
|
|
||||||
|
|
||||||
|
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
|
||||||
|
/* 3% of 30min file == 54s step size */
|
||||||
|
#define MIN_FF_REWIND_STEP 500
|
||||||
|
|
||||||
static int wpsbars;
|
static int wpsbars;
|
||||||
/* currently only one wps_state is needed */
|
/* currently only one wps_state is needed */
|
||||||
static struct wps_state wps_state;
|
static struct wps_state wps_state;
|
||||||
|
@ -85,14 +90,50 @@ static void track_changed_callback(void *param);
|
||||||
static void nextid3available_callback(void* param);
|
static void nextid3available_callback(void* param);
|
||||||
|
|
||||||
|
|
||||||
|
void wps_data_load(enum screen_type screen, const char *buf, bool isfile)
|
||||||
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
|
|
||||||
/* 3% of 30min file == 54s step size */
|
|
||||||
#define MIN_FF_REWIND_STEP 500
|
|
||||||
|
|
||||||
void wps_data_load(enum screen_type screen, const char *buf, bool is_file)
|
|
||||||
{
|
{
|
||||||
skin_data_load(gui_wps[screen].data, &screens[screen], buf, is_file);
|
bool loaded_ok = buf && skin_data_load(gui_wps[screen].data, &screens[screen], buf, isfile);
|
||||||
|
if (!loaded_ok) /* load the hardcoded default */
|
||||||
|
{
|
||||||
|
char *skin_buf[NB_SCREENS] = {
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
||||||
|
"%s%?ia<%ia|%?d2<%d2|(root)>>\n"
|
||||||
|
"%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n\n"
|
||||||
|
"%al%pc/%pt%ar[%pp:%pe]\n"
|
||||||
|
"%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
|
||||||
|
"%pb\n%pm\n",
|
||||||
|
#else
|
||||||
|
"%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
|
||||||
|
"%pc%?ps<*|/>%pt\n",
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_REMOTE_LCD
|
||||||
|
"%s%?ia<%ia|%?d2<%d2|(root)>>\n"
|
||||||
|
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
||||||
|
"%al%pc/%pt%ar[%pp:%pe]\n"
|
||||||
|
"%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
|
||||||
|
"%pb\n",
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
skin_data_load(gui_wps[screen].data, &screens[screen],
|
||||||
|
skin_buf[screen], false);
|
||||||
|
/* set the default wps for the main-screen */
|
||||||
|
if(screen == SCREEN_MAIN)
|
||||||
|
{
|
||||||
|
#if LCD_DEPTH > 1
|
||||||
|
unload_wps_backdrop();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#ifdef HAVE_REMOTE_LCD
|
||||||
|
/* set the default wps for the remote-screen */
|
||||||
|
else if(screen == SCREEN_REMOTE)
|
||||||
|
{
|
||||||
|
#if LCD_REMOTE_DEPTH > 1
|
||||||
|
unload_remote_wps_backdrop();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#ifdef HAVE_REMOVE_LCD
|
#ifdef HAVE_REMOVE_LCD
|
||||||
gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN);
|
gui_wps[screen].data->remote_wps = !(screen == SCREEN_MAIN);
|
||||||
#endif
|
#endif
|
||||||
|
@ -103,7 +144,8 @@ void wps_data_init(enum screen_type screen)
|
||||||
skin_data_init(gui_wps[screen].data);
|
skin_data_init(gui_wps[screen].data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wps_fading_out = false;
|
|
||||||
|
static bool wps_fading_out = false;
|
||||||
void fade(bool fade_in, bool updatewps)
|
void fade(bool fade_in, bool updatewps)
|
||||||
{
|
{
|
||||||
int fp_global_vol = global_settings.volume << 8;
|
int fp_global_vol = global_settings.volume << 8;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue