mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Support loading backdrops from anywhere in the filesystem. Fixes FS#12041
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29700 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b66239b436
commit
d09f97880a
4 changed files with 10 additions and 23 deletions
|
@ -113,10 +113,7 @@ bool skin_backdrops_preload(void)
|
||||||
if (screen == SCREEN_MAIN && global_settings.backdrop_file[0] &&
|
if (screen == SCREEN_MAIN && global_settings.backdrop_file[0] &&
|
||||||
global_settings.backdrop_file[0] != '-' && filename[0] == '-')
|
global_settings.backdrop_file[0] != '-' && filename[0] == '-')
|
||||||
{
|
{
|
||||||
char* temp = filename+2; /* slightly hacky to get a buffer */
|
filename = global_settings.backdrop_file;
|
||||||
size_t size = sizeof(backdrops[i].name) - 2;
|
|
||||||
snprintf(temp, size, BACKDROP_DIR "/%s.bmp", global_settings.backdrop_file);
|
|
||||||
filename = temp;
|
|
||||||
}
|
}
|
||||||
if (*filename && *filename != '-')
|
if (*filename && *filename != '-')
|
||||||
{
|
{
|
||||||
|
@ -156,7 +153,6 @@ void skin_backdrop_unload(int backdrop_id)
|
||||||
void skin_backdrop_load_setting(void)
|
void skin_backdrop_load_setting(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char filename[MAX_PATH];
|
|
||||||
for(i=0;i<SKINNABLE_SCREENS_COUNT*NB_SCREENS;i++)
|
for(i=0;i<SKINNABLE_SCREENS_COUNT*NB_SCREENS;i++)
|
||||||
{
|
{
|
||||||
if (backdrops[i].name[0] == '-' && backdrops[i].screen == SCREEN_MAIN)
|
if (backdrops[i].name[0] == '-' && backdrops[i].screen == SCREEN_MAIN)
|
||||||
|
@ -166,11 +162,11 @@ void skin_backdrop_load_setting(void)
|
||||||
{
|
{
|
||||||
if (!backdrops[i].buffer)
|
if (!backdrops[i].buffer)
|
||||||
backdrops[i].buffer = (char*)skin_buffer_alloc(LCD_BACKDROP_BYTES);
|
backdrops[i].buffer = (char*)skin_buffer_alloc(LCD_BACKDROP_BYTES);
|
||||||
snprintf(filename, sizeof filename, BACKDROP_DIR "/%s.bmp",
|
|
||||||
global_settings.backdrop_file);
|
|
||||||
bool loaded = backdrops[i].buffer &&
|
bool loaded = backdrops[i].buffer &&
|
||||||
screens[SCREEN_MAIN].backdrop_load(filename,
|
screens[SCREEN_MAIN].backdrop_load(
|
||||||
backdrops[i].buffer);
|
global_settings.backdrop_file,
|
||||||
|
backdrops[i].buffer);
|
||||||
backdrops[i].name[2] = loaded ? '.' : '\0';
|
backdrops[i].name[2] = loaded ? '.' : '\0';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1017,18 +1017,9 @@ MENUITEM_FUNCTION(add_to_faves_item, MENU_FUNC_USEPARAM, ID2P(LANG_ADD_TO_FAVES)
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
static bool set_backdrop(void)
|
static bool set_backdrop(void)
|
||||||
{
|
{
|
||||||
/* load the image
|
strlcpy(global_settings.backdrop_file, selected_file,
|
||||||
if(sb_set_backdrop(SCREEN_MAIN, selected_file)) {
|
sizeof(global_settings.backdrop_file));
|
||||||
splash(HZ, str(LANG_BACKDROP_LOADED));
|
settings_save();
|
||||||
set_file(selected_file, (char *)global_settings.backdrop_file,
|
|
||||||
MAX_FILENAME);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
splash(HZ, str(LANG_BACKDROP_FAILED));
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
set_file(selected_file, (char *)global_settings.backdrop_file,
|
|
||||||
MAX_FILENAME);
|
|
||||||
skin_backdrop_load_setting();
|
skin_backdrop_load_setting();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -588,7 +588,7 @@ struct user_settings
|
||||||
#endif /* HAVE_TAGCACHE */
|
#endif /* HAVE_TAGCACHE */
|
||||||
|
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
unsigned char backdrop_file[MAX_FILENAME+1]; /* backdrop bitmap file */
|
unsigned char backdrop_file[MAX_PATHNAME+1]; /* backdrop bitmap file */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
|
|
@ -1587,7 +1587,7 @@ const struct settings_list settings[] = {
|
||||||
TEXT_SETTING(0,lang_file,"lang","",LANG_DIR "/",".lng"),
|
TEXT_SETTING(0,lang_file,"lang","",LANG_DIR "/",".lng"),
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
TEXT_SETTING(F_THEMESETTING,backdrop_file,"backdrop",
|
TEXT_SETTING(F_THEMESETTING,backdrop_file,"backdrop",
|
||||||
DEFAULT_BACKDROP, BACKDROP_DIR "/", ".bmp"),
|
DEFAULT_BACKDROP, NULL, NULL),
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
TEXT_SETTING(0,kbd_file,"kbd","-",ROCKBOX_DIR "/",".kbd"),
|
TEXT_SETTING(0,kbd_file,"kbd","-",ROCKBOX_DIR "/",".kbd"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue