summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/skin_engine/skin_engine.c27
-rw-r--r--apps/main.c9
2 files changed, 32 insertions, 4 deletions
diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c
index 069c346..0d86cc2 100644
--- a/apps/gui/skin_engine/skin_engine.c
+++ b/apps/gui/skin_engine/skin_engine.c
@@ -25,6 +25,7 @@
#include <limits.h>
#include "inttypes.h"
#include "config.h"
+#include "core_alloc.h"
#include "action.h"
#include "crc32.h"
#include "settings.h"
@@ -48,9 +49,31 @@ void theme_init_buffer(void)
skins_initialising = false;
}
#else
-static char skin_buffer[SKIN_BUFFER_SIZE];
+static size_t skin_buffer_size;
+static char *skin_buffer = NULL;
+static int buflib_move_callback(int handle, void* current, void* new)
+{
+ (void)current;
+ (void)new;
+ return BUFLIB_CB_CANNOT_MOVE;
+}
+static struct buflib_callbacks buflib_ops = {buflib_move_callback, NULL};
+
void theme_init_buffer(void)
{
+ int fd;
+ size_t size = SKIN_BUFFER_SIZE;
+ fd = open_utf8(ROCKBOX_DIR "/skin_buffer_size.txt", O_RDONLY);
+ if (fd >= 0)
+ {
+ char buf[32];
+ read(fd, buf, sizeof(buf));
+ if (buf[0] >= '0' && buf[0] <= '9')
+ size = atoi(buf)*1024;
+ close(fd);
+ }
+ skin_buffer = core_get_data(core_alloc_ex("skin buffer", size, &buflib_ops));
+ skin_buffer_size = size;
skins_initialising = false;
}
#endif
@@ -113,7 +136,7 @@ void settings_apply_skins(void)
skin_data_free_buflib_allocs(&skins[j][i].data);
}
- skin_buffer_init(skin_buffer, SKIN_BUFFER_SIZE);
+ skin_buffer_init(skin_buffer, skin_buffer_size);
#ifdef HAVE_LCD_BITMAP
skin_backdrop_init();
diff --git a/apps/main.c b/apps/main.c
index a617882..84f8bc3 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -350,6 +350,9 @@ static void init(void)
#ifdef HAVE_REMOTE_LCD
lcd_remote_init();
#endif
+ /* This init call allocates an *unmovable* block so must be
+ * before any other moveable allocs. */
+ theme_init_buffer();
#ifdef HAVE_LCD_BITMAP
FOR_NB_SCREENS(i)
global_status.font_id[i] = FONT_SYSFIXED;
@@ -390,7 +393,6 @@ static void init(void)
tree_mem_init();
filetype_init();
playlist_init();
- theme_init_buffer();
#if CONFIG_CODEC != SWCODEC
mp3_init( global_settings.volume,
@@ -439,7 +441,10 @@ static void init(void)
#endif
cpu_boost(true);
#endif
-
+
+ /* This init call allocates an *unmovable* block so must be
+ * before any other moveable allocs. */
+ theme_init_buffer();
settings_reset();