summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/skin_engine/skin_engine.c31
-rw-r--r--apps/main.c8
2 files changed, 4 insertions, 35 deletions
diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c
index 89230cbcb3..03afbc5195 100644
--- a/apps/gui/skin_engine/skin_engine.c
+++ b/apps/gui/skin_engine/skin_engine.c
@@ -25,9 +25,7 @@
25#include <limits.h> 25#include <limits.h>
26#include "inttypes.h" 26#include "inttypes.h"
27#include "config.h" 27#include "config.h"
28#include "core_alloc.h"
29#include "action.h" 28#include "action.h"
30#include "misc.h"
31#include "crc32.h" 29#include "crc32.h"
32#include "settings.h" 30#include "settings.h"
33#include "wps.h" 31#include "wps.h"
@@ -45,38 +43,14 @@ static bool skins_initialising = true;
45/* App uses the host malloc to manage the buffer */ 43/* App uses the host malloc to manage the buffer */
46#ifdef APPLICATION 44#ifdef APPLICATION
47#define skin_buffer NULL 45#define skin_buffer NULL
48#define skin_buffer_size 0
49void theme_init_buffer(void) 46void theme_init_buffer(void)
50{ 47{
51 skins_initialising = false; 48 skins_initialising = false;
52} 49}
53#else 50#else
54static size_t skin_buffer_size; 51static char skin_buffer[SKIN_BUFFER_SIZE];
55static char *skin_buffer = NULL;
56static int buflib_move_callback(int handle, void* current, void* new)
57{
58 (void)handle;
59 (void)current;
60 (void)new;
61 return BUFLIB_CB_CANNOT_MOVE;
62}
63static struct buflib_callbacks buflib_ops = {buflib_move_callback, NULL};
64
65void theme_init_buffer(void) 52void theme_init_buffer(void)
66{ 53{
67 int fd;
68 size_t size = SKIN_BUFFER_SIZE;
69 fd = open_utf8(ROCKBOX_DIR "/skin_buffer_size.txt", O_RDONLY);
70 if (fd >= 0)
71 {
72 char buf[32];
73 read(fd, buf, sizeof(buf));
74 if (buf[0] >= '0' && buf[0] <= '9')
75 size = atoi(buf)*1024;
76 close(fd);
77 }
78 skin_buffer = core_get_data(core_alloc_ex("skin buffer", size, &buflib_ops));
79 skin_buffer_size = size;
80 skins_initialising = false; 54 skins_initialising = false;
81} 55}
82#endif 56#endif
@@ -139,7 +113,8 @@ void skin_unload_all(void)
139 skin_data_free_buflib_allocs(&skins[j][i].data); 113 skin_data_free_buflib_allocs(&skins[j][i].data);
140 } 114 }
141 115
142 skin_buffer_init(skin_buffer, skin_buffer_size); 116 skin_buffer_init(skin_buffer, SKIN_BUFFER_SIZE);
117
143#ifdef HAVE_LCD_BITMAP 118#ifdef HAVE_LCD_BITMAP
144 skin_backdrop_init(); 119 skin_backdrop_init();
145#endif 120#endif
diff --git a/apps/main.c b/apps/main.c
index 4d1293dcce..f0da50eaa6 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -350,9 +350,6 @@ static void init(void)
350#ifdef HAVE_REMOTE_LCD 350#ifdef HAVE_REMOTE_LCD
351 lcd_remote_init(); 351 lcd_remote_init();
352#endif 352#endif
353 /* This init call allocates an *unmovable* block so must be
354 * before any other moveable allocs. */
355 theme_init_buffer();
356#ifdef HAVE_LCD_BITMAP 353#ifdef HAVE_LCD_BITMAP
357 FOR_NB_SCREENS(i) 354 FOR_NB_SCREENS(i)
358 global_status.font_id[i] = FONT_SYSFIXED; 355 global_status.font_id[i] = FONT_SYSFIXED;
@@ -393,6 +390,7 @@ static void init(void)
393 tree_mem_init(); 390 tree_mem_init();
394 filetype_init(); 391 filetype_init();
395 playlist_init(); 392 playlist_init();
393 theme_init_buffer();
396 394
397#if CONFIG_CODEC != SWCODEC 395#if CONFIG_CODEC != SWCODEC
398 mp3_init( global_settings.volume, 396 mp3_init( global_settings.volume,
@@ -442,10 +440,6 @@ static void init(void)
442 cpu_boost(true); 440 cpu_boost(true);
443#endif 441#endif
444 442
445 /* This init call allocates an *unmovable* block so must be
446 * before any other moveable allocs. */
447 theme_init_buffer();
448
449 i2c_init(); 443 i2c_init();
450 444
451 power_init(); 445 power_init();