From 637c7414a91c33e2627f99fee7b4c9cbf04abdb4 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Fri, 13 Jan 2017 18:45:04 -0500 Subject: puzzles: enable fallback to audiobuf when smalloc() fails - upon a failed smalloc(), the audio buffer will be used for further allocations - should fix things on low-memory targets (c100 and c200v2), but breaks playback - playback should still be intact on other targets Change-Id: Ic239f1316efadc957050afacf5c614dbbca3f805 --- apps/plugins/puzzles/rockbox.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'apps/plugins/puzzles/rockbox.c') diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c index 86dc9cffd4..3e3bd15f33 100644 --- a/apps/plugins/puzzles/rockbox.c +++ b/apps/plugins/puzzles/rockbox.c @@ -71,6 +71,7 @@ static void fix_size(void); static struct viewport clip_rect; static bool clipped = false; +extern bool audiobuf_available; static struct settings_t { int slowmo_factor; @@ -1026,7 +1027,10 @@ static int pausemenu_cb(int action, const struct menu_item_ex *this_item) * care, I bet */ return ACTION_EXIT_MENUITEM; #else - break; + if(audiobuf_available) + break; + else + return ACTION_EXIT_MENUITEM; #endif case 9: if(!midend_num_presets(me)) @@ -1355,10 +1359,10 @@ void deactivate_timer(frontend *fe) #ifdef COMBINED /* can't use audio buffer */ -static char giant_buffer[1024*1024*4]; +char giant_buffer[1024*1024*4]; #else -/* points to audiobuf */ -static char *giant_buffer = NULL; +/* points to pluginbuf */ +char *giant_buffer = NULL; #endif static size_t giant_buffer_len = 0; /* set on start */ @@ -1565,6 +1569,18 @@ static int mainmenu_cb(int action, const struct menu_item_ex *this_item) return ACTION_EXIT_MENUITEM; #else break; +#endif + case 4: +#ifdef COMBINED + /* audio buf is used, so no playback */ + /* TODO: neglects app builds, but not many people will + * care, I bet */ + return ACTION_EXIT_MENUITEM; +#else + if(audiobuf_available) + break; + else + return ACTION_EXIT_MENUITEM; #endif case 5: if(!midend_num_presets(me)) -- cgit v1.2.3