diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/rockpaint.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index 4e4791c659..ab1eb5e3db 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c | |||
@@ -418,7 +418,7 @@ struct incdec_ctx incdec_y = { ROWS, { 1, 4}, true }; | |||
418 | /* Maximum string size allowed for the text tool */ | 418 | /* Maximum string size allowed for the text tool */ |
419 | #define MAX_TEXT 256 | 419 | #define MAX_TEXT 256 |
420 | 420 | ||
421 | typedef union | 421 | union buf |
422 | { | 422 | { |
423 | /* Used by fill and gradient algorithms */ | 423 | /* Used by fill and gradient algorithms */ |
424 | struct | 424 | struct |
@@ -452,9 +452,10 @@ typedef union | |||
452 | int fw_buf[30]; | 452 | int fw_buf[30]; |
453 | char fontname_buf[30][MAX_PATH]; | 453 | char fontname_buf[30][MAX_PATH]; |
454 | } text; | 454 | } text; |
455 | } buf; | 455 | }; |
456 | 456 | ||
457 | static buf *buffer; | 457 | static union buf *buffer; |
458 | static bool audio_buf = false; | ||
458 | 459 | ||
459 | /* Current filename */ | 460 | /* Current filename */ |
460 | static char filename[MAX_PATH]; | 461 | static char filename[MAX_PATH]; |
@@ -2530,7 +2531,10 @@ static void goto_menu(void) | |||
2530 | break; | 2531 | break; |
2531 | 2532 | ||
2532 | case MAIN_MENU_PLAYBACK_CONTROL: | 2533 | case MAIN_MENU_PLAYBACK_CONTROL: |
2533 | playback_control( NULL ); | 2534 | if (!audio_buf) |
2535 | playback_control( NULL ); | ||
2536 | else | ||
2537 | rb->splash(HZ, "Cannot restart playback"); | ||
2534 | break; | 2538 | break; |
2535 | 2539 | ||
2536 | case MAIN_MENU_EXIT: | 2540 | case MAIN_MENU_EXIT: |
@@ -2957,19 +2961,20 @@ static int save_bitmap( char *file ) | |||
2957 | enum plugin_status plugin_start(const void* parameter) | 2961 | enum plugin_status plugin_start(const void* parameter) |
2958 | { | 2962 | { |
2959 | size_t buffer_size; | 2963 | size_t buffer_size; |
2960 | buffer = (buf*) (((uintptr_t)rb->plugin_get_buffer(&buffer_size) + 3) & ~3); | 2964 | unsigned char *temp; |
2965 | temp = rb->plugin_get_buffer(&buffer_size); | ||
2961 | if (buffer_size < sizeof(*buffer) + 3) | 2966 | if (buffer_size < sizeof(*buffer) + 3) |
2962 | { | 2967 | { |
2963 | /* steal from audiobuffer if plugin buffer is too small */ | 2968 | /* steal from audiobuffer if plugin buffer is too small */ |
2964 | buffer = (buf*) | 2969 | temp = rb->plugin_get_audio_buffer(&buffer_size); |
2965 | (((uintptr_t)rb->plugin_get_audio_buffer(&buffer_size) + 3) & ~3); | ||
2966 | |||
2967 | if (buffer_size < sizeof(*buffer) + 3) | 2970 | if (buffer_size < sizeof(*buffer) + 3) |
2968 | { | 2971 | { |
2969 | rb->splash(HZ, "Not enough memory"); | 2972 | rb->splash(HZ, "Not enough memory"); |
2970 | return PLUGIN_ERROR; | 2973 | return PLUGIN_ERROR; |
2971 | } | 2974 | } |
2975 | audio_buf = true; | ||
2972 | } | 2976 | } |
2977 | buffer = (union buf*) (((uintptr_t)temp + 3) & ~3); | ||
2973 | 2978 | ||
2974 | rb->lcd_set_foreground(COLOR_WHITE); | 2979 | rb->lcd_set_foreground(COLOR_WHITE); |
2975 | rb->lcd_set_backdrop(NULL); | 2980 | rb->lcd_set_backdrop(NULL); |