summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <franklin@rockbox.org>2020-06-27 19:13:19 -0400
committerFranklin Wei <franklin@rockbox.org>2020-06-27 19:13:19 -0400
commit4b108896cc7440986d9e2384021db7ea9c42abb7 (patch)
tree78495babfbbf74fad096469e75625a360b3a2c0f
parent5831801d168c48fcdd97de8cb29442534afbfad0 (diff)
downloadrockbox-4b108896cc7440986d9e2384021db7ea9c42abb7.tar.gz
rockbox-4b108896cc7440986d9e2384021db7ea9c42abb7.zip
puzzles: replace menu title kludge with more elegant solution
This hack has survived for far too long. Change-Id: Idca0b647bd6e77f2afcd9a538513a6b9aa970fc7
-rw-r--r--apps/plugins/puzzles/rockbox.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index 300e2c33c7..de89c42eed 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -167,6 +167,9 @@ static struct {
167 bool timerflash, clipoff, shortcuts, no_aa, polyanim; 167 bool timerflash, clipoff, shortcuts, no_aa, polyanim;
168} debug_settings; 168} debug_settings;
169 169
170// used in menu titles - make sure to initialize!
171static char menu_desc[32];
172
170/* These are re-implementations of many rockbox drawing functions, adapted to 173/* These are re-implementations of many rockbox drawing functions, adapted to
171 * draw into a custom framebuffer (used for the zoom feature). */ 174 * draw into a custom framebuffer (used for the zoom feature). */
172static void zoom_drawpixel(int x, int y) 175static void zoom_drawpixel(int x, int y)
@@ -2717,9 +2720,7 @@ static void new_game_notify(void)
2717 2720
2718static int pause_menu(void) 2721static int pause_menu(void)
2719{ 2722{
2720#define static auto 2723 MENUITEM_STRINGLIST(menu, menu_desc, pausemenu_cb,
2721#define const
2722 MENUITEM_STRINGLIST(menu, NULL, pausemenu_cb,
2723 "Resume Game", // 0 2724 "Resume Game", // 0
2724 "New Game", // 1 2725 "New Game", // 1
2725 "Restart Game", // 2 2726 "Restart Game", // 2
@@ -2735,12 +2736,6 @@ static int pause_menu(void)
2735 "Configure Game", // 12 2736 "Configure Game", // 12
2736 "Quit without Saving", // 13 2737 "Quit without Saving", // 13
2737 "Quit"); // 14 2738 "Quit"); // 14
2738#undef static
2739#undef const
2740 /* HACK ALERT */
2741 char title[32] = { 0 };
2742 rb->snprintf(title, sizeof(title), "%s Menu", midend_which_game(me)->name);
2743 menu__.desc = title;
2744 2739
2745#if defined(FOR_REAL) && defined(DEBUG_MENU) 2740#if defined(FOR_REAL) && defined(DEBUG_MENU)
2746 help_times = 0; 2741 help_times = 0;
@@ -3289,6 +3284,9 @@ static void puzzles_main(void)
3289 init_for_game(&thegame, -1); 3284 init_for_game(&thegame, -1);
3290 } 3285 }
3291 3286
3287 /* must be done before any menu needs to be displayed */
3288 rb->snprintf(menu_desc, sizeof(menu_desc), "%s Menu", midend_which_game(me)->name);
3289
3292#ifdef HAVE_ADJUSTABLE_CPU_FREQ 3290#ifdef HAVE_ADJUSTABLE_CPU_FREQ
3293 /* about to go to menu or button block */ 3291 /* about to go to menu or button block */
3294 rb->cpu_boost(false); 3292 rb->cpu_boost(false);
@@ -3298,9 +3296,7 @@ static void puzzles_main(void)
3298 help_times = 0; 3296 help_times = 0;
3299#endif 3297#endif
3300 3298
3301#define static auto 3299 MENUITEM_STRINGLIST(menu, menu_desc, mainmenu_cb,
3302#define const
3303 MENUITEM_STRINGLIST(menu, NULL, mainmenu_cb,
3304 "Resume Game", // 0 3300 "Resume Game", // 0
3305 "New Game", // 1 3301 "New Game", // 1
3306 "Quick Help", // 2 3302 "Quick Help", // 2
@@ -3310,13 +3306,6 @@ static void puzzles_main(void)
3310 "Configure Game", // 6 3306 "Configure Game", // 6
3311 "Quit without Saving", // 7 3307 "Quit without Saving", // 7
3312 "Quit"); // 8 3308 "Quit"); // 8
3313#undef static
3314#undef const
3315
3316 /* HACK ALERT */
3317 char title[32] = { 0 };
3318 rb->snprintf(title, sizeof(title), "%s Menu", midend_which_game(me)->name);
3319 menu__.desc = title;
3320 3309
3321 bool quit = false; 3310 bool quit = false;
3322 int sel = 0; 3311 int sel = 0;